diff --git a/.vscode/IDEHelperScripts/Setup.cmake b/.vscode/IDEHelperScripts/Setup.cmake index c56aa004e28c4d45c5991d32546dfd9431a7bc56..b9dd3ac3e16f1473a4f05a570b5953f38126bde5 100644 --- a/.vscode/IDEHelperScripts/Setup.cmake +++ b/.vscode/IDEHelperScripts/Setup.cmake @@ -29,6 +29,8 @@ execute_process( # flake8 wrapper configure_file( "${CMAKE_CURRENT_LIST_DIR}/flake8_wrapper.sh.in" "${ATLAS_IDE_PREFIX}flake8" @ONLY ) +# autopep8 wrapper +configure_file( "${CMAKE_CURRENT_LIST_DIR}/autopep8_wrapper.sh.in" "${ATLAS_IDE_PREFIX}autopep8" @ONLY ) # gdb wrappers set( ATLAS_IDE_ASETUP_CALL "asetup --restore" CACHE STRING diff --git a/.vscode/IDEHelperScripts/autopep8_wrapper.sh.in b/.vscode/IDEHelperScripts/autopep8_wrapper.sh.in new file mode 100755 index 0000000000000000000000000000000000000000..0b5ecf6d2160e23a09fd37c2631d9b3c853e1f55 --- /dev/null +++ b/.vscode/IDEHelperScripts/autopep8_wrapper.sh.in @@ -0,0 +1,3 @@ +#!/bin/bash + +"@CMAKE_BINARY_DIR@@CMAKE_FILES_DIRECTORY@/atlas_build_run.sh" "@Python_EXECUTABLE@" -m autopep8 "$@" diff --git a/.vscode/settings.json b/.vscode/settings.json index e7d2c64519d2238e0de1e5747d8d0c72885bbaf2..e9defccc6c407d569bafe157ae5b6749697d9abd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,8 +6,10 @@ ], "remote.SSH.lockfilesInTmp": true, "gitlab.instanceUrl": "https://gitlab.cern.ch", - "python.pythonPath": "${workspaceFolder}/../build/ide_python", + "python.defaultInterpreterPath": "${workspaceFolder}/../build/ide_python", "python.envFile": "${workspaceFolder}/../build/env.txt", + "python.formatting.provider": "autopep8", + "python.formatting.autopep8Path": "${workspaceFolder}/../build/ide_autopep8", "python.linting.enabled": true, "python.linting.pylintEnabled": false, "python.linting.flake8Enabled": true, diff --git a/AtlasTest/CITest/Athena.cmake b/AtlasTest/CITest/Athena.cmake index 8020b18a9d6acabc0bf1583477921300451fca60..1a37f27b9d317186c97508fc39640de984161565 100644 --- a/AtlasTest/CITest/Athena.cmake +++ b/AtlasTest/CITest/Athena.cmake @@ -243,8 +243,12 @@ atlas_add_citest( ACTS_ValidateClusters SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateClusters.sh LOG_IGNORE_PATTERN "WARNING FPE INVALID" ) -atlas_add_citest( ACTS_ValidateSpacePoints - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateSpacePoints.sh +atlas_add_citest( ACTS_ValidateActsCoreSpacePoints + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateActsCoreSpacePoints.sh + LOG_IGNORE_PATTERN "WARNING FPE INVALID" ) + +atlas_add_citest( ACTS_ValidateActsTrkSpacePoints + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateActsTrkSpacePoints.sh LOG_IGNORE_PATTERN "WARNING FPE INVALID" ) atlas_add_citest( ACTS_ValidateSeeds @@ -267,6 +271,14 @@ atlas_add_citest( ACTS_ActsKfRefitting SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsKfRefitting.sh LOG_IGNORE_PATTERN "WARNING FPE INVALID" ) +atlas_add_citest( ACTS_ActsGSFRefitting + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsGSFRefitting.sh + LOG_IGNORE_PATTERN "WARNING FPE INVALID" ) + +atlas_add_citest( ACTS_ActsBenchmarkWithSpot + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsBenchmarkWithSpot.sh + LOG_IGNORE_PATTERN "WARNING FPE INVALID" ) + ################################################################################# # Trigger ################################################################################# diff --git a/AtlasTest/CITest/test/ActsBenchmarkWithSpot.sh b/AtlasTest/CITest/test/ActsBenchmarkWithSpot.sh new file mode 100755 index 0000000000000000000000000000000000000000..fda240c64da25bc31ecb198effa81c2e109feae6 --- /dev/null +++ b/AtlasTest/CITest/test/ActsBenchmarkWithSpot.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/ATLAS-P2-RUN4-01-01-00_ttbar_mu200.RDO.root +n_events=10 + +Reco_tf.py --CA \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsBenchmarkSpotFlags" \ + --postExec "cfg.getEventAlgo(\"ActsTrkITkPixelClusterizationAlg\").PixelClustersKey=\"xAODpixelClusters\";cfg.getEventAlgo(\"ActsTrkITkStripClusterizationAlg\").StripClustersKey=\"xAODstripClusters\";" \ + --inputRDOFile ${input_rdo} \ + --outputAODFile AOD.pool.root \ + --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsGSFRefitting.sh b/AtlasTest/CITest/test/ActsGSFRefitting.sh new file mode 100755 index 0000000000000000000000000000000000000000..1f8882059eceb25592b5c2821caee3d9c307de89 --- /dev/null +++ b/AtlasTest/CITest/test/ActsGSFRefitting.sh @@ -0,0 +1,13 @@ +#!/usr/bin/bash +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/ATLAS-P2-RUN4-01-01-00_ttbar_mu200.RDO.root +n_events=5 + +Reco_tf.py --CA \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsValidateGSFFlags" \ + --postInclude "ActsConfig.ActsTrkFittingConfig.ActsReFitterAlgCfg" \ + --inputRDOFile ${input_rdo} \ + --outputESDFile ESD.pool.root \ + --outputAODFile AOD.pool.root \ + --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsKfRefitting.sh b/AtlasTest/CITest/test/ActsKfRefitting.sh index a9850befdfa9ca0c36102d59d73951980de8c688..3ae181346901318160826c9e682429aa8af6cdc6 100755 --- a/AtlasTest/CITest/test/ActsKfRefitting.sh +++ b/AtlasTest/CITest/test/ActsKfRefitting.sh @@ -1,14 +1,13 @@ #!/usr/bin/bash # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/601237_ttbar_allhad_PU200_ITk_master_v1.RDO.root +input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/ATLAS-P2-RUN4-01-01-00_ttbar_mu200.RDO.root n_events=5 Reco_tf.py --CA \ - --detectors Bpipe ITkPixel ITkStrip \ - --preExec "ConfigFlags.Reco.EnableHGTDExtension=False;" \ + --preExec "flags.Reco.EnableHGTDExtension=False;" \ --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude" \ - --postInclude "ActsTrkFittingAlgs.ActsTrkFittingAlgsConfig.ActsReFitterAlgCfg" \ + --postInclude "ActsConfig.ActsTrkFittingConfig.ActsReFitterAlgCfg" \ --inputRDOFile ${input_rdo} \ --outputESDFile ESD.pool.root \ --outputAODFile AOD.pool.root \ diff --git a/AtlasTest/CITest/test/ActsPersistifyEDM.sh b/AtlasTest/CITest/test/ActsPersistifyEDM.sh index ec14c2a42e3e8ebd908ce0aca4f6933348312ca5..ee929fa84d6c4c926ee3035ab1823dac21a338eb 100755 --- a/AtlasTest/CITest/test/ActsPersistifyEDM.sh +++ b/AtlasTest/CITest/test/ActsPersistifyEDM.sh @@ -6,8 +6,9 @@ n_events=2 # Run reconstruction and produce AOD with persistified Acts EDM Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsWorkflowFlags" \ - --postInclude "ActsInterop.ActsPostIncludes.PersistifyActsEDMCfg" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsWorkflowFlags" \ + --postInclude "ActsConfig.ActsPostIncludes.PersistifyActsEDMCfg" \ + --preExec "flags.Acts.EDM.PersistifyClusters=True;flags.Acts.EDM.PersistifySpacePoints=True;" \ --inputRDOFile ${input_rdo} \ --outputAODFile AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsValidateActsCoreSpacePoints.sh b/AtlasTest/CITest/test/ActsValidateActsCoreSpacePoints.sh new file mode 100755 index 0000000000000000000000000000000000000000..316873f448b3033be397308f55e5253c7e2065d4 --- /dev/null +++ b/AtlasTest/CITest/test/ActsValidateActsCoreSpacePoints.sh @@ -0,0 +1,11 @@ +#!/usr/bin/bash +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/ATLAS-P2-RUN4-01-01-00_ttbar_mu200.RDO.root +n_events=5 + +Reco_tf.py --CA \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsCoreValidateSpacePointsFlags" \ + --inputRDOFile ${input_rdo} \ + --outputAODFile AOD.pool.root \ + --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsValidateSpacePoints.sh b/AtlasTest/CITest/test/ActsValidateActsTrkSpacePoints.sh similarity index 86% rename from AtlasTest/CITest/test/ActsValidateSpacePoints.sh rename to AtlasTest/CITest/test/ActsValidateActsTrkSpacePoints.sh index 2e60aba23fa441e679285228780d76eec87a5f52..e1b4a64d6a1dd8925ebc0eba1c818acb06e86e1c 100755 --- a/AtlasTest/CITest/test/ActsValidateSpacePoints.sh +++ b/AtlasTest/CITest/test/ActsValidateActsTrkSpacePoints.sh @@ -5,7 +5,7 @@ input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitori n_events=5 Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsValidateSpacePointsFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsTrkValidateSpacePointsFlags" \ --inputRDOFile ${input_rdo} \ --outputAODFile AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsValidateClusters.sh b/AtlasTest/CITest/test/ActsValidateClusters.sh index d5ca8a5cceb92aafe9997d923a6d5084012e6ed6..3d5364bf52e110bb851562ee647db7816ea30166 100755 --- a/AtlasTest/CITest/test/ActsValidateClusters.sh +++ b/AtlasTest/CITest/test/ActsValidateClusters.sh @@ -5,7 +5,7 @@ input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitori n_events=5 Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsValidateClustersFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsValidateClustersFlags" \ --inputRDOFile ${input_rdo} \ --outputAODFile AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsValidateOrthogonalSeeds.sh b/AtlasTest/CITest/test/ActsValidateOrthogonalSeeds.sh index 00e6d1c29679a9b36b755f41bd3d3a2e2343ac3c..19a3b0b56e2359c948afed3b9d291a99a7b7d894 100755 --- a/AtlasTest/CITest/test/ActsValidateOrthogonalSeeds.sh +++ b/AtlasTest/CITest/test/ActsValidateOrthogonalSeeds.sh @@ -5,7 +5,7 @@ input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitori n_events=10 Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsValidateOrthogonalSeedsFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsValidateOrthogonalSeedsFlags" \ --inputRDOFile ${input_rdo} \ --outputAODFile test.AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsValidateSeeds.sh b/AtlasTest/CITest/test/ActsValidateSeeds.sh index 31a993c2ee5692008b531d97bd18feee987f58da..cf05d3b27084d9235129bce5d8b2a119b5337365 100755 --- a/AtlasTest/CITest/test/ActsValidateSeeds.sh +++ b/AtlasTest/CITest/test/ActsValidateSeeds.sh @@ -5,7 +5,7 @@ input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitori n_events=10 Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsValidateSeedsFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsValidateSeedsFlags" \ --inputRDOFile ${input_rdo} \ --outputAODFile test.AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsValidateTracks.sh b/AtlasTest/CITest/test/ActsValidateTracks.sh index 83b197c87ca537d184a805be2e34c59b7eef729d..ee38719ac75d97ec66a7ea2382ac34e1d35a5203 100755 --- a/AtlasTest/CITest/test/ActsValidateTracks.sh +++ b/AtlasTest/CITest/test/ActsValidateTracks.sh @@ -5,7 +5,7 @@ input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitori n_events=1 Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsValidateTracksFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsValidateTracksFlags" \ --inputRDOFile ${input_rdo} \ --outputAODFile test.AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/CITest/test/ActsWorkflow.sh b/AtlasTest/CITest/test/ActsWorkflow.sh index c3af450bc99b3860eb5b59b6942a6e1bf8db10e0..501198cafcb6ea03a7931136255f8032e28e717d 100755 --- a/AtlasTest/CITest/test/ActsWorkflow.sh +++ b/AtlasTest/CITest/test/ActsWorkflow.sh @@ -5,7 +5,7 @@ input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitori n_events=10 Reco_tf.py --CA \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsWorkflowFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsWorkflowFlags" \ --inputRDOFile ${input_rdo} \ --outputAODFile AOD.pool.root \ --maxEvents ${n_events} diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestBuildInput.ref b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestBuildInput.ref index eb38b990c2c7be55ecc479974fbd7b9f0b5189fb..b6adc6e16d571cd0f33fc59d433cba44e16e0cbd 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestBuildInput.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestBuildInput.ref @@ -2,102 +2,82 @@ AddTrigMap INFO in initialize() WriteData INFO in initialize() AddTrigMap INFO EventInfo event: 1 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 1 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 2 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 2 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 3 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 3 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 4 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 4 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 5 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 5 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 6 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 6 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 7 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 7 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 8 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 8 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 9 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 9 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 10 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 10 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 11 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 11 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 12 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 12 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 13 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 13 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 14 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 14 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 15 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 15 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 16 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 16 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 17 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 17 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 18 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 18 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 19 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 19 run: 0 WriteData INFO registered all data AddTrigMap INFO EventInfo event: 20 run: 0 AddTrigMap INFO registered all data -WriteData DEBUG in execute() WriteData INFO EventInfo event: 20 run: 0 WriteData INFO registered all data WriteData INFO in finalize() diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventNoSplit.ref b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventNoSplit.ref index 456b4418130ce72e58e4c49c4250d127fc529870..4824058be87c4b55f5e4b2ac7f634ea899125907 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventNoSplit.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventNoSplit.ref @@ -18,245 +18,245 @@ DecisionSvc INFO Inserting stream: StreamAll with no Algs StreamAll.Strea... INFO Initializing StreamAll.StreamAllTool StreamAll INFO Data output: AthenaPoolMultiTest_StreamAll.root StreamAll INFO ../O reinitialization... -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 1 run: 0 -Splitter1 DEBUG Trigmask = 2 +Splitter1 INFO Trigmask = 2 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 1 run: 0 +Splitter2 INFO Trigmask = 2 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 1 run: 0 -Splitter3 DEBUG Trigmask = 2 +Splitter3 INFO Trigmask = 2 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 1 run: 0 +Triggered INFO Trigmask = 2 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 2 run: 0 -Splitter1 DEBUG Trigmask = 4 +Splitter1 INFO Trigmask = 4 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 2 run: 0 +Splitter2 INFO Trigmask = 4 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 2 run: 0 -Splitter3 DEBUG Trigmask = 4 +Splitter3 INFO Trigmask = 4 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 2 run: 0 +Triggered INFO Trigmask = 4 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 3 run: 0 -Splitter1 DEBUG Trigmask = 256 +Splitter1 INFO Trigmask = 256 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 3 run: 0 +Splitter2 INFO Trigmask = 256 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 3 run: 0 -Splitter3 DEBUG Trigmask = 256 +Splitter3 INFO Trigmask = 256 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 3 run: 0 +Triggered INFO Trigmask = 256 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 4 run: 0 -Splitter1 DEBUG Trigmask = 18 +Splitter1 INFO Trigmask = 18 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 4 run: 0 +Splitter2 INFO Trigmask = 18 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 4 run: 0 -Splitter3 DEBUG Trigmask = 18 +Splitter3 INFO Trigmask = 18 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 4 run: 0 +Triggered INFO Trigmask = 18 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 5 run: 0 -Splitter1 DEBUG Trigmask = 36 +Splitter1 INFO Trigmask = 36 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 5 run: 0 +Splitter2 INFO Trigmask = 36 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 5 run: 0 -Splitter3 DEBUG Trigmask = 36 +Splitter3 INFO Trigmask = 36 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 5 run: 0 +Triggered INFO Trigmask = 36 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 6 run: 0 -Splitter1 DEBUG Trigmask = 65 +Splitter1 INFO Trigmask = 65 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 6 run: 0 +Splitter2 INFO Trigmask = 65 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 6 run: 0 -Splitter3 DEBUG Trigmask = 65 +Splitter3 INFO Trigmask = 65 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 6 run: 0 +Triggered INFO Trigmask = 65 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 7 run: 0 -Splitter1 DEBUG Trigmask = 130 +Splitter1 INFO Trigmask = 130 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 7 run: 0 +Splitter2 INFO Trigmask = 130 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 7 run: 0 -Splitter3 DEBUG Trigmask = 130 +Splitter3 INFO Trigmask = 130 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 7 run: 0 +Triggered INFO Trigmask = 130 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 8 run: 0 -Splitter1 DEBUG Trigmask = 260 +Splitter1 INFO Trigmask = 260 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 8 run: 0 +Splitter2 INFO Trigmask = 260 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 8 run: 0 -Splitter3 DEBUG Trigmask = 260 +Splitter3 INFO Trigmask = 260 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 8 run: 0 +Triggered INFO Trigmask = 260 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 9 run: 0 -Splitter1 DEBUG Trigmask = 513 +Splitter1 INFO Trigmask = 513 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 9 run: 0 +Splitter2 INFO Trigmask = 513 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 9 run: 0 -Splitter3 DEBUG Trigmask = 513 +Splitter3 INFO Trigmask = 513 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 9 run: 0 +Triggered INFO Trigmask = 513 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 10 run: 0 -Splitter1 DEBUG Trigmask = 1026 +Splitter1 INFO Trigmask = 1026 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 10 run: 0 +Splitter2 INFO Trigmask = 1026 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 10 run: 0 -Splitter3 DEBUG Trigmask = 1026 +Splitter3 INFO Trigmask = 1026 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 10 run: 0 +Triggered INFO Trigmask = 1026 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 11 run: 0 -Splitter1 DEBUG Trigmask = 2052 +Splitter1 INFO Trigmask = 2052 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 11 run: 0 +Splitter2 INFO Trigmask = 2052 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 11 run: 0 -Splitter3 DEBUG Trigmask = 2052 +Splitter3 INFO Trigmask = 2052 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 11 run: 0 +Triggered INFO Trigmask = 2052 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 12 run: 0 -Splitter1 DEBUG Trigmask = 4097 +Splitter1 INFO Trigmask = 4097 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 12 run: 0 +Splitter2 INFO Trigmask = 4097 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 12 run: 0 -Splitter3 DEBUG Trigmask = 4097 +Splitter3 INFO Trigmask = 4097 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 12 run: 0 +Triggered INFO Trigmask = 4097 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 13 run: 0 -Splitter1 DEBUG Trigmask = 8194 +Splitter1 INFO Trigmask = 8194 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 13 run: 0 +Splitter2 INFO Trigmask = 8194 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 13 run: 0 -Splitter3 DEBUG Trigmask = 8194 +Splitter3 INFO Trigmask = 8194 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 13 run: 0 +Triggered INFO Trigmask = 8194 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 14 run: 0 -Splitter1 DEBUG Trigmask = 16388 +Splitter1 INFO Trigmask = 16388 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 14 run: 0 +Splitter2 INFO Trigmask = 16388 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 14 run: 0 -Splitter3 DEBUG Trigmask = 16388 +Splitter3 INFO Trigmask = 16388 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 14 run: 0 +Triggered INFO Trigmask = 16388 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 15 run: 0 -Splitter1 DEBUG Trigmask = 32769 +Splitter1 INFO Trigmask = 32769 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 15 run: 0 +Splitter2 INFO Trigmask = 32769 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 15 run: 0 -Splitter3 DEBUG Trigmask = 32769 +Splitter3 INFO Trigmask = 32769 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 15 run: 0 +Triggered INFO Trigmask = 32769 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 16 run: 0 -Splitter1 DEBUG Trigmask = 3 +Splitter1 INFO Trigmask = 3 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 16 run: 0 +Splitter2 INFO Trigmask = 3 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 16 run: 0 -Splitter3 DEBUG Trigmask = 3 +Splitter3 INFO Trigmask = 3 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 16 run: 0 +Triggered INFO Trigmask = 3 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 17 run: 0 -Splitter1 DEBUG Trigmask = 6 +Splitter1 INFO Trigmask = 6 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 17 run: 0 +Splitter2 INFO Trigmask = 6 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 17 run: 0 -Splitter3 DEBUG Trigmask = 6 +Splitter3 INFO Trigmask = 6 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 17 run: 0 +Triggered INFO Trigmask = 6 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 18 run: 0 -Splitter1 DEBUG Trigmask = 5 +Splitter1 INFO Trigmask = 5 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 18 run: 0 +Splitter2 INFO Trigmask = 5 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 18 run: 0 -Splitter3 DEBUG Trigmask = 5 +Splitter3 INFO Trigmask = 5 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 18 run: 0 +Triggered INFO Trigmask = 5 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 19 run: 0 -Splitter1 DEBUG Trigmask = 10 +Splitter1 INFO Trigmask = 10 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 19 run: 0 +Splitter2 INFO Trigmask = 10 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 19 run: 0 -Splitter3 DEBUG Trigmask = 10 +Splitter3 INFO Trigmask = 10 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 19 run: 0 +Triggered INFO Trigmask = 10 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 20 run: 0 -Splitter1 DEBUG Trigmask = 20 +Splitter1 INFO Trigmask = 20 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 20 run: 0 +Splitter2 INFO Trigmask = 20 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 20 run: 0 -Splitter3 DEBUG Trigmask = 20 +Splitter3 INFO Trigmask = 20 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 20 run: 0 +Triggered INFO Trigmask = 20 Triggered INFO L1 passed StorageSvc INFO EventStreamInfo_p3 [11DF1B8C-0DEE-4687-80D7-E74B520ACBB4] StreamAll INFO Metadata records written: 21 diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplit.ref b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplit.ref index 9bb519830d110a363a8ed3f5c82a3a01f31eb95b..3b835baf5852ec4dbbc9eda89a5617cb97b8d045 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplit.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplit.ref @@ -22,245 +22,245 @@ DecisionSvc INFO Inserting stream: Bad with no Algs Bad.BadTool INFO Initializing Bad.BadTool Bad INFO Data output: AthenaPoolMultiTest_Bad.root Bad INFO ../O reinitialization... -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 1 run: 0 -Splitter1 DEBUG Trigmask = 2 +Splitter1 INFO Trigmask = 2 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 1 run: 0 +Splitter2 INFO Trigmask = 2 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 1 run: 0 -Splitter3 DEBUG Trigmask = 2 +Splitter3 INFO Trigmask = 2 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 1 run: 0 +Triggered INFO Trigmask = 2 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 2 run: 0 -Splitter1 DEBUG Trigmask = 4 +Splitter1 INFO Trigmask = 4 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 2 run: 0 +Splitter2 INFO Trigmask = 4 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 2 run: 0 -Splitter3 DEBUG Trigmask = 4 +Splitter3 INFO Trigmask = 4 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 2 run: 0 +Triggered INFO Trigmask = 4 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 3 run: 0 -Splitter1 DEBUG Trigmask = 256 +Splitter1 INFO Trigmask = 256 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 3 run: 0 +Splitter2 INFO Trigmask = 256 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 3 run: 0 -Splitter3 DEBUG Trigmask = 256 +Splitter3 INFO Trigmask = 256 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 3 run: 0 +Triggered INFO Trigmask = 256 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 4 run: 0 -Splitter1 DEBUG Trigmask = 18 +Splitter1 INFO Trigmask = 18 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 4 run: 0 +Splitter2 INFO Trigmask = 18 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 4 run: 0 -Splitter3 DEBUG Trigmask = 18 +Splitter3 INFO Trigmask = 18 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 4 run: 0 +Triggered INFO Trigmask = 18 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 5 run: 0 -Splitter1 DEBUG Trigmask = 36 +Splitter1 INFO Trigmask = 36 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 5 run: 0 +Splitter2 INFO Trigmask = 36 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 5 run: 0 -Splitter3 DEBUG Trigmask = 36 +Splitter3 INFO Trigmask = 36 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 5 run: 0 +Triggered INFO Trigmask = 36 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 6 run: 0 -Splitter1 DEBUG Trigmask = 65 +Splitter1 INFO Trigmask = 65 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 6 run: 0 +Splitter2 INFO Trigmask = 65 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 6 run: 0 -Splitter3 DEBUG Trigmask = 65 +Splitter3 INFO Trigmask = 65 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 6 run: 0 +Triggered INFO Trigmask = 65 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 7 run: 0 -Splitter1 DEBUG Trigmask = 130 +Splitter1 INFO Trigmask = 130 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 7 run: 0 +Splitter2 INFO Trigmask = 130 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 7 run: 0 -Splitter3 DEBUG Trigmask = 130 +Splitter3 INFO Trigmask = 130 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 7 run: 0 +Triggered INFO Trigmask = 130 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 8 run: 0 -Splitter1 DEBUG Trigmask = 260 +Splitter1 INFO Trigmask = 260 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 8 run: 0 +Splitter2 INFO Trigmask = 260 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 8 run: 0 -Splitter3 DEBUG Trigmask = 260 +Splitter3 INFO Trigmask = 260 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 8 run: 0 +Triggered INFO Trigmask = 260 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 9 run: 0 -Splitter1 DEBUG Trigmask = 513 +Splitter1 INFO Trigmask = 513 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 9 run: 0 +Splitter2 INFO Trigmask = 513 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 9 run: 0 -Splitter3 DEBUG Trigmask = 513 +Splitter3 INFO Trigmask = 513 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 9 run: 0 +Triggered INFO Trigmask = 513 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 10 run: 0 -Splitter1 DEBUG Trigmask = 1026 +Splitter1 INFO Trigmask = 1026 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 10 run: 0 +Splitter2 INFO Trigmask = 1026 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 10 run: 0 -Splitter3 DEBUG Trigmask = 1026 +Splitter3 INFO Trigmask = 1026 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 10 run: 0 +Triggered INFO Trigmask = 1026 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 11 run: 0 -Splitter1 DEBUG Trigmask = 2052 +Splitter1 INFO Trigmask = 2052 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 11 run: 0 +Splitter2 INFO Trigmask = 2052 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 11 run: 0 -Splitter3 DEBUG Trigmask = 2052 +Splitter3 INFO Trigmask = 2052 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 11 run: 0 +Triggered INFO Trigmask = 2052 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 12 run: 0 -Splitter1 DEBUG Trigmask = 4097 +Splitter1 INFO Trigmask = 4097 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 12 run: 0 +Splitter2 INFO Trigmask = 4097 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 12 run: 0 -Splitter3 DEBUG Trigmask = 4097 +Splitter3 INFO Trigmask = 4097 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 12 run: 0 +Triggered INFO Trigmask = 4097 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 13 run: 0 -Splitter1 DEBUG Trigmask = 8194 +Splitter1 INFO Trigmask = 8194 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 13 run: 0 +Splitter2 INFO Trigmask = 8194 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 13 run: 0 -Splitter3 DEBUG Trigmask = 8194 +Splitter3 INFO Trigmask = 8194 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 13 run: 0 +Triggered INFO Trigmask = 8194 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 14 run: 0 -Splitter1 DEBUG Trigmask = 16388 +Splitter1 INFO Trigmask = 16388 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 14 run: 0 +Splitter2 INFO Trigmask = 16388 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 14 run: 0 -Splitter3 DEBUG Trigmask = 16388 +Splitter3 INFO Trigmask = 16388 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 14 run: 0 +Triggered INFO Trigmask = 16388 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 15 run: 0 -Splitter1 DEBUG Trigmask = 32769 +Splitter1 INFO Trigmask = 32769 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 15 run: 0 +Splitter2 INFO Trigmask = 32769 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 15 run: 0 -Splitter3 DEBUG Trigmask = 32769 +Splitter3 INFO Trigmask = 32769 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 15 run: 0 +Triggered INFO Trigmask = 32769 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 16 run: 0 -Splitter1 DEBUG Trigmask = 3 +Splitter1 INFO Trigmask = 3 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 16 run: 0 +Splitter2 INFO Trigmask = 3 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 16 run: 0 -Splitter3 DEBUG Trigmask = 3 +Splitter3 INFO Trigmask = 3 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 16 run: 0 +Triggered INFO Trigmask = 3 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 17 run: 0 -Splitter1 DEBUG Trigmask = 6 +Splitter1 INFO Trigmask = 6 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 17 run: 0 +Splitter2 INFO Trigmask = 6 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 17 run: 0 -Splitter3 DEBUG Trigmask = 6 +Splitter3 INFO Trigmask = 6 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 17 run: 0 +Triggered INFO Trigmask = 6 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 18 run: 0 -Splitter1 DEBUG Trigmask = 5 +Splitter1 INFO Trigmask = 5 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 18 run: 0 +Splitter2 INFO Trigmask = 5 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 18 run: 0 -Splitter3 DEBUG Trigmask = 5 +Splitter3 INFO Trigmask = 5 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 18 run: 0 +Triggered INFO Trigmask = 5 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 19 run: 0 -Splitter1 DEBUG Trigmask = 10 +Splitter1 INFO Trigmask = 10 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 19 run: 0 +Splitter2 INFO Trigmask = 10 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 19 run: 0 -Splitter3 DEBUG Trigmask = 10 +Splitter3 INFO Trigmask = 10 Splitter3 INFO L1 failed Triggered INFO EventInfo event: 19 run: 0 +Triggered INFO Trigmask = 10 Triggered INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 20 run: 0 -Splitter1 DEBUG Trigmask = 20 +Splitter1 INFO Trigmask = 20 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 20 run: 0 +Splitter2 INFO Trigmask = 20 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 20 run: 0 -Splitter3 DEBUG Trigmask = 20 +Splitter3 INFO Trigmask = 20 Splitter3 INFO L1 passed Triggered INFO EventInfo event: 20 run: 0 +Triggered INFO Trigmask = 20 Triggered INFO L1 passed StorageSvc INFO EventStreamInfo_p3 [11DF1B8C-0DEE-4687-80D7-E74B520ACBB4] Stream2 INFO Metadata records written: 8 diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplitDecision.ref b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplitDecision.ref index 22039fda9ee2875ec897a1980b68bf7b4d63a60c..4ee12ce9867665c0403c1dae0f2debb105107ccc 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplitDecision.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/AthenaPoolMultiTestEventSplitDecision.ref @@ -8,205 +8,185 @@ DecisionSvc INFO Inserting stream: StreamAll2 with no Algs StreamAll2.Stre... INFO Initializing StreamAll2.StreamAll2Tool StreamAll2 INFO Data output: AthenaPoolMultiTest_StreamAll2.root StreamAll2 INFO ../O reinitialization... -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 1 run: 0 -Splitter1 DEBUG Trigmask = 2 +Splitter1 INFO Trigmask = 2 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 1 run: 0 +Splitter2 INFO Trigmask = 2 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 1 run: 0 -Splitter3 DEBUG Trigmask = 2 +Splitter3 INFO Trigmask = 2 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 2 run: 0 -Splitter1 DEBUG Trigmask = 4 +Splitter1 INFO Trigmask = 4 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 2 run: 0 +Splitter2 INFO Trigmask = 4 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 2 run: 0 -Splitter3 DEBUG Trigmask = 4 +Splitter3 INFO Trigmask = 4 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 3 run: 0 -Splitter1 DEBUG Trigmask = 256 +Splitter1 INFO Trigmask = 256 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 3 run: 0 +Splitter2 INFO Trigmask = 256 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 3 run: 0 -Splitter3 DEBUG Trigmask = 256 +Splitter3 INFO Trigmask = 256 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 4 run: 0 -Splitter1 DEBUG Trigmask = 18 +Splitter1 INFO Trigmask = 18 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 4 run: 0 +Splitter2 INFO Trigmask = 18 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 4 run: 0 -Splitter3 DEBUG Trigmask = 18 +Splitter3 INFO Trigmask = 18 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 5 run: 0 -Splitter1 DEBUG Trigmask = 36 +Splitter1 INFO Trigmask = 36 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 5 run: 0 +Splitter2 INFO Trigmask = 36 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 5 run: 0 -Splitter3 DEBUG Trigmask = 36 +Splitter3 INFO Trigmask = 36 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 6 run: 0 -Splitter1 DEBUG Trigmask = 65 +Splitter1 INFO Trigmask = 65 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 6 run: 0 +Splitter2 INFO Trigmask = 65 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 6 run: 0 -Splitter3 DEBUG Trigmask = 65 +Splitter3 INFO Trigmask = 65 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 7 run: 0 -Splitter1 DEBUG Trigmask = 130 +Splitter1 INFO Trigmask = 130 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 7 run: 0 +Splitter2 INFO Trigmask = 130 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 7 run: 0 -Splitter3 DEBUG Trigmask = 130 +Splitter3 INFO Trigmask = 130 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 8 run: 0 -Splitter1 DEBUG Trigmask = 260 +Splitter1 INFO Trigmask = 260 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 8 run: 0 +Splitter2 INFO Trigmask = 260 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 8 run: 0 -Splitter3 DEBUG Trigmask = 260 +Splitter3 INFO Trigmask = 260 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 9 run: 0 -Splitter1 DEBUG Trigmask = 513 +Splitter1 INFO Trigmask = 513 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 9 run: 0 +Splitter2 INFO Trigmask = 513 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 9 run: 0 -Splitter3 DEBUG Trigmask = 513 +Splitter3 INFO Trigmask = 513 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 10 run: 0 -Splitter1 DEBUG Trigmask = 1026 +Splitter1 INFO Trigmask = 1026 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 10 run: 0 +Splitter2 INFO Trigmask = 1026 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 10 run: 0 -Splitter3 DEBUG Trigmask = 1026 +Splitter3 INFO Trigmask = 1026 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 11 run: 0 -Splitter1 DEBUG Trigmask = 2052 +Splitter1 INFO Trigmask = 2052 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 11 run: 0 +Splitter2 INFO Trigmask = 2052 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 11 run: 0 -Splitter3 DEBUG Trigmask = 2052 +Splitter3 INFO Trigmask = 2052 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 12 run: 0 -Splitter1 DEBUG Trigmask = 4097 +Splitter1 INFO Trigmask = 4097 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 12 run: 0 +Splitter2 INFO Trigmask = 4097 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 12 run: 0 -Splitter3 DEBUG Trigmask = 4097 +Splitter3 INFO Trigmask = 4097 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 13 run: 0 -Splitter1 DEBUG Trigmask = 8194 +Splitter1 INFO Trigmask = 8194 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 13 run: 0 +Splitter2 INFO Trigmask = 8194 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 13 run: 0 -Splitter3 DEBUG Trigmask = 8194 +Splitter3 INFO Trigmask = 8194 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 14 run: 0 -Splitter1 DEBUG Trigmask = 16388 +Splitter1 INFO Trigmask = 16388 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 14 run: 0 +Splitter2 INFO Trigmask = 16388 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 14 run: 0 -Splitter3 DEBUG Trigmask = 16388 +Splitter3 INFO Trigmask = 16388 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 15 run: 0 -Splitter1 DEBUG Trigmask = 32769 +Splitter1 INFO Trigmask = 32769 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 15 run: 0 +Splitter2 INFO Trigmask = 32769 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 15 run: 0 -Splitter3 DEBUG Trigmask = 32769 +Splitter3 INFO Trigmask = 32769 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 16 run: 0 -Splitter1 DEBUG Trigmask = 3 +Splitter1 INFO Trigmask = 3 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 16 run: 0 +Splitter2 INFO Trigmask = 3 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 16 run: 0 -Splitter3 DEBUG Trigmask = 3 +Splitter3 INFO Trigmask = 3 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 17 run: 0 -Splitter1 DEBUG Trigmask = 6 +Splitter1 INFO Trigmask = 6 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 17 run: 0 +Splitter2 INFO Trigmask = 6 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 17 run: 0 -Splitter3 DEBUG Trigmask = 6 +Splitter3 INFO Trigmask = 6 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 18 run: 0 -Splitter1 DEBUG Trigmask = 5 +Splitter1 INFO Trigmask = 5 Splitter1 INFO L1 passed Splitter2 INFO EventInfo event: 18 run: 0 +Splitter2 INFO Trigmask = 5 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 18 run: 0 -Splitter3 DEBUG Trigmask = 5 +Splitter3 INFO Trigmask = 5 Splitter3 INFO L1 passed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 19 run: 0 -Splitter1 DEBUG Trigmask = 10 +Splitter1 INFO Trigmask = 10 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 19 run: 0 +Splitter2 INFO Trigmask = 10 Splitter2 INFO L1 passed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 19 run: 0 -Splitter3 DEBUG Trigmask = 10 +Splitter3 INFO Trigmask = 10 Splitter3 INFO L1 failed -Splitter1 DEBUG in execute() Splitter1 INFO EventInfo event: 20 run: 0 -Splitter1 DEBUG Trigmask = 20 +Splitter1 INFO Trigmask = 20 Splitter1 INFO L1 failed Splitter2 INFO EventInfo event: 20 run: 0 +Splitter2 INFO Trigmask = 20 Splitter2 INFO L1 failed -Splitter3 DEBUG in execute() Splitter3 INFO EventInfo event: 20 run: 0 -Splitter3 DEBUG Trigmask = 20 +Splitter3 INFO Trigmask = 20 Splitter3 INFO L1 passed StorageSvc INFO EventStreamInfo_p3 [11DF1B8C-0DEE-4687-80D7-E74B520ACBB4] StreamAll2 INFO Metadata records written: 21 diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventNoSplit_jo.py b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventNoSplit_jo.py index 6661e3655cb650e9e049c42047e360491bb087fe..55434ff16095a38d97c00425c96e74232381108d 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventNoSplit_jo.py +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventNoSplit_jo.py @@ -58,17 +58,13 @@ include( "AthenaPoolMultiTest/ExampleStreamConfig.py" ) from AthenaPoolMultiTest.AthenaPoolMultiTestConf import EventSplit Splitter1 = EventSplit("Splitter1") # Accept bit 1 -Splitter1.L1bitmask = 1 -Splitter1.OutputLevel = DEBUG +Splitter1.L1bitmask = 1 Splitter2 = EventSplit("Splitter2") # Accept bit 2 -Splitter2.L1bitmask = 2 -Splitter2.OutputLevel = INFO +Splitter2.L1bitmask = 2 Splitter3 = EventSplit("Splitter3") # Accept bit 3 Splitter3.L1bitmask = 4 -Splitter3.OutputLevel = DEBUG Triggered = EventSplit("Triggered") # Accept all bits Triggered.L1bitmask = 65535 # assume -1 will set all bits on -Triggered.OutputLevel = INFO topSequence+=Splitter1 topSequence+=Splitter2 diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplitDecision_jo.py b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplitDecision_jo.py index a0b6764b590766b7e6e34163e9ebd94071e5d6f2..81ba8c0d5cd5e6b15b4da2ef71ad6e8dfb7b5954 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplitDecision_jo.py +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplitDecision_jo.py @@ -54,13 +54,10 @@ from AthenaPoolMultiTest.AthenaPoolMultiTestConf import EventSplit Splitter1 = EventSplit("Splitter1") # Accept bit 1 Splitter1.L1bitmask = 1 -Splitter1.OutputLevel = DEBUG Splitter2 = EventSplit("Splitter2") # Accept bit 2 Splitter2.L1bitmask = 2 -Splitter2.OutputLevel = INFO Splitter3 = EventSplit("Splitter3") # Accept bit 3 Splitter3.L1bitmask = 4 -Splitter3.OutputLevel = DEBUG topSequence+=Splitter1 topSequence+=Splitter2 diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplit_jo.py b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplit_jo.py index 88ef997775961104026e377d479d823b0e7c89f7..82f1c921fae0fcf378f1564043d54b0658206049 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplit_jo.py +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/EventSplit_jo.py @@ -63,16 +63,12 @@ from AthenaPoolMultiTest.AthenaPoolMultiTestConf import EventSplit Splitter1 = EventSplit("Splitter1") # Accept bit 1 Splitter1.L1bitmask = 1 -Splitter1.OutputLevel = DEBUG Splitter2 = EventSplit("Splitter2") # Accept bit 2 Splitter2.L1bitmask = 2 -Splitter2.OutputLevel = INFO Splitter3 = EventSplit("Splitter3") # Accept bit 3 Splitter3.L1bitmask = 4 -Splitter3.OutputLevel = DEBUG Triggered = EventSplit("Triggered") # Accept all bits Triggered.L1bitmask = 65535 # assume -1 will set all bits on -Triggered.OutputLevel = INFO topSequence+=Splitter1 topSequence+=Splitter2 diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/SplittableData_jo.py b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/SplittableData_jo.py index 635b91d4c34c27a50a34fa29c4f3e919af4c6c68..67553f3f385388e2b4873737d04ae5e8fe40b303 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/SplittableData_jo.py +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/share/SplittableData_jo.py @@ -1,7 +1,6 @@ ## @file AthenaPoolExample_WriteJobOptions.py ## @brief Example job options file to illustrate how to write event data to Pool. ## @author Peter van Gemmeren <gemmeren@anl.gov> -## $Id: SplittableData_jo.py,v 1.24 2009-05-01 13:51:40 cranshaw Exp $ ############################################################### # # This Job option: @@ -110,7 +109,6 @@ include( "AthenaPoolExampleConverter/AthenaPoolExampleConverter_jobOption.py" ) svcMgr.MessageSvc.OutputLevel = INFO svcMgr.PoolSvc.OutputLevel = DEBUG svcMgr.AthenaPoolCnvSvc.OutputLevel = DEBUG -topSequence.WriteData.OutputLevel = DEBUG DataStream.OutputLevel = DEBUG # # End of job options file diff --git a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/src/EventSplit.cxx b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/src/EventSplit.cxx index ce63682ddc8a0f35c488b45ccaf2e69623dd5b7a..805d9b588f77b0389c30dbc0a3b104451d5036da 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolMultiTest/src/EventSplit.cxx +++ b/AtlasTest/DatabaseTest/AthenaPoolMultiTest/src/EventSplit.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** @@ -66,7 +66,7 @@ StatusCode EventSplit::execute() } // Now check for requested bits in L1 - ATH_MSG_DEBUG( "Trigmask = " << static_cast<int>(eh->bits()) ); + ATH_MSG_INFO( "Trigmask = " << static_cast<int>(eh->bits()) ); if (m_l1bits & eh->bits()) { setFilterPassed(true); ATH_MSG_INFO( "L1 passed" ); diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt b/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt index 62ffb62ef73ea1eccfaaf2171a26101b48a8d801..3b5b6bd2d6b5e241e72c900dbb0425c12ffbb742 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( AthenaPoolTest ) @@ -38,7 +38,7 @@ function (athenapooltest_run_test testName jo pattern) SCRIPT athena.py AthenaPoolTest/${jo}.py ${_extraArgs} LOG_SELECT_PATTERN ${pattern} - LOG_IGNORE_PATTERN "0x[0-9a-f]{4,}|DEBUG Try item:|AthenaAttribute.*DB=|AtlasRelease|Release version" + LOG_IGNORE_PATTERN "0x[0-9a-f]{4,}|DEBUG Try item:|AthenaAttribute.*DB=|AtlasRelease|Release version|data dependencies" PROPERTIES TIMEOUT 900 DEPENDS ${ARG_DEPENDS} ) endfunction (athenapooltest_run_test) diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContRead.ref b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContRead.ref index f542ed1f5ac75633ead0fd67b6c5a082ab6dc1ba..5f073fd11988fb92a9dd77c37c741b0a2894f6cf 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContRead.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContRead.ref @@ -1,396 +1,203 @@ -Fri Jul 22 23:29:56 CEST 2016 -Preloading tcmalloc_minimal.so -Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc49-dbg] [private/private] -- built on [2016-07-22 23:19] -Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" -Warning in <TInterpreter::ReadRootmapFile>: class Event found in libG4AtlasControlDict.so is already in libtest_GPyTestDict.so -Warning in <TInterpreter::ReadRootmapFile>: class UCharDbArray found in libStorageSvcDict.so is already in libRootCnvDict.so -Py:Athena INFO executing ROOT6Setup -[?1034hPy:Athena INFO including file "AthenaCommon/Execution.py" -Py:Athena INFO including file "AthenaPoolTest/LArCellContReader_jobOptions.py" -Py:ConfigurableDb INFO Read module info for 5102 configurables from 11 genConfDb files -Py:ConfigurableDb INFO No duplicates have been found: that's good ! -Py:Athena INFO including file "RecExCond/AllDet_detDescr.py" -Py:Athena INFO including file "RecExCond/RecExCommon_DetFlags.py" -Py:RecExCommon_DetFlags INFO DetFlags already defined.by user : user should have fully configured it already! -Py:Athena INFO Importing MuonRecExample.MuonRecUtils -Py:Athena INFO Importing MuonCnvExample.MuonCnvUtils -Py:Athena INFO Importing module MuonCnvExample.MuonCalibFlags -Py:MuonCnvExample.MuonCalibFlags INFO Changing default mdtPropagationSpeedBeta = 1.0 -Py:MuonRec INFO Importing MuonRecExample.MuonRecFlags -Py:MuonRec INFO Changing default applyResilience = True -Py:MuonRec INFO Changing default doMSVertex = True -Py:MuonRec INFO Changing default enableErrorTuning = True -Py:MuonRec INFO Changing default writeSDOs = True -Py:MuonRec INFO Changing default calibNtupleTrigger = False -Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -SetGeometryVersion.py obtained major release version 22 -EventInfoMgtInit: Got release version AtlasOffline-rel_5 -Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 -Data source lookup using /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasCore/rel_5/InstallArea/x86_64-slc6-gcc49-dbg/XML/AtlasAuthentication/dblookup.xml file -Py:Athena INFO including file "CaloIdCnv/CaloIdCnv_joboptions.py" -Py:Athena INFO including file "CaloConditions/CaloConditions_jobOptions.py" -Py:Athena INFO including file "CaloConditions/LArTTCellMap_ATLAS_jobOptions.py" -Py:Athena INFO including file "CaloConditions/CaloTTIdMap_ATLAS_jobOptions.py" -Py:Athena INFO including file "TileIdCnv/TileIdCnv_jobOptions.py" -Py:Athena INFO including file "LArDetDescr/LArDetDescr_joboptions.py" -now initializing the LAr readout geometry : standard Atlas flavour -Py:Athena INFO including file "LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py" -ATLAS-R2-2015-03-01-00 -Py:JobPropertyContainer:: INFO use global tag for all LArElecCalibMC constants -Py:Athena INFO including file "LArCondAthenaPool/LArCondAthenaPool_joboptions.py" -Py:Athena INFO including file "LArConditionsCommon/LArIdMap_MC_jobOptions.py" -Py:JobPropertyContainer:: INFO setting folder /LAR/Identifier/OnOffIdMap with tag LARIdentifierOnOffIdMap-012 -Py:JobPropertyContainer:: INFO setting folder /LAR/Identifier/CalibIdMap with tag LARIdentifierCalibIdMap-012 -Py:JobPropertyContainer:: INFO setting folder /LAR/Identifier/FebRodMap with tag LARIdentifierFebRodMap-005 -Py:Athena INFO including file "AthenaPoolTest/NoStats_jobOptions.py" -Py:Athena INFO including file "AthenaCommon/runbatch.py" -ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v4r1) - running on lxplus064.cern.ch on Fri Jul 22 23:30:05 2016 -==================================================================================================================================== -ApplicationMgr INFO Successfully loaded modules : AthenaServices -ApplicationMgr INFO Application Manager Configured successfully -ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize -PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml via PathResolver, check your DATAPATH variable -RootDatabase.open Success SimplePoolFile.root File version:60602 -RalSessionMgr Warning Use COOL_DISABLE_CORALCONNECTIONPOOLCLEANUP -CORAL/Services/ConnectionService Warning Failed to connect to service sqlite200/ALLP200.db (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:sqlite200/ALLP200.db": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" ) -CORAL/Services/ConnectionService Warning Failed to connect to service sqlite200/ALLP200.db (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:sqlite200/ALLP200.db": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" ) -CORAL/Services/ConnectionService Warning Failed to connect to service geomDB/geomDB_sqlite (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:geomDB/geomDB_sqlite": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" ) -warn [frontier.c:1014]: Request 15 on chan 3 failed at Fri Jul 22 23:30:59 2016: -9 [fn-socket.c:125]: connect to 128.142.152.230 timed out after 5 seconds -warn [frontier.c:1114]: Trying next proxy [188.184.129.19] with same server atlasfrontier-ai.cern.ch -============== EMEC Construction =============== - multi-layered version of absorbers activated, mlabs == 1 -================================================ -============== EMEC Construction =============== - multi-layered version of absorbers activated, mlabs == 1 -================================================ -LArCellContFake... DEBUG Property update for OutputLevel : new value = 2 LArCellContFake... INFO LArCellContFakeReader::initialize() -CORAL/Services/ConnectionService Warning Failed to connect to service geomDB/geomDB_sqlite (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:geomDB/geomDB_sqlite": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" ) -DetectorStore WARNING retrieve(default): No valid proxy for default object - of type TileDetDescrManager(CLID 2941) -CaloMgrDetDescrCnvWARNING Could not get the TileDetectorManager. No Calo Elements will be built for Tile -LArCellContFake... DEBUG input handles: 0 -LArCellContFake... DEBUG output handles: 0 -LArCellContFake... DEBUG Data Deps for LArCellContFakeReader -HistogramPersis...WARNING Histograms saving not required. -ApplicationMgr INFO Application Manager Initialized successfully -RootDatabase.open Success SimplePoolFile.root File version:60602 -ApplicationMgr INFO Application Manager Started successfully -CORAL/Services/ConnectionService Warning Failed to connect to service sqlite200/ALLP200.db (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:sqlite200/ALLP200.db": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" ) -RootDatabase.open Success /afs/cern.ch/atlas/conditions/poolcond/vol0/cond09_mc.000016.gen.COND/cond09_mc.000016.gen.COND._0001.pool.root File version:52200 -RootDatabase.open Success /afs/cern.ch/atlas/conditions/poolcond/vol0/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0064.pool.root File version:52200 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end -LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 -LArCellContFake... DEBUG LArCellContFakeReader::execute() -LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeReader::printCells() end +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 +LArCellContFake... INFO LArCellContFakeReader::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 ApplicationMgr INFO Application Manager Stopped successfully LArCellContFake... INFO LArCellContFakeReader::finalize() -LArCellContFake... DEBUG Calling destructor -IOVDbSvc WARNING Folder /LAR/BadChannels/BadChannels is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/BadChannels/MissingFEBs is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/CalibIdMap is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/FebRodMap is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/OnOffIdMap is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/AutoCorr is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/DAC2uA is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/HVScaleCorr is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MinBias is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MinBiasAverage is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MphysOverMcal is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Noise is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Pedestal is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Ramp is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Shape is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/LArTTCellMapAtlas is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/fSampl is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/uA2MeV is requested but no data retrieved -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully -Py:Athena INFO leaving with code 0: "successful run" diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContReader_jobOptions.py b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContReader_jobOptions.py index 2b57caaeb04d4abd394427021720ca4e41aa3e34..a6765155eccb1128c8cfb82515b259d5769e5b7a 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContReader_jobOptions.py +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContReader_jobOptions.py @@ -77,9 +77,7 @@ topSequence += LArCellContFakeReader( "LArCellContFakeReader" ) #-------------------------------------------------------------- svcMgr.MessageSvc.OutputLevel = WARNING svcMgr.MessageSvc.debugLimit = 100000 -LArCellContFakeReader.OutputLevel = DEBUG - -#svcMgr.AthenaEventLoopMgr.OutputLevel = DEBUG +LArCellContFakeReader.OutputLevel = INFO from AthenaServices import AthenaServicesConf AthenaEventLoopMgr = AthenaServicesConf.AthenaEventLoopMgr() diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter.ref b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter.ref index af868683b20df39b7fe42c6a24a7388dc89ede04..7b662ae2490a0c370f350c4b762a1a6124ba6fe6 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter.ref @@ -1,353 +1,182 @@ -Fri Jul 22 23:15:25 CEST 2016 -Preloading tcmalloc_minimal.so -Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.0] [x86_64-slc6-gcc49-dbg] [private/private] -- built on [2016-07-22 22:59] -Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" -Warning in <TInterpreter::ReadRootmapFile>: class Event found in libG4AtlasControlDict.so is already in libtest_GPyTestDict.so -Warning in <TInterpreter::ReadRootmapFile>: class UCharDbArray found in libStorageSvcDict.so is already in libRootCnvDict.so -Py:Athena INFO executing ROOT6Setup -[?1034hPy:Athena INFO including file "AthenaCommon/Execution.py" -Py:Athena INFO including file "AthenaPoolTest/LArCellContWriter_jobOptions.py" -Py:Athena INFO including file "RecExCond/AllDet_detDescr.py" -Py:Athena INFO including file "RecExCond/RecExCommon_DetFlags.py" -Py:RecExCommon_DetFlags INFO DetFlags already defined.by user : user should have fully configured it already! -Py:Athena INFO Importing MuonRecExample.MuonRecUtils -Py:Athena INFO Importing MuonCnvExample.MuonCnvUtils -Py:Athena INFO Importing module MuonCnvExample.MuonCalibFlags -Py:MuonCnvExample.MuonCalibFlags INFO Changing default mdtPropagationSpeedBeta = 1.0 -Py:MuonRec INFO Importing MuonRecExample.MuonRecFlags -Py:MuonRec INFO Changing default applyResilience = True -Py:MuonRec INFO Changing default doMSVertex = True -Py:MuonRec INFO Changing default enableErrorTuning = True -Py:MuonRec INFO Changing default writeSDOs = True -Py:MuonRec INFO Changing default calibNtupleTrigger = False -Py:Athena INFO including file "IdDictDetDescrCnv/IdDictDetDescrCnv_joboptions.py" -SetGeometryVersion.py obtained major release version 22 -Py:ConfigurableDb INFO Read module info for 5102 configurables from 11 genConfDb files -Py:ConfigurableDb INFO No duplicates have been found: that's good ! -EventInfoMgtInit: Got release version AtlasOffline-rel_5 -Py:IOVDbSvc.CondDB INFO Setting up conditions DB access to instance OFLP200 -Data source lookup using /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasCore/rel_5/InstallArea/x86_64-slc6-gcc49-dbg/XML/AtlasAuthentication/dblookup.xml file -Py:Athena INFO including file "CaloIdCnv/CaloIdCnv_joboptions.py" -Py:Athena INFO including file "CaloConditions/CaloConditions_jobOptions.py" -Py:Athena INFO including file "CaloConditions/LArTTCellMap_ATLAS_jobOptions.py" -Py:Athena INFO including file "CaloConditions/CaloTTIdMap_ATLAS_jobOptions.py" -Py:Athena INFO including file "TileIdCnv/TileIdCnv_jobOptions.py" -Py:Athena INFO including file "LArDetDescr/LArDetDescr_joboptions.py" -now initializing the LAr readout geometry : standard Atlas flavour -Py:Athena INFO including file "LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py" -ATLAS-R2-2015-03-01-00 -Py:JobPropertyContainer:: INFO use global tag for all LArElecCalibMC constants -Py:Athena INFO including file "LArCondAthenaPool/LArCondAthenaPool_joboptions.py" -Py:Athena INFO including file "LArConditionsCommon/LArIdMap_MC_jobOptions.py" -Py:JobPropertyContainer:: INFO setting folder /LAR/Identifier/OnOffIdMap with tag LARIdentifierOnOffIdMap-012 -Py:JobPropertyContainer:: INFO setting folder /LAR/Identifier/CalibIdMap with tag LARIdentifierCalibIdMap-012 -Py:JobPropertyContainer:: INFO setting folder /LAR/Identifier/FebRodMap with tag LARIdentifierFebRodMap-005 -Py:Athena INFO including file "AthenaPoolTest/NoStats_jobOptions.py" -Py:Athena INFO including file "AthenaCommon/runbatch.py" -ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v4r1) - running on lxplus064.cern.ch on Fri Jul 22 23:15:35 2016 -==================================================================================================================================== -ApplicationMgr INFO Successfully loaded modules : AthenaServices -ApplicationMgr INFO Application Manager Configured successfully -ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 -StatusCodeSvc INFO initialize -PoolSvc WARNING Unable to locate catalog for prfile:poolcond/PoolCat_oflcond.xml via PathResolver, check your DATAPATH variable -RalSessionMgr Warning Use COOL_DISABLE_CORALCONNECTIONPOOLCLEANUP -CORAL/Services/ConnectionService Warning Failed to connect to service sqlite200/ALLP200.db (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:sqlite200/ALLP200.db": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" ) -CORAL/Services/ConnectionService Warning Failed to connect to service sqlite200/ALLP200.db (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:sqlite200/ALLP200.db": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" ) -CORAL/Services/ConnectionService Warning Failed to connect to service geomDB/geomDB_sqlite (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:geomDB/geomDB_sqlite": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" ) -============== EMEC Construction =============== - multi-layered version of absorbers activated, mlabs == 1 -================================================ -============== EMEC Construction =============== - multi-layered version of absorbers activated, mlabs == 1 -================================================ -LArCellContFake... DEBUG Property update for OutputLevel : new value = 2 LArCellContFake... INFO LArCellContFakeWriter::initialize() -CORAL/Services/ConnectionService Warning Failed to connect to service geomDB/geomDB_sqlite (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:geomDB/geomDB_sqlite": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/geomDB is not writable" ) -DetectorStore WARNING retrieve(default): No valid proxy for default object - of type TileDetDescrManager(CLID 2941) -CaloMgrDetDescrCnvWARNING Could not get the TileDetectorManager. No Calo Elements will be built for Tile -LArCellContFake... DEBUG input handles: 0 -LArCellContFake... DEBUG output handles: 0 -LArCellContFake... DEBUG Data Deps for LArCellContFakeWriter -HistogramPersis...WARNING Histograms saving not required. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr INFO Application Manager Started successfully -CORAL/Services/ConnectionService Warning Failed to connect to service sqlite200/ALLP200.db (coral::Exception): 'CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" )' - do NOT retry -CORAL/Services/ConnectionService Warning Failure while attempting to connect to "sqlite_file:sqlite200/ALLP200.db": CORAL/RelationalPlugins/sqlite ( CORAL : "Connection::connect" from "/afs/cern.ch/work/s/ssnyder/builds/atlas-work3e/build-x86_64-slc6-gcc49-dbg/AtlasTest/DatabaseTest/AthenaPoolTest/unitTestRun/sqlite200 is not writable" ) -RootDatabase.open Success /afs/cern.ch/atlas/conditions/poolcond/vol0/cond09_mc.000016.gen.COND/cond09_mc.000016.gen.COND._0001.pool.root File version:52200 -RootDatabase.open Success /afs/cern.ch/atlas/conditions/poolcond/vol0/cond08_mc.000003.gen.COND/cond08_mc.000003.gen.COND._0064.pool.root File version:52200 -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -RootDatabase.open Success SimplePoolFile.root File version:60602 -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -LArCellContFake... DEBUG LArCellContFakeWriter::execute() -LArCellContFake... DEBUG Created CaloCellContainer -LArCellContFake... INFO LArCellContFakeWriter::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 -LArCellContFake... DEBUG LArCellContFakeWriter::printCells() end -ApplicationMgr INFO Application Manager Stopped successfully +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO LArCellContFakeWriter::printRDOs() +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5 time 40 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 10 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 10 time 40 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15 time 40 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 20 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 20 time 40 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... INFO LArCellContFakeWriter::finalize() -LArCellContFake... DEBUG Calling destructor -IOVDbSvc WARNING Folder /LAR/BadChannels/BadChannels is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/BadChannels/MissingFEBs is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/CalibIdMap is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/FebRodMap is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/OnOffIdMap is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/AutoCorr is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/DAC2uA is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/HVScaleCorr is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MinBias is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MinBiasAverage is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/MphysOverMcal is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Noise is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Pedestal is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Ramp is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/Shape is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/Identifier/LArTTCellMapAtlas is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/fSampl is requested but no data retrieved -IOVDbSvc WARNING Folder /LAR/ElecCalibMC/uA2MeV is requested but no data retrieved -ApplicationMgr INFO Application Manager Finalized successfully -ApplicationMgr INFO Application Manager Terminated successfully -Py:Athena INFO leaving with code 0: "successful run" diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter_jobOptions.py b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter_jobOptions.py index 5e79ddd2b07b14de586a6af795dee5c88b35c357..5a4eab9fe5cfbd0bb0f90b5f057530abf8bafd7b 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter_jobOptions.py +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/LArCellContWriter_jobOptions.py @@ -83,8 +83,7 @@ Stream1.ItemList+=["EventInfo#*"] svcMgr.MessageSvc.OutputLevel = WARNING svcMgr.MessageSvc.debugLimit = 100000 svcMgr.MessageSvc.errorLimit = 100000 -#svcMgr.ClassIDSvc.OutputLevel = DEBUG -LArCellContFakeWriter.OutputLevel = DEBUG +LArCellContFakeWriter.OutputLevel = INFO from AthenaServices import AthenaServicesConf AthenaEventLoopMgr = AthenaServicesConf.AthenaEventLoopMgr() diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/ReadCombinedRDO.ref b/AtlasTest/DatabaseTest/AthenaPoolTest/share/ReadCombinedRDO.ref index 785fe68870d663d973464e68626344534d783a95..bfad91676bb3d433148a63713e50b370349d20d0 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/ReadCombinedRDO.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/ReadCombinedRDO.ref @@ -388,14 +388,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -663,14 +663,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -938,14 +938,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -1213,14 +1213,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -1488,14 +1488,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -1763,14 +1763,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -2038,14 +2038,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -2313,14 +2313,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -2588,14 +2588,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -2863,14 +2863,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -3138,14 +3138,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -3413,14 +3413,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -3688,14 +3688,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -3963,14 +3963,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -4238,14 +4238,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -4513,14 +4513,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -4788,14 +4788,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -5063,14 +5063,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -5338,14 +5338,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 InDetRawDataFak... DEBUG InDetRawDataFakeReader::execute() @@ -5613,14 +5613,14 @@ LArCellContFake... DEBUG LArCellContFakeReader::execute() LArCellContFake... DEBUG Container 'CaloCellCont' retrieved from StoreGate LArCellContFake... DEBUG Created CaloCellContainer LArCellContFake... INFO LArCellContFakeReader::printRDOs() -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 -LArCellContFake... DEBUG CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.3.0] energy 5.0301 time 0 quality 0 provenance 0 eta 0.0051512 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.1.4.0] energy 5.0301 time 39.993 quality 2 provenance 8200 eta 0.005152 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.3.0] energy 9.9956 time 0 quality 0 provenance 0 eta 0.0082824 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.2.4.0] energy 9.9956 time 39.993 quality 4 provenance 8200 eta 0.0082837 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.3.0] energy 15.049 time 0 quality 0 provenance 0 eta 0.011414 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.3.4.0] energy 15.049 time 39.993 quality 6 provenance 8200 eta 0.011415 phi 0.43721 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.3.0] energy 19.941 time 0 quality 0 provenance 0 eta 0.014545 phi 0.33884 +LArCellContFake... INFO CaloCell: id [4.1.1.1.0.4.4.0] energy 19.941 time 39.993 quality 8 provenance 8200 eta 0.014547 phi 0.43721 LArCellContFake... DEBUG LArCellContFakeReader::printCells() end LArCellContFake... INFO Successful check of CaloCellContainer I/O. Cells read: 8 ApplicationMgr INFO Application Manager Stopped successfully diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeReader.cxx b/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeReader.cxx index 72d4fe4c30d96208b02a221ca158a6db51de7ff8..6c15aaea34d32698d1f2406633a2b2cef9f571c9 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeReader.cxx +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeReader.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** @@ -10,7 +10,6 @@ * * @author RD Schaffer <R.D.Schaffer@cern.ch> * - * $Id: LArCellContFakeReader.cxx,v 1.10 2008-11-22 16:59:48 schaffer Exp $ * */ @@ -127,7 +126,7 @@ void LArCellContFakeReader::printCells(const CaloCellContainer* caloCont) const for(; first != last; ++first) { - ATH_MSG_DEBUG("CaloCell: id " + ATH_MSG_INFO("CaloCell: id " << m_calocellId->show_to_string((*first)->ID()) << std::setprecision(5) << " energy " << (*first)->energy() diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeWriter.cxx b/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeWriter.cxx index 167f7aeb608897a77e362530658bd03327308007..6811a7d68965a316139d11df73aa69cc1331a735 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeWriter.cxx +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/src/LArCellContFakeWriter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ @@ -11,7 +11,6 @@ * * @author RD Schaffer <R.D.Schaffer@cern.ch> * - * $Id: LArCellContFakeWriter.cxx,v 1.9 2008-11-22 16:59:48 schaffer Exp $ * */ @@ -90,7 +89,7 @@ void LArCellContFakeWriter::printCells(const CaloCellContainer* caloCont) const for(; first != last; ++first) { - ATH_MSG_DEBUG("CaloCell: id " + ATH_MSG_INFO("CaloCell: id " << m_calocellId->show_to_string((*first)->ID()) << " energy " << (*first)->energy() << " time " << (*first)->time() diff --git a/Build/AtlasBuildScripts/build_project_externals.sh b/Build/AtlasBuildScripts/build_project_externals.sh index b6547aecc6cd94e5df70265b87821a352c5be5eb..4e751592720d6eb60720afed18b95f84993d3f40 100644 --- a/Build/AtlasBuildScripts/build_project_externals.sh +++ b/Build/AtlasBuildScripts/build_project_externals.sh @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # # Script that is used by the build_externals.sh scripts of the individual # projects. @@ -147,6 +147,14 @@ source "${ATLAS_BUILD_SCRIPTS_DIR}/TDAQ_RELEASE_BASE.sh" # Include the timing function. source "${ATLAS_BUILD_SCRIPTS_DIR}/atlas_build_time.sh" +# Set the shell's language, in case it's not set explicitly already. +if [[ -z "${LANG}" || "${LANG}" == "C" ]]; then + export LANG=en_US.UTF-8 +fi +if [[ -z "${LC_ALL}" || "${LC_ALL}" == "C" ]]; then + export LC_ALL=en_US.UTF-8 +fi + # Flag for triggering the build of RPMs for the externals. RPMOPTIONS="-r ${ATLAS_BUILD_DIR}" if [ "$ATLAS_CI_BUILD" = "1" ]; then diff --git a/Build/AtlasBuildScripts/prepare_release_notes.py b/Build/AtlasBuildScripts/prepare_release_notes.py index a4be0a155c51ad3ba74580028405ef2b09415f11..359ae8172514c45e8812399d9b7158c9676b6556 100755 --- a/Build/AtlasBuildScripts/prepare_release_notes.py +++ b/Build/AtlasBuildScripts/prepare_release_notes.py @@ -1,28 +1,24 @@ #!/bin/env python3 -"""Prepare ATLAS release notes with a list of merge requests +# +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# +# Original Author: davide.gerbaudo@gmail.com, Jul 2017 +# Modified by edward.moyse@cern.ch, Dec 2020 +# + +"""Create merge request lists for releases and sweeps. Supports two modes: + - Release mode [default], to create release notes for a release built from nightly: + > prepare_release_notes.py release/22.0.82 nightly/22.0/2022-08-02T2101 + - Sweep mode, to create the MR diff of the currently checked out branch: + > prepare_release_notes.py --sweep -davide.gerbaudo@gmail.com -Jul 2017 - -Modified by edward.moyse@cern.ch -Dec 2020 """ + from collections import defaultdict import subprocess import re import os import argparse -usage = """%prog target_release nightly_tag - -where - target_release is the release you are creating, e.g. release/21.1.6 - nightly_tag is the nightly tag the release will be based on, e.g. nightly/21.1/2017-06-07T2215 - -Example: - git clone ssh://git@gitlab.cern.ch:7999/atlas/athena.git - cd athena - %prog release/21.1.6 nightly/21.1/2017-06-07T2215 -""" gitlab_available = True @@ -33,31 +29,43 @@ except ImportError: def main(): - parser = argparse.ArgumentParser(description=__doc__) + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-p', '--previous', help='previous release wrt. which we diff') parser.add_argument('-o', '--output', default='release_notes.md', help='where the notes are written') parser.add_argument('-r', '--relaxed', action='store_true', help='do not stop on dubious configurations') + parser.add_argument('-s', '--sweep', action='store_true', + help='prepare notes for a sweep') parser.add_argument('-v', '--verbose', action='store_true', help='print more info') parser.add_argument('--group-merge-requests', action='store_true', help='Group merge requests with the same labels together.') parser.add_argument( '-t', '--token', help='Optionally pass a gitlab token to get more information.') - parser.add_argument('target', help='Target release') - parser.add_argument('nightly', help='Nightly tag to use') + parser.add_argument('target', nargs='?', help='Target release') + parser.add_argument('nightly', nargs='?', help='Nightly tag to use') args = parser.parse_args() if args.token and not gitlab_available: print('WARNING - passing a token but was not able to import gitlab. You probably need to setup python-gitlab first (i.e. lsetup gitlab) or install it locally (see https://python-gitlab.readthedocs.io)') - target_release = args.target - nightly_tag = args.nightly - sanitize_args(target_release, nightly_tag, keep_going=args.relaxed) - previous_release = guess_previous_and_check( - target_release=target_release) if not args.previous else args.previous + if args.sweep: + target_release = '' # not used + previous_release = 'HEAD^' # parent of merge commit + nightly_tag = 'HEAD' # current HEAD + else: + if args.target is None or args.nightly is None: + parser.error('target and nightly are required in release mode') + + target_release = args.target + nightly_tag = args.nightly + sanitize_args(target_release, nightly_tag, keep_going=args.relaxed) + previous_release = guess_previous_and_check( + target_release=target_release) if not args.previous else args.previous + verbose = args.verbose pretty_format = '%b' # perhaps some combination of '%s%n%b' ? cmd = "git log "+previous_release+".."+nightly_tag + \ @@ -79,17 +87,20 @@ def main(): print('About to parse the MRs. Depending on the number, this could take a few minutes (run with --verbose to get more output while this is happening).') merged_mrs = parse_mrs_from_log(output_log['stdout'].decode("utf-8"), pretty_format=pretty_format, verbose=verbose, gl_project=gl_project) - release_notes = fill_template(target_release, nightly_tag, previous_release, - merged_mrs, output_filename=args.output, verbose=verbose, gl_project=gl_project, group_mrs=args.group_merge_requests) + + release_notes = fill_template(sweep_template() if args.sweep else default_template(), + target_release, nightly_tag, previous_release, + merged_mrs, output_filename=args.output, verbose=verbose, + gl_project=gl_project, group_mrs=args.group_merge_requests) print() - if args.token and gitlab_available: + if not args.sweep and args.token and gitlab_available: msg = 'Would you like me to create the release for you in gitlab (i.e. make the tag and fill in the release notes)?' if input("%s (y/N) " % msg).lower() == 'y': print('Is there a ticket associated with the release build request e.g. ATLINFR-XXXX? (press return to skip)') ticket = input(': ') print('Do you wish to add a description of the release?') - print('e.g. "Master release for derivations and upgrade", or "Production release for data-taking. ') + print('e.g. "Release for derivations and upgrade", or "Production release for data-taking. ') print('(press return to skip)') message = input(': ') if ticket: @@ -113,7 +124,7 @@ def sanitize_args(target_release, nightly_tag, keep_going=False): rel_match = re.search( r'release/(?P<ver>\d+)\.(?P<maj>\d+?)\.(?P<rev>\d+?)', target_release) nig_match = re.search( - r'nightly/(?P<branch>((\d+\.\d+)|master|22\.0-mc20))/(?P<date>\d{4}-\d{2}-\d{2})T(?P<time>\d{4})', nightly_tag) + r'nightly/(?P<branch>((\d+\.\d+)|master|main|22\.0-mc20))/(?P<date>\d{4}-\d{2}-\d{2})T(?P<time>\d{4})', nightly_tag) if not rel_match: print("The target release is not formatted as xx.y.z (version.major.revision semantic)") @@ -126,7 +137,7 @@ def sanitize_args(target_release, nightly_tag, keep_going=False): else: branch_rel = '.'.join([rel_match.group('ver'), rel_match.group('maj')]) branch_nig = nig_match.group('branch') - if branch_rel != branch_nig and branch_rel != '22.0' and branch_nig != 'master': + if branch_rel not in (branch_nig,'22.0') and branch_nig not in ('main','master'): print("You are creating a tag for %s from a nightly from %s" % (branch_rel, branch_nig)) if not keep_going: @@ -244,6 +255,11 @@ https://gitlab.cern.ch/atlas/athena/compare/{previous_release:s}...{target_relea """ +def sweep_template(): + return """ +This sweep contains the following MRs: +{formatted_list_of_merge_requests:s} +""" def format_mrs_from_gitlab(merged_mrs, group_mrs=False): # FIXME - we don't want to dump all labels, so have an approved list @@ -274,7 +290,7 @@ def format_mrs_from_gitlab(merged_mrs, group_mrs=False): return '\n'.join(lines) -def fill_template(target_release, nightly_tag, previous_release, +def fill_template(template, target_release, nightly_tag, previous_release, merged_mrs=[], output_filename='foo.md', verbose=False, gl_project=None, group_mrs=False): formatted_mrs = "" if gl_project: @@ -286,13 +302,14 @@ def fill_template(target_release, nightly_tag, previous_release, def formatted_tag_link(tag=''): base_url = 'https://gitlab.cern.ch/atlas/athena/tags' return "[%s](%s)" % (tag, base_url+'/'+tag) - filled_template = default_template().format(**{'target_release': target_release, - 'target_release_link': formatted_tag_link(target_release), - 'nightly_tag': nightly_tag, - 'nightly_tag_link': formatted_tag_link(nightly_tag), - 'previous_release': previous_release, - 'previous_release_link': formatted_tag_link(previous_release), - 'formatted_list_of_merge_requests': formatted_mrs}) + + filled_template = template.format(**{'target_release': target_release, + 'target_release_link': formatted_tag_link(target_release), + 'nightly_tag': nightly_tag, + 'nightly_tag_link': formatted_tag_link(nightly_tag), + 'previous_release': previous_release, + 'previous_release_link': formatted_tag_link(previous_release), + 'formatted_list_of_merge_requests': formatted_mrs}) out_file = open(output_filename, 'w') out_file.write(filled_template) out_file.close() diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloClusterCellLink.h b/Calorimeter/CaloEvent/CaloEvent/CaloClusterCellLink.h index 207d070354c1d27763b85f17c46c7dd785047d30..cfa934e1217fa8b6602d96c316cdfcda3574f13a 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloClusterCellLink.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloClusterCellLink.h @@ -162,7 +162,13 @@ class CaloClusterCellLink { * @param newWeight The new weight */ void reweight(const weight_t newWeight) {m_it->second=newWeight;} + + /**@brief Update the index + * @param newWIndex The new index + */ + void reindex(const unsigned newIndex) {m_it->first=newIndex;} + private: const CaloCellContainer* m_ccc; linkAndWeightCollType::iterator m_it; diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx index 894274177a0386049de03d50f7b05f4df62edcf7..eaf31d9fa970b7719806e0883ccf4aa42859e2cb 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx @@ -314,6 +314,23 @@ struct cellinfo { double lambda; double volume; CaloCell_ID::CaloSample sample; + unsigned int identifier; + cellinfo(const bool useGPUCriteria = false) + { + if (useGPUCriteria) { + x = 0; + y = 0; + z = 0; + energy = 0; + eta = 0; + phi = 0; + r = 0; + lambda = 0; + volume = 0; + sample = CaloCell_ID::Unknown; + identifier = 0; + } + } }; } // namespace CaloClusterMomentsMaker_detail @@ -416,7 +433,7 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, if (cellinfo.capacity() == 0) cellinfo.reserve (theNumOfCells*2); - cellinfo.resize (theNumOfCells); + cellinfo.resize (theNumOfCells, CaloClusterMomentsMaker_detail::cellinfo(m_useGPUCriteria)); for(i=0;i<(unsigned int)CaloCell_ID::Unknown;i++) maxSampE[i] = 0; @@ -439,7 +456,7 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, Identifier myId = pCell->ID(); const CaloDetDescrElement* myCDDE = pCell->caloDDE(); double ene = pCell->e(); - if(m_absOpt) ene = fabs(ene); + if(m_absOpt) ene = std::abs(ene); double weight = cellIter.weight();//theCluster->getCellWeight(cellIter); if ( pCell->badcell() ) { eBad += ene*weight; @@ -484,9 +501,21 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, sumSig2 += sigma*sigma; // use geomtery weighted energy of cell for leading cell significance double Sig = (sigma>0?ene*weight/sigma:0); - if ( fabs(Sig) > fabs(maxAbsSig) ) { - maxAbsSig = Sig; - nSigSampl = myCDDE->getSampling(); + if (m_useGPUCriteria) { + unsigned int thisSampl = myCDDE->getSampling(); + if ( ( std::abs(Sig) > std::abs(maxAbsSig) ) || + ( std::abs(Sig) == std::abs(maxAbsSig) && thisSampl > nSigSampl ) || + ( std::abs(Sig) == std::abs(maxAbsSig) && thisSampl == nSigSampl && Sig > maxAbsSig ) ) { + maxAbsSig = Sig; + nSigSampl = thisSampl; + } + + } + else { + if ( std::abs(Sig) > std::abs(maxAbsSig) ) { + maxAbsSig = Sig; + nSigSampl = myCDDE->getSampling(); + } } } if ( m_calculateIsolation ) { @@ -526,27 +555,44 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, if ( ene > 0. && weight > 0) { // get all geometric information needed ... CaloClusterMomentsMaker_detail::cellinfo& ci = cellinfo[ncell]; - ci.x = myCDDE->x(); - ci.y = myCDDE->y(); - ci.z = myCDDE->z(); - ci.eta = myCDDE->eta(); - ci.phi = myCDDE->phi(); - ci.energy = ene*weight; - ci.volume = myCDDE->volume(); - ci.sample = myCDDE->getSampling(); + ci.x = myCDDE->x(); + ci.y = myCDDE->y(); + ci.z = myCDDE->z(); + ci.eta = myCDDE->eta(); + ci.phi = myCDDE->phi(); + ci.energy = ene*weight; + ci.volume = myCDDE->volume(); + ci.sample = myCDDE->getSampling(); + ci.identifier = m_calo_id->calo_cell_hash(myId); if ( ci.energy > maxSampE[(unsigned int)ci.sample] ) maxSampE[(unsigned int)ci.sample] = ci.energy; - - if (iCellMax < 0 || ci.energy > cellinfo[iCellMax].energy ) { - iCellScndMax = iCellMax; - iCellMax = ncell; + + if (m_useGPUCriteria) { + if (iCellMax < 0 || + ci.energy > cellinfo[iCellMax].energy || + (ci.energy == cellinfo[iCellMax].energy && ci.identifier > cellinfo[iCellMax].identifier) ) { + iCellScndMax = iCellMax; + iCellMax = ncell; + } + else if (iCellScndMax < 0 || + ci.energy > cellinfo[iCellScndMax].energy || + (ci.energy == cellinfo[iCellScndMax].energy && ci.identifier > cellinfo[iCellScndMax].identifier) ) + { + iCellScndMax = ncell; + } } - else if (iCellScndMax < 0 || - ci.energy > cellinfo[iCellScndMax].energy ) - { - iCellScndMax = ncell; + else { + if (iCellMax < 0 || ci.energy > cellinfo[iCellMax].energy ) { + iCellScndMax = iCellMax; + iCellMax = ncell; } + else if (iCellScndMax < 0 || + ci.energy > cellinfo[iCellScndMax].energy ) + { + iCellScndMax = ncell; + } + } xc += ci.energy*ci.x; yc += ci.energy*ci.y; @@ -676,7 +722,7 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, << m_maxAxisAngle*(1./deg) << " deg from IP-to-ClusterCenter-axis (" << showerAxis[Amg::x] << ", " << showerAxis[Amg::y] << ", " << showerAxis[Amg::z] << ")"); - }//end if fabs(S)<epsilon + }//end if std::abs(S)<epsilon else { ATH_MSG_DEBUG("Eigenvalues close to 0, do not use principal axis"); } @@ -865,7 +911,7 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, showerCenter.phi(), caloDDMgr); if ( z_calo != 0 && showerAxis.z() != 0 ) { - lambda_c = fabs((z_calo-showerCenter.z())/showerAxis.z()); + lambda_c = std::abs((z_calo-showerCenter.z())/showerAxis.z()); } } else { @@ -883,10 +929,10 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, double l2(l1); l1 += det; l2 -= det; - if ( fabs(l1) < fabs(l2) ) - lambda_c = fabs(l1); + if ( std::abs(l1) < std::abs(l2) ) + lambda_c = std::abs(l1); else - lambda_c = fabs(l2); + lambda_c = std::abs(l2); } } } diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h index c4c380c8c972d9ba02e02d9b1821449f2ff03bbb..3a563c5f6ea341c7f115774077e1b83017138f7b 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h @@ -156,6 +156,9 @@ class CaloClusterMomentsMaker: public AthAlgTool, virtual public CaloClusterColl /** * @brief Transition from outer to inner wheel in EME2 */ double m_etaInnerWheel = { 2.52 }; + + + Gaudi::Property<bool> m_useGPUCriteria {this, "UseGPUCriteria", false, "Adopt a set of criteria that is consistent with the GPU implementation."}; }; #endif // CALOCLUSTERMOMENTSMAKER_H diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx index 3b5d0cc2951b43038d2f960f9ed51d96a34dd972..d012737b4887f7b2b22e844f9cc9eda391e680c6 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx @@ -446,14 +446,26 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, // sort initial seed cells to start with the cell of largest S/N // this makes the resulting clusters independent of the initial - // ordering of the cells - if ( m_seedCutsInAbsE) { - CaloTopoTmpHashCellSort::compareAbs<CaloTopoTmpClusterCell> compareSoverN; - std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN); + // ordering of the cells + if ( m_useGPUCriteria) { + if ( m_seedCutsInAbsE) { + CaloTopoTmpHashCellSort::compareAbsWithIndex<CaloTopoTmpClusterCell> compareSoverN; + std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN); + } + else { + CaloTopoTmpHashCellSort::compareWithIndex<CaloTopoTmpClusterCell> compareSoverN; + std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN); + } } else { - CaloTopoTmpHashCellSort::compare<CaloTopoTmpClusterCell> compareSoverN; - std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN); + if ( m_seedCutsInAbsE) { + CaloTopoTmpHashCellSort::compareAbs<CaloTopoTmpClusterCell> compareSoverN; + std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN); + } + else { + CaloTopoTmpHashCellSort::compare<CaloTopoTmpClusterCell> compareSoverN; + std::sort(mySeedCells.begin(),mySeedCells.end(),compareSoverN); + } } #if 1 @@ -512,47 +524,11 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, opt = LArNeighbours::nextInSamp; } m_calo_id->get_neighbours(hashid,opt,theNeighbors); -#if 0 - if ( m_doALotOfPrintoutInFirstEvent && msgLvl(MSG::DEBUG)) { - Identifier myId; - myId = m_calo_id->cell_id((int)(mySubDet),hashid); - ATH_MSG_DEBUG( " Cell [" << mySubDet << "|" - << (unsigned int)hashid << "|" - << m_calo_id->show_to_string(myId,0,'/') - << "] has " << theNeighbors.size() - << " neighbors:" ); - } -#endif // loop over all neighbors of that cell (Seed Growing Algo) for (IdentifierHash nId : theNeighbors) { CaloCell_ID::SUBCALO otherSubDet = (CaloCell_ID::SUBCALO)m_calo_id->sub_calo(nId); if ( m_subcaloUsed[otherSubDet] ) { -#if 0 - if ( m_doALotOfPrintoutInFirstEvent && msgLvl(MSG::DEBUG)) { - Identifier myId = m_calo_id->cell_id(nId); - ATH_MSG_DEBUG( " NeighborCell [" << otherSubDet << "|" - << (unsigned int) nId << "|" - << m_calo_id->show_to_string(myId,0,'/') << "]" - ); - - m_calo_id->get_neighbours(nId,m_nOption,theNNeighbors); - if ( std::find (theNNeighbors.begin(), - theNNeighbors.end(), hashid) ==theNNeighbors.end() ) - { - myId = m_calo_id->cell_id(hashid); - msg(MSG::ERROR) << " Cell [" << mySubDet << "|" - << (unsigned int)hashid << "|" - << m_calo_id->show_to_string(myId,0,'/') - << "] has bad neighbor cell["; - myId = m_calo_id->cell_id(nId); - - msg() << otherSubDet << "|" << nId << "|" - << m_calo_id->show_to_string(myId,0,'/') - << "]" << endmsg; - } - } -#endif HashCell neighborCell = hashCells[nId]; if ( neighborCell.getCaloTopoTmpClusterCell() ) { CaloTopoTmpClusterCell* pNCell = @@ -571,7 +547,26 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, HashCluster *toKill = nullptr; HashCluster *toKeep = nullptr; if ( !otherCluster || isAboveNeighborThreshold ) { - if ( !otherCluster || otherCluster->size() < myCluster->size() ) { + + auto compareClusters = [&](const auto & c1, const auto & c2) { + if (m_useGPUCriteria) { + //The seed cell with the largest SNR wins + if (m_seedCutsInAbsE) { + CaloTopoTmpHashCellSort::compareAbsWithIndex<CaloTopoTmpClusterCell> compare; + return compare(*(c1->begin()), *(c2->begin())); + } + else { + CaloTopoTmpHashCellSort::compareWithIndex<CaloTopoTmpClusterCell> compare; + return compare(*(c1->begin()), *(c2->begin())); + } + } + else { + //We merge the smallest cluster to the largest... + return c1->size() > c2->size(); + } + }; + + if ( !otherCluster || compareClusters(myCluster, otherCluster) ) { toKill = otherCluster; toKeep = myCluster; } @@ -651,7 +646,7 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, clusColl->push_back(xAODCluster); xAODCluster->addCellLink(protoCluster->releaseCellLinks());//Hand over ownership to xAOD::CaloCluster xAODCluster->setClusterSize(m_clusterSize); - CaloClusterKineHelper::calculateKine(xAODCluster,false,true); //No weight at this point! + CaloClusterKineHelper::calculateKine(xAODCluster,false,true, m_useGPUCriteria); //No weight at this point! } tmpclus_pool.erase(); diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h index c3384c2d71aa14e094371edb6487ca72a0f0da0f..61b88fc797ab52be31ca65a7c46143bac6508038 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h @@ -296,7 +296,9 @@ private: /// Cluster size enum. Set based on energy cut jobO - xAOD::CaloCluster::ClusterSize m_clusterSize; + xAOD::CaloCluster::ClusterSize m_clusterSize; + + Gaudi::Property<bool> m_useGPUCriteria {this, "UseGPUCriteria", false, "Adopt a set of criteria that is consistent with the GPU implementation."}; }; #endif // CALOTOPOCLUSTERMAKER_HH diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx b/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx index af1342eff9a5bf721d583410e3c981a7ce26de0c..8846ab2332baa94f41957035b1588ddf66f763fc 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.cxx @@ -477,7 +477,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, // energy was found before if (! pClusCell->getUsed() ) { float myEnergy = pClusCell->getSignedRatio(); - if(m_absOpt) myEnergy=fabs(myEnergy); + if(m_absOpt) myEnergy=std::abs(myEnergy); if ( myEnergy >= m_minEnergy && !pClusCell->getSecondary() ) { int nCells=0; bool isLocalMax = true; @@ -492,12 +492,12 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, if ( pNeighCell && pNeighCell->getParentClusterIndex() == iParent) { nCells++; if ( ((myEnergy > pNeighCell->getSignedRatio() ) && !m_absOpt) || - (m_absOpt && myEnergy > fabs(pNeighCell->getSignedRatio() ) ) || + (m_absOpt && myEnergy > std::abs(pNeighCell->getSignedRatio() ) ) || pNeighCell->getSecondary() ) { // in case the neighbor cell is a 2nd local max candidate // it has negative energy and we set it to used only if also // its abs value is smaller than myEnergy - if (fabs(pNeighCell->getSignedRatio()) < myEnergy ) + if (std::abs(pNeighCell->getSignedRatio()) < myEnergy ) pNeighCell->setUsed(); } else { @@ -513,7 +513,16 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, } } } - } + } + + std::vector<CaloTopoSplitterClusterCell *> myPotentialSecondarySeeds; + //These will be used for ordering the secondary seeds + //in a way that we can ensure agrees with the GPU version, + //as without it we depend on the ordering of the cells + //within the clusters (and the order of the clusters themselves) + //to decide the elimination between overlapping secondary clusters. + myPotentialSecondarySeeds.reserve(100); + // look for secondary local maxima if ( !m_validSecondarySamplings.empty() ) { allCellIter=allCellList.begin(); @@ -523,7 +532,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, // energy was found before if (! pClusCell->getUsed() && pClusCell->getSecondary()) { float myEnergy = pClusCell->getSignedRatio(); - if(m_absOpt) myEnergy=fabs(myEnergy); + if(m_absOpt) myEnergy=std::abs(myEnergy); if ( (!m_absOpt && myEnergy <= -m_minEnergy) || (m_absOpt && myEnergy >= m_minEnergy) ) { int nCells=0; bool isLocalMax = true; @@ -538,7 +547,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, CaloTopoSplitterClusterCell *pNeighCell = neighborCell.getCaloTopoTmpClusterCell(); if ( pNeighCell && pNeighCell->getParentClusterIndex() == iParent) { nCells++; - if ( fabs(myEnergy) > fabs(pNeighCell->getSignedRatio()) ) { + if ( std::abs(myEnergy) > std::abs(pNeighCell->getSignedRatio()) ) { pNeighCell->setUsed(); } else { @@ -548,6 +557,14 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, } if ( nCells < m_nCells ) isLocalMax = false; + + if (m_useGPUCriteria) { + if (isLocalMax) { + myPotentialSecondarySeeds.push_back(pClusCell); + } + continue; + } + // check the neighbors in all previous and all next samplings // for overlapping cells in the primary local maximum list // in case such cells exist do not consider this cell as @@ -681,6 +698,106 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, (*allCellIter)->setSignedRatio(itrCell->e()); } + + //Declaring this here because it is used for secondary maxima elimination + CaloTopoTmpHashCellSort::compareWithIndex<CaloTopoSplitterClusterCell> compareEWithIndex; + + if (m_useGPUCriteria && !m_validSecondarySamplings.empty()) { + + std::sort(myPotentialSecondarySeeds.begin(), myPotentialSecondarySeeds.end(), [&](const auto & a, const auto & b) { + return compareEWithIndex(cellVector[(unsigned int)a->getID() - m_hashMin], cellVector[(unsigned int)b->getID() - m_hashMin]); + }); + + //This way, we always exclude the clusters based on overlap with more energetic ones. + //If the more energetic ones get excluded, then the cluster would end up being excluded too + //(since we're always checking with the same neighbour options). + + std::vector<bool> secondarySeedExclude(myPotentialSecondarySeeds.size(), false); + + for (unsigned int i = 0; i < myPotentialSecondarySeeds.size(); ++i) { + CaloTopoSplitterClusterCell * pClusCell = myPotentialSecondarySeeds[i]; + bool isLocalMax = true; + IdentifierHash hashid = pClusCell->getID(); + + //Avoid repeated code... + + auto check_with_neighbour_options = [&, this](const LArNeighbours::neighbourOption opt_1, + const LArNeighbours::neighbourOption opt_2) { + if (this->m_nOption & (opt_1 | opt_2)) { + theCurrentNeighbors.clear(); + theCurrentNeighbors.push_back(hashid); + + while ( isLocalMax && !theCurrentNeighbors.empty() ) { + + theNextNeighbors.clear(); + for (const IdentifierHash & currentNeighbor : theCurrentNeighbors) { + + theNeighbors.clear(); + theSuperNeighbors.clear(); + + if ( this->m_nOption & opt_1 ) { + this->m_calo_id->get_neighbours(currentNeighbor, opt_1, theNeighbors); + } + + if ( this->m_nOption & opt_2 ) { + this->m_calo_id->get_neighbours(currentNeighbor, opt_2, theSuperNeighbors); + } + + theNeighbors.insert(theNeighbors.end(), theSuperNeighbors.begin(), theSuperNeighbors.end()); + + for (const IdentifierHash nId : theNeighbors) { + + for (const auto & seedCell: mySeedCells) { + if (cellVector[(unsigned int)nId - m_hashMin] == seedCell) { + return false; + } + } + + for (unsigned int j = 0; j < i; ++j) { + if (cellVector[(unsigned int)nId - m_hashMin] == myPotentialSecondarySeeds[j]) { + return false; + } + } + + bool doInclude(true); + + for (const IdentifierHash nextNId : theNextNeighbors) { + if (nextNId == nId) { + doInclude = false; + break; + } + } + + if ( doInclude ) { + theNextNeighbors.push_back(nId); + } + } + } + + theCurrentNeighbors.swap (theNextNeighbors); + } + } + + return true; + }; + + if ( ! ( check_with_neighbour_options(LArNeighbours::prevInSamp, LArNeighbours::prevSuperCalo) && + check_with_neighbour_options(LArNeighbours::nextInSamp, LArNeighbours::nextSuperCalo) ) ) { + secondarySeedExclude[i] = true; + } + } + + for (unsigned int i = 0; i < myPotentialSecondarySeeds.size(); ++i) { + CaloTopoSplitterClusterCell * pClusCell = myPotentialSecondarySeeds[i]; + IdentifierHash hashid = pClusCell->getID(); + size_t iParent = pClusCell->getParentClusterIndex(); + if ( !secondarySeedExclude[i] ) { + mySeedCells.push_back(cellVector[(unsigned int)hashid - m_hashMin]); + hasLocalMaxVector[iParent]++; + } + } + } + // create shared cell list for border cells between two split clusters std::vector<HashCell> sharedCellList; std::vector<HashCell> nextSharedCellList; @@ -702,9 +819,19 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, // this makes the resulting clusters independent of the initial // ordering of the cells - CaloTopoTmpHashCellSort::compare<CaloTopoSplitterClusterCell> compareE; - std::sort(mySeedCells.begin(),mySeedCells.end(),compareE); - + CaloTopoTmpHashCellSort::compare<CaloTopoSplitterClusterCell> compareEOriginal; + + auto compareE = [&, this](auto && ... ps) { + if (this->m_useGPUCriteria) { + return compareEWithIndex(std::forward<decltype(ps)>(ps)...); + } + else { + return compareEOriginal(std::forward<decltype(ps)>(ps)...); + } + }; + + std::sort(mySeedCells.begin(),mySeedCells.end(),compareE); + if ( msgLvl(MSG::DEBUG)) { hashCellIter= mySeedCells.begin(); hashCellIterEnd=mySeedCells.end(); @@ -1013,8 +1140,8 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, CaloTopoSplitterClusterCell* pClusCell = hashCellIter->getCaloTopoTmpClusterCell(); float e1 = (pClusCell->getCaloTopoTmpHashCluster())->getEnergy(); float e2 = (pClusCell->getSecondCaloTopoTmpHashCluster())->getEnergy(); - if(m_absOpt) e1 = fabs(e1); - if(m_absOpt) e2 = fabs(e2); + if(m_absOpt) e1 = std::abs(e1); + if(m_absOpt) e2 = std::abs(e2); if ( e1 <= 0 ) e1 = 1*MeV; if ( e2 <= 0 ) e2 = 1*MeV; const xAOD::CaloCluster::cell_iterator itrCell = pClusCell->getCellIterator(); @@ -1059,8 +1186,21 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, std::vector<HashCluster *>::iterator hashClusIterEnd=myHashClusters.end(); for (;hashClusIter!=hashClusIterEnd;++hashClusIter) { HashCluster * tmpCluster = (*hashClusIter); - if ( tmpCluster->size() > 1 ) { + if ( (m_useGPUCriteria && tmpCluster->getContainsLocalMax()) || tmpCluster->size() > 1 ) { // local maximum implies at least 2 cells are in the cluster ... + + // If one is not using shared cells and the thresholds are low enough, + // some local maxima may be surrounded (with one cell in the middle) + // by other local maxima that gobble up the cells first. + // For this reason, it makes sense to also include those clusters + // as separate entities instead of merging all of them to the original (pre-split) cluster + // as it was being done before. + // In practice, since these settings would seldom be chosen + // and the clusters would get a very low energy, + // they'd get cut and not influence the results, + // but, when doing the CPU <-> GPU comparison, + // they showed up as unexpected and unexplainable differences... + std::unique_ptr<CaloProtoCluster> myCluster = std::make_unique<CaloProtoCluster>(myCellCollLink); ATH_MSG_DEBUG("[CaloCluster@" << myCluster.get() << "] created in <myCaloClusters>."); HashCluster::iterator clusCellIter=tmpCluster->begin(); @@ -1078,9 +1218,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, } myCluster->addCell(itrCell.index(),myWeight); } - //CaloClusterKineHelper::calculateKine(myCluster); ATH_MSG_DEBUG("[CaloCluster@" << myCluster.get() << "] size: " << myCluster->size()); - //myCluster->setClusterSize(clusterSize); myCaloClusters.push_back(std::move(myCluster)); } else if ( tmpCluster->size() == 1 ) { @@ -1106,10 +1244,8 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, const double myWeight = itrCell.weight(); myRestClusters[tmpCluster->getParentClusterIndex()]->addCell(itrCell.index(),myWeight); } - //CaloClusterKineHelper::calculateKine(myRestClusters[tmpCluster->getParentClusterIndex()]); ATH_MSG_DEBUG("[CaloCluster@" << myRestClusters[tmpCluster->getParentClusterIndex()].get() << "] size: " << myRestClusters[tmpCluster->getParentClusterIndex()]->size()); - //myRestClusters[tmpCluster->getParentClusterIndex()]->setClusterSize(clusterSize); } } } @@ -1159,7 +1295,7 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, clusColl->push_back(xAODCluster); xAODCluster->addCellLink(protoCluster->releaseCellLinks());//Hand over ownership to xAOD::CaloCluster xAODCluster->setClusterSize(clusterSize); - CaloClusterKineHelper::calculateKine(xAODCluster); + CaloClusterKineHelper::calculateKine(xAODCluster, true, true, m_useGPUCriteria); ATH_MSG_DEBUG("CaloCluster@" << xAODCluster << " pushed into " << "CaloClusterContainer@" << clusColl); @@ -1171,16 +1307,16 @@ StatusCode CaloTopoClusterSplitter::execute(const EventContext& ctx, eTot+=xAODCluster->e(); nTot+=xAODCluster->size(); - if ( fabs(xAODCluster->e()) > eMax ) - eMax = fabs(xAODCluster->e()); + if ( std::abs(xAODCluster->e()) > eMax ) + eMax = std::abs(xAODCluster->e()); } ATH_MSG_DEBUG("Sum of all CaloClusters E = " << eTot << " MeV, NCells = " << nTot << " (including NShared = " << nShared << " twice)"); - if ( fabs(eTot) > eMax ) - eMax = fabs(eTot); - if ( fabs(eTot-eTotOrig)>0.001*eMax ){ + if ( std::abs(eTot) > eMax ) + eMax = std::abs(eTot); + if ( std::abs(eTot-eTotOrig)>0.001*eMax ){ msg(MSG::WARNING) << "Energy sum for split Clusters = " << eTot << " MeV does not equal original sum = " << eTotOrig << " MeV !" << endmsg; } if ( abs(nTot-nShared-nTotOrig) > 0 ) { diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.h b/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.h index 0384303115c54cb0c891ab28e7dbace96ff1664b..96ad121db79385d38764581fedf8549109693218 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.h +++ b/Calorimeter/CaloRec/src/CaloTopoClusterSplitter.h @@ -242,6 +242,8 @@ class CaloTopoClusterSplitter: public AthAlgTool, virtual public CaloClusterColl IdentifierHash m_hashMin; IdentifierHash m_hashMax; + + Gaudi::Property<bool> m_useGPUCriteria {this, "UseGPUCriteria", false, "Adopt a set of criteria that is consistent with the GPU implementation."}; }; #endif // CALOTOPOCLUSTERSPLITTER_H diff --git a/Calorimeter/CaloRec/src/CaloTopoTmpHashCellSort.h b/Calorimeter/CaloRec/src/CaloTopoTmpHashCellSort.h index 145edf94bd16b20a1ba96784620df8bf5417c746..c63988b9590cbb556a1c3f533358d0d98b458586 100644 --- a/Calorimeter/CaloRec/src/CaloTopoTmpHashCellSort.h +++ b/Calorimeter/CaloRec/src/CaloTopoTmpHashCellSort.h @@ -21,33 +21,74 @@ #include "CaloTopoTmpHashCell.h" namespace CaloTopoTmpHashCellSort{ -// comparison, order seed cells by E/V -template <class T> -class compare - { + + // comparison, order seed cells by E/V + template <class T> + class compare + { public: - inline compare() {} ; - inline bool operator () (const CaloTopoTmpHashCell<T>& c1, - const CaloTopoTmpHashCell<T>& c2) - { - return c1.getCaloTopoTmpClusterCell()->getSignedRatio() > c2.getCaloTopoTmpClusterCell()->getSignedRatio(); - } + inline compare() {} ; + inline bool operator () (const CaloTopoTmpHashCell<T>& c1, + const CaloTopoTmpHashCell<T>& c2) + { + return c1.getCaloTopoTmpClusterCell()->getSignedRatio() > c2.getCaloTopoTmpClusterCell()->getSignedRatio(); + } - }; + }; + + template <class T> + class compareAbs + { + + public: + inline compareAbs() {} ; + inline bool operator () (const CaloTopoTmpHashCell<T>& c1, + const CaloTopoTmpHashCell<T>& c2) + { + return std::abs(c1.getCaloTopoTmpClusterCell()->getSignedRatio()) > std::abs(c2.getCaloTopoTmpClusterCell()->getSignedRatio()); + } + }; -template <class T> -class compareAbs - { + //These are used to agree with GPU ordering: use the cell index as a tie-breaker. + + template <class T> + class compareWithIndex + { public: - inline compareAbs() {} ; - inline bool operator () (const CaloTopoTmpHashCell<T>& c1, - const CaloTopoTmpHashCell<T>& c2) + inline compareWithIndex() {} ; + inline bool operator () (const CaloTopoTmpHashCell<T>& c1, + const CaloTopoTmpHashCell<T>& c2) + { + const auto s1 = c1.getCaloTopoTmpClusterCell()->getSignedRatio(); + const auto s2 = c2.getCaloTopoTmpClusterCell()->getSignedRatio(); + if (s1 == s2) { + return c1.getCaloTopoTmpClusterCell()->getID() > c2.getCaloTopoTmpClusterCell()->getID(); + } + return s1 > s2; + } + + }; + + template <class T> + class compareAbsWithIndex { - return fabs(c1.getCaloTopoTmpClusterCell()->getSignedRatio()) > fabs(c2.getCaloTopoTmpClusterCell()->getSignedRatio()); - } - }; + + public: + inline compareAbsWithIndex() {} ; + inline bool operator () (const CaloTopoTmpHashCell<T>& c1, + const CaloTopoTmpHashCell<T>& c2) + { + const auto s1 = std::abs(c1.getCaloTopoTmpClusterCell()->getSignedRatio()); + const auto s2 = std::abs(c2.getCaloTopoTmpClusterCell()->getSignedRatio()); + if (s1 == s2) { + return c1.getCaloTopoTmpClusterCell()->getID() > c2.getCaloTopoTmpClusterCell()->getID(); + } + return s1 > s2; + } + }; } + #endif // CALOTOPOTMPHASHCELLSORT_H diff --git a/Calorimeter/CaloRecGPU/CMakeLists.txt b/Calorimeter/CaloRecGPU/CMakeLists.txt index 6f50e0f24df8ac73f12840658f7846017e8236da..2afd8634b70eaf375107c3f70ae86a1ae48d39a7 100644 --- a/Calorimeter/CaloRecGPU/CMakeLists.txt +++ b/Calorimeter/CaloRecGPU/CMakeLists.txt @@ -1,76 +1,41 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - - -# This package needs CUDA to be handled as a "first class language" by CMake. -cmake_minimum_required(VERSION 3.11) - -# Set the name of the package. -atlas_subdir( CaloRecGPU ) - -# The build of this package needs CUDA. If it's not available, don't try to do -# anything... -if( NOT CMAKE_CUDA_COMPILER ) - message( STATUS "CUDA not found, CaloRecGPU is not built" ) - return() -endif() - -find_package( Boost COMPONENTS chrono filesystem ) -find_package( ROOT COMPONENTS Core MathCore Hist Gpad Graf ) - -# Add a component library that has some CUDA code in it. -atlas_add_library( CaloRecGPULib - CaloRecGPU/*.h src/*.cxx src/*.cu src/*.h - PUBLIC_HEADERS CaloRecGPU - LINK_LIBRARIES AthenaBaseComps GaudiKernel CaloEvent CaloInterfaceLib TrigT2CaloCommonLib CxxUtils - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}) - -atlas_add_component( CaloRecGPU - src/components/*.cxx - LINK_LIBRARIES CaloRecGPULib ) - -atlas_add_executable( calorecgpu_plotter - tools/plotter/clusterplotter.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} CaloRecGPULib ) - -atlas_add_executable( calorecgpu_optimizer - tools/optimizer/Optimize.cu - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES CaloRecGPULib ) - -atlas_add_executable( calorecgpu_methodchecker - tools/methodchecker/NewMethodCheck.cu - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES CaloRecGPULib ) - -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - -set_target_properties( CaloRecGPULib PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED TRUE ) - -set_target_properties( calorecgpu_methodchecker PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED TRUE ) - -set_target_properties( calorecgpu_optimizer PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED TRUE ) - -target_compile_definitions(CaloRecGPULib PRIVATE CUDA_API_PER_THREAD_DEFAULT_STREAM=1) -target_compile_options(CaloRecGPULib PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-expt-relaxed-constexpr>) - -target_compile_definitions(calorecgpu_optimizer PRIVATE CUDA_API_PER_THREAD_DEFAULT_STREAM=1) -target_compile_options(calorecgpu_optimizer PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-expt-relaxed-constexpr>) - -target_compile_definitions(calorecgpu_methodchecker PRIVATE CUDA_API_PER_THREAD_DEFAULT_STREAM=1) -target_compile_options(calorecgpu_methodchecker PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-expt-relaxed-constexpr>) +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + + +# This package needs CUDA to be handled as a "first class language" by CMake. +cmake_minimum_required(VERSION 3.11) + +# Set the name of the package. +atlas_subdir( CaloRecGPU ) + +# The build of this package needs CUDA. If it's not available, don't try to do +# anything... +if( NOT CMAKE_CUDA_COMPILER ) + message( STATUS "CUDA not found, CaloRecGPU is not built" ) + return() +endif() + +find_package( Boost COMPONENTS chrono filesystem ) + +# Add a component library that has some CUDA code in it. +atlas_add_library( CaloRecGPULib + CaloRecGPU/*.h src/*.cxx src/*.cu src/*.h + PUBLIC_HEADERS CaloRecGPU + LINK_LIBRARIES AthenaBaseComps CaloEvent CaloInterfaceLib CxxUtils GaudiKernel TileEvent TrigT2CaloCommonLib + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ) + +atlas_add_component( CaloRecGPU + src/components/*.cxx + LINK_LIBRARIES CaloRecGPULib ) + +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + +set_target_properties( CaloRecGPULib PROPERTIES + CUDA_SEPARABLE_COMPILATION ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED TRUE ) + +target_compile_definitions(CaloRecGPULib PRIVATE CUDA_API_PER_THREAD_DEFAULT_STREAM=1) +target_compile_options(CaloRecGPULib PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-expt-relaxed-constexpr>) diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/BaseDefinitions.h b/Calorimeter/CaloRecGPU/CaloRecGPU/BaseDefinitions.h new file mode 100644 index 0000000000000000000000000000000000000000..8063b68ec8bb528e86618bf12e6873f3b9d29b86 --- /dev/null +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/BaseDefinitions.h @@ -0,0 +1,34 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_BASEDEFINITIONS_H +#define CALORECGPU_BASEDEFINITIONS_H + +namespace CaloRecGPU +{ + constexpr inline int NMaxNeighbours = 34; + constexpr inline int NCaloCells = 187652; + //Max index will be 0x0002 DD03 + constexpr inline int NMaxClusters = 0x10000U; + //So it all fits in an int16_t + //Would only start getting fishy if all the cells + //were part of a cluster and all the clusters + //had an average number of cells lower than 2.863... + //(Or, in general, for N cells not part of a cluster, + // an average number of cells per cluster lower than 2.863 - N/65536...) + + constexpr inline int NMaxPairs = NMaxNeighbours * NCaloCells; + + constexpr inline int NumGainStates = 4; + //This is the number of different gain states a cell can have. + //(For the noise calculation.) + + constexpr inline int NumSamplings = 28; + //The number of samplings in the calorimeter. + +} + +#endif diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/CUDAFriendlyClasses.h b/Calorimeter/CaloRecGPU/CaloRecGPU/CUDAFriendlyClasses.h index 080d2003360f05ea9a90643adcfe1405a99e5d6a..28010129d88e7fa93f8397c423c36aaf11fb053d 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/CUDAFriendlyClasses.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/CUDAFriendlyClasses.h @@ -1,516 +1,15 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// #ifndef CALORECGPU_CUDAFRIENDLYCLASSES_H #define CALORECGPU_CUDAFRIENDLYCLASSES_H -#include <cstddef> -#include <iostream> -#include <limits> - -//#include "CaloRecGPU/Helpers.h" - -namespace CaloRecGPU -{ - - constexpr inline int NMaxNeighbours = 26; - constexpr inline int NCaloCells = 187652; - //Max index will be 0x0002 DD03 - constexpr inline int NMaxClusters = 0x10000; - //So it all fits in an int16_t - //Would only start getting fishy if all the cells - //were part of a cluster and all the clusters - //had an average number of cells lower than 2.87... - //(Or, in general, for N cells not part of a cluster, - // an average number of cells per cluster lower than 2.87 - N/65536...) - - constexpr inline int NMaxPairs = NMaxNeighbours * NCaloCells; - - constexpr inline int NumGainStates = 4; - //This is the number of different gain states a cell can have. - //(For the noise calculation.) - - //Migrated from macro defines to constexpr, for type safety. - - using tag_type = unsigned long long int; - //uint64_t is unsigned long long int in CUDA. - - class Tags - { - protected: - - constexpr static tag_type tag_counter_mask = 0x7FFF800000000000ULL; - //0x 7FFF 8000 0000 0000 - - constexpr static tag_type tag_snr_mask = 0x00007FFFFFFF0000ULL; - //0x 0000 7FFF FFFF 0000 - - constexpr static tag_type tag_index_mask = 0xFFFFULL; - - constexpr static tag_type tag_propagation_delta = 0x0000800000000000ULL; - //0x 0000 8000 0000 0000 - - public: - - constexpr static tag_type ValidPropagationMark = 0x8000000000000000ULL; - //0x 8000 0000 0000 0000 - - constexpr static tag_type GrowTag = ValidPropagationMark; - - constexpr static tag_type TerminalTag = 0x1000000000000000ULL; - //0x 1000 0000 0000 0000 - - constexpr static tag_type InvalidTag = tag_propagation_delta; - //0x 0000 8000 0000 0000 - - inline static constexpr bool is_invalid(const tag_type tag) - { - return tag <= InvalidTag; - } - - inline static constexpr bool is_valid(const tag_type tag) - { - return !is_invalid(tag); - } - - inline static constexpr bool is_assignable_terminal(const tag_type tag) - { - return tag >= TerminalTag && tag < GrowTag; - } - - inline static constexpr bool is_non_assigned_terminal(const tag_type tag) - { - return tag == TerminalTag; - } - - inline static constexpr bool is_assigned_terminal(const tag_type tag) - { - return tag > TerminalTag && tag < GrowTag; - } - - inline static constexpr bool is_terminal(const tag_type tag) - { - return tag >= TerminalTag && tag < GrowTag; - } - - inline static constexpr bool is_non_assigned_growing(const tag_type tag) - { - return tag == GrowTag; - } - - inline static constexpr bool is_growing_or_seed(const tag_type tag) - { - return tag >= GrowTag; - } - - inline static constexpr bool is_part_of_cluster(const tag_type tag) - { - return tag > GrowTag; - } - - inline static constexpr tag_type make_seed_tag(const int32_t snr_as_int, const int32_t /*seed_cell_index*/, const int32_t cluster_index) - //This works because the numbers will always be non-negative when we make a signature. - { - constexpr uint32_t two_byte_mask = 0xFFFFU; - //By design, the numbers should be clamped to acceptable values. - //However, no harm in preventing explicit clobbering? - //Might aid in optimizations, upon naive check on Godbolt/CUDA, - //due to the existance of "bfi" instructions that do bit-wise insertion. - - const uint32_t index = uint32_t(cluster_index & two_byte_mask); - - tag_type ret = two_byte_mask; - - - ret = (ret << 31) | snr_as_int; - - ret = (ret << 16) | index; - - return ret | ValidPropagationMark; - } - - inline static constexpr int32_t get_snr_from_tag(const tag_type tag) - { - const tag_type masked = tag & tag_snr_mask; - - const uint32_t ret = (masked >> 16); - - return ret; - } - - inline static constexpr int32_t get_index_from_tag(const tag_type tag) - { - const uint32_t ret = tag & tag_index_mask; - - return ret; - } - - inline static constexpr int32_t get_counter_from_tag(const tag_type tag) - { - const tag_type masked = tag & tag_counter_mask; - - const uint32_t ret = (masked >> 47); - - return ret; - - } - - inline static constexpr tag_type clear_counter(const tag_type tag) - { - return tag & (~tag_counter_mask); - } - - inline static constexpr tag_type clear_everything_but_counter(const tag_type tag) - { - return tag & tag_counter_mask; - } - - inline static constexpr tag_type set_for_propagation(const tag_type tag) - { - return tag - tag_propagation_delta; - } - - inline static constexpr tag_type set_for_terminal_propagation(const tag_type tag) - { - return tag - tag_propagation_delta; - } - - inline static constexpr tag_type update_non_terminal_tag(const tag_type old_tag, const tag_type new_tag) - { - return clear_everything_but_counter(old_tag) | new_tag; - } - - inline static constexpr tag_type update_terminal_tag(const tag_type old_tag, const tag_type new_tag) - { - return clear_everything_but_counter(old_tag) | new_tag; - } - - inline static constexpr tag_type terminal_to_seed_tag(const tag_type old_tag) - { - return old_tag; - } - }; - - - - /* - //The following definitions are used to signal certain cells through their energy - //as being ineligible for being seeds, or for being part of a cluster, - //if the cells are being cut according to time (option m_seedCutsInT) - - class EnergyManip - { - protected: - - constexpr static int invalid_seed_min_exponent = 64; - constexpr static int invalid_seed_factor_exponent = 96; - - constexpr static float invalid_seed_min = Helpers::compile_time_pow2<float, int>(invalid_seed_min_exponent); - constexpr static float invalid_seed_factor = Helpers::compile_time_pow2<float, int>(invalid_seed_factor_exponent); - - constexpr static float invalid_for_all_value = std::numeric_limits<float>::max(); - - //Cheap trick to allow these functions to be called from a CUDA context - //without actually placing __host__ __device__ decorations - //that would be invalid in C++ and cause different signature shenanigans: - //given that constexpr functions can be called from device code - //with exprt-relaxed-constexpr, - //we shall declare them as such even if they are not used in such a way. - public: - - inline static constexpr bool is_ineligible_for_any(const float energy) - { - return (energy == invalid_for_all_value); - } - - inline static constexpr bool is_ineligible_for_seed(const float energy) - //Might be ineligible for other things as well. - { - using namespace std; - return abs(energy) > invalid_seed_min; - } - - inline static constexpr bool is_valid_cell(const float energy) - { - using namespace std; - return abs(energy) < invalid_seed_min; - } - - inline static constexpr float correct_energy(const float energy) - //May change bad and invalid for all cell energies too... - { - if (is_ineligible_for_seed(energy)) - { - return energy / invalid_seed_factor; - } - else - { - return energy; - } - } - - inline static constexpr void mark_ineligible_for_seed(float & energy) - { - energy *= invalid_seed_factor; - } - - inline static constexpr void mark_ineligible_for_all(float & energy) - { - energy = invalid_for_all_value; - } - - //Note: the fact that we use abs(energy) to classify this validity - // does not change the results when we use the signed energy - // for the cluster growing in itself: as energy < 0 means - // the cells will be invalid, they will continue being invalid too... - }; - - */ - - - struct CellNoiseArr - { - float noise[NumGainStates][NCaloCells]; - }; - - class GainConversion - { - protected: - - enum class GainType : int - { - TileLowLow = 0, TileLowHigh = 1, TileHighLow = 2, TileHighHigh = 3, - TileOneLow = 0, TileOneHigh = 3, //Are these valid/used? - LArHigh = 0, LArMedium = 1, LArLow = 2, - DefaultOrInvalid = 0, //A sane value just to ensure no out-of-bounds reading. - BadCell = 5, - InvalidCell = 6, - InvalidSeedInv0 = -1, - InvalidSeedInv1 = -2, - InvalidSeedInv2 = -3, - InvalidSeedInv3 = -4, - GainMinValue = -4, - GainMaxValue = 6, - NumGainValues = GainMaxValue - GainMinValue + 1 - - }; - - public: - - template <class T = int> - inline static constexpr T max_gain_value() - { - return (T) GainType::GainMaxValue; - } - - template <class T = int> - inline static constexpr T min_gain_value() - { - return (T) GainType::GainMinValue; - } - - template <class T = int> - inline static constexpr T num_gain_values() - { - return (T) GainType::NumGainValues; - } - - inline static constexpr GainType from_standard_gain(const int gain) - //Basically, CaloCondUtils::getDbCaloGain without the Athena logging. - { - switch (gain) - { - case -16: //Tile LOWLOW - return GainType::TileLowLow; - case -15: //Tile LOWHIGH - return GainType::TileLowHigh; - case -12: //Tile HIGHLOW - return GainType::TileHighLow; - case -11: //Tile HIGHHIGH - return GainType::TileHighHigh; - case -4 : //Tile ONELOW - return GainType::TileOneLow; - case -3 : //Tile ONEHIGH - return GainType::TileOneHigh; - case 0 : //LAr High - return GainType::LArHigh; - case 1 : //LAr Medium - return GainType::LArMedium; - case 2 : //Lar Low - return GainType::LArLow; - default: - return GainType::DefaultOrInvalid; - } - } - - inline static constexpr void mark_bad_cell(GainType & gain) - { - gain = GainType::BadCell; - } - - //This somewhat defeats the point of the enum class, but... - template <class T> - inline static constexpr void mark_bad_cell(T & gain_rep) - { - gain_rep = (T) GainType::BadCell; - } - - inline static constexpr void mark_invalid_cell(GainType & gain) - { - gain = GainType::InvalidCell; - } - - //Again, enum class sidestepping... - template <class T> - inline static constexpr void mark_invalid_cell(T & gain_rep) - { - gain_rep = (T) GainType::InvalidCell; - } - - inline static constexpr void mark_invalid_seed_cell(GainType & gain) - { - const int ermediate = (int) gain; - - gain = (GainType) (-ermediate - 1); - } - - template <class T> - inline static constexpr void mark_invalid_seed_cell(T & gain_rep) - { - gain_rep = -gain_rep - 1; - } - - inline static constexpr bool is_bad_cell(const GainType & gain) - { - return gain == GainType::BadCell; - } - - template <class T> - inline static constexpr bool is_bad_cell(const T & gain_rep) - { - return gain_rep == (T) GainType::BadCell; - } - - inline static constexpr bool is_invalid_cell(const GainType & gain) - { - return gain == GainType::InvalidCell; - } - - template <class T> - inline static constexpr bool is_invalid_cell(const T & gain_rep) - { - return gain_rep == (T) GainType::InvalidCell; - } - - inline static constexpr bool is_invalid_seed_cell(const GainType & gain) - { - return ((int) gain < 0); - } - - template <class T> - inline static constexpr bool is_invalid_seed_cell(const T & gain_rep) - { - return gain_rep < 0; - } - - template <class T> - inline static constexpr bool is_normal_cell(const T & gain_maybe_rep) - { - return !is_invalid_cell(gain_maybe_rep) && !is_invalid_seed_cell(gain_maybe_rep) && !is_bad_cell(gain_maybe_rep); - } - - inline static constexpr GainType recover_invalid_seed_cell_gain(const GainType & gain) - { - switch (gain) - { - case GainType::InvalidSeedInv0: - return (GainType) 0; - case GainType::InvalidSeedInv1: - return (GainType) 1; - case GainType::InvalidSeedInv2: - return (GainType) 2; - case GainType::InvalidSeedInv3: - return (GainType) 3; - default: - break; - } - return gain; - } - - template <class T> - inline static constexpr T recover_invalid_seed_cell_gain(const T & gain_rep) - { - if (gain_rep < 0) - { - return -(gain_rep + 1); - } - return gain_rep; - } - - }; - - struct CellInfoArr - { - float energy[NCaloCells]; - signed char gain[NCaloCells]; - }; - - - struct GeometryArr - { - int caloSample[NCaloCells]; - float x[NCaloCells]; - float y[NCaloCells]; - float z[NCaloCells]; - float eta[NCaloCells]; - float phi[NCaloCells]; - - int nNeighbours[NCaloCells]; //Number of neighbours - int neighbours[NCaloCells][NMaxNeighbours]; //NMaxNeighbours = 26 - //Cell A will appear in neighbours[i] if - //i appears in the result of the CPU get_neighbours of cell A - - int nReverseNeighbours[NCaloCells]; //Number of neighbours - int reverseNeighbours[NCaloCells][NMaxNeighbours]; //NMaxNeighbours = 26 - //These last two represent the reverse of what we use, - //but which corresponds to the same as the neighbours in the CPU: - //Cell A will appear in neighbours[i] if - //A appears in the result of the CPU get_neighbours of cell i... - - //This last one is needed to support the GPU splitter in its current implementation. - }; - - struct CellStateArr - { - tag_type clusterTag[NCaloCells]; //cluster tag - }; - - struct PairsArr - { - int number; - int reverse_number; - //This is to store neighbours in the other way around... - - int cellID[NMaxPairs]; - //This is guaranteed growing or seed cell - int neighbourID[NMaxPairs]; - //This is any cell - }; - - struct ClusterInfoArr - { - int number; - float clusterEnergy[NMaxClusters]; - float clusterEt[NMaxClusters]; - //Also used, as an intermediate value, to store AbsE - float clusterEta[NMaxClusters]; - float clusterPhi[NMaxClusters]; - int seedCellID[NMaxClusters]; - }; - -} +#include "BaseDefinitions.h" +#include "TagDefinitions.h" +#include "ConstantInfoDefinitions.h" +#include "EventInfoDefinitions.h" #endif //CALORECGPU_CUDAFRIENDLYCLASSES_H diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUProcessor.h b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUProcessor.h index e53ae0012d901dae0c69a2d8bafd99c3340ce7e4..62212028bc7e48942e064260cf4902482f57042f 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUProcessor.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUProcessor.h @@ -1,43 +1,58 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOCLUSTERGPUPROCESSOR_H -#define CALORECGPU_CALOCLUSTERGPUPROCESSOR_H - - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/EventContext.h" -#include "CaloRecGPU/DataHolders.h" - -/** - * @class CaloClusterGPUProcessor - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 27 May 2022 - * @brief Base class for GPU-accelerated cluster processing tools - * to be called from @c CaloGPUHybridClusterProcessor. - * - * This class defines an @c execute method that takes as an argument - * a @c EventContext, a @c ConstantDataHolder and a @c EventDataHolder. - */ - -class CaloClusterGPUProcessor : virtual public IAlgTool -{ - public: - - /** - * @brief Process the clusters on GPU. - * @param ctx The event context. - * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). - * @param event_data Data held in GPU memory that is specific to this event (including the description of the clusters themselves). - */ - virtual StatusCode execute (const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const = 0; - - DeclareInterfaceID( CaloClusterGPUProcessor, 1, 0); - -}; - - -#endif //CALORECGPU_CALOCLUSTERGPUPROCESSOR_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOCLUSTERGPUPROCESSOR_H +#define CALORECGPU_CALOCLUSTERGPUPROCESSOR_H + + +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/EventContext.h" +#include "CaloRecGPU/DataHolders.h" + +/** + * @class CaloClusterGPUProcessor + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 27 May 2022 + * @brief Base class for GPU-accelerated cluster processing tools + * to be called from @c CaloGPUHybridClusterProcessor. + * + * This class defines an @c execute method that takes as an argument + * a @c EventContext, a @c CaloRecGPU::ConstantDataHolder and a @c CaloRecGPU::EventDataHolder. + */ + +class CaloClusterGPUProcessor : virtual public IAlgTool +{ + public: + + /** + * @brief Process the clusters on GPU. + * @param ctx The event context. + * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). + * @param event_data Data held in GPU memory that is specific to this event (including the description of the clusters themselves). + * @param temporary_buffer A pointer to an \array in GPU memory that is at least as large as @p size_of_temporaries(), + * to hold temporary information for the algorithms. Given the way CUDA memory allocations work, + * casting this to a pointer (or a @p CaloRecGPU::Helpers::CUDA_kernel_object) to the intended type + * and then using it will be perfectly valid. + */ + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const = 0; + + /** + @brief The size (in bytes) of the temporary object(s) that the algorithm will use. + */ + virtual size_t size_of_temporaries() const + { + return 0; + }; + + DeclareInterfaceID( CaloClusterGPUProcessor, 1, 0); + +}; + + +#endif //CALORECGPU_CALOCLUSTERGPUPROCESSOR_H diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUTransformers.h b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUTransformers.h index aec27233c5d0c5fbb465e247d8d0af0c8d9153d5..83d970960e11d747c60cfa7ff237da29b4315bab 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUTransformers.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloClusterGPUTransformers.h @@ -1,107 +1,165 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOCLUSTERGPUTRANSFORMERS_H -#define CALORECGPU_CALOCLUSTERGPUTRANSFORMERS_H - - -#include "AthenaBaseComps/AthAlgTool.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "CaloRecGPU/DataHolders.h" - -/** - * @class ICaloClusterGPUConstantTransformer - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 27 May 2022 - * @brief Base class for tools that convert constant information - * to the GPU-friendly format used in @c CaloGPUHybridClusterProcessor. - * - * This class defines a @c convert method that takes as an argument - * a @c ConstantDataHolder. - */ - -class ICaloClusterGPUConstantTransformer : virtual public IAlgTool -{ - public: - - /** - * @brief Fill the @ConstantDataHolder with the relevant information. - * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). - */ - virtual StatusCode convert (ConstantDataHolder & constant_data) const = 0; - - /** - * @brief Fill the @ConstantDataHolder with the relevant information at the first event. - * @param ctx The event context. - * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). - * - * Unless otherwise specified by the tool, this does exactly the same as @c convert(constant_data) - */ - inline virtual StatusCode convert (const EventContext &, ConstantDataHolder & constant_data) const - { - return this->convert(constant_data); - } - - DeclareInterfaceID( ICaloClusterGPUConstantTransformer, 1, 0); -}; - -/** - * @class ICaloClusterGPUInputTransformer - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 27 May 2022 - * @brief Base class for tools that convert event information from the Athena structures - * to the GPU-friendly format used in @c CaloGPUHybridClusterProcessor. - * - * This class defines a @c convert method that takes as an argument - * a @c EventContext, a @c ConstantDataHolder, a @xAOD::CaloClusterContainer and a @c EventDataHolder. - */ - -class ICaloClusterGPUInputTransformer : virtual public IAlgTool -{ - public: - - /** - * @brief Fill the @EventDataHolder with the relevant information. - * @param ctx The event context. - * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). - * @param cluster_collection The cluster collection, in the standard Athena structures. - * @param event_data Data held in GPU memory that is specific to this event (including the description of the clusters themselves). - */ - virtual StatusCode convert (const EventContext & ctx, const ConstantDataHolder & constant_data, - const xAOD::CaloClusterContainer * cluster_collection, EventDataHolder & event_data) const = 0; - - DeclareInterfaceID( ICaloClusterGPUInputTransformer, 1, 0); -}; - -/** - * @class ICaloClusterGPUOutputTransformer - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 27 May 2022 - * @brief Base class for tools that convert event information from the GPU-friendly format - * used in @c CaloGPUHybridClusterProcessor to the Athena structures. - * - * This class defines a @c convert method that takes as an argument - * a @c EventContext, a @c ConstantDataHolder, a @c EventDataHolder and a @xAOD::CaloClusterContainer. - */ - -class ICaloClusterGPUOutputTransformer : virtual public IAlgTool -{ - public: - - /** - * @brief Fill the @xAOD::CaloClusterContainer with the relevant information. - * @param ctx The event context. - * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). - * @param event_data Data held in GPU memory that is specific to this event (including the description of the clusters themselves). - * @param cluster_collection The cluster collection, in the standard Athena structures. - */ - virtual StatusCode convert (const EventContext & ctx, const ConstantDataHolder & constant_data, - EventDataHolder & event_data, xAOD::CaloClusterContainer * cluster_collection) const = 0; - - DeclareInterfaceID( ICaloClusterGPUOutputTransformer, 1, 0); -}; - -#endif //CALORECGPU_CALOCLUSTERGPUTRANSFORMERS_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOCLUSTERGPUTRANSFORMERS_H +#define CALORECGPU_CALOCLUSTERGPUTRANSFORMERS_H + + +#include "AthenaBaseComps/AthAlgTool.h" +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "CaloRecGPU/DataHolders.h" + +/** + * @class ICaloClusterGPUConstantTransformer + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 27 May 2022 + * @brief Base class for tools that convert constant information + * to the GPU-friendly format used in @c CaloGPUHybridClusterProcessor. + * + * This class defines a @c convert method that takes as an argument + * a @c CaloRecGPU::ConstantDataHolder. + */ + +class ICaloClusterGPUConstantTransformer : virtual public IAlgTool +{ + public: + + /** + * @brief Fill the @ConstantDataHolder with the relevant information. + * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). + * @param override_keep_CPU_info If @p true, keep CPU info regardless of the default behaviour of the tool. + */ + virtual StatusCode convert (CaloRecGPU::ConstantDataHolder & constant_data, const bool override_keep_CPU_info) const = 0; + + /** + * @brief Fill the @CaloRecGPU::ConstantDataHolder with the relevant information at the first event. + * @param ctx The event context. + * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). + * @param override_keep_CPU_info If @p true, keep CPU info regardless of the default behaviour of the tool. + * + * Unless otherwise specified by the tool, this does exactly the same as @c convert(constant_data) + */ + inline virtual StatusCode convert (const EventContext &, CaloRecGPU::ConstantDataHolder & constant_data, const bool override_keep_CPU_info) const + { + return this->convert(constant_data, override_keep_CPU_info); + } + + DeclareInterfaceID( ICaloClusterGPUConstantTransformer, 1, 0); +}; + +/** + * @class ICaloClusterGPUInputTransformer + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 27 May 2022 + * @brief Base class for tools that convert event information from the Athena structures + * to the GPU-friendly format used in @c CaloGPUHybridClusterProcessor. + * + * This class defines a @c convert method that takes as an argument + * a @c EventContext, a @c CaloRecGPU::ConstantDataHolder, a @c xAOD::CaloClusterContainer + * and a @c CaloRecGPU::EventDataHolder. + */ + +class ICaloClusterGPUInputTransformer : virtual public IAlgTool +{ + public: + + /** + * @brief Fill the @p CaloRecGPU::EventDataHolder with the relevant information. + * @param ctx The event context. + * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). + * @param cluster_collection The cluster collection, in the standard Athena structures. + * @param event_data Data held in GPU memory that is specific to this event (including the description of the clusters themselves). + */ + virtual StatusCode convert (const EventContext & ctx, const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection, CaloRecGPU::EventDataHolder & event_data) const = 0; + + DeclareInterfaceID( ICaloClusterGPUInputTransformer, 1, 0); +}; + +/** + * @class ICaloClusterGPUOutputTransformer + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 27 May 2022 + * @brief Base class for tools that convert event information from the GPU-friendly format + * used in @c CaloGPUHybridClusterProcessor to the Athena structures. + * + * This class defines a @c convert method that takes as an argument + * a @c EventContext, a @c CaloRecGPU::ConstantDataHolder, a @c CaloRecGPU::EventDataHolder and a @xAOD::CaloClusterContainer. + */ + +class ICaloClusterGPUOutputTransformer : virtual public IAlgTool +{ + public: + + /** + * @brief Fill the @xAOD::CaloClusterContainer with the relevant information. + * @param ctx The event context. + * @param constant_data Data held in GPU memory that is common to all events (cell noise and geometry). + * @param event_data Data held in GPU memory that is specific to this event (including the description of the clusters themselves). + * @param cluster_collection The cluster collection, in the standard Athena structures. + */ + virtual StatusCode convert (const EventContext & ctx, const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, xAOD::CaloClusterContainer * cluster_collection) const = 0; + + DeclareInterfaceID( ICaloClusterGPUOutputTransformer, 1, 0); +}; + + +class CaloClusterCollectionProcessor; +class CaloClusterGPUProcessor; + +/** + * @class ICaloClusterGPUPlotter + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 09 November 2022 + * @brief Base class for tools that can be used to plot events within @c CaloGPUHybridClusterProcessor. + * + * This class should define several overloads of an @c update_plots function, + * which is called after each tool has ran, an @c update_plots_start and @update_plots_end, + * and a @c finalize_plots function, potentially to actually output the plots in the end. + * + */ + +class ICaloClusterGPUPlotter : virtual public IAlgTool +{ + public: + virtual StatusCode update_plots_start(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr) const = 0; + + virtual StatusCode update_plots_end(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr) const = 0; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloClusterCollectionProcessor * tool) const = 0; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloRecGPU::EventDataHolder & event_data, + const ICaloClusterGPUInputTransformer * tool) const = 0; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloRecGPU::EventDataHolder & event_data, + const CaloClusterGPUProcessor * tool) const = 0; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloRecGPU::EventDataHolder & event_data, + const ICaloClusterGPUOutputTransformer * tool) const = 0; + + virtual StatusCode finalize_plots() const = 0; + + DeclareInterfaceID( ICaloClusterGPUPlotter, 1, 0); +}; + +#endif //CALORECGPU_CALOCLUSTERGPUTRANSFORMERS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUHybridClusterProcessor.h b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUHybridClusterProcessor.h deleted file mode 100644 index ffcd5622e55a4cf7cc8c67dbf59cedd5ad977575..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUHybridClusterProcessor.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H -#define CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H - - -#include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "CaloUtils/CaloClusterCollectionProcessor.h" -#include "CaloRecGPU/CaloClusterGPUTransformers.h" -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "CaloRecGPU/DataHolders.h" -#include "xAODCaloEvent/CaloClusterContainer.h" - -#include <string> -#include <mutex> -#include <atomic> - -/** - * @class CaloGPUHybridClusterProcessor - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 27 May 2022 - * @brief Algorithm to reconstruct CaloCluster objects with GPU acceleration, - * providing interoperability for calling standard CPU algorithms before and after - * the GPU processing part. - * - * This class is meant as a replacement for @c CaloClusterMaker in that - * it creates a CaloClusterCollection and runs several tools over it. - * The main addition is the fact that, besides CPU-based tools, - * GPU-accelerated versions of the standard tools can be run, - * with adequate memory sharing between them to minimize transfers - * and (re-)conversions from and to the GPU-friendly data representation. */ - -class CaloGPUHybridClusterProcessor : public AthReentrantAlgorithm, public CaloGPUTimed -{ - public: - - CaloGPUHybridClusterProcessor(const std::string & name, ISvcLocator * pSvcLocator); - virtual ~CaloGPUHybridClusterProcessor() override; - virtual StatusCode initialize() override; - virtual StatusCode execute(const EventContext & ctx) const override; - virtual StatusCode execute(const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const; - //This second version is so we can 'hack' this into simply processing other containers - //via AlgToToolHelperHack for debugging purposes... - virtual StatusCode finalize() override; - - private: - - /** - * @brief The tool that will convert the constant data from the CPU to the GPU. - * - */ - ToolHandle<CaloClusterGPUConstantTransformer> m_transformConstantData; - - /** - * @brief Tools to be applied to the clusters before being sent to the GPU for processing. - * - */ - ToolHandleArray<CaloClusterCollectionProcessor> m_preGPUoperations; - - - /** - * @brief The tool that will actually convert the data from the CPU to the GPU. - * - */ - ToolHandle<CaloClusterGPUInputTransformer> m_transformForGPU; - - /** - * @brief Tools to be applied to the clusters on the GPU. - * - */ - ToolHandleArray<CaloClusterGPUProcessor> m_GPUoperations; - - /** - * @brief The tool that will convert the data from the GPU back to the CPU. - * - */ - ToolHandle<CaloClusterGPUOutputTransformer> m_transformBackToCPU; - - /** - * @brief Tools to be applied to the clusters after returning from the GPU. - * - */ - ToolHandleArray<CaloClusterCollectionProcessor> m_postGPUoperations; - - /** - * @brief Number of events for which to pre-allocate space on GPU memory - * (should ideally be set to the expected number of threads to be run with). - * - */ - size_t m_numPreAllocatedGPUData; - - /** @brief The name of the key in StoreGate for the output - CaloClusterContainer */ - SG::WriteHandleKey<xAOD::CaloClusterContainer> m_clusterOutput; - - /** @brief The name of the key in StoreGate for the output - CaloClusterCellLinkContainer */ - SG::WriteHandleKey<CaloClusterCellLinkContainer> m_clusterCellLinkOutput; - - /** @brief If @p true, the constant data is only converted and - sent to the GPU on the first event, in case not all the necessary - information is available during the @p initialize phase. - */ - bool m_deferConstantDataToFirstEvent; - - /** @brief A way to reduce allocations over multiple threads by keeping a cache - * of previously allocated objects that get assigned to the threads as they need them. - * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. - */ - mutable Helpers::separate_thread_holder<EventDataHolder> m_eventDataThreadedHolder ATLAS_THREAD_SAFE; - - /** @brief Constant data, common for all events and persisted throughout the run. - * - * Is @p mutable to deal with the cases where the data preparation is deferred to the first event. - */ - - mutable ConstantDataHolder m_constantData; - - /** @brief A flag to signal that the constant data has been adequately sent to the GPU. - * This is required for everything to work properly in a multi-threaded context... - */ - - mutable std::atomic<bool> m_constantDataSent; - - - /** @brief This mutex is locked when sending the constant data on the first event - * to ensure thread safety. Otherwise, it's unused. - */ - mutable std::mutex m_mutex; - -}; - -#endif //CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUTimed.h b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUTimed.h index f785f2c439cffb69f15563984fc6bbd097452f32..2137bdbb75e2143fdd26865dddda36e744e6b0ee 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUTimed.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/CaloGPUTimed.h @@ -1,175 +1,179 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOGPUTIMED_H -#define CALORECGPU_CALOGPUTIMED_H - -#include <vector> -#include <mutex> -#include <string> -#include <fstream> -#include "CxxUtils/checker_macros.h" - -/** - * @class CaloGPUTimed - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 01 June 2022 - * @brief Base class to provide some basic common infrastructure for timing measurements... */ - -class CaloGPUTimed -{ - - protected: - - - /** @brief Mutex that is locked when recording times. - */ - mutable std::mutex m_timeMutex; - /** @brief Vector to hold execution times to be recorded if necessary. - */ - mutable std::vector<size_t> m_times ATLAS_THREAD_SAFE; - //Mutexes should ensure no problems with thread safety. - - /** @brief Vector to hold the event numbers to be recorded if necessary. - */ - mutable std::vector<size_t> m_eventNumbers ATLAS_THREAD_SAFE; - //Mutexes should ensure no problems with thread safety. - - /** @brief If @p true, times are recorded to the file given by @p m_timeFileName. - * Defaults to @p false. - */ - Gaudi::Property<bool> m_measureTimes; - - /** @brief File to which times should be saved. - */ - Gaudi::Property<std::string> m_timeFileName; - - //Use CaloGPUTimed(this) in the derived classes for everything to work. - template <class T> - CaloGPUTimed(T * ptr): - m_measureTimes(ptr, "MeasureTimes", false, "Save time measurements"), - m_timeFileName(ptr, "TimeFileOutput", "times.txt", "File to which time measurements should be saved") - { - } - - private: - - inline void record_times_helper(size_t) const - { - //Do nothing - } - - - inline void record_times_helper(size_t index, size_t t) const - { - m_times[index] = t; - } - - template <class ... Args> - inline void record_times_helper(size_t index, size_t t, Args && ... args) const - { - record_times_helper(index, t); - record_times_helper(index + 1, std::forward<Args>(args)...); - } - - protected: - - inline void record_times(const size_t event_num, const std::vector<size_t> & times) const - { - size_t old_size; - //Scope just for the lock_guard. - { - std::lock_guard<std::mutex> lock_guard(m_timeMutex); - old_size = m_times.size(); - m_times.resize(old_size + times.size()); - m_eventNumbers.push_back(event_num); - } - - for (size_t i = 0; i < times.size(); ++i) - { - m_times[old_size + i] = times[i]; - } - } - - template <class ... Args> - inline void record_times(const size_t event_num, const size_t & val) const - { - const size_t time_size = 1; - - size_t old_size; - - //Scope just for the lock_guard. - { - std::lock_guard<std::mutex> lock_guard(m_timeMutex); - old_size = m_times.size(); - m_times.resize(old_size + time_size); - m_eventNumbers.push_back(event_num); - } - - record_times_helper(old_size, val); - } - - template <class ... Args> - inline void record_times(const size_t event_num, const size_t & val, Args && ... args) const - { - const size_t time_size = sizeof...(args) + 1; - - size_t old_size; - - //Scope just for the lock_guard. - { - std::lock_guard<std::mutex> lock_guard(m_timeMutex); - old_size = m_times.size(); - m_times.resize(old_size + time_size); - m_eventNumbers.push_back(event_num); - } - - record_times_helper(old_size, val, std::forward<Args>(args)...); - - } - - inline void print_times(const std::string & header, const size_t time_size) const - { - - std::vector<size_t> indices(m_eventNumbers.size()); - std::iota(indices.begin(), indices.end(), 0); - std::sort(indices.begin(), indices.end(), [&](size_t a, size_t b) - { - return m_eventNumbers[a] < m_eventNumbers[b]; - } - ); - std::ofstream out(m_timeFileName); - - out << "Event_Number Total " << header << "\n"; - - for (const size_t idx : indices) - { - out << m_eventNumbers[idx] << " "; - - size_t total = 0; - - for (size_t i = 0; i < time_size; ++i) - { - total += m_times[idx * time_size + i]; - } - - out << total << " "; - - for (size_t i = 0; i < time_size; ++i) - { - out << m_times[idx * time_size + i] << " "; - } - out << "\n"; - } - - out << std::endl; - - out.close(); - } -}; - - -#endif //CALORECGPU_CALOGPUTIMED_H \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOGPUTIMED_H +#define CALORECGPU_CALOGPUTIMED_H + +#include <vector> +#include <mutex> +#include <string> +#include <fstream> +#include "CxxUtils/checker_macros.h" + +/** + * @class CaloGPUTimed + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 01 June 2022 + * @brief Base class to provide some basic common infrastructure for timing measurements... */ + +class CaloGPUTimed +{ + + protected: + + + /** @brief Mutex that is locked when recording times. + */ + mutable std::mutex m_timeMutex; + /** @brief Vector to hold execution times to be recorded if necessary. + */ + mutable std::vector<size_t> m_times ATLAS_THREAD_SAFE; + //Mutexes should ensure no problems with thread safety. + + /** @brief Vector to hold the event numbers to be recorded if necessary. + */ + mutable std::vector<size_t> m_eventNumbers ATLAS_THREAD_SAFE; + //Mutexes should ensure no problems with thread safety. + + /** @brief If @p true, times are recorded to the file given by @p m_timeFileName. + * Defaults to @p false. + */ + Gaudi::Property<bool> m_measureTimes; + + /** @brief File to which times should be saved. + */ + Gaudi::Property<std::string> m_timeFileName; + + //Use CaloGPUTimed(this) in the derived classes for everything to work. + template <class T> + CaloGPUTimed(T * ptr): + m_measureTimes(ptr, "MeasureTimes", false, "Save time measurements"), + m_timeFileName(ptr, "TimeFileOutput", "times.txt", "File to which time measurements should be saved") + { + } + + private: + + inline void record_times_helper(size_t) const + { + //Do nothing + } + + + inline void record_times_helper(size_t index, size_t t) const + { + m_times[index] = t; + } + + template <class ... Args> + inline void record_times_helper(size_t index, size_t t, Args && ... args) const + { + record_times_helper(index, t); + record_times_helper(index + 1, std::forward<Args>(args)...); + } + + protected: + + inline void record_times(const size_t event_num, const std::vector<size_t> & times) const + { + size_t old_size; + //Scope just for the lock_guard. + { + std::lock_guard<std::mutex> lock_guard(m_timeMutex); + old_size = m_times.size(); + m_times.resize(old_size + times.size()); + m_eventNumbers.push_back(event_num); + } + + for (size_t i = 0; i < times.size(); ++i) + { + m_times[old_size + i] = times[i]; + } + } + + template <class ... Args> + inline void record_times(const size_t event_num, const size_t & value) const + { + const size_t time_size = 1; + + size_t old_size; + + //Scope just for the lock_guard. + { + std::lock_guard<std::mutex> lock_guard(m_timeMutex); + old_size = m_times.size(); + m_times.resize(old_size + time_size); + m_eventNumbers.push_back(event_num); + } + + record_times_helper(old_size, value); + } + + template <class ... Args> + inline void record_times(const size_t event_num, const size_t & value, Args && ... args) const + { + const size_t time_size = sizeof...(args) + 1; + + size_t old_size; + + //Scope just for the lock_guard. + { + std::lock_guard<std::mutex> lock_guard(m_timeMutex); + old_size = m_times.size(); + m_times.resize(old_size + time_size); + m_eventNumbers.push_back(event_num); + } + + record_times_helper(old_size, value, std::forward<Args>(args)...); + + } + + inline void print_times(const std::string & header, const size_t time_size) const + { + if (m_timeFileName.size() == 0) + { + return; + } + + std::vector<size_t> indices(m_eventNumbers.size()); + std::iota(indices.begin(), indices.end(), 0); + std::sort(indices.begin(), indices.end(), [&](size_t a, size_t b) + { + return m_eventNumbers[a] < m_eventNumbers[b]; + } + ); + std::ofstream out(m_timeFileName); + + out << "Event_Number Total " << header << "\n"; + + for (const size_t idx : indices) + { + out << m_eventNumbers[idx] << " "; + + size_t total = 0; + + for (size_t i = 0; i < time_size; ++i) + { + total += m_times[idx * time_size + i]; + } + + out << total << " "; + + for (size_t i = 0; i < time_size; ++i) + { + out << m_times[idx * time_size + i] << " "; + } + out << "\n"; + } + + out << std::endl; + + out.close(); + } +}; + + +#endif //CALORECGPU_CALOGPUTIMED_H diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/ConstantInfoDefinitions.h b/Calorimeter/CaloRecGPU/CaloRecGPU/ConstantInfoDefinitions.h new file mode 100644 index 0000000000000000000000000000000000000000..7445c2e1e606ae644dbd24d893dad429bf7c0f87 --- /dev/null +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/ConstantInfoDefinitions.h @@ -0,0 +1,1635 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CONSTANTINFODEFINITIONS_H +#define CALORECGPU_CONSTANTINFODEFINITIONS_H + +#include "BaseDefinitions.h" +#include "Helpers.h" +#include <climits> +//For CHAR_BIT +#include <utility> +//Forward + +namespace CaloRecGPU +{ + + constexpr inline int NumNeighOptions = 12; + //The non-combined choices for LArNeighbours::neighbourOption: + //prevInPhi = 0x0001, -> starts at 0 + //nextInPhi = 0x0002, -> starts at NeighOffsets.get_number(0) + //prevInEta = 0x0004, -> starts at NeighOffsets.get_number(1) + //nextInEta = 0x0008, -> starts at NeighOffsets.get_number(2) + //corners2D = 0x0010, -> starts at NeighOffsets.get_number(3) + //prevInSamp = 0x0020, -> starts at NeighOffsets.get_number(4) + //nextInSamp = 0x0040, -> starts at NeighOffsets.get_number(5) + //prevSubDet = 0x0080, -> starts at NeighOffsets.get_number(6) + //nextSubDet = 0x0100, -> starts at NeighOffsets.get_number(7) + //corners3D = 0x0200, -> starts at NeighOffsets.get_number(8) + //prevSuperCalo = 0x0400, -> starts at NeighOffsets.get_number(9) + //nextSuperCalo = 0x0800 -> starts at NeighOffsets.get_number(10) + + /*! @class NeighOffsets + A class that expresses the offset from the beginning of the neighbours list + for the several neighbour options. + + Bit packed to store all cumulative offsets, + since they fit in 5 bits. (NMaxNeighbours == 26) + For a 64-bit integer, the last 4 bits are empty. + We use the highest of those to signal that the cell + fulfills the conditions for its neighbourhood relations + to be reduced to `nextInSamp`, as used in the clustering algorithms. + */ + struct NeighOffsets + { + using carrier = unsigned long long int; + carrier value; + + protected: + + constexpr static carrier s_numbers_to_keep = NumNeighOptions - 2; + //This is the number of starting cell offsets we actually need to keep. + + constexpr static int s_bits_per_offset = 5; + constexpr static int s_bits_per_last_offset = 6; + constexpr static int s_more_bits_begin = 9; + //We start giving an extra bit to the offsets from + //the 9th number (corresponding to prevSuperCalo) + //since corners3D can push some cells to have more than 32 neighbours. + + + constexpr static carrier s_offset_mask = 0x1FULL; + constexpr static carrier s_offset_mask_last = 0x3FULL; + constexpr static carrier s_offset_delta_pattern = 0x0008210842108421ULL; + //This has one set bit every five, + //except for the last two, that are one every six. + + constexpr static carrier s_last_bit_mask = 0x8000000000000000ULL; + constexpr static carrier s_beforelast_bit_mask = 0x4000000000000000ULL; + + constexpr static carrier s_limited_bits_mask = s_last_bit_mask | s_beforelast_bit_mask; + + constexpr static carrier s_unused_mask = 0x3E00000000000000ULL; + //We actually have five spare bits! + //Not enough to store number of neighbours, though... + //(Maybe it'll be useful for other limited neighbours + // besides HEICW and FCAL?) + + constexpr static carrier s_only_numbers_mask = ~(s_limited_bits_mask | s_unused_mask); + + static_assert( s_more_bits_begin * s_bits_per_offset + + (s_numbers_to_keep - s_more_bits_begin) * s_bits_per_last_offset + + 2 < sizeof(carrier) * CHAR_BIT, "All the offsets must fit within the carrier!" ); + //The first offset is 0, by definition! + //We also need the last two bits free to mark the cells to be limited to nextInSamp + //according to the restrict(...) options. + + public: + + constexpr operator carrier () const + { + return value; + } + + constexpr NeighOffsets (const carrier v): value(v) + { + } + + constexpr NeighOffsets & operator = (const carrier v) + { + value = v; + return (*this); + } + + constexpr int get_number(const int i) const + { + carrier ret = value & s_only_numbers_mask; + if (i >= s_more_bits_begin) + { + ret = ret >> (s_bits_per_offset * s_more_bits_begin); + ret = ret >> (s_bits_per_last_offset * (i - s_more_bits_begin)); + ret &= s_offset_mask_last; + } + else + { + ret = ret >> (s_bits_per_offset * i); + ret &= s_offset_mask; + } + return (uint32_t) ret; + } + + constexpr int get_start_cell (const int option) const + { + if (option == 0) + { + return 0; + } + return get_number(option - 1); + } + + /*! To clarify, this cell no longer corresponds to the option, + so it's one past the end (like the end iterator of a C++ container)... + Except in the case of the last option + (corresponding to @c LArNeighbours::nextSuperCalo), + which simply returns the maximum possible number of neighbours + (so one should check @c NeighArr::total_number instead). + + */ + constexpr int get_end_cell (const int option) const + { + if (option >= NumNeighOptions - 1) + { + return NMaxNeighbours; + } + return get_number(option); + } + + constexpr int get_num_cells (const int option) const + { + return this->get_end_cell(option) - this->get_start_cell(option); + } + + /*! Returns, for each @p i, what must be added to the offset + to increase the stores numbers appropriately when a cell + belonging to option @c (i-1) is added. + + In other words, the neighbour counts starting from option @p i are incremented. + */ + static constexpr carrier offset_delta(const int i) + { + carrier mask = 0xFFFFFFFFFFFFFFFFULL; + if (i >= s_more_bits_begin) + { + mask = mask << (s_bits_per_offset * s_more_bits_begin); + mask = mask << (s_bits_per_last_offset * (i - s_more_bits_begin)); + } + else + { + mask = mask << (s_bits_per_offset * i); + } + mask &= s_only_numbers_mask; + return s_offset_delta_pattern & mask; + } + + constexpr bool is_limited(const bool limit_HECIWandFCal, const bool limit_PS) const + { + return value & ((s_last_bit_mask * limit_HECIWandFCal) | (s_beforelast_bit_mask * limit_PS)); + } + + constexpr bool is_limited_HECIWandFCal() const + { + return value & s_last_bit_mask; + } + + constexpr bool is_limited_PS() const + { + return value & s_beforelast_bit_mask; + } + + constexpr bool is_limited_any() const + { + return value & s_limited_bits_mask; + } + + constexpr void set_limited(const bool limited_one = true, const bool limited_two = true) + { + value = (value & (~s_limited_bits_mask)) | (limited_one * s_last_bit_mask) | (limited_two * s_beforelast_bit_mask); + } + + static constexpr carrier limited_HECIWandFCal_bitmask() + { + return s_last_bit_mask; + } + + static constexpr carrier limited_PS_bitmask() + { + return s_beforelast_bit_mask; + } + + static constexpr carrier limited_both_bitmask() + { + return s_limited_bits_mask; + } + }; + + struct NeighArr + { + int total_number[NCaloCells]; + NeighOffsets::carrier offsets[NCaloCells]; + int cells[NMaxNeighbours][NCaloCells]; + //This is more efficient for the GPU + //as long as the threads are accessing + //the same neighbour of the cell in parallel. + //It's slightly worse if we add the neighbour options in the mix... + + constexpr bool has_limited_neighbours(const int cell, const bool limited_HECIWandFCal, const bool limited_PS) const + { + const NeighOffsets neigh_off = offsets[cell]; + return neigh_off.is_limited(limited_HECIWandFCal, limited_PS); + } + + constexpr bool has_limited_HECIWandFCal_neighbours(const int cell) const + { + const NeighOffsets neigh_off = offsets[cell]; + return neigh_off.is_limited_HECIWandFCal(); + } + + constexpr bool has_limited_PS_neighbours(const int cell) const + { + const NeighOffsets neigh_off = offsets[cell]; + return neigh_off.is_limited_PS(); + } + + constexpr bool has_limited_neighbours_any(const int cell) const + { + const NeighOffsets neigh_off = offsets[cell]; + return neigh_off.is_limited_any(); + } + + private: + + constexpr static int s_next_in_samp_option = 6; + constexpr static unsigned int s_next_in_samp_bit_mask = 0x00000040U; + + public: + + /*! + * If \p limit is `true`, limits the neighbours to `nextInSamp`, as is done + * with certain options to some cells in the CPU cluster growing and splitting. + */ + constexpr int get_number_of_neighbours(const int cell, const bool limit_HECIWandFCal = false, const bool limit_PS = false) const + { + const NeighOffsets neigh_off = offsets[cell]; + if (neigh_off.is_limited(limit_HECIWandFCal, limit_PS)) + { + return neigh_off.get_num_cells(s_next_in_samp_option); + } + else + { + return total_number[cell]; + } + } + + + /*! Just for semantic clarity since the neighbours are reversed. + * If \p limit is `true`, limits the neighbours to `nextInSamp`, as is done + * with certain options to some cells in the CPU cluster growing and splitting. + * + */ + constexpr int get_neighbour(const int cell, const int neigh_number, const bool limit_HECIWandFCal = false, const bool limit_PS = false) const + { + const NeighOffsets neigh_off = offsets[cell]; + if (neigh_off.is_limited(limit_HECIWandFCal, limit_PS)) + { + return cells[neigh_number + neigh_off.get_start_cell(s_next_in_samp_option)][cell]; + } + else + { + return cells[neigh_number][cell]; + } + } + + /*! Just for semantic clarity since the neighbours are reversed. + * + */ + constexpr int set_neighbour(const int cell, const int neigh_number, const int neigh_v) + { + return cells[neigh_number][cell] = neigh_v; + } + + /*! Places the neighbours in the array and returns the number of neighbours. + * If \p limit is `true`, limits the neighbours to `nextInSamp`, as is done + * with certain options to some cells in the CPU cluster growing and splitting. + * + * We're using C arrays for more immediate CUDA compatibility. + */ + constexpr int get_neighbours(const int cell, int * neigh_arr, const bool limit_HECIWandFCal = false, const bool limit_PS = false) const + { + const NeighOffsets neigh_off = offsets[cell]; + if (neigh_off.is_limited(limit_HECIWandFCal, limit_PS)) + { + const int start = neigh_off.get_start_cell(s_next_in_samp_option); + const int end = neigh_off.get_end_cell(s_next_in_samp_option); + const int num_neighs = end - start; + for (int i = start; i < end; ++i) + { + neigh_arr[i - start] = cells[i][cell]; + } + return num_neighs; + } + //We don't do this by default + //because the splitter doesn't exclude + //the cells when finding local maxima... + else + { + const int num_neighs = total_number[cell]; + for (int i = 0; i < num_neighs; ++i) + { + neigh_arr[i] = cells[i][cell]; + } + return num_neighs; + } + } + + /*! Places the neighbours according to the option(s) in neigh_options in the array + * and returns the number of such neighbours (not the total number of neighbours of the cell). + * + * We're using C arrays for more immediate CUDA compatibility. + */ + constexpr int get_neighbours_with_option(const unsigned int neigh_options, const int cell, int * neigh_arr, + const bool limit_HECIWandFCal = false, const bool limit_PS = false ) const + { + int neigh = 0; + int limit = 0; + int neigh_arr_len = 0; + const int num_neighs = total_number[cell]; + + const NeighOffsets neigh_off = offsets[cell]; + + if (neigh_off.is_limited(limit_HECIWandFCal, limit_PS) && (neigh_options & s_next_in_samp_bit_mask)) + { + const int start = neigh_off.get_start_cell(s_next_in_samp_option); + const int end = neigh_off.get_end_cell(s_next_in_samp_option); + for (int i = start; i < end; ++i) + { + neigh_arr[i - start] = cells[i][cell]; + } + return end - start; + } + else + { + for (int i = 0; i < NumNeighOptions; ++i) + { + limit = neigh_off.get_end_cell(i); + if ( neigh_options & (1U << i) ) + { + for (; neigh < limit && neigh < num_neighs; ++neigh) + { + neigh_arr[neigh_arr_len] = cells[neigh][cell]; + ++neigh_arr_len; + } + } + neigh = limit; + } + } + return neigh_arr_len; + } + }; + + /// @class EtaPhiMapEntry + /// @brief Holds an (eta, phi) to cell map for a given sampling. + /// + /// @par eta_grid: number of subdivisions in eta (doubled for non-continuous) + /// + /// @par phi_grid: number of subdivisions in phi (doubled for non-continuous) + /// + /// @par respect_deltas: if @p true, the cells stretch only as far as their @p deta and @p dphi; + /// if @p false, always return closest cell. + /// + /// @par continuous: if @p true, the sampling provides continuous coverage for positive and negative etas. + /// if @p false, the sampling is separated between its positive and negative eta cells. + template <int eta_grid, int phi_grid, bool respect_deltas, bool continuous> + struct EtaPhiMapEntry; + + template <int eta_grid, int phi_grid, bool respect_deltas> + struct EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, true> + { + friend class EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, false>; + + static constexpr int s_max_overlap_cells = 10; + //We could/should try to refine things + //so we get only 8 overlapping cells at most, + //for more efficient memory transfers + //(32 bytes more natural than 40...). + + float eta_min; + float phi_min; + float eta_max; + float phi_max; + float delta_eta; + float delta_phi; + int cells [eta_grid][phi_grid][s_max_overlap_cells]; + float corner_eta [eta_grid][phi_grid][s_max_overlap_cells]; + float corner_phi [eta_grid][phi_grid][s_max_overlap_cells]; + //Corners in fractions of delta_eta/phi + //(Or center (eta, phi) of original cells, + //if respect_deltas == false) + + //If corner_{eta, phi}[h][f][n] > 0, + //then the cell ends at this fraction. + //If it < 0, it starts at this fraction. + + private: + + constexpr int eta_coordinate(const float eta) const + { + using namespace std; + return floorf((eta - eta_min) / delta_eta); + } + + ///Version that returns the floating point remainder too via the second argument. + constexpr int eta_coordinate(const float eta, float & interval) const + { + using namespace std; + const float frac = (eta - eta_min) / delta_eta; + const float rounded = floorf(frac); + interval = frac - rounded; + return rounded; + } + + constexpr int phi_coordinate(const float phi) const + { + using namespace std; + return floorf((phi - phi_min) / delta_phi); + } + + ///Version that returns the floating point remainder too via the second argument. + constexpr int phi_coordinate(const float phi, float & interval) const + { + using namespace std; + const float frac = (phi - phi_min) / delta_phi; + const float rounded = floorf(frac); + interval = frac - rounded; + return rounded; + } + + constexpr void add_cell_to_grid(const int cell, const float eta_corner, const float phi_corner, const int eta, const int phi) + { + for (int i = 0; i < s_max_overlap_cells; ++i) + { + if (cells[eta][phi][i] < 0) + { + cells [eta][phi][i] = cell; + corner_eta [eta][phi][i] = eta_corner; + corner_phi [eta][phi][i] = phi_corner; + return; + } + } + // /* + printf("Unable to store %d: %d %d %d %d (%d %d %d %d)\n", cell, + cells[eta][phi][0], cells[eta][phi][1], + cells[eta][phi][2], cells[eta][phi][3], + eta, eta_grid, phi, phi_grid ); + // */ + } + + constexpr void register_cell_with_deltas(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi) + { + int eta_coord_start = 0, eta_coord_end = 0, phi_coord_start = 0, phi_coord_end = 0; + int phi_coord_extra_neg = 0, phi_coord_extra_pos = 0; + float eta_fraction_start = 0.f, eta_fraction_end = 0.f, phi_fraction_start = 0.f, phi_fraction_end = 0.f; + float phi_fraction_extra_neg = 0.f, phi_fraction_extra_pos = 0.f; + + eta_coord_start = eta_coordinate(cell_eta - cell_deta / 2, eta_fraction_start); + eta_coord_end = eta_coordinate(cell_eta + cell_deta / 2, eta_fraction_end); + phi_coord_start = phi_coordinate(cell_phi - cell_dphi / 2, phi_fraction_start); + phi_coord_end = phi_coordinate(cell_phi + cell_dphi / 2, phi_fraction_end); + + phi_coord_extra_neg = phi_coordinate(cell_phi + cell_dphi / 2 - 2 * Helpers::Constants::pi<float>, phi_fraction_extra_neg); + phi_coord_extra_pos = phi_coordinate(cell_phi - cell_dphi / 2 + 2 * Helpers::Constants::pi<float>, phi_fraction_extra_pos); + + if ((eta_coord_end == eta_coord_start && (eta_fraction_start > 0 || eta_fraction_end < 1)) || + (phi_coord_end == phi_coord_start && (phi_fraction_start > 0 || phi_fraction_end < 1)) ) + { + // /* + printf("Something strange going on with cell %d: %f %f %f %f %f %f (%d %d %f %f | %d %d %f %f)\n", + cell, cell_eta, cell_deta, delta_eta, cell_phi, cell_dphi, delta_phi, + eta_coord_start, eta_coord_end, eta_fraction_start, eta_fraction_end, + phi_coord_start, phi_coord_end, phi_fraction_start, phi_fraction_end); + // */ + return; + } + + if (eta_coord_start < 0 || eta_coord_end < 0 || phi_coord_start < 0 || phi_coord_end < 0 || + eta_fraction_start < 0 || eta_fraction_end < 0 || phi_fraction_start < 0 || phi_fraction_end < 0) + { + // /* + printf("Underflowing cell %d: %f %f %f %f %f %f (%d %d %f %f | %d %d %f %f) [%f %f]\n", + cell, cell_eta, cell_deta, cell_eta - cell_deta / 2, cell_phi, cell_dphi, cell_phi - cell_dphi / 2, + eta_coord_start, eta_coord_end, eta_fraction_start, eta_fraction_end, + phi_coord_start, phi_coord_end, phi_fraction_start, phi_fraction_end, + eta_min, phi_min); + // */ + return; + } + + if (eta_coord_start >= eta_grid || eta_coord_end >= eta_grid || phi_coord_start >= phi_grid || phi_coord_end >= phi_grid || + eta_fraction_start > 1 || eta_fraction_end > 1 || phi_fraction_start > 1 || phi_fraction_end > 1) + { + // /* + printf("Overflowing cell %d: %f %f %f %f %f %f (%d %d %f %f | %d %d %f %f) [%f %f]\n", + cell, cell_eta, cell_deta, cell_eta + cell_deta / 2, cell_phi, cell_dphi, cell_phi + cell_dphi / 2, + eta_coord_start, eta_coord_end, eta_fraction_start, eta_fraction_end, + phi_coord_start, phi_coord_end, phi_fraction_start, phi_fraction_end, + eta_min, phi_min); + // */ + return; + } + + for (int eta_c = eta_coord_start; eta_c <= eta_coord_end; ++eta_c) + { + const float eta_corner = ( eta_c == eta_coord_start ? + -eta_fraction_start : ( eta_c == eta_coord_end ? + eta_fraction_end : 0.f ) + ); + for (int phi_c = 0; phi_c <= phi_coord_extra_neg; ++phi_c) + { + const float phi_corner = ( phi_c == phi_coord_extra_neg ? + phi_fraction_extra_neg : 0.f ); + + add_cell_to_grid(cell, eta_corner, phi_corner, eta_c, phi_c); + + } + for (int phi_c = phi_coord_start; phi_c <= phi_coord_end; ++phi_c) + { + const float phi_corner = ( phi_c == phi_coord_start ? + -phi_fraction_start : ( phi_c == phi_coord_end ? + phi_fraction_end : 0.f ) + ); + add_cell_to_grid(cell, eta_corner, phi_corner, eta_c, phi_c); + } + for (int phi_c = phi_coord_extra_pos; phi_c < phi_grid; ++phi_c) + { + const float phi_corner = ( phi_c == phi_coord_extra_pos ? + -phi_fraction_extra_pos : 0.f ); + add_cell_to_grid(cell, eta_corner, phi_corner, eta_c, phi_c); + } + } + } + + constexpr void register_cell_center(const int cell, const float cell_eta, const float cell_phi) + { + const int eta_coord = eta_coordinate(cell_eta); + const int phi_coord = phi_coordinate(cell_phi); + + if (eta_coord < 0 || eta_coord >= eta_grid || phi_coord < 0 || phi_coord >= phi_grid) + { + // /* + printf("Out of bounds cell: %d | %f %d %f %f %d | %f %d %f %f %d\n", cell, + cell_eta, eta_coord, eta_min, eta_max, eta_grid, + cell_phi, phi_coord, phi_min, phi_max, phi_grid ); + // */ + return; + } + + add_cell_to_grid(cell, cell_eta, cell_phi, eta_coord, phi_coord); + } + + + constexpr void initialize(const float min_eta, const float min_phi, + const float max_eta, const float max_phi, + const float deta, const float dphi) + { + for (int i = 0; i < eta_grid; ++i) + { + for (int j = 0; j < phi_grid; ++j) + { + for (int k = 0; k < s_max_overlap_cells; ++k) + { + cells[i][j][k] = -1; + } + } + } + eta_min = min_eta; + phi_min = min_phi; + eta_max = max_eta; + phi_max = max_phi; + delta_eta = deta; + delta_phi = dphi; + } + + public: + + + constexpr void register_cell(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi) + { + if (respect_deltas) + //If we could be sure of C++17 compatibility, + //this would be a constexpr if... + { + register_cell_with_deltas(cell, cell_eta, cell_phi, cell_deta, cell_dphi); + } + else + { + register_cell_center(cell, cell_eta, cell_phi); + } + } + + constexpr void initialize() + { + initialize(0, 0, 0, 0, 0, 0); + } + + constexpr void initialize(const float min_eta_neg, const float min_phi_neg, + const float /*max_eta_neg*/, const float /*max_phi_neg*/, + const float /*min_eta_pos*/, const float /*min_phi_pos*/, + const float max_eta_pos, const float max_phi_pos, + const float deta, const float dphi) + { + initialize(min_eta_neg, min_phi_neg, max_eta_pos, max_phi_pos, deta, dphi); + } + + constexpr static size_t finish_initializing_buffer_size() + { + return eta_grid * phi_grid * s_max_overlap_cells * sizeof(int); + } + + ///! @par buffer is casted to a sufficiently large array (minimum size given by @p finish_initializing_buffer_size). + CUDA_HOS_DEV void finish_initializing(void * buffer) + { + if (!respect_deltas) + //If we could be sure of C++17 compatibility, + //this would be a constexpr if... + { + //This is O( N * M * (N + M) ) for a N * M grid, + //but gives us reasonable results. + //And, since this is just an initialization step, + //not too serious. Still, we could optimize it further... + //(Or do it on the GPU. Really. + //Because it ends up being quite cellular automaton-y.) + // + //Of course the proper way to do this would be to build + //a Voronoi diagram based on the cell positions + //and then discretize it in the grid (overlapping where needed), + //but the complexity versus performance gains trade-off + //in this case favours keeping this simpler version. + + int (*casted)[eta_grid][phi_grid][s_max_overlap_cells] = (int (*)[eta_grid][phi_grid][s_max_overlap_cells]) buffer; + + int (&cell_arr_dest)[eta_grid][phi_grid][s_max_overlap_cells] = *casted; + + using namespace std; + + memcpy(&(cell_arr_dest[0][0][0]), &(cells[0][0][0]), finish_initializing_buffer_size()); + + bool keep_going = true; + + bool second_phase = false; + //The first phase grows out the clusters, + //I mean, the elements of the grid that are + //closest to a cell and stops when they intersect. + //The second phase grows out those who do intersect + //to empty elements, to handle the cases where an element + //is all surrounded by intersections... + + + auto propagate_cell = [&](const int eta_c, const int phi_c, const int input_cell, + const float input_eta, const float input_phi, const bool only_empty ) + { + if (only_empty && cells[eta_c][phi_c][0] >= 0) + { + return; + } + int to_add_index = 0; + for (; to_add_index < s_max_overlap_cells; ++to_add_index) + { + if (cell_arr_dest[eta_c][phi_c][to_add_index] == input_cell) + { + return; + } + else if (cell_arr_dest[eta_c][phi_c][to_add_index] < 0) + { + break; + } + } + if (to_add_index == s_max_overlap_cells) + { + // /* + printf("Unable to store %d: %d %d %d %d (%d %d %d %d)\n", input_cell, + cell_arr_dest[eta_c][phi_c][0], cell_arr_dest[eta_c][phi_c][1], + cell_arr_dest[eta_c][phi_c][2], cell_arr_dest[eta_c][phi_c][3], + eta_c, eta_grid, phi_c, phi_grid ); + // */ + return; + } + + cell_arr_dest [eta_c][phi_c][to_add_index] = input_cell; + corner_eta [eta_c][phi_c][to_add_index] = input_eta; + corner_phi [eta_c][phi_c][to_add_index] = input_phi; + + keep_going = true; + }; + + auto process_cell = [&](const int eta_c, const int phi_c, const int cell_index, const bool only_empty) + { + const int this_cell = cells [eta_c][phi_c][cell_index]; + const float this_eta = corner_eta [eta_c][phi_c][cell_index]; + const float this_phi = corner_phi [eta_c][phi_c][cell_index]; + + for (int delta_eta = -1; delta_eta <= 1; ++delta_eta) + { + const int target_eta_c = eta_c + delta_eta; + if (target_eta_c < 0 || target_eta_c >= eta_grid) + { + continue; + } + for (int delta_phi = -1; delta_phi <= 1; ++delta_phi) + { + int target_phi_c = phi_c + delta_phi; + if (target_phi_c < 0) + { + target_phi_c = phi_coordinate(phi_min + delta_phi * target_phi_c + 2 * Helpers::Constants::pi<float>); + if (target_phi_c < 0 || target_phi_c >= phi_grid) + { + continue; + } + } + else if (target_phi_c >= phi_grid) + { + target_phi_c = phi_coordinate(phi_min + delta_phi * target_phi_c - 2 * Helpers::Constants::pi<float>); + if (target_phi_c < 0 || target_phi_c >= phi_grid) + { + continue; + } + } + propagate_cell(target_eta_c, target_phi_c, this_cell, this_eta, this_phi, only_empty); + } + } + }; + + while (keep_going) + { + keep_going = false; + for (int eta_c = 0; eta_c < eta_grid; ++eta_c) + { + for (int phi_c = 0; phi_c < phi_grid; ++phi_c) + { + const auto & this_square_cells = cells[eta_c][phi_c]; + if (!second_phase) + { + if (this_square_cells[0] >= 0 && this_square_cells[1] < 0) + { + process_cell(eta_c, phi_c, 0, false); + } + } + else + { + for (int cell_index = 0; cell_index < s_max_overlap_cells; ++cell_index) + { + if (this_square_cells[cell_index] < 0) + { + break; + } + process_cell(eta_c, phi_c, cell_index, true); + } + } + } + } + memcpy(&(cells[0][0][0]), &(cell_arr_dest[0][0][0]), finish_initializing_buffer_size()); + if (!keep_going && !second_phase) + { + second_phase = true; + keep_going = true; + } + } + } + else + { + //Do nothing: when respecting deltas, + //cells get properly initialized outright... + } + } + + ///We assume @p cell_arr is large enough. + constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int * cell_arr) const + { + int num_cells = 0; + + float frac_eta = 0.f, frac_phi = 0.f; + + const int eta_coord = eta_coordinate(test_eta, frac_eta); + const int phi_coord = phi_coordinate(test_phi, frac_phi); + + if ( test_eta < eta_min || test_eta > eta_max || + test_phi < phi_min || test_phi > phi_max || + eta_coord < 0 || eta_coord >= eta_grid || + phi_coord < 0 || phi_coord >= phi_grid ) + { + /* + printf("OOB: %f %d %f %f %d | %f %d %f %f %d\n", + test_eta, eta_coord, eta_min, eta_max, eta_grid, + test_phi, phi_coord, phi_min, phi_max, phi_grid); + // */ + return 0; + } + + if (respect_deltas) + //If we could be sure of C++17 compatibility, + //this would be a constexpr if... + { + auto check_coord = [](const float test, const float target) + { + using namespace std; + if (target > 0 && fabsf(test) <= fabsf(target)) + { + return true; + } + else if (target < 0 && fabsf(test) >= fabsf(target)) + { + return true; + } + else if (target == 0) + { + return true; + } + else + { + return false; + } + }; + + for (int i = 0; i < s_max_overlap_cells; ++i) + { + if (cells[eta_coord][phi_coord][i] < 0) + { + break; + } + if ( check_coord(frac_eta, corner_eta[eta_coord][phi_coord][i]) && + check_coord(frac_phi, corner_phi[eta_coord][phi_coord][i]) ) + { + cell_arr[num_cells] = cells[eta_coord][phi_coord][i]; + ++num_cells; + } + } + } + else + { + float distance = 1e38f; + int ret = -1; + + for (int i = 0; i < s_max_overlap_cells; ++i) + { + const int this_cell = cells[eta_coord][phi_coord][i]; + if (this_cell < 0) + { + break; + } + const float delta_eta = corner_eta[eta_coord][phi_coord][i] - test_eta; + const float delta_phi = Helpers::angular_difference(corner_phi[eta_coord][phi_coord][i], test_phi); + //If respect_deltas == false, + //corner_coords are actually + //the center (eta, phi) of the cell. + const float this_dist = delta_eta * delta_eta + delta_phi * delta_phi; + + if (this_dist < distance || (this_dist == distance && this_cell > ret)) + { + distance = this_dist; + ret = this_cell; + } + } + + if (ret > 0) + { + cell_arr[0] = ret; + num_cells = 1; + } + } + + return num_cells; + } + + constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const + { + float frac_eta = 0.f, frac_phi = 0.f; + + const int eta_coord = eta_coordinate(test_eta, frac_eta); + const int phi_coord = phi_coordinate(test_phi, frac_phi); + + if ( test_eta < eta_min || test_eta > eta_max || + test_phi < phi_min || test_phi > phi_max || + eta_coord < 0 || eta_coord >= eta_grid || + phi_coord < 0 || phi_coord >= phi_grid ) + { + return false; + } + + if (respect_deltas) + //If we could be sure of C++17 compatibility, + //this would be a constexpr if... + { + auto check_coord = [](const float test, const float target) + { + using namespace std; + if (fabsf(test) >= fabs(target) && target < 0) + { + return true; + } + else if (fabs(test) <= fabs(target) && target > 0) + { + return true; + } + else if (target == 0) + { + return true; + } + else + { + return false; + } + }; + + for (int i = 0; i < s_max_overlap_cells; ++i) + { + if (cells[eta_coord][phi_coord][i] < 0) + { + break; + } + if ( check_coord(frac_eta, corner_eta[eta_coord][phi_coord][i]) && + check_coord(frac_phi, corner_phi[eta_coord][phi_coord][i]) ) + { + return true; + } + } + return false; + } + else + { + return true; + //Except for being out-of-bounds, + //if respect_deltas == false + //we can always find a closest cell + //for each coordinate. + } + } + + }; + + template <int eta_grid, int phi_grid, bool respect_deltas> + struct EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, false> + { + EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, true> pos, neg; + + static constexpr int s_max_overlap_cells = EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, true>::s_max_overlap_cells; + + constexpr void register_cell(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi) + { + if (cell_eta >= 0) + { + pos.register_cell(cell, cell_eta, cell_phi, cell_deta, cell_dphi); + } + else + { + neg.register_cell(cell, cell_eta, cell_phi, cell_deta, cell_dphi); + } + } + + constexpr void initialize(const float min_eta_neg, const float min_phi_neg, + const float max_eta_neg, const float max_phi_neg, + const float min_eta_pos, const float min_phi_pos, + const float max_eta_pos, const float max_phi_pos, + const float deta, const float dphi) + { + pos.initialize(min_eta_pos, min_phi_pos, max_eta_pos, max_phi_pos, deta, dphi); + neg.initialize(min_eta_neg, min_phi_neg, max_eta_neg, max_phi_neg, deta, dphi); + } + + constexpr void initialize() + { + pos.initialize(); + neg.initialize(); + } + + constexpr static size_t finish_initializing_buffer_size() + { + return EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, true>::finish_initializing_buffer_size(); + } + + ///! @par buffer is casted to a sufficiently large array (minimum size given by @p finish_initializing_buffer_size). + CUDA_HOS_DEV void finish_initializing(void * buffer) + { + pos.finish_initializing(buffer); + neg.finish_initializing(buffer); + } + + ///We assume @p cell_arr is large enough. + constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int * cell_arr) const + { + int ret = -1; + if (test_eta >= 0) + { + ret = pos.get_possible_cells_from_coords(test_eta, test_phi, cell_arr); + } + else + { + ret = neg.get_possible_cells_from_coords(test_eta, test_phi, cell_arr); + } + return ret; + } + + constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const + { + if (test_eta >= 0) + { + return pos.has_cell_in_coords(test_eta, test_phi); + } + else + { + return neg.has_cell_in_coords(test_eta, test_phi); + } + } + + }; + + struct EtaPhiToCellMap + { + static constexpr int s_max_overlap_cells = EtaPhiMapEntry<1, 1, true, true>::s_max_overlap_cells; + + //Samplings have custom, hard-coded sizes to save space. + //Could've gone with one-size-fits all maxima, + //but it'd likely be unnecessarily wasteful. + EtaPhiMapEntry<125, 65, false, true> sampling_0; + EtaPhiMapEntry<955, 260, false, true> sampling_1; + EtaPhiMapEntry<121, 260, false, true> sampling_2; + EtaPhiMapEntry< 56, 260, false, true> sampling_3; + EtaPhiMapEntry< 14, 68, false, false> sampling_4; + EtaPhiMapEntry<362, 68, false, false> sampling_5; + EtaPhiMapEntry< 74, 260, false, false> sampling_6; + EtaPhiMapEntry< 36, 260, false, false> sampling_7; + EtaPhiMapEntry< 20, 66, false, false> sampling_8; + EtaPhiMapEntry< 18, 66, false, false> sampling_9; + EtaPhiMapEntry< 16, 66, false, false> sampling_10; + EtaPhiMapEntry< 18, 66, false, false> sampling_11; + EtaPhiMapEntry< 12, 66, true, false> sampling_12; + EtaPhiMapEntry< 12, 66, true, false> sampling_13; + EtaPhiMapEntry< 5, 66, true, false> sampling_14; + EtaPhiMapEntry< 2, 66, true, false> sampling_15; + EtaPhiMapEntry< 2, 66, true, false> sampling_16; + EtaPhiMapEntry< 8, 66, true, false> sampling_17; + EtaPhiMapEntry< 6, 66, true, false> sampling_18; + EtaPhiMapEntry< 6, 66, true, false> sampling_19; + EtaPhiMapEntry< 4, 66, true, false> sampling_20; + EtaPhiMapEntry<142, 228, false, false> sampling_21; + EtaPhiMapEntry< 96, 162, false, false> sampling_22; + EtaPhiMapEntry< 32, 128, false, false> sampling_23; + EtaPhiMapEntry< 1, 1, false, true> sampling_24; + EtaPhiMapEntry< 1, 1, false, true> sampling_25; + EtaPhiMapEntry< 1, 1, false, true> sampling_26; + EtaPhiMapEntry< 1, 1, false, true> sampling_27; + + static_assert(NumSamplings == 28, "Written under the assumption there are 28 samplings."); + + ///@p F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments. + template <class Func, class ... Args> + constexpr void apply_to_all_samplings(Func && F, Args && ... args) + { + F(sampling_0, std::forward<Args>(args)...); + F(sampling_1, std::forward<Args>(args)...); + F(sampling_2, std::forward<Args>(args)...); + F(sampling_3, std::forward<Args>(args)...); + F(sampling_4, std::forward<Args>(args)...); + F(sampling_5, std::forward<Args>(args)...); + F(sampling_6, std::forward<Args>(args)...); + F(sampling_7, std::forward<Args>(args)...); + F(sampling_8, std::forward<Args>(args)...); + F(sampling_9, std::forward<Args>(args)...); + F(sampling_10, std::forward<Args>(args)...); + F(sampling_11, std::forward<Args>(args)...); + F(sampling_12, std::forward<Args>(args)...); + F(sampling_13, std::forward<Args>(args)...); + F(sampling_14, std::forward<Args>(args)...); + F(sampling_15, std::forward<Args>(args)...); + F(sampling_16, std::forward<Args>(args)...); + F(sampling_17, std::forward<Args>(args)...); + F(sampling_18, std::forward<Args>(args)...); + F(sampling_19, std::forward<Args>(args)...); + F(sampling_20, std::forward<Args>(args)...); + F(sampling_21, std::forward<Args>(args)...); + F(sampling_22, std::forward<Args>(args)...); + F(sampling_23, std::forward<Args>(args)...); + F(sampling_24, std::forward<Args>(args)...); + F(sampling_25, std::forward<Args>(args)...); + F(sampling_26, std::forward<Args>(args)...); + F(sampling_27, std::forward<Args>(args)...); + } + + ///@p F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments. + template <class Func, class ... Args> + constexpr void apply_to_all_samplings(Func && F, Args && ... args) const + { + F(sampling_0, std::forward<Args>(args)...); + F(sampling_1, std::forward<Args>(args)...); + F(sampling_2, std::forward<Args>(args)...); + F(sampling_3, std::forward<Args>(args)...); + F(sampling_4, std::forward<Args>(args)...); + F(sampling_5, std::forward<Args>(args)...); + F(sampling_6, std::forward<Args>(args)...); + F(sampling_7, std::forward<Args>(args)...); + F(sampling_8, std::forward<Args>(args)...); + F(sampling_9, std::forward<Args>(args)...); + F(sampling_10, std::forward<Args>(args)...); + F(sampling_11, std::forward<Args>(args)...); + F(sampling_12, std::forward<Args>(args)...); + F(sampling_13, std::forward<Args>(args)...); + F(sampling_14, std::forward<Args>(args)...); + F(sampling_15, std::forward<Args>(args)...); + F(sampling_16, std::forward<Args>(args)...); + F(sampling_17, std::forward<Args>(args)...); + F(sampling_18, std::forward<Args>(args)...); + F(sampling_19, std::forward<Args>(args)...); + F(sampling_20, std::forward<Args>(args)...); + F(sampling_21, std::forward<Args>(args)...); + F(sampling_22, std::forward<Args>(args)...); + F(sampling_23, std::forward<Args>(args)...); + F(sampling_24, std::forward<Args>(args)...); + F(sampling_25, std::forward<Args>(args)...); + F(sampling_26, std::forward<Args>(args)...); + F(sampling_27, std::forward<Args>(args)...); + } + + ///@p F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments. + template <class Func, class ... Args> + constexpr void apply_to_sampling(const int sampling, Func && F, Args && ... args) + { + switch (sampling) + { + case 0: + F(sampling_0, std::forward<Args>(args)...); + break; + case 1: + F(sampling_1, std::forward<Args>(args)...); + break; + case 2: + F(sampling_2, std::forward<Args>(args)...); + break; + case 3: + F(sampling_3, std::forward<Args>(args)...); + break; + case 4: + F(sampling_4, std::forward<Args>(args)...); + break; + case 5: + F(sampling_5, std::forward<Args>(args)...); + break; + case 6: + F(sampling_6, std::forward<Args>(args)...); + break; + case 7: + F(sampling_7, std::forward<Args>(args)...); + break; + case 8: + F(sampling_8, std::forward<Args>(args)...); + break; + case 9: + F(sampling_9, std::forward<Args>(args)...); + break; + case 10: + F(sampling_10, std::forward<Args>(args)...); + break; + case 11: + F(sampling_11, std::forward<Args>(args)...); + break; + case 12: + F(sampling_12, std::forward<Args>(args)...); + break; + case 13: + F(sampling_13, std::forward<Args>(args)...); + break; + case 14: + F(sampling_14, std::forward<Args>(args)...); + break; + case 15: + F(sampling_15, std::forward<Args>(args)...); + break; + case 16: + F(sampling_16, std::forward<Args>(args)...); + break; + case 17: + F(sampling_17, std::forward<Args>(args)...); + break; + case 18: + F(sampling_18, std::forward<Args>(args)...); + break; + case 19: + F(sampling_19, std::forward<Args>(args)...); + break; + case 20: + F(sampling_20, std::forward<Args>(args)...); + break; + case 21: + F(sampling_21, std::forward<Args>(args)...); + break; + case 22: + F(sampling_22, std::forward<Args>(args)...); + break; + case 23: + F(sampling_23, std::forward<Args>(args)...); + break; + case 24: + F(sampling_24, std::forward<Args>(args)...); + break; + case 25: + F(sampling_25, std::forward<Args>(args)...); + break; + case 26: + F(sampling_26, std::forward<Args>(args)...); + break; + case 27: + F(sampling_27, std::forward<Args>(args)...); + break; + default: + break; + } + } + + ///@p F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments. + template <class Func, class ... Args> + constexpr void apply_to_sampling(const int sampling, Func && F, Args && ... args) const + { + switch (sampling) + { + case 0: + F(sampling_0, std::forward<Args>(args)...); + break; + case 1: + F(sampling_1, std::forward<Args>(args)...); + break; + case 2: + F(sampling_2, std::forward<Args>(args)...); + break; + case 3: + F(sampling_3, std::forward<Args>(args)...); + break; + case 4: + F(sampling_4, std::forward<Args>(args)...); + break; + case 5: + F(sampling_5, std::forward<Args>(args)...); + break; + case 6: + F(sampling_6, std::forward<Args>(args)...); + break; + case 7: + F(sampling_7, std::forward<Args>(args)...); + break; + case 8: + F(sampling_8, std::forward<Args>(args)...); + break; + case 9: + F(sampling_9, std::forward<Args>(args)...); + break; + case 10: + F(sampling_10, std::forward<Args>(args)...); + break; + case 11: + F(sampling_11, std::forward<Args>(args)...); + break; + case 12: + F(sampling_12, std::forward<Args>(args)...); + break; + case 13: + F(sampling_13, std::forward<Args>(args)...); + break; + case 14: + F(sampling_14, std::forward<Args>(args)...); + break; + case 15: + F(sampling_15, std::forward<Args>(args)...); + break; + case 16: + F(sampling_16, std::forward<Args>(args)...); + break; + case 17: + F(sampling_17, std::forward<Args>(args)...); + break; + case 18: + F(sampling_18, std::forward<Args>(args)...); + break; + case 19: + F(sampling_19, std::forward<Args>(args)...); + break; + case 20: + F(sampling_20, std::forward<Args>(args)...); + break; + case 21: + F(sampling_21, std::forward<Args>(args)...); + break; + case 22: + F(sampling_22, std::forward<Args>(args)...); + break; + case 23: + F(sampling_23, std::forward<Args>(args)...); + break; + case 24: + F(sampling_24, std::forward<Args>(args)...); + break; + case 25: + F(sampling_25, std::forward<Args>(args)...); + break; + case 26: + F(sampling_26, std::forward<Args>(args)...); + break; + case 27: + F(sampling_27, std::forward<Args>(args)...); + break; + default: + break; + } + } + + private: + + //CUDA and lambdas is still a bit tricky, + //hence we'll use explicitly written functors + //to implement several things. + + struct initialize_all_functor + { + template <class Entry> + constexpr void operator() (Entry & entry) const + { + entry.initialize(); + } + }; + + struct initialize_sampling_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, + const float min_eta_neg, const float min_phi_neg, + const float max_eta_neg, const float max_phi_neg, + const float min_eta_pos, const float min_phi_pos, + const float max_eta_pos, const float max_phi_pos, + const float delta_eta, const float delta_phi ) const + { + entry.initialize(min_eta_neg, min_phi_neg, max_eta_neg, max_phi_neg, + min_eta_pos, min_phi_pos, max_eta_pos, max_phi_pos, + delta_eta, delta_phi ); + } + }; + + struct register_cell_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, const int cell, + const float cell_eta, const float cell_phi, + const float cell_deta, const float cell_dphi ) const + { + entry.register_cell(cell, cell_eta, cell_phi, cell_deta, cell_dphi); + } + }; + + struct buffer_size_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, size_t & ret) const + { + using namespace std; + ret = max(ret, entry.finish_initializing_buffer_size()); + } + }; + + struct finish_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, void * buffer) const + { + entry.finish_initializing(buffer); + } + }; + //Aliohjelma-olio? + //(To not go with the obvious funktio-olio...) + + struct get_cell_from_sampling_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, int & ret, const float test_eta, const float test_phi, int * cell_arr) const + { + ret = entry.get_possible_cells_from_coords(test_eta, test_phi, cell_arr); + } + }; + + struct check_cell_in_sampling_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, bool & ret, const float test_eta, const float test_phi) const + { + ret = entry.has_cell_in_coords(test_eta, test_phi); + } + }; + + struct get_cell_from_all_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, int & ret, const float test_eta, const float test_phi, int * cell_arr) const + { + ret += entry.get_possible_cells_from_coords(test_eta, test_phi, cell_arr + ret); + } + }; + + struct check_cell_in_all_functor + { + template <class Entry> + constexpr void operator() (Entry & entry, bool & ret, const float test_eta, const float test_phi) const + { + ret = ( ret || entry.has_cell_in_coords(test_eta, test_phi) ); + //Short circuit evaluation? + } + }; + + public: + + ///Initialize all cells of all samplings. + constexpr void initialize() + { + apply_to_all_samplings(initialize_all_functor{}); + } + + ///Initialize a specific sampling with known eta and phi ranges. + constexpr void initialize(const int sampling, + const float min_eta_neg, const float min_phi_neg, + const float max_eta_neg, const float max_phi_neg, + const float min_eta_pos, const float min_phi_pos, + const float max_eta_pos, const float max_phi_pos, + const float delta_eta, const float delta_phi) + { + apply_to_sampling(sampling, initialize_sampling_functor{}, + min_eta_neg, min_phi_neg, + max_eta_neg, max_phi_neg, + min_eta_pos, min_phi_pos, + max_eta_pos, max_phi_pos, + delta_eta, delta_phi ); + } + + constexpr void register_cell(const int cell, const int sampling, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi) + { + apply_to_sampling(sampling, register_cell_functor{}, cell, cell_eta, cell_phi, cell_deta, cell_dphi); + } + + + constexpr size_t finish_initializing_buffer_size() const + { + size_t ret = 0; + + apply_to_all_samplings(buffer_size_functor{}, ret); + + return ret; + } + + ///! @par buffer is casted to a sufficiently large array (mininum size given by @p finish_initializing_buffer_size). + CUDA_HOS_DEV void finish_initializing(void * buffer) + { + apply_to_all_samplings(finish_functor{}, buffer); + } + + ///We assume @p cell_arr is large enough. + constexpr int get_possible_cells_from_coords(const int sampling, const float test_eta, const float test_phi, int * cell_arr) const + { + int ret = 0; + + apply_to_sampling(sampling, get_cell_from_sampling_functor{}, ret, test_eta, test_phi, cell_arr); + + return ret; + } + + constexpr bool has_cell_in_coords(const int sampling, const float test_eta, const float test_phi) const + { + bool ret = false; + + apply_to_sampling(sampling, check_cell_in_sampling_functor{}, ret, test_eta, test_phi); + + return ret; + } + + ///We assume @p cell_arr is large enough. + constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int * cell_arr) const + { + int ret = 0; + + apply_to_all_samplings(get_cell_from_all_functor{}, ret, test_eta, test_phi, cell_arr); + + return ret; + } + + constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const + { + bool ret = false; + + apply_to_all_samplings(check_cell_in_all_functor{}, ret, test_eta, test_phi); + + return ret; + } + + }; + + struct GeometryArr + { + int caloSample[NCaloCells]; + float x[NCaloCells]; + float y[NCaloCells]; + float z[NCaloCells]; + float r[NCaloCells]; + float eta[NCaloCells]; + float phi[NCaloCells]; + + float dx[NCaloCells]; + float dy[NCaloCells]; + float dz[NCaloCells]; + float dr[NCaloCells]; + float deta[NCaloCells]; + float dphi[NCaloCells]; + + float volume[NCaloCells]; + + NeighArr neighbours; + //Cell A will appear in the neighbours of cell B if + //A appears in the result of the CPU get_neighbours of cell B... + + + EtaPhiToCellMap etaPhiToCell; + + constexpr static int s_tileStart = 182468; + constexpr static int s_tileEnd = NCaloCells; + //These values should be constant. + //If there are any changes to that... + //Well, we'll have to update them here. + //But it's not something that would change at run time. + + constexpr static bool is_tile (const int cell) + { + return cell >= s_tileStart && cell < s_tileEnd; + } + + CUDA_HOS_DEV void fill_eta_phi_map() + { + for (int i = 0; i < NCaloCells; ++i) + { + etaPhiToCell.register_cell(i, caloSample[i], eta[i], phi[i], deta[i], dphi[i]); + } + + struct DeAllocWrapper + { + int * buf; + CUDA_HOS_DEV DeAllocWrapper(const size_t new_size) + { + buf = new int[Helpers::int_ceil_div(new_size, sizeof(int))]; + } + CUDA_HOS_DEV ~DeAllocWrapper() + { + delete[] buf; + } + CUDA_HOS_DEV DeAllocWrapper (const DeAllocWrapper &) = delete; + CUDA_HOS_DEV DeAllocWrapper (DeAllocWrapper &&) = delete; + CUDA_HOS_DEV DeAllocWrapper & operator=(const DeAllocWrapper &) = delete; + CUDA_HOS_DEV DeAllocWrapper & operator=(DeAllocWrapper &&) = delete; + }; + //Simple allocation/de-allocation + //to still be GPU-compatible if needed + //(new and delete valid on GPU code...), + //while still preventing leaks, + //all without pulling in unique_ptr. + + DeAllocWrapper wrapper(etaPhiToCell.finish_initializing_buffer_size()); + + etaPhiToCell.finish_initializing(wrapper.buf); + + } + + constexpr int get_closest_cell(const int sampling, const float test_eta, const float test_phi) const + { + int cells[EtaPhiToCellMap::s_max_overlap_cells] = {}; + + const int n_cells = etaPhiToCell.get_possible_cells_from_coords(sampling, test_eta, test_phi, cells); + + if (n_cells < 1) + { + return -1; + } + else if (n_cells == 1) + { + return cells[0]; + } + else + { + float distance = 1e38f; + int ret = -1; + + for (int i = 0; i < n_cells; ++i) + { + const int this_cell = cells[i]; + + const float delta_eta = eta[this_cell] - test_eta; + const float delta_phi = Helpers::angular_difference(phi[this_cell], test_phi); + + const float this_dist = delta_eta * delta_eta + delta_phi * delta_phi; + if (this_dist < distance || (this_dist == distance && this_cell > ret)) + { + distance = this_dist; + ret = this_cell; + } + } + return ret; + } + } + }; + + struct CellNoiseArr + { + float noise[NumGainStates][NCaloCells]; + }; + +} + +#endif diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/DataHolders.h b/Calorimeter/CaloRecGPU/CaloRecGPU/DataHolders.h index cca6b207661db91a11bc299cef5acbcfb07c176a..ee71dc46ad57f524450182f5c88c9fc0e4a83c67 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/DataHolders.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/DataHolders.h @@ -1,55 +1,101 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// #ifndef CALORECGPU_DATAHOLDERS_H #define CALORECGPU_DATAHOLDERS_H -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "Helpers.h" +#include "CUDAFriendlyClasses.h" + +#define CALORECGPU_USE_PINNED_MEMORY 1 -class ConstantDataHolder +namespace CaloRecGPU { - public: - void sendToGPU(const bool clear_CPU = true); + class ConstantDataHolder + { + public: - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> m_geometry; + void sendToGPU(const bool clear_CPU = true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> m_cell_noise; + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> m_geometry; - CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::GeometryArr> m_geometry_dev; + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> m_cell_noise; - CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::CellNoiseArr> m_cell_noise_dev; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::GeometryArr> m_geometry_dev; -}; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::CellNoiseArr> m_cell_noise_dev; -class EventDataHolder -{ - public: + }; + + class EventDataHolder + { + public: + + void sendToGPU(const bool clear_CPU = false, + const bool has_state = false, + const bool has_clusters = false, + const bool has_pairs = false, + const bool has_moments = false); + + void returnToCPU(const bool clear_GPU = false, + const bool return_cells = true, + const bool return_clusters = true, + const bool return_moments = true); + + ///This function is asynchronous. + void returnCellsToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + ///This function is asynchronous. + void returnClustersToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + ///This function is asynchronous. + void returnMomentsToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + + ///This function is asynchronous. + void returnClusterNumberToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + + ///We assume the cluster number is already known + ///and thus only return `num_clusters` clusters. + ///This function is asynchronous. + void returnSomeClustersToCPU(const size_t num_clusters, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + + ///We assume the cluster number is already known + ///and thus only return `num_clusters` clusters. + ///This function is asynchronous. + void returnSomeMomentsToCPU(const size_t num_clusters, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + + void allocate(const bool also_GPU = true); + + void clear_GPU(); + +#if CALORECGPU_USE_PINNED_MEMORY + + CaloRecGPU::Helpers::CUDA_pinned_CPU_object<CaloRecGPU::CellInfoArr> m_cell_info; + CaloRecGPU::Helpers::CUDA_pinned_CPU_object<CaloRecGPU::CellStateArr> m_cell_state; + CaloRecGPU::Helpers::CUDA_pinned_CPU_object<CaloRecGPU::PairsArr> m_pairs; + CaloRecGPU::Helpers::CUDA_pinned_CPU_object<CaloRecGPU::ClusterInfoArr> m_clusters; + CaloRecGPU::Helpers::CUDA_pinned_CPU_object<CaloRecGPU::ClusterMomentsArr> m_moments; - void sendToGPU(const bool clear_CPU = false, - const bool has_state = false, - const bool has_clusters = false, - const bool has_pairs = false); - void returnToCPU(const bool clear_GPU = false, - const bool return_clusters = true); +#else - void allocate(const bool also_GPU = true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> m_cell_info; + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> m_cell_state; + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::PairsArr> m_pairs; + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> m_clusters; + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> m_moments; - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> m_cell_info; - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> m_cell_state; - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::PairsArr> m_pairs; - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> m_clusters; +#endif - CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::CellInfoArr> m_cell_info_dev; - CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::CellStateArr> m_cell_state_dev; - CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::PairsArr> m_pairs_dev; - CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::ClusterInfoArr> m_clusters_dev; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::CellInfoArr> m_cell_info_dev; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::CellStateArr> m_cell_state_dev; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::PairsArr> m_pairs_dev; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::ClusterInfoArr> m_clusters_dev; + CaloRecGPU::Helpers::CUDA_object<CaloRecGPU::ClusterMomentsArr> m_moments_dev; -}; + }; +} -#endif //CALORECGPU_DATAHOLDERS_H +#endif //CALORECGPU_DATAHOLDERS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/EventInfoDefinitions.h b/Calorimeter/CaloRecGPU/CaloRecGPU/EventInfoDefinitions.h new file mode 100644 index 0000000000000000000000000000000000000000..600a1a452caee61b786b7c0463293f9e7766e5b2 --- /dev/null +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/EventInfoDefinitions.h @@ -0,0 +1,406 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_EVENTINFODEFINITIONS_H +#define CALORECGPU_EVENTINFODEFINITIONS_H + +#include "BaseDefinitions.h" +#include "TagDefinitions.h" +#include "ConstantInfoDefinitions.h" + +#include <cstdint> +#include <cmath> +//For fabsf... + +namespace CaloRecGPU +{ + + /*! @class GainConversion + Provides utility functions to handle the gain conversion. + */ + class GainConversion + { + using GainType = unsigned int; + protected: + + constexpr static GainType s_TileLowLow = 0, + s_TileLowHigh = 1, + s_TileHighLow = 2, + s_TileHighHigh = 3; + + constexpr static GainType s_TileOneLow = 0, + s_TileOneHigh = 3; + //Are these valid/used? + + constexpr static GainType s_LArHigh = 0, + s_LArMedium = 1, + s_LArLow = 2; + + constexpr static GainType s_InvalidCell = 4; + + constexpr static GainType s_gain_values_minimum = 0; + constexpr static GainType s_gain_values_maximum = 4; + public: + + inline static constexpr GainType invalid_gain() + { + return s_InvalidCell; + } + + inline static constexpr GainType max_gain_value() + { + return s_gain_values_maximum; + } + + inline static constexpr GainType min_gain_value() + { + return s_gain_values_minimum; + } + + inline static constexpr GainType num_gain_values() + { + return max_gain_value() - min_gain_value() + 1; + } + + template <class T> + inline static constexpr bool is_valid(const T & gain) + { + return gain != s_InvalidCell; + } + + inline static constexpr GainType from_standard_gain(const int gain) + //Basically, CaloCondUtils::getDbCaloGain without the Athena logging. + { + switch (gain) + { + case -16: //Tile LOWLOW + return s_TileLowLow; + case -15: //Tile LOWHIGH + return s_TileLowHigh; + case -12: //Tile HIGHLOW + return s_TileHighLow; + case -11: //Tile HIGHHIGH + return s_TileHighHigh; + case -4 : //Tile ONELOW + return s_TileOneLow; + case -3 : //Tile ONEHIGH + return s_TileOneHigh; + case 0 : //LAr High + return s_LArHigh; + case 1 : //LAr Medium + return s_LArMedium; + case 2 : //Lar Low + return s_LArLow; + default: + return s_InvalidCell; + } + } + + }; + + /*! @class QualityProvenance + Just two uint16_t bit-packed onto a uint32_t. + + Not too worrisome for GPU performance since the kinds of things + that ask the most for quality and provenance (cluster moments calculation) + do ask for them both at the same time, so slower separate accesses + are a non-issue. + */ + struct QualityProvenance + { + using carrier = unsigned int; + + carrier value; + + constexpr static carrier s_16_bit_mask = 0xFFFFU; + constexpr static carrier s_8_bit_mask = 0x00FFU; + + public: + + constexpr operator carrier () const + { + return value; + } + + constexpr QualityProvenance (const carrier v): value(v) + { + } + + constexpr QualityProvenance & operator = (const carrier v) + { + value = v; + return (*this); + } + + constexpr unsigned int quality() const + { + return value & s_16_bit_mask; + } + + constexpr unsigned int provenance() const + { + return (value >> 16) & s_16_bit_mask; + } + + constexpr QualityProvenance(const uint16_t quality, const uint16_t provenance): value(provenance) + //For non-tile + { + value = (value << 16) | quality; + } + + constexpr QualityProvenance(const uint8_t q1, const uint8_t q2, const uint8_t q3, const uint8_t q4): + value(q4) + //For tile + { + value = (value << 8) | q3; + value = (value << 8) | q2; + value = (value << 8) | q1; + } + + constexpr unsigned int tile_qual1() const + { + return value & s_8_bit_mask; + } + + constexpr unsigned int tile_qual2() const + { + return (value >> 8) & s_8_bit_mask; + } + + constexpr unsigned int tile_qbit1() const + { + return (value >> 16) & s_8_bit_mask; + } + + constexpr unsigned int tile_qbit2() const + { + return (value >> 24) & s_8_bit_mask; + } + }; + + struct CellInfoArr + { + float energy[NCaloCells]; + unsigned char gain[NCaloCells]; + float time[NCaloCells]; + QualityProvenance::carrier qualityProvenance[NCaloCells]; + //We could use/type pun a short2, + //but let's go for portability for the time being... + + static constexpr bool is_bad(const bool is_tile, const QualityProvenance qp, const bool treat_L1_predicted_as_good = false) + { + bool ret = false; + + if (is_tile) + { + + const unsigned int mask = 0x08U; + + ret = (qp.tile_qbit1() & mask) && (qp.tile_qbit2() & mask); + //From TileCell::badcell() + //badch1() && badch2() + //badch1() -> m_tileQual[2]&TileCell::MASK_BADCH + //badch2() -> m_tileQual[3]&TileCell::MASK_BADCH + // + //TileCell::MASK_BADCH= 0x08 + // + //From CaloCell: + //union { + // int m_quality ; + // uint16_t m_qualProv[2]; + // uint8_t m_tileQual[4]; + //}; + //quality returns m_qualProv[0] + //provenance returns m_qualProv[1] + //These are used to build our QualityProvenance... + // + //It's packing and unpacking back and forth, how fun! + } + else + { + const unsigned int provenance = qp.provenance(); + ret = provenance & 0x0800U; + //As in LArCell::badcell() + + if (treat_L1_predicted_as_good && (provenance & 0x0200U)) + //As in CaloBadCellHelper::isBad + { + ret = false; + } + } + return ret; + } + + /*! GPU version of @c CaloBadCellHelper::isBad. If @p treat_L1_predicted_as_good is false, + has the same effect as cell->badcell() (just like @c CaloBadCellHelper::isBad). + */ + constexpr bool is_bad(const GeometryArr & geom, const int cell, const bool treat_L1_predicted_as_good = false) const + { + return is_bad(geom.is_tile(cell), qualityProvenance[cell], treat_L1_predicted_as_good); + } + + /*! GPU equivalent of CaloTopoClusterMaker::passCellTimeCut. + */ + constexpr bool passes_time_cut(const GeometryArr & geom, const int cell, const float threshold) const + { + const int sampling = geom.caloSample[cell]; + if (sampling == 0 || //CaloSampling::PreSamplerB + sampling == 4 || //CaloSampling::PreSamplerE + sampling == 28 ) //CaloSampling::Unknown + { + return true; + } + else + { + const QualityProvenance qp = qualityProvenance[cell]; + const unsigned int mask = geom.is_tile(cell) ? 0x8080U : 0x2000U; + if (qp.provenance() & mask) + { + return fabsf(time[cell]) < threshold; + } + } + return true; + } + + constexpr bool is_valid(const int cell) const + { + return GainConversion::is_valid(gain[cell]); + } + }; + + struct CellStateArr + { + tag_type clusterTag[NCaloCells]; //cluster tag + }; + + struct PairsArr + { + int number; + int reverse_number; + //This is to store neighbours in the other way around... + //(used for some tricks in TAC and TAS) + + int cellID[NMaxPairs]; + int neighbourID[NMaxPairs]; + }; + //Note: this information is not, strictly speaking, + // essential for arbitrary GPU-based algorithms + // and could be moved to temporaries; however, + // it's not inconceivable that a grower and splitter + // that follow from our cellular-automaton-based implementations + // might benefit from having the list of pairs + // being shared between both, so we keep this + // as part of the actual event informations to be kept. + + struct ClusterInfoArr + { + int number; + float clusterEnergy[NMaxClusters]; + float clusterEt[NMaxClusters]; + //Also used, as an intermediate value, to store AbsE + float clusterEta[NMaxClusters]; + float clusterPhi[NMaxClusters]; + ///Invalid(ated) clusters have seedCellID < 0 + int seedCellID[NMaxClusters]; + }; + + struct ClusterMomentsArr +//60 MB, but no explicit allocations needed. +//Worth the trade-off. GPU memory will only increase... + { + float energyPerSample [NumSamplings][NMaxClusters]; + float maxEPerSample [NumSamplings][NMaxClusters]; + float maxPhiPerSample [NumSamplings][NMaxClusters]; + float maxEtaPerSample [NumSamplings][NMaxClusters]; + float etaPerSample [NumSamplings][NMaxClusters]; + float phiPerSample [NumSamplings][NMaxClusters]; + float time [NMaxClusters]; + //These are, strictly speaking, not moments, + //but I think they are best left here rather than + //in the ClusterInfoArr since they are only filled in + //during cluster moments calculation... + + float firstPhi [NMaxClusters]; + float firstEta [NMaxClusters]; + float secondR [NMaxClusters]; + float secondLambda [NMaxClusters]; + float deltaPhi [NMaxClusters]; + float deltaTheta [NMaxClusters]; + float deltaAlpha [NMaxClusters]; + float centerX [NMaxClusters]; + float centerY [NMaxClusters]; + float centerZ [NMaxClusters]; + float centerMag [NMaxClusters]; + float centerLambda [NMaxClusters]; + float lateral [NMaxClusters]; + float longitudinal [NMaxClusters]; + float engFracEM [NMaxClusters]; + float engFracMax [NMaxClusters]; + float engFracCore [NMaxClusters]; + float firstEngDens [NMaxClusters]; + float secondEngDens [NMaxClusters]; + float isolation [NMaxClusters]; + float engBadCells [NMaxClusters]; + int nBadCells [NMaxClusters]; + int nBadCellsCorr [NMaxClusters]; + float badCellsCorrE [NMaxClusters]; + float badLArQFrac [NMaxClusters]; + float engPos [NMaxClusters]; + float significance [NMaxClusters]; + float cellSignificance [NMaxClusters]; + int cellSigSampling [NMaxClusters]; + float avgLArQ [NMaxClusters]; + float avgTileQ [NMaxClusters]; + float engBadHVCells [NMaxClusters]; + float nBadHVCells [NMaxClusters]; + float PTD [NMaxClusters]; + float mass [NMaxClusters]; + float EMProbability [NMaxClusters]; + float hadWeight [NMaxClusters]; + float OOCweight [NMaxClusters]; + float DMweight [NMaxClusters]; + float tileConfidenceLevel [NMaxClusters]; + float secondTime [NMaxClusters]; + int nCellSampling [NumSamplings][NMaxClusters]; + int nExtraCellSampling [NMaxClusters]; + int numCells [NMaxClusters]; + float vertexFraction [NMaxClusters]; + float nVertexFraction [NMaxClusters]; + float etaCaloFrame [NMaxClusters]; + float phiCaloFrame [NMaxClusters]; + float eta1CaloFrame [NMaxClusters]; + float phi1CaloFrame [NMaxClusters]; + float eta2CaloFrame [NMaxClusters]; + float phi2CaloFrame [NMaxClusters]; + float engCalibTot [NMaxClusters]; + float engCalibOutL [NMaxClusters]; + float engCalibOutM [NMaxClusters]; + float engCalibOutT [NMaxClusters]; + float engCalibDeadL [NMaxClusters]; + float engCalibDeadM [NMaxClusters]; + float engCalibDeadT [NMaxClusters]; + float engCalibEMB0 [NMaxClusters]; + float engCalibEME0 [NMaxClusters]; + float engCalibTileG3 [NMaxClusters]; + float engCalibDeadTot [NMaxClusters]; + float engCalibDeadEMB0 [NMaxClusters]; + float engCalibDeadTile0 [NMaxClusters]; + float engCalibDeadTileG3 [NMaxClusters]; + float engCalibDeadEME0 [NMaxClusters]; + float engCalibDeadHEC0 [NMaxClusters]; + float engCalibDeadFCAL [NMaxClusters]; + float engCalibDeadLeakage [NMaxClusters]; + float engCalibDeadUnclass [NMaxClusters]; + float engCalibFracEM [NMaxClusters]; + float engCalibFracHad [NMaxClusters]; + float engCalibFracRest [NMaxClusters]; + //And DigiHSTruth ones are reused here if that is the case? + //Maybe counting from the end if we need to keep both? + }; + +} + +#endif diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h b/Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h index 3bbe6657ca499160d781cc873792195a86cd3922..48d48f3ae66ece3ab7c5653499acaa86fb28367b 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h @@ -1,6 +1,8 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// // Dear emacs, this is -*- c++ -*- // -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration #ifndef CALORECGPU_HELPERS_H #define CALORECGPU_HELPERS_H @@ -10,13 +12,14 @@ #include <cstring> //For memcpy, of all things... #include <string> -#include <algorithm> #include <cstdio> #include <iostream> #include <thread> #include <mutex> #include <memory> #include <vector> +#include <climits> +#include <new> #if __cpp_lib_math_constants #include <numbers> @@ -25,7 +28,7 @@ //but we provide a more manual alternative. //Of course, there's also M_PI, //but we wanted to ensure the type matched -//to prevent any GPU-based shenanigans. +//to prevent any GPU-based casting shenanigans. namespace CaloRecGPU { @@ -46,6 +49,7 @@ namespace CaloRecGPU #if CUDA_AVAILABLE +#define CUDA_HOS_DEV __host__ __device__ /*! @@ -53,34 +57,69 @@ namespace CaloRecGPU \remark Standard CUDA definition that can be found almost everywhere... */ - inline void CUDA_gpu_assert(cudaError_t code, const char * file, int line, bool abort = true) + CUDA_HOS_DEV inline void CUDA_gpu_assert(cudaError_t code, const char * file, int line, bool abort = true) { if (code != cudaSuccess) { printf("GPU Error: %s (%s %d)\n", cudaGetErrorString(code), file, line); if (abort) { +#ifdef __CUDA_ARCH__ + asm("trap;"); +#else exit(code); +#endif } } } -#define CUDA_HOS_DEV __host__ __device__ - /*! \brief Wraps up a `CUDA_gpu_assert` using `__FILE__` and `__LINE__` to improve error reporting (and debugging) capabilities. */ -#define CUDA_ERRCHECK(ans) { CUDA_gpu_assert((ans), __FILE__, __LINE__); } +#define CUDA_ERRCHECK(...) CUDA_ERRCHECK_HELPER(__VA_ARGS__, true) + +#define CUDA_ERRCHECK_HELPER(ans, ...) do { ::CaloRecGPU::CUDA_gpu_assert((ans), __FILE__, __LINE__, CUDA_ERRCHECK_GET_FIRST(__VA_ARGS__, true) ); } while(0) +#define CUDA_ERRCHECK_GET_FIRST(x, ...) x #else #define CUDA_HOS_DEV +#define CUDA_ERRCHECK(...) #endif namespace CUDA_Helpers { + + struct CUDAStreamPtrHolder + { + void * ptr = nullptr; + + + operator void * () const + { + return ptr; + } + + template <class T> + operator T * () const + { + return (T *) ptr; + } + + template <class T> + CUDAStreamPtrHolder (T * p) : ptr(p) + { + } + + CUDAStreamPtrHolder() = default; + }; + //Can't do much more than this + //since cudaStream_t is a typedef... + //Though not typesafe, it is still + //semantically more safe than a naked void *... + /*! \brief Allocates and returns the address of \p num bytes from GPU memory. */ @@ -92,19 +131,51 @@ namespace CaloRecGPU void deallocate(void * address); /*! - \brief Copies \p num byte from \p source in GPU memory to \p dest in CPU memory. + \brief Allocates and returns the address of \p num bytes from CPU pinned memory. + */ + void * allocate_pinned(const size_t num); + + /*! + \brief Deallocates \p address in CPU pinned memory. + */ + void deallocate_pinned(void * address); + + + /*! + \brief Copies \p num bytse from \p source in GPU memory to \p dest in CPU memory. */ void GPU_to_CPU(void * dest, const void * const source, const size_t num); /*! - \brief Copies \p num byte from \p source in CPU memory to \p dest in GPU memory. + \brief Copies \p num bytes from \p source in CPU memory to \p dest in GPU memory. */ void CPU_to_GPU(void * dest, const void * const source, const size_t num); /*! - \brief Copies \p num byte from \p source to \p dest, both in GPU memory. + \brief Copies \p num bytes from \p source to \p dest, both in GPU memory. */ void GPU_to_GPU(void * dest, const void * const source, const size_t num); + + + /*! + \brief Copies \p num bytes from \p source in GPU memory to \p dest in CPU memory, asynchronously. + */ + void GPU_to_CPU_async(void * dest, const void * const source, const size_t num, CUDAStreamPtrHolder stream = {}); + + /*! + \brief Copies \p num bytes from \p source in CPU memory to \p dest in GPU memory, asynchronously. + */ + void CPU_to_GPU_async(void * dest, const void * const source, const size_t num, CUDAStreamPtrHolder stream = {}); + + /*! + \brief Copies \p num bytes from \p source to \p dest, both in GPU memory, asynchronously. + */ + void GPU_to_GPU_async(void * dest, const void * const source, const size_t num, CUDAStreamPtrHolder stream = {}); + + /*! + \brief Synchronizes the \p stream. If called with no value, synchronizes with @c cudaStreamPerThread. + */ + void GPU_synchronize(CUDAStreamPtrHolder stream = {}); } namespace Helpers @@ -116,6 +187,12 @@ namespace CaloRecGPU return num / denom + (num % denom != 0); } + /// \brief Returns the floor of num/denom, with proper rounding. + inline constexpr int int_floor_div(const int num, const int denom) + { + return num / denom; + } + /// \brief Returns 2 to the power of \p exp. template <class Base = float, class Exp = int> inline constexpr Base compile_time_pow2(const Exp exp) @@ -142,6 +219,60 @@ namespace CaloRecGPU //Since it's compile-time, this being a trifle slower is meaningless. + /*! Calculates a Pearson hash from @ number. + */ + template <class T> + inline constexpr unsigned char Pearson_hash(const T number) + { + constexpr unsigned char initial_value = 42; + //The answer. + + constexpr unsigned char c_mult = 7; + constexpr unsigned char c_add = 1; + //For our "look up table": table[i] = c_mult * i + c_add + //For an appropriate choice of constants (such as this), + //this will be bijective (modulo 255), as required. + + unsigned char ret = initial_value; + + for (unsigned int i = 0; i < sizeof(T); i += sizeof(unsigned char)) + { + const unsigned char to_hash = number >> (i * CHAR_BIT); + const unsigned char operand = ret ^ to_hash; + ret = c_mult * operand + c_add; + } + + return ret; + } + + + /*! Calculates a 16-bit Pearson hash from @ number. + */ + template <class T> + inline constexpr unsigned short Pearson_hash_16_bit(const T number) + { + constexpr unsigned short initial_value = 42754; + //The answer and the standard. + + constexpr unsigned short c_mult = 7; + constexpr unsigned short c_add = 1; + //For our "look up table": table[i] = c_mult * i + c_add + //For an appropriate choice of constants (such as this), + //this will be bijective (modulo 255), as required. + + unsigned short ret = initial_value; + + for (unsigned int i = 0; i < sizeof(T); i += sizeof(unsigned short)) + { + const unsigned short to_hash = number >> (i * CHAR_BIT); + const unsigned short operand = ret ^ to_hash; + ret = c_mult * operand + c_add; + } + + return ret; + } + + ///! \brief Just a wapper around constants with fallback. namespace Constants { @@ -153,7 +284,75 @@ namespace CaloRecGPU inline constexpr T pi = T(3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624L); #endif } + + CUDA_HOS_DEV static inline + float regularize_angle(const float b, const float a = 0.f) + //a. k. a. proxim in Athena code. + { + using namespace std; + const float diff = b - a; + const float divi = (fabsf(diff) - Helpers::Constants::pi<float>) / (2 * Helpers::Constants::pi<float>); + return b - ceilf(divi) * ((b > a + Helpers::Constants::pi<float>) - (b < a - Helpers::Constants::pi<float>)) * 2 * Helpers::Constants::pi<float>; + } + + CUDA_HOS_DEV static inline + double regularize_angle(const double b, const double a = 0.) + //a. k. a. proxim in Athena code. + { + using namespace std; + const float diff = b - a; + const float divi = (fabs(diff) - Helpers::Constants::pi<double>) / (2 * Helpers::Constants::pi<double>); + return b - ceil(divi) * ((b > a + Helpers::Constants::pi<double>) - (b < a - Helpers::Constants::pi<double>)) * 2 * Helpers::Constants::pi<double>; + } + + template <class T> + CUDA_HOS_DEV static inline + T angular_difference(const T x, const T y) + { + return regularize_angle(x - y, T(0)); + //Might be problematic if x and y have a significant difference + //in terms of factors of pi, in which case one should add + //a regularize_angle(x) and regularize_angle(y) in there. + //For our use case, I think this will be fine. + //(The Athena ones are even worse, + // being a branchy thing that only + // takes care of one factor of 2 pi...) + } + + CUDA_HOS_DEV static inline + float eta_from_coordinates(const float x, const float y, const float z) + { + using namespace std; + const float rho2 = x * x + y * y; + if (rho2 > 0.) + { + const float m = sqrtf(rho2 + z * z); + return 0.5 * logf((m + z) / (m - z)); + } + else + { + constexpr float s_etaMax = 22756.0; + return z + ((z > 0) - (z < 0)) * s_etaMax; + } + } + CUDA_HOS_DEV static inline + double eta_from_coordinates(const double x, const double y, const double z) + { + using namespace std; + const double rho2 = x * x + y * y; + if (rho2 > 0.) + { + const double m = sqrt(rho2 + z * z); + return 0.5 * log((m + z) / (m - z)); + } + else + { + constexpr double s_etaMax = 22756.0; + return z + ((z > 0) - (z < 0)) * s_etaMax; + } + } + ///! Holds dummy classes just to identify the place in which memory lives. namespace MemoryContext { @@ -165,6 +364,10 @@ namespace CaloRecGPU { constexpr static char const * name = "CUDA GPU"; }; + struct CUDAPinnedCPU + { + constexpr static char const * name = "CUDA Pinned CPU"; + }; } ///! Handles allocation of a type \p T, using \p indexer as the integer type to indicate sizes. @@ -201,6 +404,20 @@ namespace CaloRecGPU } }; + + template <class dummy> struct unary_helper<MemoryContext::CUDAPinnedCPU, dummy> + { + static inline T * allocate(const indexer size) + { + return static_cast<T *>(CUDA_Helpers::allocate_pinned(sizeof(T) * size)); + } + + static inline void deallocate(T *& arr) + { + CUDA_Helpers::deallocate_pinned(arr); + } + }; + template <class C1, class C2, class dummy = void> struct copy_helper; template <class dummy> struct copy_helper<MemoryContext::CPU, MemoryContext::CPU, dummy> @@ -235,6 +452,46 @@ namespace CaloRecGPU } }; + template <class dummy> struct copy_helper<MemoryContext::CUDAPinnedCPU, MemoryContext::CPU, dummy> + { + static inline void copy (T * dest, const T * const source, const indexer sz) + { + std::memcpy(dest, source, sizeof(T) * sz); + } + }; + + template <class dummy> struct copy_helper<MemoryContext::CPU, MemoryContext::CUDAPinnedCPU, dummy> + { + static inline void copy (T * dest, const T * const source, const indexer sz) + { + std::memcpy(dest, source, sizeof(T) * sz); + } + }; + + template <class dummy> struct copy_helper<MemoryContext::CUDAPinnedCPU, MemoryContext::CUDAPinnedCPU, dummy> + { + static inline void copy (T * dest, const T * const source, const indexer sz) + { + std::memcpy(dest, source, sizeof(T) * sz); + } + }; + + template <class dummy> struct copy_helper<MemoryContext::CUDAPinnedCPU, MemoryContext::CUDAGPU, dummy> + { + static inline void copy (T * dest, const T * const source, const indexer sz) + { + CUDA_Helpers::GPU_to_CPU(dest, source, sizeof(T) * sz); + } + }; + + template <class dummy> struct copy_helper<MemoryContext::CUDAGPU, MemoryContext::CUDAPinnedCPU, dummy> + { + static inline void copy (T * dest, const T * const source, const indexer sz) + { + CUDA_Helpers::CPU_to_GPU(dest, source, sizeof(T) * sz); + } + }; + template <class C1, class C2, class dummy = void> struct move_helper; @@ -266,8 +523,8 @@ namespace CaloRecGPU { ret = unary_helper<Context>::allocate(size); } -#if CALOREC_HELPERS_DEBUG - std::cerr << "ALLOCATED " << size << " in " << Context::name << ": " << ret << std::endl; +#if CALORECGPU_HELPERS_DEBUG + std::cerr << "ALLOCATED " << size << " x " << sizeof(T) << " in " << Context::name << ": " << ret << std::endl; #endif return ret; } @@ -276,13 +533,13 @@ namespace CaloRecGPU template <class Context> static inline void deallocate(T *& arr) { if (arr == nullptr) - //This check is to ensure the code behaves on non-CUDA enabled platforms - //where some destructors might still be called with nullptr. - { - return; - } + //This check is to ensure the code behaves on non-CUDA enabled platforms + //where some destructors might still be called with nullptr. + { + return; + } unary_helper<Context>::deallocate(arr); -#if CALOREC_HELPERS_DEBUG +#if CALORECGPU_HELPERS_DEBUG std::cerr << "DEALLOCATED in " << Context::name << ": " << arr << std::endl; #endif arr = nullptr; @@ -297,7 +554,7 @@ namespace CaloRecGPU { copy_helper<DestContext, SourceContext>::copy(dest, source, sz); } -#if CALOREC_HELPERS_DEBUG +#if CALORECGPU_HELPERS_DEBUG std::cerr << "COPIED " << sz << " from " << SourceContext::name << " to " << DestContext::name << ": " << source << " to " << dest << std::endl; #endif } @@ -311,7 +568,7 @@ namespace CaloRecGPU template <class DestContext, class SourceContext> static inline void move(T *& dest, T *& source, const indexer sz) { -#if CALOREC_HELPERS_DEBUG +#if CALORECGPU_HELPERS_DEBUG std::cerr << "MOVED " << sz << " from " << SourceContext::name << " to " << DestContext::name << ": " << source << " to " << dest; #endif if (sz > 0 && source != nullptr) @@ -323,7 +580,7 @@ namespace CaloRecGPU dest = nullptr; deallocate<SourceContext>(source); } -#if CALOREC_HELPERS_DEBUG +#if CALORECGPU_HELPERS_DEBUG std::cerr << " | " << source << " to " << dest << std::endl; #endif } @@ -383,7 +640,7 @@ namespace CaloRecGPU { T * temp = m_array; m_array = Manager::template allocate<Context>(new_size); - Manager::template copy<Context, Context>(m_array, temp, std::min(m_size, new_size)); + Manager::template copy<Context, Context>(m_array, temp, (m_size < new_size ? m_size : new_size)); Manager::template deallocate<Context>(temp); m_size = new_size; } @@ -629,6 +886,8 @@ namespace CaloRecGPU return m_array[i]; } + // cppcheck-suppress uninitMemberVar + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleContainer() : m_array(nullptr), m_size(0) { } @@ -636,19 +895,23 @@ namespace CaloRecGPU /*! \warning We assume the pointer is in a valid memory location! */ - CUDA_HOS_DEV SimpleContainer(T * other_array, const indexer sz) + // cppcheck-suppress uninitMemberVar + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... + CUDA_HOS_DEV SimpleContainer(T * other_array, const indexer sz) : m_array(other_array), m_size(sz) { - m_array = other_array; - m_size = sz; } template <class other_indexer, bool other_hold> + // cppcheck-suppress uninitMemberVar + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleContainer(const SimpleContainer<T, other_indexer, Context, other_hold> & other) { m_size = other.m_size; m_array = other.m_array; } + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleContainer & operator= (const SimpleContainer & other) { if (this == &other) @@ -659,10 +922,13 @@ namespace CaloRecGPU { m_array = other.m_array; m_size = other.m_size; + return (*this); } } template <class other_indexer, bool other_hold> + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleContainer & operator= (const SimpleContainer<T, other_indexer, Context, other_hold> & other) { m_size = other.m_size; @@ -833,6 +1099,8 @@ namespace CaloRecGPU Manager::template move<Context, other_context>(m_object, other.m_object, other.valid()); } + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... SimpleHolder & operator= (const SimpleHolder & other) { if (!valid() && other.valid()) @@ -848,6 +1116,8 @@ namespace CaloRecGPU template < class X, class other_context, bool other_hold, class disabler = typename std::enable_if < std::is_base_of<T, X>::value || std::is_same<T, X>::value >::type > + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... SimpleHolder & operator= (const SimpleHolder<X, other_context, other_hold> & other) { if (!valid() && other.valid()) @@ -858,6 +1128,8 @@ namespace CaloRecGPU return (*this); } + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... SimpleHolder & operator= (SimpleHolder && other) { if (&other != this) @@ -870,6 +1142,8 @@ namespace CaloRecGPU template < class X, class other_context, class disabler = typename std::enable_if < std::is_base_of<T, X>::value || std::is_same<T, X>::value >::type > + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... SimpleHolder & operator= (SimpleHolder<X, other_context, true> && other) { clear(); @@ -1022,6 +1296,8 @@ namespace CaloRecGPU return m_object != nullptr; } + // cppcheck-suppress uninitMemberVar + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleHolder() : m_object(nullptr) { } @@ -1030,6 +1306,8 @@ namespace CaloRecGPU \warning We assume the pointer is in a valid memory location! */ template < class X, class disabler = typename std::enable_if < std::is_base_of<T, X>::value || std::is_same<T, X>::value >::type > + // cppcheck-suppress uninitMemberVar + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleHolder(X * other_p) { m_object = other_p; @@ -1037,6 +1315,8 @@ namespace CaloRecGPU template < class X, bool other_hold, class disabler = typename std::enable_if < std::is_base_of<T, X>::value || std::is_same<T, X>::value >::type > + // cppcheck-suppress uninitMemberVar + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleHolder(const SimpleHolder<X, Context, other_hold> & other) { m_object = other.m_object; @@ -1044,6 +1324,8 @@ namespace CaloRecGPU template < class X, bool other_hold, class disabler = typename std::enable_if < std::is_base_of<T, X>::value || std::is_same<T, X>::value >::type > + // cppcheck-suppress operatorEqVarError + //Try to suppress the uninitialized member thing that is probably being thrown off by the CUDA_HOS_DEV macro... CUDA_HOS_DEV SimpleHolder & operator= (const SimpleHolder<X, Context, other_hold> & other) { m_object = other.m_object; @@ -1075,6 +1357,10 @@ namespace CaloRecGPU template <class T> using CUDA_kernel_object = SimpleHolder<T, MemoryContext::CUDAGPU, false>; + /// \brief Holds an object of type \p T in CUDA GPU memory. + template <class T> + using CUDA_pinned_CPU_object = SimpleHolder<T, MemoryContext::CUDAPinnedCPU, true>; + /*! \brief Manages objects of type \p T in a thread-safe way, ensuring that there's an object available for each separate thread while minimizing the number of allocations. @@ -1122,6 +1408,22 @@ namespace CaloRecGPU return *(m_held.back()); } + ///\pre Assumes the thread already has an allocated object (through @p get_one). + T & get_for_thread() const + { + std::thread::id this_id = std::this_thread::get_id(); + for (size_t i = 0; i < m_thread_equivs.size(); ++i) + { + if (m_thread_equivs[i] == this_id) + { + return *(m_held[i]); + } + } + //Here would be a good place for an unreachable. + //C++23? + return *(m_held.back()); + } + void release_one() { std::lock_guard<std::mutex> lock_guard(m_mutex); @@ -1234,6 +1536,141 @@ namespace CaloRecGPU ptr = m_held; } }; + + /** \brief Possibly holds an object in its internal buffer. + Useful to forego heap allocations, but still + have the option not to construct something... + */ + template <class T> + struct maybe_allocate + { + private: + + alignas(T) char m_buf[sizeof(T)]; + T * m_object = nullptr; + + public: + + maybe_allocate(const bool allocate, const T & t) + { + if (allocate) + { + m_object = new (m_buf) T(t); + } + } + + maybe_allocate(const bool allocate, T && t) + { + if (allocate) + { + m_object = new (m_buf) T(t); + } + } + + template <class ... Args> + maybe_allocate(const bool allocate, Args && ... args) + { + if (allocate) + { + m_object = new (m_buf) T(std::forward<Args>(args)...); + } + } + + maybe_allocate(const maybe_allocate & other) : maybe_allocate(other.get()) + { + } + + + maybe_allocate(maybe_allocate && other) : maybe_allocate(other.get()) + { + } + + maybe_allocate & operator= (const maybe_allocate & other) + { + if (&other != this) + { + if (m_object != nullptr) + { + (*m_object) = other.get(); + } + else + { + m_object = new (m_buf) T(other.get()); + } + } + return (*this); + } + + + maybe_allocate & operator= (maybe_allocate && other) + { + if (&other != this) + { + if (m_object != nullptr) + { + (*m_object) = other.get(); + } + else + { + m_object = new (m_buf) T(other.get()); + } + } + return (*this); + } + + ~maybe_allocate() + { + if (m_object != nullptr) + { + m_object->~T(); + } + } + + bool valid() const + { + return m_object != nullptr; + } + + T && get() && + { + return *m_object; + } + + T & get() & + { + return *m_object; + } + + const T & get() const & + { + return *m_object; + } + + const T * operator ->() const + { + return m_object; + } + + T * operator ->() + { + return m_object; + } + + operator T & () + { + return *m_object; + } + + operator T && () && + { + return *m_object; + } + + operator const T & () const + { + return *m_object; + } + }; } } diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/StandaloneDataIO.h b/Calorimeter/CaloRecGPU/CaloRecGPU/StandaloneDataIO.h index c319d2e76d1ab44718ae8b96f1c0a7fcff8b907b..657e7191f43ee6d418080d1b2b48db89ef6426ea 100644 --- a/Calorimeter/CaloRecGPU/CaloRecGPU/StandaloneDataIO.h +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/StandaloneDataIO.h @@ -1,1294 +1,1767 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_STANDALONEDATAIO_H -#define CALORECGPU_STANDALONEDATAIO_H - -#include "Helpers.h" - -#include "CUDAFriendlyClasses.h" - - -#include <fstream> -#include <string> -#include <map> -#include <set> -#include <iomanip> - -#include <boost/filesystem.hpp> - -struct StandaloneDataIO -{ - enum class ErrorState - { - OK = 0, ReadError, WriteError, VersionError - }; - - protected: - - - constexpr static int current_version = 4; - - template <class T> - inline static ErrorState read_from_file(const boost::filesystem::path & file, T * obj_ptr, const size_t offset = 0, const bool can_have_bool_at_start = true) - { - std::ifstream in(file.native(), std::ios_base::binary); - if (boost::filesystem::file_size(file) && can_have_bool_at_start) - //Some of our output versions had an extra bool at the start. - { - in.ignore(sizeof(bool) + offset); - if (in.fail()) - { - return ErrorState::ReadError; - } - } - in.read((char *) obj_ptr, sizeof(T)); - if (in.fail()) - { - return ErrorState::ReadError; - } - in.close(); - - return ErrorState::OK; - } - - inline static int guess_version(const boost::filesystem::path & filepath) - { - if (filepath.extension() == ".dat") - { - return 1; - } - else if (filepath.extension() == ".diag") - { - return 2; - } - else if (filepath.extension() == ".abrv") - { - return 3; - } - else if (filepath.extension() == ".clusters" || filepath.extension() == ".geo" || filepath.extension() == ".noise" || filepath.extension() == ".cells") - { - return 4; - } - else - { - return -1; - } - } - - inline static void report_error(const boost::filesystem::path & file, const std::string & kind, const bool report = false) - { - if (report) - { - std::cerr << "ERROR: when " << kind << " from '" << file << "'." << std::endl; - } - } - - public: - - struct ConstantInformation - { - protected: - constexpr static int NMaxNeighbours = 26; - constexpr static int NCaloCells = 187652; - - struct GeometryArr_v1 - { - int caloSample[NCaloCells]; - float x[NCaloCells]; - float y[NCaloCells]; - float z[NCaloCells]; - float eta[NCaloCells]; - float phi[NCaloCells]; - float noise[NCaloCells]; - unsigned int nNeighbours[NCaloCells]; - unsigned int neighbours[NCaloCells][NMaxNeighbours]; - }; - - public: - - inline static ErrorState read_geometry(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, const int version) - { - if (version <= 0 || version > current_version) - { - return ErrorState::VersionError; - } - else if (version < 4) - { - CaloRecGPU::Helpers::CPU_object<GeometryArr_v1> temp(true); - if (read_from_file<GeometryArr_v1>(file, temp) != ErrorState::OK) - { - report_error(file, "reading geometry"); - return ErrorState::ReadError; - } - geo.allocate(); - for (int i = 0; i < NCaloCells; ++i) - { - geo->caloSample[i] = temp->caloSample[i]; - geo->x[i] = temp->x[i]; - geo->y[i] = temp->y[i]; - geo->z[i] = temp->z[i]; - geo->eta[i] = temp->eta[i]; - geo->phi[i] = temp->phi[i]; - geo->nNeighbours[i] = temp->nNeighbours[i]; - for (int j = 0; j < NMaxNeighbours; ++j) - { - geo->neighbours[i][j] = temp->neighbours[i][j]; - } - } - } - else if (version == 4) - { - std::ifstream in(file.native(), std::ios_base::binary); - geo.binary_input(in); - if (in.fail()) - { - report_error(file, "reading geometry"); - return ErrorState::ReadError; - } - in.close(); - } - else - { - return ErrorState::VersionError; - } - return ErrorState::OK; - } - - inline static ErrorState read_noise(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise, const int version) - { - if (version <= 0 || version > current_version) - { - return ErrorState::VersionError; - } - if (version < 4) - { - CaloRecGPU::Helpers::CPU_object<GeometryArr_v1> temp(true); - if (read_from_file<GeometryArr_v1>(file, temp) != ErrorState::OK) - { - report_error(file, "reading noise"); - return ErrorState::ReadError; - } - noise.allocate(); - for (int i = 0; i < NCaloCells; ++i) - { - for (int j = 0; j < CaloRecGPU::NumGainStates; ++j) - { - noise->noise[j][i] = temp->noise[i]; - //Wrongfully assuming the same noise for all gain states, - //but that's what was being done... - } - } - } - else if (version == 4) - { - std::ifstream in(file.native(), std::ios_base::binary); - noise.binary_input(in); - if (in.fail()) - { - report_error(file, "reading noise"); - return ErrorState::ReadError; - } - in.close(); - } - else - { - return ErrorState::VersionError; - } - return ErrorState::OK; - } - - inline static ErrorState read_geometry_and_noise(const boost::filesystem::path & file, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise, const int version) - { - if (version <= 0 || version > current_version) - { - return ErrorState::VersionError; - } - else if (version < 4) - { - CaloRecGPU::Helpers::CPU_object<GeometryArr_v1> temp(true); - if (read_from_file<GeometryArr_v1>(file, temp) != ErrorState::OK) - { - report_error(file, "reading geometry and noise"); - return ErrorState::ReadError; - } - geo.allocate(); - noise.allocate(); - for (int i = 0; i < NCaloCells; ++i) - { - geo->caloSample[i] = temp->caloSample[i]; - geo->x[i] = temp->x[i]; - geo->y[i] = temp->y[i]; - geo->z[i] = temp->z[i]; - geo->eta[i] = temp->eta[i]; - geo->phi[i] = temp->phi[i]; - for (int j = 0; j < CaloRecGPU::NumGainStates; ++j) - { - noise->noise[j][i] = temp->noise[i]; - //Wrongfully assuming the same noise for all gain states, - //but that's what was being done... - } - geo->nNeighbours[i] = temp->nNeighbours[i]; - for (int j = 0; j < NMaxNeighbours; ++j) - { - geo->neighbours[i][j] = temp->neighbours[i][j]; - } - } - } - else - { - //Current (and future?) versions - //save the noise and geometry - //in separate files, hence the error. - return ErrorState::VersionError; - } - return ErrorState::OK; - } - - inline static ErrorState read_geometry(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo) - { - return read_geometry(file, geo, guess_version(file)); - } - - inline static ErrorState read_noise(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise) - { - return read_noise(file, noise, guess_version(file)); - } - - inline static ErrorState read_geometry_and_noise(const boost::filesystem::path & file, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise) - { - return read_geometry_and_noise(file, geo, noise, guess_version(file)); - } - - inline static ErrorState write_geometry(boost::filesystem::path file, const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo) - { - file.replace_extension(".geo"); - std::ofstream out(file, std::ios_base::binary); - geo.binary_output(out); - if (out.fail()) - { - report_error(file, "writing geometry"); - return ErrorState::WriteError; - } - out.close(); - return ErrorState::OK; - } - - inline static ErrorState write_noise(boost::filesystem::path file, const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise) - { - file.replace_extension(".noise"); - std::ofstream out(file, std::ios_base::binary); - noise.binary_output(out); - if (out.fail()) - { - report_error(file, "writing noise"); - return ErrorState::WriteError; - } - out.close(); - return ErrorState::OK; - } - }; - - struct EventInformation - { - protected: - constexpr static int NMaxNeighbours = 26; - constexpr static int NCaloCells = 187652; - - //Data files, Ademar-style .dat - struct ClusterInfoArr_v1 - { - constexpr static int NMaxClusters = 100000; - constexpr static int NClustTimers = 11; - int nClusters; - int seedTag[NCaloCells]; - int clusterSize[NMaxClusters]; - float cellSNR[NCaloCells]; - float clusterEnergy[NMaxClusters]; - float clusterEt[NMaxClusters]; - float clusterEta[NMaxClusters]; - float clusterPhi[NMaxClusters]; - float timers[NClustTimers]; - }; - - struct CellEnergyArr_v1 - { - float energy[NCaloCells]; - }; - - struct CellTagArr_v1 - { - int clusterTag[NCaloCells]; - }; - - //Data files, Ademar-style .diag - struct ClusterInfoArr_v2 - { - constexpr static int NMaxClusters = 50000; - int seedTag[NCaloCells]; - float cellE[NCaloCells]; - int nClusters; - int clusterNCells[NMaxClusters]; - float clusterEnergy[NMaxClusters]; - float clusterEt[NMaxClusters]; - float clusterEta[NMaxClusters]; - float clusterPhi[NMaxClusters]; - }; - - inline static void cluster_tag_adjust(CaloRecGPU::tag_type & tag, const int old_tag, const int index) - { - if (old_tag < 0) - //Old way of storing had cells not part of clusters having tag -1. - { - tag = CaloRecGPU::Tags::InvalidTag; - } - else - { - tag = CaloRecGPU::Tags::make_seed_tag(0x7f7fffff, index, old_tag); - //0x7f7fffff is the largest possible valid (finite non-NaN) floating point value. - } - } - - public: - inline static ErrorState read_cluster_info(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, const int version) - { - if (version <= 0 || version > current_version) - { - return ErrorState::VersionError; - } - else if (version == 1) - { - CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v1> temp(true); - if (read_from_file<ClusterInfoArr_v1>(file, temp) != ErrorState::OK) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - clusters.allocate(); - clusters->number = temp->nClusters; - for (int i = 0; i < temp->nClusters; ++i) - { - clusters->clusterEnergy[i] = temp->clusterEnergy[i]; - clusters->clusterEt[i] = temp->clusterEt[i]; - clusters->clusterEta[i] = temp->clusterEta[i]; - clusters->clusterPhi[i] = temp->clusterPhi[i]; - clusters->seedCellID[i] = -1; - //One would need to recalculate if using this for old versions... - //(In this case we could actually recalculate since we have the SNR, - // but for version 2 that's not possible, so it's best to be consistent - // and ask the user to handle it if necessary.) - } - } - else if (version == 2) - { - CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v2> temp(true); - if (read_from_file<ClusterInfoArr_v2>(file, temp) != ErrorState::OK) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - clusters.allocate(); - clusters->number = temp->nClusters; - for (int i = 0; i < temp->nClusters; ++i) - { - clusters->clusterEnergy[i] = temp->clusterEnergy[i]; - clusters->clusterEt[i] = temp->clusterEt[i]; - clusters->clusterEta[i] = temp->clusterEta[i]; - clusters->clusterPhi[i] = temp->clusterPhi[i]; - clusters->seedCellID[i] = -1; - //One would need to recalculate if using this for old versions... - } - } - else if (version == 3) - { - clusters.allocate(); - - std::ifstream in(file.native(), std::ios_base::binary); - - in.ignore(sizeof(int) * NCaloCells); - //seedTag - in.ignore(sizeof(float) * NCaloCells); - //cellE - - if (in.fail()) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - - in.read((char *) & (clusters->number), sizeof(int)); - - if (in.fail() || clusters->number < 0 || clusters->number > ClusterInfoArr_v2::NMaxClusters) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - - in.ignore(sizeof(int) * clusters->number); - //clusterNCells - - in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number); - - if (in.fail()) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - - in.close(); - - for (int i = 0; i < clusters->number; ++i) - { - clusters->seedCellID[i] = -1; - } - //One would need to recalculate if using this for old versions... - - } - else if (version == 4) - { - clusters.allocate(); - - std::ifstream in(file.native(), std::ios_base::binary); - - in.read((char *) & (clusters->number), sizeof(int)); - - if (in.fail() || clusters->number < 0) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - - in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number); - in.read((char *) clusters->seedCellID, sizeof(int) * clusters->number); - - if (in.fail()) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - - in.close(); - } - else - { - return ErrorState::VersionError; - } - return ErrorState::OK; - - } - - inline static ErrorState read_cell_info(const boost::filesystem::path & file, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, - const int version) - { - if (version <= 0 || version > current_version) - { - return ErrorState::VersionError; - } - else if (version == 1) - //version 1 does not have a file where one can read all the necessary info, - //only the energies, but we keep this here for easier folder reading... - { - cell_info.allocate(); - cell_state.allocate(); - CaloRecGPU::Helpers::CPU_object<CellEnergyArr_v1> temp(true); - if (read_from_file<CellEnergyArr_v1>(file, temp) != ErrorState::OK) - { - report_error(file, "reading cells"); - return ErrorState::ReadError; - } - for (int i = 0; i < NCaloCells; ++i) - { - cell_info->energy[i] = temp->energy[i]; - cell_info->gain[i] = 0; - //We don't have varying gains in this case, - //so we just assume it's constant and equal to the first type. - //(A guess as good as any...) - } - } - else if (version == 2) - { - CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v2> temp(true); - if (read_from_file<ClusterInfoArr_v2>(file, temp) != ErrorState::OK) - { - report_error(file, "reading cells"); - return ErrorState::ReadError; - } - cell_info.allocate(); - cell_state.allocate(); - for (int i = 0; i < NCaloCells; ++i) - { - cell_info->energy[i] = temp->cellE[i]; - cell_info->gain[i] = 0; - //We don't have varying gains in this case, - //so we just assume it's constant and equal to the first type. - //(A guess as good as any...) - - cluster_tag_adjust(cell_state->clusterTag[i], temp->seedTag[i], i); - } - } - else if (version == 3) - { - cell_info.allocate(); - cell_state.allocate(); - - CaloRecGPU::Helpers::CPU_object<CellTagArr_v1> temp(true); - - std::ifstream in(file.native(), std::ios_base::binary); - - in.read((char *) temp->clusterTag, sizeof(int) * NCaloCells); - in.read((char *) cell_info->energy, sizeof(float) * NCaloCells); - - if (in.fail()) - { - report_error(file, "reading clusters"); - return ErrorState::ReadError; - } - for (int i = 0; i < NCaloCells; ++i) - { - cell_info->gain[i] = 0; - //We don't have varying gains in this case, - //so we just assume it's constant and equal to the first type. - //(A guess as good as any...) - - cluster_tag_adjust(cell_state->clusterTag[i], temp->clusterTag[i], i); - } - } - else if (version == 4) - { - std::ifstream in(file.native(), std::ios_base::binary); - cell_info.binary_input(in); - cell_state.binary_input(in); - if (in.fail()) - { - report_error(file, "reading cells"); - return ErrorState::ReadError; - } - in.close(); - } - else - { - return ErrorState::VersionError; - } - return ErrorState::OK; - - } - - - inline static ErrorState read_cell_and_cluster_info(const boost::filesystem::path & file, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, - const int version) - { - if (version <= 0 || version > current_version) - { - return ErrorState::VersionError; - } - else if (version == 1) - //version 1 does not have a file where one can read all the necessary info, - //since the energies are stored separately, but we keep this here for easier folder reading... - { - CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v1> temp(true); - if (read_from_file<ClusterInfoArr_v1>(file, temp) != ErrorState::OK) - { - report_error(file, "reading cells and clusters"); - return ErrorState::ReadError; - } - clusters.allocate(); - cell_state.allocate(); - cell_info.allocate(); - clusters->number = temp->nClusters; - for (int i = 0; i < temp->nClusters; ++i) - { - clusters->clusterEnergy[i] = temp->clusterEnergy[i]; - clusters->clusterEt[i] = temp->clusterEt[i]; - clusters->clusterEta[i] = temp->clusterEta[i]; - clusters->clusterPhi[i] = temp->clusterPhi[i]; - clusters->seedCellID[i] = -1; - } - for (int i = 0; i < NCaloCells; ++i) - { - cluster_tag_adjust(cell_state->clusterTag[i], temp->seedTag[i], i); - } - } - else if (version == 2) - { - CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v2> temp(true); - if (read_from_file<ClusterInfoArr_v2>(file, temp) != ErrorState::OK) - { - report_error(file, "reading cells and clusters"); - return ErrorState::ReadError; - } - clusters.allocate(); - cell_state.allocate(); - cell_info.allocate(); - - clusters->number = temp->nClusters; - for (int i = 0; i < temp->nClusters; ++i) - { - clusters->clusterEnergy[i] = temp->clusterEnergy[i]; - clusters->clusterEt[i] = temp->clusterEt[i]; - clusters->clusterEta[i] = temp->clusterEta[i]; - clusters->clusterPhi[i] = temp->clusterPhi[i]; - clusters->seedCellID[i] = -1; - } - for (int i = 0; i < NCaloCells; ++i) - { - cell_info->energy[i] = temp->cellE[i]; - cell_info->gain[i] = 0; - cluster_tag_adjust(cell_state->clusterTag[i], temp->seedTag[i], i); - } - } - else if (version == 3) - { - clusters.allocate(); - cell_info.allocate(); - cell_state.allocate(); - CaloRecGPU::Helpers::CPU_object<CellTagArr_v1> temp(true); - - std::ifstream in(file.native(), std::ios_base::binary); - - in.read((char *) temp->clusterTag, sizeof(int) * NCaloCells); - in.read((char *) cell_info->energy, sizeof(float) * NCaloCells); - - if (in.fail()) - { - report_error(file, "reading cells and clusters"); - return ErrorState::ReadError; - } - - in.read((char *) & (clusters->number), sizeof(int)); - - if (in.fail() || clusters->number < 0 || clusters->number > ClusterInfoArr_v2::NMaxClusters) - { - report_error(file, "reading cells and clusters"); - return ErrorState::ReadError; - } - - in.ignore(sizeof(int) * clusters->number); - //clusterNCells - - in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number); - in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number); - - if (in.fail()) - { - report_error(file, "reading cells and clusters"); - return ErrorState::ReadError; - } - - in.close(); - - for (int i = 0; i < clusters->number; ++i) - { - clusters->seedCellID[i] = -1; - } - - for (int i = 0; i < NCaloCells; ++i) - { - cell_info->gain[i] = 0; - //We don't have varying gains in this case, - //so we just assume it's constant and equal to the first type. - //(A guess as good as any...) - - cluster_tag_adjust(cell_state->clusterTag[i], temp->clusterTag[i], i); - } - } - else - { - return ErrorState::VersionError; - } - return ErrorState::OK; - } - - inline static ErrorState read_cluster_info(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters) - { - return read_cluster_info(file, clusters, guess_version(file)); - } - - inline static ErrorState read_cell_info(const boost::filesystem::path & file, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state) - { - return read_cell_info(file, cell_info, cell_state, guess_version(file)); - } - - inline static ErrorState read_cell_and_cluster_info(const boost::filesystem::path & file, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters) - { - return read_cell_and_cluster_info(file, cell_info, cell_state, clusters, guess_version(file)); - } - - inline static ErrorState write_cluster_info(boost::filesystem::path file, const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters) - { - file.replace_extension(".clusters"); - std::ofstream out(file, std::ios_base::binary); - - out.write((char *) & (clusters->number), sizeof(int)); - out.write((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); - out.write((char *) clusters->clusterEt, sizeof(float) * clusters->number); - out.write((char *) clusters->clusterEta, sizeof(float) * clusters->number); - out.write((char *) clusters->clusterPhi, sizeof(float) * clusters->number); - out.write((char *) clusters->seedCellID, sizeof(int) * clusters->number); - - if (out.fail()) - { - report_error(file, "writing clusters"); - return ErrorState::WriteError; - } - out.close(); - return ErrorState::OK; - } - - inline static ErrorState write_cell_info(boost::filesystem::path file, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state) - { - file.replace_extension(".cells"); - std::ofstream out(file, std::ios_base::binary); - cell_info.binary_output(out); - cell_state.binary_output(out); - if (out.fail()) - { - report_error(file, "writing cells"); - return ErrorState::WriteError; - } - out.close(); - return ErrorState::OK; - } - - }; - - protected: - - inline static bool create_or_check_folder(const boost::filesystem::path & folder, const bool output_errors = true) - { - if (!boost::filesystem::exists(folder)) - { - if (!boost::filesystem::create_directory(folder)) - { - if (output_errors) - { - std::cout << "ERROR: folder '" << folder << "' could not be created." << std::endl; - } - return false; - } - } - else if (!boost::filesystem::is_directory(folder)) - { - if (output_errors) - { - std::cout << "ERROR: folder '" << folder << "' is not a valid folder." << std::endl; - } - return false; - } - return true; - } - - public: - - inline static ErrorState prepare_folder_for_output(const boost::filesystem::path & folder, const bool output_errors = true) - { - if (!create_or_check_folder(folder, output_errors)) - { - return ErrorState::WriteError; - } - return ErrorState::OK; - } - - inline static std::string build_filename( const std::string & prefix, - const std::string & text, - const std::string & suffix, - const std::string & ext ) - { - return prefix + (prefix.size() > 0 ? "_" : "") + text + - (suffix.size() > 0 ? "_" : "") + suffix + "." + ext; - } - - inline static std::string build_filename( const std::string & prefix, - const size_t event_number, - const std::string & suffix, - const std::string & ext, - const unsigned int num_width = 9) - { - std::ostringstream event_ID_format; - event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; - const std::string event_ID = event_ID_format.str(); - return build_filename(prefix, event_ID, suffix, ext); - } - - - inline static ErrorState save_constants_to_folder(const boost::filesystem::path & folder, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise, - const std::string & prefix = "", - const std::string & suffix = "", - const bool output_errors = true) - { - if (!create_or_check_folder(folder, output_errors)) - { - return ErrorState::WriteError; - } - - auto filename = [&] (const std::string & text, const std::string & ext) - { - return folder / build_filename(prefix, text, suffix, ext); - }; - - if (ConstantInformation::write_geometry(filename("geometry", "geo"), geo) != ErrorState::OK) - { - return ErrorState::WriteError; - } - if (ConstantInformation::write_noise(filename("noise", "noise"), noise) != ErrorState::OK) - { - return ErrorState::WriteError; - } - return ErrorState::OK; - } - - inline static ErrorState save_event_to_folder(const size_t event_number, - const boost::filesystem::path & folder, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, - const std::string & prefix = "", - const std::string & suffix = "", - const unsigned int num_width = 9, - const bool output_errors = true) - { - if (!create_or_check_folder(folder, output_errors)) - { - return ErrorState::WriteError; - } - - std::ostringstream event_ID_format; - event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; - const std::string event_ID = event_ID_format.str(); - - auto filename = [&] (const std::string & ext) - { - return folder / build_filename(prefix, event_ID, suffix, ext); - }; - - if (EventInformation::write_cell_info(filename("cells"), cell_info, cell_state) != ErrorState::OK) - { - return ErrorState::WriteError; - } - if (EventInformation::write_cluster_info(filename("clusters"), clusters) != ErrorState::OK) - { - return ErrorState::WriteError; - } - return ErrorState::OK; - } - - inline static ErrorState save_cells_to_folder(const size_t event_number, - const boost::filesystem::path & folder, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, - const std::string & prefix = "", - const std::string & suffix = "", - const unsigned int num_width = 9, - const bool output_errors = true) - { - if (!create_or_check_folder(folder, output_errors)) - { - return ErrorState::WriteError; - } - - std::ostringstream event_ID_format; - event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; - const std::string event_ID = event_ID_format.str(); - - auto filename = [&] (const std::string & ext) - { - return folder / build_filename(prefix, event_ID, suffix, ext); - }; - - if (EventInformation::write_cell_info(filename("cells"), cell_info, cell_state) != ErrorState::OK) - { - return ErrorState::WriteError; - } - return ErrorState::OK; - } - - inline static ErrorState save_clusters_to_folder(const size_t event_number, - const boost::filesystem::path & folder, - const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, - const std::string & prefix = "", - const std::string & suffix = "", - const unsigned int num_width = 9, - const bool output_errors = true) - { - if (!create_or_check_folder(folder, output_errors)) - { - return ErrorState::WriteError; - } - - std::ostringstream event_ID_format; - event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; - const std::string event_ID = event_ID_format.str(); - - auto filename = [&] (const std::string & ext) - { - return folder / build_filename(prefix, event_ID, suffix, ext); - }; - - if (EventInformation::write_cluster_info(filename("clusters"), clusters) != ErrorState::OK) - { - return ErrorState::WriteError; - } - return ErrorState::OK; - } - - struct FolderLoad - { - std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr>> geometry; - std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr>> noise; - std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr>> clusters; - std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr>> cell_info; - std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr>> cell_state; - }; - - - template <class F> - inline static FolderLoad load_folder_filter(F && filter_function, - //Receives a std::string (the filename), - //returns `true` if the file should be filtered out. - const boost::filesystem::path & folder, - int max_events = -1, - const bool load_clusters = true, - const bool load_cells = true, - const bool load_geometry = true, - const bool load_noise = true, - const bool output_messages = true) - { - FolderLoad ret; - if (!boost::filesystem::is_directory(folder)) - { - if (output_messages) - { - std::cout << "ERROR: '" << folder << "' is not a valid folder." << std::endl; - } - return ret; - } - std::set<std::string> read_one_part_of_v1_cells; - int event_count = 0; - for (const boost::filesystem::path & file : boost::filesystem::directory_iterator(folder)) - { - if (max_events > 0 && event_count >= max_events && ret.geometry.size() > 0 && ret.noise.size() > 0) - { - break; - } - const bool can_load_events = (max_events < 0) || (event_count < max_events); - const std::string filename = file.stem().native(); - if (filter_function(filename)) - { - continue; - } - auto check_error = [&](const ErrorState & es, const std::string & str) - { - if (es == ErrorState::OK) - { - return false; - } - if (output_messages) - { - std::cout << "ERROR: '" << file << "' is not a valid " << str << " file (" << (int) es << ")." << std::endl; - } - return true; - }; - auto output_loading_message = [&](const std::string & str) - { - if (output_messages) - { - std::cout << "Loaded " << str << " from '" << file << "'." << std::endl; - } - }; - if (file.extension() == ".geo") - { - if (!load_geometry) - { - continue; - } - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> tempgeo(true); - if (check_error(ConstantInformation::read_geometry(file, tempgeo), "geometry")) - { - continue; - } - ret.geometry[filename] = std::move(tempgeo); - output_loading_message("geometry"); - } - else if (filename.find("geometry") != std::string::npos) - { - if (!load_geometry && !load_noise) - { - continue; - } - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> tempgeo(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> tempnois(true); - if (check_error(ConstantInformation::read_geometry_and_noise(file, tempgeo, tempnois), "geometry and noise")) - { - continue; - } - if (load_geometry) - { - ret.geometry[filename] = std::move(tempgeo); - } - if (load_noise) - { - ret.noise[filename] = std::move(tempnois); - } - output_loading_message("geometry and noise"); - } - else if (file.extension() == ".noise") - { - if (!load_noise) - { - continue; - } - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> tempnois(true); - if (check_error(ConstantInformation::read_noise(file, tempnois), "noise")) - { - continue; - } - ret.noise[filename] = std::move(tempnois); - output_loading_message("noise"); - } - else if (file.extension() == ".clusters") - { - if (!load_clusters || !can_load_events) - { - continue; - } - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); - if (check_error(EventInformation::read_cluster_info(file, tempclu), "clusters")) - { - continue; - } - ret.clusters[filename] = std::move(tempclu); - output_loading_message("clusters"); - if (ret.cell_info.count(filename) > 0 || !load_cells) - { - ++event_count; - } - } - else if (file.extension() == ".cells") - { - if (!load_cells || !can_load_events) - { - continue; - } - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); - if (check_error(EventInformation::read_cell_info(file, tempcellinfo, tempcellstate), "cells")) - { - continue; - } - ret.cell_info[filename] = std::move(tempcellinfo); - ret.cell_state[filename] = std::move(tempcellstate); - output_loading_message("cells"); - if (ret.clusters.count(filename) > 0 || !load_clusters) - { - ++event_count; - } - } - else if ((file.extension() == ".diag" || file.extension() == ".abrv")) - { - if (!(load_cells || load_clusters) || !can_load_events) - { - continue; - } - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); - if (check_error(EventInformation::read_cell_and_cluster_info(file, tempcellinfo, tempcellstate, tempclu), "cells and clusters")) - { - continue; - } - if (load_cells) - { - ret.cell_info[filename] = std::move(tempcellinfo); - ret.cell_state[filename] = std::move(tempcellstate); - } - if (load_clusters) - { - ret.clusters[filename] = std::move(tempclu); - } - if (load_cells && load_clusters) - { - output_loading_message("cells and clusters"); - } - else if (load_cells) - { - output_loading_message("cells"); - } - else if (load_clusters) - { - output_loading_message("clusters"); - } - ++event_count; - } - else if (file.extension() == ".dat") - { - if (!(load_cells || load_clusters) || !can_load_events) - { - continue; - } - const auto str_starts_with = [ ](const std::string & str, const std::string & start) - { - for (size_t i = 0; i < start.size(); ++i) - { - if (str[i] != start[i]) - { - return false; - } - } - return true; - }; - - if (str_starts_with(filename, "cellData_")) - { - if (!load_cells) - { - continue; - } - const std::string real_name = filename.substr(9); - if (read_one_part_of_v1_cells.count(real_name) > 0 && ret.cell_info.count(real_name) == 0) - { - //The other part of the event information was not properly loaded. - continue; - } - else if (read_one_part_of_v1_cells.count(real_name) > 0) - { - if (check_error(EventInformation::read_cell_info(file, ret.cell_info[real_name], ret.cell_state[real_name]), "cells")) - { - ret.cell_info.erase(real_name); - ret.cell_state.erase(real_name); - ret.clusters.erase(real_name); - continue; - } - ++event_count; - } - else - { - read_one_part_of_v1_cells.insert(real_name); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); - if (check_error(EventInformation::read_cell_info(file, tempcellinfo, tempcellstate), "cells")) - { - continue; - } - if (load_cells) - { - ret.cell_info[filename] = std::move(tempcellinfo); - ret.cell_state[filename] = std::move(tempcellstate); - } - if (load_clusters) - { - ret.clusters[filename] = std::move(tempclu); - } - } - output_loading_message("partial cell data"); - } - else if (str_starts_with(filename, "clusterData_")) - { - if (!load_cells && !load_clusters) - { - continue; - } - const std::string real_name = filename.substr(12); - if (read_one_part_of_v1_cells.count(real_name) > 0 && ret.cell_info.count(real_name) == 0 && load_cells) - { - //The other part of the event information was not properly loaded. - continue; - } - else if (read_one_part_of_v1_cells.count(real_name) > 0) - { - if (check_error(EventInformation::read_cell_and_cluster_info(file, ret.cell_info[real_name], ret.cell_state[real_name], ret.clusters[real_name]), "cells and clusters")) - { - ret.cell_info.erase(real_name); - ret.cell_state.erase(real_name); - ret.clusters.erase(real_name); - continue; - } - ++event_count; - } - else - { - read_one_part_of_v1_cells.insert(real_name); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); - if (check_error(EventInformation::read_cell_and_cluster_info(file, tempcellinfo, tempcellstate, tempclu), "cells and clusters")) - { - continue; - } - if (load_cells) - { - ret.cell_info[filename] = std::move(tempcellinfo); - ret.cell_state[filename] = std::move(tempcellstate); - } - if (load_clusters) - { - ret.clusters[filename] = std::move(tempclu); - } - } - output_loading_message("clusters and partial cell data"); - } - else - { - if (output_messages) - { - std::cout << "ERROR: '" << file << "' does not seem to be a valid file for data input." << std::endl; - } - } - } - else if (can_load_events) - { - if (output_messages) - { - std::cout << "ERROR: '" << file << "' does not seem to be a valid file for data input." << std::endl; - } - } - } - return ret; - } - - inline static FolderLoad load_folder(const boost::filesystem::path & folder, - int max_events = -1, - const bool load_clusters = true, - const bool load_cells = true, - const bool load_geometry = true, - const bool load_noise = true, - const bool output_messages = true) - { - return load_folder_filter([&](const std::string &) - { - return false; - }, - folder, max_events, load_clusters, load_cells, load_geometry, load_noise, output_messages); - } - -}; - - -#endif //CALORECGPU_STANDALONEDATAIO_H \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_STANDALONEDATAIO_H +#define CALORECGPU_STANDALONEDATAIO_H + +#include "Helpers.h" + +#include "CUDAFriendlyClasses.h" + + +#include <fstream> +#include <string> +#include <map> +#include <set> +#include <iomanip> + +#include <boost/filesystem.hpp> + + +//Note to self and/or anyone who may worry about that: +//we aren't using anything fancier than file extension + file size +//to detect the versions of the files. +//I know this is unelegant and hardly scalable, +//but it's easier and works fine for our purposes. +//The only possible side-effect of this is that +//file extensions can become a bit larger than 3 +//("clusterinfo", 11 characters), +//but this should pose no problem in our days... + +struct StandaloneDataIO +{ + enum class ErrorState + { + OK = 0, ReadError, WriteError, VersionError + }; + + protected: + + + constexpr static int current_version = 6; + + template <class T> + inline static ErrorState read_from_file(const boost::filesystem::path & file, T * obj_ptr, const size_t offset = 0, const bool can_have_bool_at_start = true) + { + std::ifstream in(file.native(), std::ios_base::binary); + if (boost::filesystem::file_size(file) > sizeof(T) + offset && can_have_bool_at_start) + //Some of our output versions had an extra bool at the start. + { + in.ignore(sizeof(bool) + offset); + if (in.fail()) + { + return ErrorState::ReadError; + } + } + else if (offset) + { + in.ignore(offset); + } + in.read((char *) obj_ptr, sizeof(T)); + if (in.fail()) + { + return ErrorState::ReadError; + } + in.close(); + + return ErrorState::OK; + } + + inline static int guess_version(const boost::filesystem::path & filepath) + { + if (filepath.extension() == ".dat") + { + return 1; + } + else if (filepath.extension() == ".diag") + { + return 2; + } + else if (filepath.extension() == ".abrv") + { + return 3; + } + else if (filepath.extension() == ".cellsold") + { + return 4; + } + else if (filepath.extension() == ".clusters" || filepath.extension() == ".cells") + { + return 5; + } + else if (filepath.extension() == ".geo") + { + if (abs(ptrdiff_t( boost::filesystem::file_size(filepath)) - ptrdiff_t(sizeof(ConstantInformation::GeometryArr_v2))) > ptrdiff_t(sizeof(bool))) + //There might be a bool in the beginning due to the old way of binary output... + { + return 5; + } + else + { + return 3; + } + } + else if ( filepath.extension() == ".geometry" || filepath.extension() == ".noise" || + filepath.extension() == ".clusterinfo" || filepath.extension() == ".cellinfo" || + filepath.extension() == ".cellstate" ) + { + return 6; + } + //Most recent ones. Hopefully final. + //(Additional objects, e. g. cluster moments, + // might get added, but hopefully the objects + // will remain the same, size and structure-wise.) + else + { + return -1; + } + } + + inline static void report_error(const boost::filesystem::path & file, const std::string & kind, const bool report = false) + { + if (report) + { + std::cerr << "ERROR: when " << kind << " from '" << file << "'." << std::endl; + } + } + + public: + + struct ConstantInformation + { + friend class StandaloneDataIO; + protected: + constexpr static int NMaxNeighboursOld = 26; + constexpr static int NCaloCells = 187652; + + struct GeometryArr_v1 + { + int caloSample[NCaloCells]; + float x[NCaloCells]; + float y[NCaloCells]; + float z[NCaloCells]; + float eta[NCaloCells]; + float phi[NCaloCells]; + float noise[NCaloCells]; + unsigned int nNeighbours[NCaloCells]; + unsigned int neighbours[NCaloCells][NMaxNeighboursOld]; + }; + + struct GeometryArr_v2 + { + int caloSample[NCaloCells]; + float x[NCaloCells]; + float y[NCaloCells]; + float z[NCaloCells]; + float eta[NCaloCells]; + float phi[NCaloCells]; + int nNeighbours[NCaloCells]; + int neighbours[NCaloCells][NMaxNeighboursOld]; + int nReverseNeighbours[NCaloCells]; + int reverseNeighbours[NCaloCells][NMaxNeighboursOld]; + }; + + struct NeighArr_v5 + { + int total_number[NCaloCells]; + unsigned long long int offsets[NCaloCells]; + //don't forget to correct for the last offsets now being 6 bit! + int cells[NMaxNeighboursOld][NCaloCells]; + }; + + struct GeometryArr_v5 + { + int caloSample[NCaloCells]; + float x[NCaloCells]; + float y[NCaloCells]; + float z[NCaloCells]; + float eta[NCaloCells]; + float phi[NCaloCells]; + float volume[NCaloCells]; + + NeighArr_v5 neighbours; + + int tileStart, tileEnd; + }; + + inline static unsigned long long int old_to_new_offset(unsigned long long int old_offset) + { + unsigned long long int ret = old_offset & 0xC000000000000000ULL; + //Keep the two last bits (to mark limited neighbours) + for (int i = 0; i < CaloRecGPU::NumNeighOptions; ++i) + { + ret += CaloRecGPU::NeighOffsets::offset_delta(i) * ((old_offset >> (i * 5)) & 0x1FULL); + } + return ret; + } + + public: + + inline static ErrorState read_geometry(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version < 3) + { + CaloRecGPU::Helpers::CPU_object<GeometryArr_v1> temp(true); + if (read_from_file<GeometryArr_v1>(file, temp) != ErrorState::OK) + { + report_error(file, "reading geometry"); + return ErrorState::ReadError; + } + geo.allocate(); + for (int i = 0; i < NCaloCells; ++i) + { + geo->caloSample[i] = temp->caloSample[i]; + geo->x[i] = temp->x[i]; + geo->y[i] = temp->y[i]; + geo->z[i] = temp->z[i]; + geo->eta[i] = temp->eta[i]; + geo->phi[i] = temp->phi[i]; + geo->r[i] = std::sqrt(temp->x[i] * temp->x[i] + temp->y[i] * temp->y[i] + temp->z[i] * temp->z[i]); + geo->dx[i] = 0; + geo->dy[i] = 0; + geo->dz[i] = 0; + geo->dr[i] = 0; + geo->deta[i] = 0; + geo->dphi[i] = 0; + geo->volume[i] = 0; + //We weren't caring about these then. + geo->neighbours.total_number[i] = temp->nNeighbours[i]; + geo->neighbours.offsets[i] = 0; + for (int j = 0; j < NMaxNeighboursOld; ++j) + { + geo->neighbours.cells[j][i] = temp->neighbours[i][j]; + //We switched the order! + } + } + std::memset(&(geo->etaPhiToCell), 0, sizeof(CaloRecGPU::EtaPhiToCellMap)); + } + else if (version == 3) + { + CaloRecGPU::Helpers::CPU_object<GeometryArr_v2> temp(true); + if (read_from_file<GeometryArr_v2>(file, temp) != ErrorState::OK) + { + report_error(file, "reading geometry"); + return ErrorState::ReadError; + } + geo.allocate(); + for (int i = 0; i < NCaloCells; ++i) + { + geo->caloSample[i] = temp->caloSample[i]; + geo->x[i] = temp->x[i]; + geo->y[i] = temp->y[i]; + geo->z[i] = temp->z[i]; + geo->eta[i] = temp->eta[i]; + geo->phi[i] = temp->phi[i]; + geo->r[i] = std::sqrt(temp->x[i] * temp->x[i] + temp->y[i] * temp->y[i] + temp->z[i] * temp->z[i]); + geo->dx[i] = 0; + geo->dy[i] = 0; + geo->dz[i] = 0; + geo->dr[i] = 0; + geo->deta[i] = 0; + geo->dphi[i] = 0; + geo->volume[i] = 0; + //We weren't caring about these then. + geo->neighbours.total_number[i] = temp->nReverseNeighbours[i]; + geo->neighbours.offsets[i] = 0; + for (int j = 0; j < NMaxNeighboursOld; ++j) + { + geo->neighbours.cells[j][i] = temp->reverseNeighbours[i][j]; + //We switched the order! + } + } + std::memset(&(geo->etaPhiToCell), 0, sizeof(CaloRecGPU::EtaPhiToCellMap)); + } + else if (version == 4 || version == 5) + { + CaloRecGPU::Helpers::CPU_object<GeometryArr_v5> temp(true); + if (read_from_file<GeometryArr_v5>(file, temp) != ErrorState::OK) + { + report_error(file, "reading geometry"); + return ErrorState::ReadError; + } + geo.allocate(); + for (int i = 0; i < NCaloCells; ++i) + { + geo->caloSample[i] = temp->caloSample[i]; + geo->x[i] = temp->x[i]; + geo->y[i] = temp->y[i]; + geo->z[i] = temp->z[i]; + geo->eta[i] = temp->eta[i]; + geo->phi[i] = temp->phi[i]; + geo->r[i] = std::sqrt(temp->x[i] * temp->x[i] + temp->y[i] * temp->y[i] + temp->z[i] * temp->z[i]); + geo->dx[i] = 0; + geo->dy[i] = 0; + geo->dz[i] = 0; + geo->dr[i] = 0; + geo->deta[i] = 0; + geo->dphi[i] = 0; + //We weren't caring about these then. + + geo->volume[i] = temp->volume[i]; + geo->neighbours.total_number[i] = temp->neighbours.total_number[i]; + for (int j = 0; j < NMaxNeighboursOld; ++j) + { + geo->neighbours.cells[j][i] = temp->neighbours.cells[j][i]; + } + geo->neighbours.offsets[i] = old_to_new_offset(temp->neighbours.offsets[i]); + } + std::memset(&(geo->etaPhiToCell), 0, sizeof(CaloRecGPU::EtaPhiToCellMap)); + } + else if (version == 6) + { + std::ifstream in(file.native(), std::ios_base::binary); + geo.binary_input(in); + if (in.fail()) + { + report_error(file, "reading geometry"); + return ErrorState::ReadError; + } + in.close(); + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + } + + inline static ErrorState read_noise(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise, const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + if (version < 4) + { + CaloRecGPU::Helpers::CPU_object<GeometryArr_v1> temp(true); + if (read_from_file<GeometryArr_v1>(file, temp) != ErrorState::OK) + { + report_error(file, "reading noise"); + return ErrorState::ReadError; + } + noise.allocate(); + for (int i = 0; i < NCaloCells; ++i) + { + for (int j = 0; j < CaloRecGPU::NumGainStates; ++j) + { + noise->noise[j][i] = temp->noise[i]; + //Wrongfully assuming the same noise for all gain states, + //but that's what was being done... + } + } + } + else if (version == 4 || version == 5 || version == 6) + { + std::ifstream in(file.native(), std::ios_base::binary); + noise.binary_input(in); + if (in.fail()) + { + report_error(file, "reading noise"); + return ErrorState::ReadError; + } + in.close(); + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + } + + inline static ErrorState read_geometry_and_noise(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise, const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version < 3) + { + CaloRecGPU::Helpers::CPU_object<GeometryArr_v1> temp(true); + if (read_from_file<GeometryArr_v1>(file, temp) != ErrorState::OK) + { + report_error(file, "reading geometry and noise"); + return ErrorState::ReadError; + } + geo.allocate(); + noise.allocate(); + for (int i = 0; i < NCaloCells; ++i) + { + geo->caloSample[i] = temp->caloSample[i]; + geo->x[i] = temp->x[i]; + geo->y[i] = temp->y[i]; + geo->z[i] = temp->z[i]; + geo->eta[i] = temp->eta[i]; + geo->phi[i] = temp->phi[i]; + geo->volume[i] = 0; + //We weren't caring about volume then. + for (int j = 0; j < CaloRecGPU::NumGainStates; ++j) + { + noise->noise[j][i] = temp->noise[i]; + //Wrongfully assuming the same noise for all gain states, + //but that's what was being done... + } + geo->neighbours.total_number[i] = temp->nNeighbours[i]; + geo->neighbours.offsets[i] = 0; + for (int j = 0; j < NMaxNeighboursOld; ++j) + { + geo->neighbours.cells[j][i] = temp->neighbours[i][j]; + //We switched the order! + } + } + } + else + { + //Current (and future?) versions + //save the noise and geometry + //in separate files, hence the error. + return ErrorState::VersionError; + } + return ErrorState::OK; + } + + inline static ErrorState read_geometry(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo) + { + return read_geometry(file, geo, guess_version(file)); + } + + inline static ErrorState read_noise(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise) + { + return read_noise(file, noise, guess_version(file)); + } + + inline static ErrorState read_geometry_and_noise(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise) + { + return read_geometry_and_noise(file, geo, noise, guess_version(file)); + } + + inline static ErrorState write_geometry(boost::filesystem::path file, const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo) + { + file.replace_extension(".geometry"); + std::ofstream out(file, std::ios_base::binary); + geo.binary_output(out); + if (out.fail()) + { + report_error(file, "writing geometry"); + return ErrorState::WriteError; + } + out.close(); + return ErrorState::OK; + } + + inline static ErrorState write_noise(boost::filesystem::path file, const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise) + { + file.replace_extension(".noise"); + std::ofstream out(file, std::ios_base::binary); + noise.binary_output(out); + if (out.fail()) + { + report_error(file, "writing noise"); + return ErrorState::WriteError; + } + out.close(); + return ErrorState::OK; + } + }; + + struct EventInformation + { + friend class StandaloneDataIO; + protected: + constexpr static int NMaxNeighbours = 26; + constexpr static int NCaloCells = 187652; + + //Data files, Ademar-style .dat + struct ClusterInfoArr_v1 + { + constexpr static int NMaxClusters = 100000; + constexpr static int NClustTimers = 11; + int nClusters; + int seedTag[NCaloCells]; + int clusterSize[NMaxClusters]; + float cellSNR[NCaloCells]; + float clusterEnergy[NMaxClusters]; + float clusterEt[NMaxClusters]; + float clusterEta[NMaxClusters]; + float clusterPhi[NMaxClusters]; + float timers[NClustTimers]; + }; + + struct CellEnergyArr_v1 + { + float energy[NCaloCells]; + }; + + struct CellTagArr_v1 + { + int clusterTag[NCaloCells]; + }; + + //Data files, Ademar-style .diag + struct ClusterInfoArr_v2 + { + constexpr static int NMaxClusters = 50000; + int seedTag[NCaloCells]; + float cellE[NCaloCells]; + int nClusters; + int clusterNCells[NMaxClusters]; + float clusterEnergy[NMaxClusters]; + float clusterEt[NMaxClusters]; + float clusterEta[NMaxClusters]; + float clusterPhi[NMaxClusters]; + }; + + + struct CellInfoArr_v4 + { + float energy[NCaloCells]; + signed char gain[NCaloCells]; + }; + + inline static void cluster_tag_adjust(CaloRecGPU::tag_type & tag, const int old_tag, const int /*index*/) + { + if (old_tag < 0) + //Old way of storing had cells not part of clusters having tag -1. + { + tag = CaloRecGPU::ClusterTag::make_invalid_tag(); + } + else + { + tag = CaloRecGPU::ClusterTag::make_tag(old_tag); + } + } + + public: + inline static ErrorState read_cluster_info(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version == 1) + { + CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v1> temp(true); + if (read_from_file<ClusterInfoArr_v1>(file, temp) != ErrorState::OK) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + clusters.allocate(); + clusters->number = temp->nClusters; + for (int i = 0; i < temp->nClusters; ++i) + { + clusters->clusterEnergy[i] = temp->clusterEnergy[i]; + clusters->clusterEt[i] = temp->clusterEt[i]; + clusters->clusterEta[i] = temp->clusterEta[i]; + clusters->clusterPhi[i] = temp->clusterPhi[i]; + clusters->seedCellID[i] = -1; + //One would need to recalculate if using this for old versions... + //(In this case we could actually recalculate since we have the SNR, + // but for version 2 that's not possible, so it's best to be consistent + // and ask the user to handle it if necessary.) + } + } + else if (version == 2) + { + CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v2> temp(true); + if (read_from_file<ClusterInfoArr_v2>(file, temp) != ErrorState::OK) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + clusters.allocate(); + clusters->number = temp->nClusters; + for (int i = 0; i < temp->nClusters; ++i) + { + clusters->clusterEnergy[i] = temp->clusterEnergy[i]; + clusters->clusterEt[i] = temp->clusterEt[i]; + clusters->clusterEta[i] = temp->clusterEta[i]; + clusters->clusterPhi[i] = temp->clusterPhi[i]; + clusters->seedCellID[i] = -1; + //One would need to recalculate if using this for old versions... + } + } + else if (version == 3) + { + clusters.allocate(); + + std::ifstream in(file.native(), std::ios_base::binary); + + in.ignore(sizeof(int) * NCaloCells); + //seedTag + in.ignore(sizeof(float) * NCaloCells); + //cellE + + if (in.fail()) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + + in.read((char *) & (clusters->number), sizeof(int)); + + if (in.fail() || clusters->number < 0 || clusters->number > ClusterInfoArr_v2::NMaxClusters) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + + in.ignore(sizeof(int) * clusters->number); + //clusterNCells + + in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number); + + if (in.fail()) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + + in.close(); + + for (int i = 0; i < clusters->number; ++i) + { + clusters->seedCellID[i] = -1; + } + //One would need to recalculate if using this for old versions... + + } + else if (version == 4 || version == 5 || version == 6) + { + clusters.allocate(); + + std::ifstream in(file.native(), std::ios_base::binary); + + in.read((char *) & (clusters->number), sizeof(int)); + + if (in.fail() || clusters->number < 0) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + + in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number); + in.read((char *) clusters->seedCellID, sizeof(int) * clusters->number); + + if (in.fail()) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + + in.close(); + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + + } + + inline static ErrorState read_cell_info(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version == 6) + { + std::ifstream in(file.native(), std::ios_base::binary); + cell_info.binary_input(in); + if (in.fail()) + { + report_error(file, "reading cell info"); + return ErrorState::ReadError; + } + in.close(); + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + } + + inline static ErrorState read_cell_state(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version == 6) + { + std::ifstream in(file.native(), std::ios_base::binary); + cell_state.binary_input(in); + if (in.fail()) + { + report_error(file, "reading cell state"); + return ErrorState::ReadError; + } + in.close(); + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + } + + inline static ErrorState read_cell_info_and_state(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version == 1) + //version 1 does not have a file where one can read all the necessary info, + //only the energies, but we keep this here for easier folder reading... + { + cell_info.allocate(); + cell_state.allocate(); + CaloRecGPU::Helpers::CPU_object<CellEnergyArr_v1> temp(true); + if (read_from_file<CellEnergyArr_v1>(file, temp) != ErrorState::OK) + { + report_error(file, "reading cells"); + return ErrorState::ReadError; + } + for (int i = 0; i < NCaloCells; ++i) + { + cell_info->energy[i] = temp->energy[i]; + cell_info->gain[i] = 0; + //We don't have varying gains in this case, + //so we just assume it's constant and equal to the first type. + //(A guess as good as any...) + cell_info->time[i] = 0; + cell_info->qualityProvenance[i] = 0; + } + } + else if (version == 2) + { + CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v2> temp(true); + if (read_from_file<ClusterInfoArr_v2>(file, temp) != ErrorState::OK) + { + report_error(file, "reading cells"); + return ErrorState::ReadError; + } + cell_info.allocate(); + cell_state.allocate(); + for (int i = 0; i < NCaloCells; ++i) + { + cell_info->energy[i] = temp->cellE[i]; + cell_info->gain[i] = 0; + //We don't have varying gains in this case, + //so we just assume it's constant and equal to the first type. + //(A guess as good as any...) + + cluster_tag_adjust(cell_state->clusterTag[i], temp->seedTag[i], i); + } + } + else if (version == 3) + { + cell_info.allocate(); + cell_state.allocate(); + + CaloRecGPU::Helpers::CPU_object<CellTagArr_v1> temp(true); + + std::ifstream in(file.native(), std::ios_base::binary); + + in.read((char *) temp->clusterTag, sizeof(int) * NCaloCells); + in.read((char *) cell_info->energy, sizeof(float) * NCaloCells); + + if (in.fail()) + { + report_error(file, "reading clusters"); + return ErrorState::ReadError; + } + for (int i = 0; i < NCaloCells; ++i) + { + cell_info->gain[i] = 0; + //We don't have varying gains in this case, + //so we just assume it's constant and equal to the first type. + //(A guess as good as any...) + cell_info->time[i] = 0; + cell_info->qualityProvenance[i] = 0; + + cluster_tag_adjust(cell_state->clusterTag[i], temp->clusterTag[i], i); + } + } + else if (version == 4) + { + cell_info.allocate(); + cell_state.allocate(); + + CaloRecGPU::Helpers::CPU_object<CellInfoArr_v4> temp(true); + + std::ifstream in(file.native(), std::ios_base::binary); + temp.binary_input(in); + cell_state.binary_input(in); + + if (in.fail()) + { + report_error(file, "reading cells"); + return ErrorState::ReadError; + } + in.close(); + + for (int i = 0; i < NCaloCells; ++i) + { + cell_info->energy[i] = temp->energy[i]; + cell_info->gain[i] = temp->gain[i]; + cell_info->time[i] = 0; + cell_info->qualityProvenance[i] = 0; + + CaloRecGPU::ClusterTag tag = cell_state->clusterTag[i]; + + unsigned int weight_pattern = tag.secondary_cluster_weight(); + float weight = 0; + std::memcpy(&weight, &weight_pattern, sizeof(float)); + weight = 1.0f - weight; + //We changed the definition. + std::memcpy(&weight_pattern, &weight, sizeof(float)); + + tag = tag.override_secondary_cluster_weight(weight_pattern); + } + } + else if (version == 5) + { + std::ifstream in(file.native(), std::ios_base::binary); + cell_info.binary_input(in); + cell_state.binary_input(in); + for (int i = 0; i < NCaloCells; ++i) + { + CaloRecGPU::ClusterTag tag = cell_state->clusterTag[i]; + + unsigned int weight_pattern = tag.secondary_cluster_weight(); + float weight = 0; + std::memcpy(&weight, &weight_pattern, sizeof(float)); + weight = 1.0f - weight; + //We changed the definition. + std::memcpy(&weight_pattern, &weight, sizeof(float)); + + tag = tag.override_secondary_cluster_weight(weight_pattern); + } + if (in.fail()) + { + report_error(file, "reading cells"); + return ErrorState::ReadError; + } + in.close(); + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + + } + + + inline static ErrorState read_cell_and_cluster_info(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + const int version) + { + if (version <= 0 || version > current_version) + { + return ErrorState::VersionError; + } + else if (version == 1) + //version 1 does not have a file where one can read all the necessary info, + //since the energies are stored separately, but we keep this here for easier folder reading... + { + CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v1> temp(true); + if (read_from_file<ClusterInfoArr_v1>(file, temp) != ErrorState::OK) + { + report_error(file, "reading cells and clusters"); + return ErrorState::ReadError; + } + clusters.allocate(); + cell_state.allocate(); + cell_info.allocate(); + clusters->number = temp->nClusters; + for (int i = 0; i < temp->nClusters; ++i) + { + clusters->clusterEnergy[i] = temp->clusterEnergy[i]; + clusters->clusterEt[i] = temp->clusterEt[i]; + clusters->clusterEta[i] = temp->clusterEta[i]; + clusters->clusterPhi[i] = temp->clusterPhi[i]; + clusters->seedCellID[i] = -1; + } + for (int i = 0; i < NCaloCells; ++i) + { + cluster_tag_adjust(cell_state->clusterTag[i], temp->seedTag[i], i); + } + } + else if (version == 2) + { + CaloRecGPU::Helpers::CPU_object<ClusterInfoArr_v2> temp(true); + if (read_from_file<ClusterInfoArr_v2>(file, temp) != ErrorState::OK) + { + report_error(file, "reading cells and clusters"); + return ErrorState::ReadError; + } + clusters.allocate(); + cell_state.allocate(); + cell_info.allocate(); + + clusters->number = temp->nClusters; + for (int i = 0; i < temp->nClusters; ++i) + { + clusters->clusterEnergy[i] = temp->clusterEnergy[i]; + clusters->clusterEt[i] = temp->clusterEt[i]; + clusters->clusterEta[i] = temp->clusterEta[i]; + clusters->clusterPhi[i] = temp->clusterPhi[i]; + clusters->seedCellID[i] = -1; + } + for (int i = 0; i < NCaloCells; ++i) + { + cell_info->energy[i] = temp->cellE[i]; + cell_info->gain[i] = 0; + cluster_tag_adjust(cell_state->clusterTag[i], temp->seedTag[i], i); + } + } + else if (version == 3) + { + clusters.allocate(); + cell_info.allocate(); + cell_state.allocate(); + CaloRecGPU::Helpers::CPU_object<CellTagArr_v1> temp(true); + + std::ifstream in(file.native(), std::ios_base::binary); + + in.read((char *) temp->clusterTag, sizeof(int) * NCaloCells); + in.read((char *) cell_info->energy, sizeof(float) * NCaloCells); + + if (in.fail()) + { + report_error(file, "reading cells and clusters"); + return ErrorState::ReadError; + } + + in.read((char *) & (clusters->number), sizeof(int)); + + if (in.fail() || clusters->number < 0 || clusters->number > ClusterInfoArr_v2::NMaxClusters) + { + report_error(file, "reading cells and clusters"); + return ErrorState::ReadError; + } + + in.ignore(sizeof(int) * clusters->number); + //clusterNCells + + in.read((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterEt, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterEta, sizeof(float) * clusters->number); + in.read((char *) clusters->clusterPhi, sizeof(float) * clusters->number); + + if (in.fail()) + { + report_error(file, "reading cells and clusters"); + return ErrorState::ReadError; + } + + in.close(); + + for (int i = 0; i < clusters->number; ++i) + { + clusters->seedCellID[i] = -1; + } + + for (int i = 0; i < NCaloCells; ++i) + { + cell_info->gain[i] = 0; + //We don't have varying gains in this case, + //so we just assume it's constant and equal to the first type. + //(A guess as good as any...) + cell_info->time[i] = 0; + cell_info->qualityProvenance[i] = 0; + + cluster_tag_adjust(cell_state->clusterTag[i], temp->clusterTag[i], i); + } + } + else + { + return ErrorState::VersionError; + } + return ErrorState::OK; + } + + inline static ErrorState read_cluster_info(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters) + { + return read_cluster_info(file, clusters, guess_version(file)); + } + + inline static ErrorState read_cell_info(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info) + { + return read_cell_info(file, cell_info, guess_version(file)); + } + + inline static ErrorState read_cell_state(const boost::filesystem::path & file, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state) + { + return read_cell_state(file, cell_state, guess_version(file)); + } + + inline static ErrorState read_cell_info_and_state(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state) + { + return read_cell_info_and_state(file, cell_info, cell_state, guess_version(file)); + } + + inline static ErrorState read_cell_and_cluster_info(const boost::filesystem::path & file, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters) + { + return read_cell_and_cluster_info(file, cell_info, cell_state, clusters, guess_version(file)); + } + + inline static ErrorState write_cluster_info(boost::filesystem::path file, const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters) + { + file.replace_extension(".clusterinfo"); + std::ofstream out(file, std::ios_base::binary); + + out.write((char *) & (clusters->number), sizeof(int)); + out.write((char *) clusters->clusterEnergy, sizeof(float) * clusters->number); + out.write((char *) clusters->clusterEt, sizeof(float) * clusters->number); + out.write((char *) clusters->clusterEta, sizeof(float) * clusters->number); + out.write((char *) clusters->clusterPhi, sizeof(float) * clusters->number); + out.write((char *) clusters->seedCellID, sizeof(int) * clusters->number); + + if (out.fail()) + { + report_error(file, "writing clusters"); + return ErrorState::WriteError; + } + out.close(); + return ErrorState::OK; + } + + inline static ErrorState write_cell_info(boost::filesystem::path file, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info) + { + file.replace_extension(".cellinfo"); + std::ofstream out(file, std::ios_base::binary); + cell_info.binary_output(out); + if (out.fail()) + { + report_error(file, "writing cell info"); + return ErrorState::WriteError; + } + out.close(); + return ErrorState::OK; + } + + inline static ErrorState write_cell_state(boost::filesystem::path file, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state) + { + file.replace_extension(".cellstate"); + std::ofstream out(file, std::ios_base::binary); + cell_state.binary_output(out); + if (out.fail()) + { + report_error(file, "writing cell state"); + return ErrorState::WriteError; + } + out.close(); + return ErrorState::OK; + } + + }; + + protected: + + inline static bool create_or_check_folder(const boost::filesystem::path & folder, const bool output_errors = true) + { + if (!boost::filesystem::exists(folder)) + { + if (!boost::filesystem::create_directory(folder)) + { + if (output_errors) + { + std::cout << "ERROR: folder '" << folder << "' could not be created." << std::endl; + } + return false; + } + } + else if (!boost::filesystem::is_directory(folder)) + { + if (output_errors) + { + std::cout << "ERROR: folder '" << folder << "' is not a valid folder." << std::endl; + } + return false; + } + return true; + } + + public: + + inline static ErrorState prepare_folder_for_output(const boost::filesystem::path & folder, const bool output_errors = true) + { + if (!create_or_check_folder(folder, output_errors)) + { + return ErrorState::WriteError; + } + return ErrorState::OK; + } + + inline static std::string build_filename( const std::string & prefix, + const std::string & text, + const std::string & suffix, + const std::string & ext ) + { + return prefix + (prefix.size() > 0 ? "_" : "") + text + + (suffix.size() > 0 ? "_" : "") + suffix + "." + ext; + } + + inline static std::string build_filename( const std::string & prefix, + const size_t event_number, + const std::string & suffix, + const std::string & ext, + const unsigned int num_width = 9) + { + std::ostringstream event_ID_format; + event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; + const std::string event_ID = event_ID_format.str(); + return build_filename(prefix, event_ID, suffix, ext); + } + + + inline static ErrorState save_constants_to_folder(const boost::filesystem::path & folder, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> & geo, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> & noise, + const std::string & prefix = "", + const std::string & suffix = "", + const bool output_errors = true) + { + if (!create_or_check_folder(folder, output_errors)) + { + return ErrorState::WriteError; + } + + auto filename = [&] (const std::string & text, const std::string & ext) + { + return folder / build_filename(prefix, text, suffix, ext); + }; + + if (ConstantInformation::write_geometry(filename("geometry", "geo"), geo) != ErrorState::OK) + { + return ErrorState::WriteError; + } + if (ConstantInformation::write_noise(filename("noise", "noise"), noise) != ErrorState::OK) + { + return ErrorState::WriteError; + } + return ErrorState::OK; + } + + inline static ErrorState save_event_to_folder(const size_t event_number, + const boost::filesystem::path & folder, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + const std::string & prefix = "", + const std::string & suffix = "", + const unsigned int num_width = 9, + const bool output_errors = true) + { + if (!create_or_check_folder(folder, output_errors)) + { + return ErrorState::WriteError; + } + + std::ostringstream event_ID_format; + event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; + const std::string event_ID = event_ID_format.str(); + + auto filename = [&] (const std::string & ext) + { + return folder / build_filename(prefix, event_ID, suffix, ext); + }; + + if (EventInformation::write_cell_info(filename("cellinfo"), cell_info) != ErrorState::OK) + { + return ErrorState::WriteError; + } + if (EventInformation::write_cell_state(filename("cellstate"), cell_state) != ErrorState::OK) + { + return ErrorState::WriteError; + } + if (EventInformation::write_cluster_info(filename("clusterinfo"), clusters) != ErrorState::OK) + { + return ErrorState::WriteError; + } + return ErrorState::OK; + } + + inline static ErrorState save_cell_state_to_folder(const size_t event_number, + const boost::filesystem::path & folder, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + const std::string & prefix = "", + const std::string & suffix = "", + const unsigned int num_width = 9, + const bool output_errors = true) + { + if (!create_or_check_folder(folder, output_errors)) + { + return ErrorState::WriteError; + } + + std::ostringstream event_ID_format; + event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; + const std::string event_ID = event_ID_format.str(); + + auto filename = [&] (const std::string & ext) + { + return folder / build_filename(prefix, event_ID, suffix, ext); + }; + + if (EventInformation::write_cell_state(filename("cellstate"), cell_state) != ErrorState::OK) + { + return ErrorState::WriteError; + } + return ErrorState::OK; + } + + inline static ErrorState save_cell_info_to_folder(const size_t event_number, + const boost::filesystem::path & folder, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + const std::string & prefix = "", + const std::string & suffix = "", + const unsigned int num_width = 9, + const bool output_errors = true) + { + if (!create_or_check_folder(folder, output_errors)) + { + return ErrorState::WriteError; + } + + std::ostringstream event_ID_format; + event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; + const std::string event_ID = event_ID_format.str(); + + auto filename = [&] (const std::string & ext) + { + return folder / build_filename(prefix, event_ID, suffix, ext); + }; + + if (EventInformation::write_cell_info(filename("cellinfo"), cell_info) != ErrorState::OK) + { + return ErrorState::WriteError; + } + return ErrorState::OK; + } + + inline static ErrorState save_clusters_to_folder(const size_t event_number, + const boost::filesystem::path & folder, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + const std::string & prefix = "", + const std::string & suffix = "", + const unsigned int num_width = 9, + const bool output_errors = true) + { + if (!create_or_check_folder(folder, output_errors)) + { + return ErrorState::WriteError; + } + + std::ostringstream event_ID_format; + event_ID_format << std::setfill('0') << std::setw(num_width) << event_number; + const std::string event_ID = event_ID_format.str(); + + auto filename = [&] (const std::string & ext) + { + return folder / build_filename(prefix, event_ID, suffix, ext); + }; + + if (EventInformation::write_cluster_info(filename("clusters"), clusters) != ErrorState::OK) + { + return ErrorState::WriteError; + } + return ErrorState::OK; + } + + struct FolderLoad + { + std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr>> geometry; + std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr>> noise; + std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr>> cluster_info; + std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr>> cell_info; + std::map<std::string, CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr>> cell_state; + }; + + /*! @class FolderLoadOptions + + The members of this structure should all be initialised by default to @c false. + It is the function caller's responsibility to specify what should be loaded. + */ + struct FolderLoadOptions + { + bool load_cluster_info = false, + load_cell_state = false, + load_cell_info = false, + load_geometry = false, + load_noise = false; + + static constexpr FolderLoadOptions None() + { + FolderLoadOptions ret; + return ret; + //By design, all options are initialized as false... + } + static constexpr FolderLoadOptions All() + { + FolderLoadOptions ret{true, true, true, true, true}; + return ret; + } + }; + + + /*! @param filter_function receives a std::string (the filename), + returns `true` if the file should be filtered out. + */ + template <class F> + inline static FolderLoad load_folder_filter(F && filter_function, + //Receives a std::string (the filename), + //returns `true` if the file should be filtered out. + const boost::filesystem::path & folder, + int max_events = -1, + const FolderLoadOptions & flo = FolderLoadOptions::None(), + const bool output_messages = true) + { + FolderLoad ret; + if (!boost::filesystem::is_directory(folder)) + { + if (output_messages) + { + std::cout << "ERROR: '" << folder << "' is not a valid folder." << std::endl; + } + return ret; + } + std::set<std::string> read_one_part_of_v1_cells; + int event_count = 0; + for (const boost::filesystem::path & file : boost::filesystem::directory_iterator(folder)) + { + if ( max_events > 0 && event_count >= max_events && + ret.geometry.size() > 0 && ret.noise.size() > 0 ) + { + break; + } + + const bool can_load_events = (max_events < 0) || (event_count < max_events); + const std::string filename = file.stem().native(); + + if (filter_function(filename)) + { + continue; + } + + auto check_error = [&](const ErrorState & es, const std::string & str) + { + if (es == ErrorState::OK) + { + return false; + } + if (output_messages) + { + std::cout << "ERROR: '" << file << "' is not a valid " << str << " file (" << (int) es << ")." << std::endl; + } + return true; + }; + + auto output_loading_message = [&](const std::string & str) + { + if (output_messages) + { + std::cout << "Loaded " << str << " from '" << file << "'." << std::endl; + } + }; + + + if (file.extension() == ".geometry") + { + if (!flo.load_geometry) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> tempgeo(true); + if (check_error(ConstantInformation::read_geometry(file, tempgeo), "geometry")) + { + continue; + } + ret.geometry[filename] = std::move(tempgeo); + output_loading_message("geometry"); + } + else if (file.extension() == ".cellstate") + { + if (!flo.load_cell_state || !can_load_events) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); + if (check_error(EventInformation::read_cell_state(file, tempcellstate), "cell state")) + { + continue; + } + ret.cell_state[filename] = std::move(tempcellstate); + output_loading_message("cell state"); + if ((ret.cluster_info.count(filename) > 0 || !flo.load_cluster_info) && + (ret.cell_info.count(filename) > 0 || !flo.load_cell_info)) + { + ++event_count; + } + } + else if (file.extension() == ".cellinfo") + { + if (!flo.load_cell_info || !can_load_events) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); + if (check_error(EventInformation::read_cell_info(file, tempcellinfo), "cell info")) + { + continue; + } + ret.cell_info[filename] = std::move(tempcellinfo); + output_loading_message("cell info"); + if ((ret.cluster_info.count(filename) > 0 || !flo.load_cluster_info) && + (ret.cell_state.count(filename) > 0 || !flo.load_cell_state)) + { + ++event_count; + } + } + else if (file.extension() == ".clusterinfo") + { + if (!flo.load_cluster_info || !can_load_events) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); + if (check_error(EventInformation::read_cluster_info(file, tempclu), "cluster info")) + { + continue; + } + ret.cluster_info[filename] = std::move(tempclu); + output_loading_message("cluster info"); + if ((ret.cell_state.count(filename) > 0 || !flo.load_cell_state) && + (ret.cell_info.count(filename) > 0 || !flo.load_cell_info)) + { + ++event_count; + } + } + else if (file.extension() == ".noise") + { + if (!flo.load_noise) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> tempnois(true); + if (check_error(ConstantInformation::read_noise(file, tempnois), "noise")) + { + continue; + } + ret.noise[filename] = std::move(tempnois); + output_loading_message("noise"); + } + + //Legacy versions start now... + + else if (file.extension() == ".geo") + { + if (!flo.load_geometry) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> tempgeo(true); + if (check_error(ConstantInformation::read_geometry(file, tempgeo), "geometry")) + { + continue; + } + ret.geometry[filename] = std::move(tempgeo); + output_loading_message("geometry"); + } + else if (filename.find("geometry") != std::string::npos) + { + if (!flo.load_geometry && !flo.load_noise) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> tempgeo(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> tempnois(true); + if (check_error(ConstantInformation::read_geometry_and_noise(file, tempgeo, tempnois), "geometry and noise")) + { + continue; + } + if (flo.load_geometry) + { + ret.geometry[filename] = std::move(tempgeo); + } + if (flo.load_noise) + { + ret.noise[filename] = std::move(tempnois); + } + output_loading_message("geometry and noise"); + } + else if (file.extension() == ".clusters") + { + if (!flo.load_cluster_info || !can_load_events) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); + if (check_error(EventInformation::read_cluster_info(file, tempclu), "cluster info")) + { + continue; + } + ret.cluster_info[filename] = std::move(tempclu); + output_loading_message("cluster info"); + if ((ret.cell_state.count(filename) > 0 || !flo.load_cell_state) && + (ret.cell_info.count(filename) > 0 || !flo.load_cell_info)) + { + ++event_count; + } + } + else if (file.extension() == ".cells") + { + if (!(flo.load_cell_info || flo.load_cell_state) || !can_load_events) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); + if (check_error(EventInformation::read_cell_info_and_state(file, tempcellinfo, tempcellstate), "cell info and state")) + { + continue; + } + if (flo.load_cell_info) + { + ret.cell_info[filename] = std::move(tempcellinfo); + } + if (flo.load_cell_state) + { + ret.cell_state[filename] = std::move(tempcellstate); + } + output_loading_message("cell info and state"); + if (ret.cluster_info.count(filename) > 0 || !flo.load_cluster_info) + { + ++event_count; + } + } + else if ((file.extension() == ".diag" || file.extension() == ".abrv")) + { + if (!(flo.load_cell_info || flo.load_cell_state || flo.load_cluster_info) || !can_load_events) + { + continue; + } + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); + if (check_error(EventInformation::read_cell_and_cluster_info(file, tempcellinfo, tempcellstate, tempclu), "cells and clusters")) + { + continue; + } + if (flo.load_cell_info) + { + ret.cell_info[filename] = std::move(tempcellinfo); + } + if (flo.load_cell_state) + { + ret.cell_state[filename] = std::move(tempcellstate); + } + if (flo.load_cluster_info) + { + ret.cluster_info[filename] = std::move(tempclu); + } + if ((flo.load_cell_info || flo.load_cell_state) && flo.load_cluster_info) + { + output_loading_message("cells and clusters"); + } + else if (flo.load_cell_info || flo.load_cell_state) + { + output_loading_message("cells"); + } + else if (flo.load_cluster_info) + { + output_loading_message("clusters"); + } + ++event_count; + } + else if (file.extension() == ".dat") + { + if (!(flo.load_cell_info || flo.load_cell_state || flo.load_cluster_info) || !can_load_events) + { + continue; + } + + const auto str_starts_with = [ ](const std::string & str, const std::string & start) + { + for (size_t i = 0; i < start.size(); ++i) + { + if (str[i] != start[i]) + { + return false; + } + } + return true; + }; + + if (str_starts_with(filename, "cellData_")) + { + if (!(flo.load_cell_info || flo.load_cell_state)) + { + continue; + } + const std::string real_name = filename.substr(9); + if ( read_one_part_of_v1_cells.count(real_name) > 0 && + (ret.cell_info.count(real_name) == 0 && ret.cell_state.count(real_name) == 0) ) + { + //The other part of the event information was not properly loaded. + continue; + } + else if (read_one_part_of_v1_cells.count(real_name) > 0) + { + if (check_error(EventInformation::read_cell_info_and_state(file, ret.cell_info[real_name], ret.cell_state[real_name]), "cells")) + { + ret.cell_info.erase(real_name); + ret.cell_state.erase(real_name); + ret.cluster_info.erase(real_name); + continue; + } + ++event_count; + } + else + { + read_one_part_of_v1_cells.insert(real_name); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); + if (check_error(EventInformation::read_cell_info_and_state(file, tempcellinfo, tempcellstate), "cells")) + { + continue; + } + if (flo.load_cell_info) + { + ret.cell_info[filename] = std::move(tempcellinfo); + } + if (flo.load_cell_state) + { + ret.cell_state[filename] = std::move(tempcellstate); + } + if (flo.load_cluster_info) + { + ret.cluster_info[filename] = std::move(tempclu); + } + } + output_loading_message("partial cell data"); + } + else if (str_starts_with(filename, "clusterData_")) + { + if (!(flo.load_cell_info || flo.load_cell_state) && !flo.load_cluster_info) + { + continue; + } + const std::string real_name = filename.substr(12); + if ( read_one_part_of_v1_cells.count(real_name) > 0 && + (ret.cell_info.count(real_name) == 0 && flo.load_cell_info) && + (ret.cell_state.count(real_name) == 0 && flo.load_cell_state) ) + { + //The other part of the event information was not properly loaded. + continue; + } + else if (read_one_part_of_v1_cells.count(real_name) > 0) + { + if (check_error(EventInformation::read_cell_and_cluster_info(file, ret.cell_info[real_name], ret.cell_state[real_name], ret.cluster_info[real_name]), "cells and clusters")) + { + ret.cell_info.erase(real_name); + ret.cell_state.erase(real_name); + ret.cluster_info.erase(real_name); + continue; + } + ++event_count; + } + else + { + read_one_part_of_v1_cells.insert(real_name); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> tempcellinfo(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> tempcellstate(true); + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> tempclu(true); + if (check_error(EventInformation::read_cell_and_cluster_info(file, tempcellinfo, tempcellstate, tempclu), "cells and clusters")) + { + continue; + } + if (flo.load_cell_info) + { + ret.cell_info[filename] = std::move(tempcellinfo); + } + if (flo.load_cell_state) + { + ret.cell_state[filename] = std::move(tempcellstate); + } + if (flo.load_cluster_info) + { + ret.cluster_info[filename] = std::move(tempclu); + } + } + output_loading_message("clusters and partial cell data"); + } + else + { + if (output_messages) + { + std::cout << "ERROR: '" << file << "' does not seem to be a valid file for data input." << std::endl; + } + } + } + else if (can_load_events) + { + if (output_messages) + { + std::cout << "ERROR: '" << file << "' does not seem to be a valid file for data input." << std::endl; + } + } + } + return ret; + } + + inline static FolderLoad load_folder(const boost::filesystem::path & folder, + int max_events = -1, + const FolderLoadOptions & flo = FolderLoadOptions::None(), + const bool output_messages = true) + { + return load_folder_filter([&](const std::string &) + { + return false; + }, + folder, max_events, flo, output_messages); + } + +}; + + +#endif //CALORECGPU_STANDALONEDATAIO_H diff --git a/Calorimeter/CaloRecGPU/CaloRecGPU/TagDefinitions.h b/Calorimeter/CaloRecGPU/CaloRecGPU/TagDefinitions.h new file mode 100644 index 0000000000000000000000000000000000000000..0d6e7e7680fec53387685b435d2dee10cfce1da5 --- /dev/null +++ b/Calorimeter/CaloRecGPU/CaloRecGPU/TagDefinitions.h @@ -0,0 +1,328 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_TAGDEFINITIONS_H +#define CALORECGPU_TAGDEFINITIONS_H + +#include "BaseDefinitions.h" + +#include <cstdint> + +namespace CaloRecGPU +{ + /*! @class TagBase + The base class for marking cells as belonging to clusters. + + Currently 64-bit based: + - Most significant bit is a flag + - Next 16 bits are meant for a `uint16_t` + - Next 31 bits are meant to hold the bit pattern of + a non-negative `float` (sign bit is zero, so we ignore it) + - Next 16 bits are meant for another `uint16_t` + + The actual arrays are intended to be + of @c TagBase::carrier rather than @c TagBase, + to keep everything as native types on the GPU side. + + */ + struct TagBase + { + public: + + using carrier = unsigned long long int; + //uint64_t is unsigned long long int in CUDA. + + carrier value; + + constexpr operator carrier () const + { + return value; + } + + constexpr TagBase (const carrier v): value(v) + { + } + + constexpr TagBase & operator = (const carrier v) + { + value = v; + return (*this); + } + + protected: + + constexpr static carrier s_bit_mask = 0x8000000000000000ULL; + //0x 8000 0000 0000 0000 + + constexpr static carrier s_second_16bit_mask = 0x7FFF800000000000ULL; + //0x 7FFF 8000 0000 0000 + + constexpr static carrier s_middle_31bit_mask = 0x00007FFFFFFF0000ULL; + //0x 0000 7FFF FFFF 0000 + + constexpr static carrier s_first_16bit_mask = 0x000000000000FFFFULL; + //0x 0000 0000 0000 FFFF + + public: + + [[nodiscard]] constexpr bool get_flag() const + { + return value & s_bit_mask; + } + + [[nodiscard]] constexpr uint32_t get_second_16bit() const + //We use ints to better fit CUDA hardware. + { + carrier pre_shift = value & s_second_16bit_mask; + uint32_t ret = pre_shift >> 47; + return ret; + } + + [[nodiscard]] constexpr uint32_t get_middle_31bit() const + { + carrier pre_shift = value & s_middle_31bit_mask; + uint32_t ret = pre_shift >> 16; + return ret; + } + + [[nodiscard]] constexpr uint32_t get_first_16bit() const + //We use ints to better fit CUDA hardware. + { + uint32_t ret = value & s_first_16bit_mask; + return ret; + } + + [[nodiscard]] constexpr carrier clear_flag() const + { + return value & (~ s_bit_mask); + } + + [[nodiscard]] constexpr carrier clear_second_16bit() const + { + return value & (~ s_second_16bit_mask); + } + + [[nodiscard]] constexpr carrier clear_middle_31bit() const + { + return value & (~ s_middle_31bit_mask); + } + + [[nodiscard]] constexpr carrier clear_first_16bit() const + { + return value & (~ s_first_16bit_mask); + } + + [[nodiscard]] constexpr carrier keep_only_flag() const + { + return value & s_bit_mask; + } + + [[nodiscard]] constexpr carrier keep_only_second_16bit() const + { + return value & s_second_16bit_mask; + } + + [[nodiscard]] constexpr carrier keep_only_middle_31bit() const + { + return value & s_middle_31bit_mask; + } + + [[nodiscard]] constexpr carrier keep_only_first_16bit() const + { + return value & s_first_16bit_mask; + } + + [[nodiscard]] constexpr carrier or_flag(const bool bit) const + { + return value | (bit * s_bit_mask); + } + + [[nodiscard]] constexpr carrier or_second_16bit(const uint16_t pattern) const + //We use ints to better fit CUDA hardware. + { + carrier temp = pattern; + return value | (temp << 47); + } + + [[nodiscard]] constexpr carrier or_middle_31bit(const uint32_t pattern) const + { + carrier temp = pattern & 0x7FFFFFFFU; + //To make sure the highest bit is unset. + return value | (temp << 16); + } + + [[nodiscard]] constexpr carrier or_first_16bit(const uint16_t pattern) const + //We use ints to better fit CUDA hardware. + { + uint32_t temp = pattern; + return value | temp; + } + + [[nodiscard]] constexpr carrier override_flag(const bool bit) const + { + return (value & (~ s_bit_mask)) | (bit * s_bit_mask); + } + + [[nodiscard]] constexpr carrier override_second_16bit(const uint16_t pattern) const + //We use ints to better fit CUDA hardware. + { + const carrier temp = pattern; + return (value & (~ s_second_16bit_mask)) | (temp << 47); + } + + [[nodiscard]] constexpr carrier override_middle_31bit(const uint32_t pattern) const + { + const carrier temp = pattern & 0x7FFFFFFFU; + //To make sure the highest bit is unset. + return (value & (~ s_middle_31bit_mask)) | (temp << 16); + } + + [[nodiscard]] constexpr carrier override_first_16bit(const uint16_t pattern) const + //We use ints to better fit CUDA hardware. + { + const uint32_t temp = pattern; + return (value & (~ s_first_16bit_mask)) | temp; + } + + [[nodiscard]] static constexpr carrier make_base_tag(const uint16_t lower = 0, const uint32_t middle = 0, const uint16_t upper = 0, const bool last = false) + { + carrier ret = upper; + ret = (ret << 31) | (middle & 0x7FFFFFFFU); + ret = (ret << 16) | lower; + + ret = ret | (s_bit_mask * last); + + return ret; + } + + [[nodiscard]] static constexpr carrier make_invalid_tag() + { + return 0ULL; + } + + }; + + /*! @class ClusterTag + The class that actually expresses the cluster assignment. + Supports cells that are shared between two clusters, + storing the weight assigned to the first + (as the weight assigned to the second will be one minus that); + cells that are part of a single cluster + have that weight set to + (the bit pattern of the floating point representation of) 1. + + See @c TagBase for more details. + + + */ + struct ClusterTag : public TagBase + { + public: + + using TagBase::TagBase; + + + [[nodiscard]] static constexpr carrier make_tag(const uint16_t cluster_index = 0, const int32_t weight = 0, const uint16_t second_cluster_index = 0) + { + return make_base_tag(cluster_index, weight, second_cluster_index, true); + } + + [[nodiscard]] constexpr bool is_part_of_cluster() const + { + return this->get_flag(); + } + + [[nodiscard]] static constexpr bool is_part_of_cluster(const ClusterTag tag) + { + return tag.is_part_of_cluster(); + } + + [[nodiscard]] constexpr int32_t cluster_index() const + { + return this->get_first_16bit(); + } + + [[nodiscard]] static constexpr int32_t cluster_index(const ClusterTag tag) + { + return tag.cluster_index(); + } + + [[nodiscard]] constexpr int32_t secondary_cluster_index() const + { + return this->get_second_16bit(); + } + + [[nodiscard]] static constexpr int32_t secondary_cluster_index(const ClusterTag tag) + { + return tag.secondary_cluster_index(); + } + + [[nodiscard]] constexpr int32_t secondary_cluster_weight() const + { + return this->get_middle_31bit(); + } + + [[nodiscard]] static constexpr int32_t secondary_cluster_weight(const ClusterTag tag) + { + return tag.secondary_cluster_weight(); + } + + [[nodiscard]] constexpr bool is_shared_between_clusters() const + { + return this->is_part_of_cluster() && this->secondary_cluster_weight() > 0; + } + + [[nodiscard]] static constexpr bool is_shared_between_clusters(const ClusterTag tag) + { + return tag.is_shared_between_clusters(); + } + + [[nodiscard]] constexpr carrier set_part_of_cluster(const bool is_part = true) const + { + return this->or_flag(is_part); + } + + [[nodiscard]] constexpr carrier set_cluster_index(const int32_t index) const + { + return this->or_first_16bit(index & 0xFFFFU); + } + + [[nodiscard]] constexpr carrier set_secondary_cluster_index(const int32_t index) const + { + return this->or_second_16bit(index & 0xFFFFU); + } + + [[nodiscard]] constexpr carrier set_secondary_cluster_weight(const int32_t weight) const + { + return this->or_middle_31bit(weight); + } + + [[nodiscard]] constexpr carrier override_part_of_cluster(const bool is_part = true) const + { + + return this->override_flag(is_part); + } + + [[nodiscard]] constexpr carrier override_cluster_index(const int32_t index) const + { + return this->override_first_16bit(index & 0xFFFFU); + } + + [[nodiscard]] constexpr carrier override_secondary_cluster_index(const int32_t index) const + { + return this->override_second_16bit(index & 0xFFFFU); + } + + [[nodiscard]] constexpr carrier override_secondary_cluster_weight(const int32_t weight) const + { + return this->override_middle_31bit(weight); + } + }; + + using tag_type = TagBase::carrier; +} + +#endif diff --git a/Calorimeter/CaloRecGPU/extra/ATLAS_plots.txt b/Calorimeter/CaloRecGPU/extra/ATLAS_plots.txt deleted file mode 100644 index 84aed74d09667120b6944fa2e1dd0e2b576ed7db..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/extra/ATLAS_plots.txt +++ /dev/null @@ -1,6 +0,0 @@ -diff_num_hist|||-10.5 10.5 -1 -1 21 -unmatched_number_hist|||-0.5 5.5 -1 -1 6 -diff_cell_per_cluster||_1|0 1000 -1 -1 50 -delta_eta_hist|||-0.25 0.25 -1 -1 100 -time_invratio_histogram||_2|0 10 -1 -1 50 -time_invratio_histogram||_1|0 15 -1 -1 75 diff --git a/Calorimeter/CaloRecGPU/extra/cell_plots.txt b/Calorimeter/CaloRecGPU/extra/cell_plots.txt deleted file mode 100644 index b181f66ec9303186c273415b481b74bbb4603a0b..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/extra/cell_plots.txt +++ /dev/null @@ -1 +0,0 @@ -cell_E_dist|||-0.3 1.5 -1 -1 75 diff --git a/Calorimeter/CaloRecGPU/extra/diffs_plots.txt b/Calorimeter/CaloRecGPU/extra/diffs_plots.txt deleted file mode 100644 index 758d847040fcd7db50162504de1b219a3c79941c..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/extra/diffs_plots.txt +++ /dev/null @@ -1,39 +0,0 @@ -diff_num_hist|||-10.5 10.5 -1 -1 21 -unmatched_number_hist|||-0.5 5.5 -1 -1 6 -diff_cell_per_cluster||_1|0 1000 -1 -1 50 -diff_cell_per_cluster||_2|0 500 -1 -1 50 -diff_cell_per_cluster||_3|0 100 -1 -1 50 -diff_cell_per_cluster||_4|0 10 -1 -1 50 -diff_cell_vs_delta_phi||_1|0 1000 -1 -1 50 -diff_cell_vs_delta_phi||_2|0 500 -1 -1 50 -diff_cell_vs_delta_phi||_3|0 100 -1 -1 50 -diff_cell_vs_delta_phi||_4|0 10 -1 -1 50 -delta_eta_hist||_2|-10 10 -1 -1 100 -delta_eta_hist||_1|-0.25 0.25 -1 -1 100 -delta_phi_hist|||-3.2 3.2 -1 -1 100 -delta_phi_hist||_full|-6.3 6.3 -1 -1 100 -delta_E_hist||_1|-200 200 -1 -1 100 -delta_E_hist||_2|-100 100 -1 -1 100 -delta_E_hist||_3|-10 10 -1 -1 100 -delta_E_hist||_4|-1 1 -1 -1 100 -delta_Et_hist||_1|-20 20 -1 -1 100 -delta_Et_hist||_2|-10 10 -1 -1 100 -delta_Et_hist||_3|-1 1 -1 -1 100 -delta_Et_hist||_4|-0.1 0.1 -1 -1 100 -cluster_phi_hist|||-3.2 3.2 -1 -1 100 -cluster_phi_hist||_full|-6.3 6.3 -1 -1 100 -equal_cells_delta_phi|||-3.2 3.2 -1 -1 100 -equal_cells_delta_phi||_full|-6.3 6.3 -1 -1 100 -equal_cells_delta_phi||_1|-1.6 1.6 -1 -1 100 -equal_cells_delta_phi||_2|-0.8 0.8 -1 -1 100 -delta_phi_vs_cpu_size_hist2d||_full|-1 -1 -1 -1 50 -delta_phi_vs_cpu_size_hist2d||_1|-6.4 6.4 0 10000 50 -delta_phi_vs_cpu_size_hist2d||_2|-3.2 3.2 0 10000 50 -delta_phi_vs_cpu_size_hist2d||_3|-1.6 1.6 0 10000 50 -delta_phi_vs_gpu_size_hist2d||_full|-1 -1 -1 -1 50 -delta_phi_vs_gpu_size_hist2d||_1|-6.4 6.4 0 10000 50 -delta_phi_vs_gpu_size_hist2d||_2|-3.2 3.2 0 10000 50 -delta_phi_vs_gpu_size_hist2d||_3|-1.6 1.6 0 10000 50 -time_invratio_histogram||_2|0 10 -1 -1 50 -time_invratio_histogram||_1|0 15 -1 -1 75 -time_invratio_histogram||_0|0 20 -1 -1 75 diff --git a/Calorimeter/CaloRecGPU/python/CaloRecGPUConfigurator.py b/Calorimeter/CaloRecGPU/python/CaloRecGPUConfigurator.py index 1a04ac50910a36bed3535401bb4ba5c72d682a49..a14025214aff1519464d36d5783995815b3725e4 100644 --- a/Calorimeter/CaloRecGPU/python/CaloRecGPUConfigurator.py +++ b/Calorimeter/CaloRecGPU/python/CaloRecGPUConfigurator.py @@ -1,655 +1,685 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -from AthenaConfiguration.Enums import Format -from AthenaCommon.SystemOfUnits import MeV, ns, cm - -class CaloRecGPUConfigurator: - def __init__ (self, configFlags = None, cellsname ="AllCalo"): - self.ConfigFlags = configFlags - self.CellsName = cellsname - - self.TopoClusterSNRSeedThreshold = 4.0 - self.TopoClusterSNRGrowThreshold = 2.0 - self.TopoClusterSNRCellThreshold = 0.0 - self.TopoClusterSeedCutsInAbsE = True - self.TopoClusterNeighborCutsInAbsE = True - self.TopoClusterCellCutsInAbsE = True - - self.CalorimeterNames = ["LAREM", - "LARHEC", - "LARFCAL", - "TILE"] - self.TopoClusterSeedSamplingNames = ["PreSamplerB", "EMB1", "EMB2", "EMB3", - "PreSamplerE", "EME1", "EME2", "EME3", - "HEC0", "HEC1","HEC2", "HEC3", - "TileBar0", "TileBar1", "TileBar2", - "TileExt0", "TileExt1", "TileExt2", - "TileGap1", "TileGap2", "TileGap3", - "FCAL0", "FCAL1", "FCAL2"] - - self.NeighborOption = "super3D" - self.RestrictHECIWandFCalNeighbors = False - self.RestrictPSNeighbors = True - - if configFlags is not None: - self.SeedCutsInT = configFlags.Calo.TopoCluster.doTimeCut - self.CutOOTseed = configFlags.Calo.TopoCluster.extendTimeCut and configFlags.Calo.TopoCluster.doTimeCut - self.UseTimeCutUpperLimit = configFlags.Calo.TopoCluster.useUpperLimitForTimeCut - else: - self.SeedCutsInT = False - self.CutOOTseed = False - self.UseTimeCutUpperLimit = False - - self.TimeCutUpperLimit = 20.0 - self.TreatL1PredictedCellsAsGood = True - - self.SeedThresholdOnTAbs = 12.5 * ns - - self.CutClustersInAbsEt = True - self.ClusterEtorAbsEtCut = 0.0*MeV - - if configFlags is not None: - self.TwoGaussianNoise = configFlags.Calo.TopoCluster.doTwoGaussianNoise - else: - self.TwoGaussianNoise = False - - - self.SplitterNumberOfCellsCut = 4 - self.SplitterEnergyCut = 500 * MeV - self.SplitterSamplingNames = ["EMB2", "EMB3", - "EME2", "EME3", - "FCAL0"] - self.SplitterSecondarySamplingNames = ["EMB1","EME1", - "TileBar0","TileBar1","TileBar2", - "TileExt0","TileExt1","TileExt2", - "HEC0","HEC1","HEC2","HEC3", - "FCAL1","FCAL2"] - self.SplitterShareBorderCells = False # True - # NSF: As far as I am aware, this option does not yet work - # on the GPU implementation we currently have available... - self.EMShowerScale = 5.0 * cm - - - if configFlags is not None: - self.SplitterUseNegativeClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute - else: - self.SplitterUseNegativeClusters = False - - - self.MeasureTimes = True - self.TestGPUGrowing = False - self.TestGPUSplitting = False - self.OutputCountsToFile = False - self.OutputClustersToFile = False - self.ClustersOutputName = "Clusters" - - self.NumPreAllocatedDataHolders = 0 - - def BasicConstantDataExporterToolConf(self, name = "ConstantDataExporter"): - result=ComponentAccumulator() - ConstantDataExporter = CompFactory.BasicConstantGPUDataExporter(name) - ConstantDataExporter.MeasureTimes = False - ConstantDataExporter.TimeFileOutput = "ConstantDataExporterTimes.txt" - ConstantDataExporter.NeighborOption = self.NeighborOption - ConstantDataExporter.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors - ConstantDataExporter.RestrictPSNeighbors = self.RestrictPSNeighbors - result.setPrivateTools(ConstantDataExporter) - return result - - def BasicEventDataExporterToolConf(self, name = "EventDataExporter"): - result=ComponentAccumulator() - EventDataExporter = CompFactory.BasicEventDataGPUExporter(name) - EventDataExporter.MeasureTimes = self.MeasureTimes - EventDataExporter.TimeFileOutput = "EventDataExporterTimes.txt" - EventDataExporter.CellsName = self.CellsName - EventDataExporter.SeedCutsInT = self.SeedCutsInT - EventDataExporter.CutOOTseed = self.CutOOTseed - EventDataExporter.UseTimeCutUpperLimit = self.UseTimeCutUpperLimit - EventDataExporter.TimeCutUpperLimit = self.TimeCutUpperLimit - EventDataExporter.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold - EventDataExporter.SeedThresholdOnTAbs = self.SeedThresholdOnTAbs - EventDataExporter.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood - result.setPrivateTools(EventDataExporter) - return result - - def BasicAthenaClusterImporterToolConf(self, name = "AthenaClusterImporter"): - result=ComponentAccumulator() - AthenaClusterImporter = CompFactory.BasicGPUToAthenaImporter(name) - AthenaClusterImporter.MeasureTimes = self.MeasureTimes - AthenaClusterImporter.TimeFileOutput = "ClusterImporterTimes.txt" - AthenaClusterImporter.CellsName = self.CellsName - AthenaClusterImporter.ClusterCutsInAbsE = self.CutClustersInAbsEt - AthenaClusterImporter.ClusterEtorAbsEtCut = self.ClusterEtorAbsEtCut - result.setPrivateTools(AthenaClusterImporter) - return result - - def CaloClusterDeleterToolConf(self, name = "ClusterDeleter"): - result=ComponentAccumulator() - ClusterDeleter = CompFactory.CaloClusterDeleter(name) - result.setPrivateTools(ClusterDeleter) - return result - - def CPUOutputToolConf(self, folder, name = "CPUOutput", prefix = "", suffix = ""): - result=ComponentAccumulator() - CPUOutput = CompFactory.CaloCPUOutput(name) - CPUOutput.SavePath = folder - CPUOutput.FilePrefix = prefix - CPUOutput.FileSuffix = suffix - CPUOutput.CellsName = self.CellsName - CPUOutput.SeedCutsInT = self.SeedCutsInT - CPUOutput.CutOOTseed = self.CutOOTseed - CPUOutput.UseTimeCutUpperLimit = self.UseTimeCutUpperLimit - CPUOutput.TimeCutUpperLimit = self.TimeCutUpperLimit - CPUOutput.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold - CPUOutput.SeedThresholdOnTAbs = self.SeedThresholdOnTAbs - CPUOutput.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood - result.setPrivateTools(CPUOutput) - return result - - def GPUOutputToolConf(self, folder, name = "GPUOutput", prefix = "", suffix = ""): - result=ComponentAccumulator() - GPUOutput = CompFactory.CaloGPUOutput(name) - GPUOutput.SavePath = folder - GPUOutput.FilePrefix = prefix - GPUOutput.FileSuffix = suffix - GPUOutput.ClusterCutsInAbsE = self.CutClustersInAbsEt - GPUOutput.ClusterEtorAbsEtCut = self.ClusterEtorAbsEtCut - GPUOutput.UseSortedAndCutClusters = True - result.setPrivateTools(GPUOutput) - return result - - def ClusterInfoCalcToolConf(self, name = "GPUClusterInfoCalculator"): - result=ComponentAccumulator() - CalcTool = CompFactory.BasicGPUClusterInfoCalculator(name) - CalcTool.MeasureTimes = self.MeasureTimes - CalcTool.TimeFileOutput = name + "Times.txt" - CalcTool.NumPreAllocatedDataHolders = self.NumPreAllocatedDataHolders - result.setPrivateTools(CalcTool) - return result - - def TopoAutomatonClusteringToolConf(self, name = "TAClusterMaker"): - result=ComponentAccumulator() - # maker tools - TAClusterMaker = CompFactory.TopoAutomatonClustering(name) - - TAClusterMaker.MeasureTimes = self.MeasureTimes - TAClusterMaker.TimeFileOutput = "TopoAutomatonClusteringTimes.txt" - - TAClusterMaker.SeedSamplingNames = self.TopoClusterSeedSamplingNames - - TAClusterMaker.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold - TAClusterMaker.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold - TAClusterMaker.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold - - TAClusterMaker.SeedCutsInAbsE = self.TopoClusterSeedCutsInAbsE - TAClusterMaker.NeighborCutsInAbsE = self.TopoClusterNeighborCutsInAbsE - TAClusterMaker.CellCutsInAbsE = self.TopoClusterCellCutsInAbsE - - TAClusterMaker.TwoGaussianNoise = self.TwoGaussianNoise - - TAClusterMaker.NumPreAllocatedDataHolders = self.NumPreAllocatedDataHolders - - result.setPrivateTools(TAClusterMaker) - return result - - def DefaultTopologicalClusteringToolConf(self, name = "TopoMaker"): - result=ComponentAccumulator() - # maker tools - TopoMaker = CompFactory.CaloTopoClusterMaker(name) - - TopoMaker.CellsName = self.CellsName - TopoMaker.CalorimeterNames= self.CalorimeterNames - TopoMaker.SeedSamplingNames = self.TopoClusterSeedSamplingNames - TopoMaker.NeighborOption = self.NeighborOption - TopoMaker.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors - TopoMaker.RestrictPSNeighbors = self.RestrictPSNeighbors - TopoMaker.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold - TopoMaker.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold - TopoMaker.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold - - TopoMaker.SeedCutsInT = self.SeedCutsInT - TopoMaker.CutOOTseed = self.CutOOTseed - TopoMaker.UseTimeCutUpperLimit = self.UseTimeCutUpperLimit - TopoMaker.TimeCutUpperLimit = self.TimeCutUpperLimit - - TopoMaker.ClusterEtorAbsEtCut = self.ClusterEtorAbsEtCut - TopoMaker.TwoGaussianNoise = self.TwoGaussianNoise - TopoMaker.SeedCutsInAbsE = self.TopoClusterSeedCutsInAbsE - TopoMaker.NeighborCutsInAbsE = self.TopoClusterNeighborCutsInAbsE - TopoMaker.CellCutsInAbsE = self.TopoClusterCellCutsInAbsE - TopoMaker.SeedThresholdOnTAbs = self.SeedThresholdOnTAbs - - TopoMaker.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood - result.setPrivateTools(TopoMaker) - return result - - - def GPUClusterSplitterToolConf(self, name = "GPUClusterSplitter"): - result=ComponentAccumulator() - # maker tools - Splitter = CompFactory.CaloTopoClusterSplitterGPU(name) - - Splitter.MeasureTimes = self.MeasureTimes - Splitter.TimeFileOutput = "ClusterSplitterTimes.txt" - - Splitter.NumberOfCellsCut = self.SplitterNumberOfCellsCut - Splitter.EnergyCut = self.SplitterEnergyCut - Splitter.SamplingNames = self.SplitterSamplingNames - Splitter.SecondarySamplingNames = self.SplitterSecondarySamplingNames - Splitter.ShareBorderCells = self.SplitterShareBorderCells - Splitter.EMShowerScale = self.EMShowerScale - Splitter.WeightingOfNegClusters = self.SplitterUseNegativeClusters - - Splitter.NumPreAllocatedDataHolders = self.NumPreAllocatedDataHolders - - result.setPrivateTools(Splitter) - return result - - def DefaultClusterSplittingToolConf(self, name = "TopoSplitter"): - result=ComponentAccumulator() - # maker tools - TopoSplitter = CompFactory.CaloTopoClusterSplitter(name) - - - TopoSplitter.NeighborOption = self.NeighborOption - TopoSplitter.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors - - TopoSplitter.NumberOfCellsCut = self.SplitterNumberOfCellsCut - TopoSplitter.EnergyCut = self.SplitterEnergyCut - - TopoSplitter.SamplingNames = self.SplitterSamplingNames - TopoSplitter.SecondarySamplingNames = self.SplitterSecondarySamplingNames - - TopoSplitter.ShareBorderCells = self.SplitterShareBorderCells - TopoSplitter.EMShowerScale = self.EMShowerScale - - TopoSplitter.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood - - TopoSplitter.WeightingOfNegClusters = self.SplitterUseNegativeClusters - - result.setPrivateTools(TopoSplitter) - return result - - - def CellsCounterCPUToolConf(self, folder, name = "CPUCounts", prefix = "CPU", suffix = ""): - result=ComponentAccumulator() - CPUCount = CompFactory.CaloCellsCounterCPU(name) - CPUCount.SavePath = folder - CPUCount.FilePrefix = prefix - CPUCount.FileSuffix = suffix - CPUCount.CellsName = self.CellsName - CPUCount.SeedCutsInT = self.SeedCutsInT - CPUCount.CutOOTseed = self.CutOOTseed - CPUCount.UseTimeCutUpperLimit = self.UseTimeCutUpperLimit - CPUCount.TimeCutUpperLimit = self.TimeCutUpperLimit - - CPUCount.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold - CPUCount.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold - CPUCount.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold - - CPUCount.SeedThresholdOnTAbs = self.SeedThresholdOnTAbs - CPUCount.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood - - result.setPrivateTools(CPUCount) - return result - - def CellsCounterGPUToolConf(self, folder, name = "GPUCounts", prefix = "GPU", suffix = ""): - result=ComponentAccumulator() - GPUCount = CompFactory.CaloCellsCounterGPU(name) - GPUCount.SavePath = folder - GPUCount.FilePrefix = prefix - GPUCount.FileSuffix = suffix - - GPUCount.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold - GPUCount.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold - GPUCount.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold - - result.setPrivateTools(GPUCount) - return result - - - - - def DefaultCaloCellMakerConf(self): - from LArCellRec.LArCellBuilderConfig import LArCellBuilderCfg,LArCellCorrectorCfg - from TileRecUtils.TileCellBuilderConfig import TileCellBuilderCfg - from CaloCellCorrection.CaloCellCorrectionConfig import CaloCellPedestalCorrCfg, CaloCellNeighborsAverageCorrCfg, CaloCellTimeCorrCfg, CaloEnergyRescalerCfg - result=ComponentAccumulator() - - from LArGeoAlgsNV.LArGMConfig import LArGMCfg - from TileGeoModel.TileGMConfig import TileGMCfg - - result.merge(LArGMCfg(self.ConfigFlags)) - result.merge(TileGMCfg(self.ConfigFlags)) - - larCellBuilder = result.popToolsAndMerge(LArCellBuilderCfg(self.ConfigFlags)) - larCellCorrectors = result.popToolsAndMerge(LArCellCorrectorCfg(self.ConfigFlags)) - tileCellBuilder = result.popToolsAndMerge(TileCellBuilderCfg(self.ConfigFlags)) - cellFinalizer = CompFactory.CaloCellContainerFinalizerTool() - - cellMakerTools=[larCellBuilder,tileCellBuilder,cellFinalizer]+larCellCorrectors - - #Add corrections tools that are not LAr or Tile specific: - if self.ConfigFlags.Calo.Cell.doPileupOffsetBCIDCorr or self.ConfigFlags.Cell.doPedestalCorr: - theCaloCellPedestalCorr=CaloCellPedestalCorrCfg(self.ConfigFlags) - cellMakerTools.append(result.popToolsAndMerge(theCaloCellPedestalCorr)) - - #LAr HV scale corr must come after pedestal corr - if self.ConfigFlags.LAr.doHVCorr: - from LArCellRec.LArCellBuilderConfig import LArHVCellContCorrCfg - theLArHVCellContCorr=LArHVCellContCorrCfg(self.ConfigFlags) - cellMakerTools.append(result.popToolsAndMerge(theLArHVCellContCorr)) - - - if self.ConfigFlags.Calo.Cell.doDeadCellCorr: - theCaloCellNeighborAvg=CaloCellNeighborsAverageCorrCfg(self.ConfigFlags) - cellMakerTools.append(result.popToolsAndMerge(theCaloCellNeighborAvg)) - - if self.ConfigFlags.Calo.Cell.doEnergyCorr: - theCaloCellEnergyRescaler=CaloEnergyRescalerCfg(self.ConfigFlags) - cellMakerTools.append(result.popToolsAndMerge(theCaloCellEnergyRescaler)) - if self.ConfigFlags.Calo.Cell.doTimeCorr: - theCaloTimeCorr=CaloCellTimeCorrCfg(self.ConfigFlags) - cellMakerTools.append(result.popToolsAndMerge(theCaloTimeCorr)) - - - #Old Config: - #CaloCellMakerToolNames': PrivateToolHandleArray(['LArCellBuilderFromLArRawChannelTool/LArCellBuilderFromLArRawChannelTool','TileCellBuilder/TileCellBuilder','CaloCellContainerFinalizerTool/CaloCellContainerFinalizerTool','LArCellNoiseMaskingTool/LArCellNoiseMaskingTool','CaloCellPedestalCorr/CaloCellPedestalCorr','CaloCellNeighborsAverageCorr/CaloCellNeighborsAverageCorr','CaloCellContainerCheckerTool/CaloCellContainerCheckerTool']), - - print(cellMakerTools) - - cellAlgo=CompFactory.CaloCellMaker(CaloCellMakerToolNames = cellMakerTools, - CaloCellsOutputName = self.CellsName) - result.addEventAlgo(cellAlgo,primary=False) - return result - - - def StandardConfigurationPreClusterAlgorithmsConf(self, clustersname = None): - doLCCalib = self.ConfigFlags.Calo.TopoCluster.doTopoClusterLocalCalib - - if clustersname is None: - clustersname = "CaloCalTopoClusters" if doLCCalib else "CaloTopoClusters" - - if clustersname=="CaloTopoClusters" and doLCCalib is True: - raise RuntimeError("Inconistent arguments: Name must not be 'CaloTopoClusters' if doLCCalib is True") - - self.ClustersOutputName = clustersname - - result=ComponentAccumulator() - - if self.ConfigFlags.Input.Format is Format.BS: - #Data-case: Schedule ByteStream reading for LAr & Tile - from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - result.merge(LArRawDataReadingCfg(self.ConfigFlags)) - - from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg - - result.merge(ByteStreamReadCfg(self.ConfigFlags,type_names=['TileDigitsContainer/TileDigitsCnt', - 'TileRawChannelContainer/TileRawChannelCnt', - 'TileMuonReceiverContainer/TileMuRcvCnt'])) - result.getService("ByteStreamCnvSvc").ROD2ROBmap=["-1"] - if self.ConfigFlags.Output.doWriteESD: - from TileRecAlgs.TileDigitsFilterConfig import TileDigitsFilterOutputCfg - result.merge(TileDigitsFilterOutputCfg(self.ConfigFlags)) - else: #Mostly for wrapping in RecExCommon - from TileRecAlgs.TileDigitsFilterConfig import TileDigitsFilterCfg - result.merge(TileDigitsFilterCfg(self.ConfigFlags)) - - from LArROD.LArRawChannelBuilderAlgConfig import LArRawChannelBuilderAlgCfg - result.merge(LArRawChannelBuilderAlgCfg(self.ConfigFlags)) - - from TileRecUtils.TileRawChannelMakerConfig import TileRawChannelMakerCfg - result.merge(TileRawChannelMakerCfg(self.ConfigFlags)) - - if not self.ConfigFlags.Input.isMC and not self.ConfigFlags.Common.isOnline: - from LArCellRec.LArTimeVetoAlgConfig import LArTimeVetoAlgCfg - result.merge(LArTimeVetoAlgCfg(self.ConfigFlags)) - - if not self.ConfigFlags.Input.isMC and not self.ConfigFlags.Overlay.DataOverlay: - from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg - result.merge(LArFebErrorSummaryMakerCfg(self.ConfigFlags)) - - if self.ConfigFlags.Input.Format is Format.BS or 'StreamRDO' in self.ConfigFlags.Input.ProcessingTags: - result.merge(self.DefaultCaloCellMakerConf()) - - from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg - - # Schedule total noise cond alg - result.merge(CaloNoiseCondAlgCfg(self.ConfigFlags,"totalNoise")) - # Schedule electronic noise cond alg (needed for LC weights) - result.merge(CaloNoiseCondAlgCfg(self.ConfigFlags,"electronicNoise")) - return result - - def HybridClusterProcessorConf(self, clustersname=None): - result = self.StandardConfigurationPreClusterAlgorithmsConf(clustersname) - - HybridClusterProcessor = CompFactory.CaloGPUHybridClusterProcessor("HybridClusterProcessor") - HybridClusterProcessor.ClustersOutputName = self.ClustersOutputName - HybridClusterProcessor.MeasureTimes = self.MeasureTimes - HybridClusterProcessor.TimeFileOutput = "GlobalTimes.txt" - HybridClusterProcessor.DeferConstantDataPreparationToFirstEvent = True - - HybridClusterProcessor.NumPreAllocatedDataHolders = self.NumPreAllocatedDataHolders - - from LArGeoAlgsNV.LArGMConfig import LArGMCfg - from TileGeoModel.TileGMConfig import TileGMCfg - - result.merge(LArGMCfg(self.ConfigFlags)) - result.merge(TileGMCfg(self.ConfigFlags)) - - ConstantDataExporter = result.popToolsAndMerge( self.BasicConstantDataExporterToolConf() ) - EventDataExporter = result.popToolsAndMerge( self.BasicEventDataExporterToolConf() ) - AthenaClusterImporter = result.popToolsAndMerge( self.BasicAthenaClusterImporterToolConf() ) - - HybridClusterProcessor.ConstantDataToGPUTool = ConstantDataExporter - HybridClusterProcessor.EventDataToGPUTool = EventDataExporter - HybridClusterProcessor.GPUToEventDataTool = AthenaClusterImporter - - HybridClusterProcessor.BeforeGPUTools = [] - - if self.TestGPUGrowing or self.TestGPUSplitting: - DefaultClustering = result.popToolsAndMerge( self.DefaultTopologicalClusteringToolConf("DefaultGrowing") ) - - HybridClusterProcessor.BeforeGPUTools += [DefaultClustering] - - if self.TestGPUGrowing: - if self.OutputCountsToFile: - CPUCount1 = result.popToolsAndMerge( self.CellsCounterCPUToolConf("./counts", "DefaultGrowCounter", "default_grow") ) - HybridClusterProcessor.BeforeGPUTools += [CPUCount1] - if self.OutputClustersToFile: - CPUOut1 = result.popToolsAndMerge( self.CPUOutputToolConf("./val_default_grow", "DefaultGrowOutput") ) - HybridClusterProcessor.BeforeGPUTools += [CPUOut1] - - - if self.TestGPUSplitting: - FirstSplitter = result.popToolsAndMerge( self.DefaultClusterSplittingToolConf("DefaultSplitting") ) - HybridClusterProcessor.BeforeGPUTools += [FirstSplitter] - - if self.OutputCountsToFile: - CPUCount2 = result.popToolsAndMerge( self.CellsCounterCPUToolConf("./counts", "DefaultGrowAndSplitCounter", "default_grow_split") ) - HybridClusterProcessor.BeforeGPUTools += [CPUCount2] - if self.OutputClustersToFile: - CPUOut2 = result.popToolsAndMerge( self.CPUOutputToolConf("./val_default_grow_split", "DefaultSplitOutput") ) - HybridClusterProcessor.BeforeGPUTools += [CPUOut2] - - if self.TestGPUGrowing: - Deleter = result.popToolsAndMerge( self.CaloClusterDeleterToolConf()) - HybridClusterProcessor.BeforeGPUTools += [Deleter] - if self.TestGPUSplitting: - SecondDefaultClustering = result.popToolsAndMerge( self.DefaultTopologicalClusteringToolConf("SecondDefaultGrowing") ) - HybridClusterProcessor.BeforeGPUTools += [SecondDefaultClustering] - - HybridClusterProcessor.GPUTools = [] - - if self.TestGPUSplitting: - if not self.TestGPUGrowing: - GPUClusterSplitting1 = result.popToolsAndMerge( self.GPUClusterSplitterToolConf("GPUSplitter")) - HybridClusterProcessor.GPUTools += [GPUClusterSplitting1] - PropCalc1 = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("PropCalcPostSplitting")) - HybridClusterProcessor.GPUTools += [PropCalc1] - else: - GPUClusterSplitting1 = result.popToolsAndMerge( self.GPUClusterSplitterToolConf("FirstGPUSplitter")) - GPUClusterSplitting1.TimeFileOutput = "ignore.txt" #Not the most elegant solution, but... - HybridClusterProcessor.GPUTools += [GPUClusterSplitting1] - PropCalc1 = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("PropCalc1")) - PropCalc1.TimeFileOutput = "ignore.txt" #Not the most elegant solution, but... - HybridClusterProcessor.GPUTools += [PropCalc1] - - if self.OutputCountsToFile: - GPUCount1 = result.popToolsAndMerge( self.CellsCounterGPUToolConf("./counts", "DefaultGrowModifiedSplitCounter", "default_grow_modified_split") ) - HybridClusterProcessor.GPUTools += [GPUCount1] - if self.OutputClustersToFile: - GPUOut1 = result.popToolsAndMerge( self.GPUOutputToolConf("./val_default_grow_modified_split", "DefaultGrowModifiedSplitOutput") ) - HybridClusterProcessor.GPUTools += [GPUOut1] - - - if self.TestGPUGrowing: - TopoAutomatonClustering1 = result.popToolsAndMerge( self.TopoAutomatonClusteringToolConf("GPUGrowing")) - HybridClusterProcessor.GPUTools += [TopoAutomatonClustering1] - - PropCalc2 = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("PropCalcPostGrowing")) - HybridClusterProcessor.GPUTools += [PropCalc2] - if self.OutputCountsToFile: - GPUCount2 = result.popToolsAndMerge( self.CellsCounterGPUToolConf("./counts", "ModifiedGrowCounter", "modified_grow") ) - HybridClusterProcessor.GPUTools += [GPUCount2] - if self.OutputClustersToFile: - GPUOut2 = result.popToolsAndMerge( self.GPUOutputToolConf("./val_modified_grow", "ModifiedGrowOutput") ) - HybridClusterProcessor.GPUTools += [GPUOut2] - - if self.TestGPUGrowing and self.TestGPUSplitting: - GPUClusterSplitting2 = result.popToolsAndMerge( self.GPUClusterSplitterToolConf("GPUSplitter")) - HybridClusterProcessor.GPUTools += [GPUClusterSplitting2] - - PropCalc3 = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("PropCalcPostSplitting")) - HybridClusterProcessor.GPUTools += [PropCalc3] - - if self.OutputCountsToFile: - GPUCount3 = result.popToolsAndMerge( self.CellsCounterGPUToolConf("./counts", "ModifiedGrowSplitCounter", "modified_grow_split") ) - HybridClusterProcessor.GPUTools += [GPUCount3] - if self.OutputClustersToFile: - GPUOut3 = result.popToolsAndMerge( self.GPUOutputToolConf("./val_modified_grow_split", "ModifiedGrowSplitOutput") ) - HybridClusterProcessor.GPUTools += [GPUOut3] - - TopoAutomatonClustering2 = result.popToolsAndMerge( self.TopoAutomatonClusteringToolConf("SecondGPUGrowing")) - TopoAutomatonClustering2.TimeFileOutput = "ignore.txt" #Not the most elegant solution, but... - HybridClusterProcessor.GPUTools += [TopoAutomatonClustering2] - - PropCalc4 = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("PropCalc4")) - PropCalc4.TimeFileOutput = "ignore.txt" #Not the most elegant solution, but... - HybridClusterProcessor.GPUTools += [PropCalc4] - - if not (self.TestGPUGrowing or self.TestGPUSplitting): - TopoAutomatonClusteringDef = result.popToolsAndMerge( self.TopoAutomatonClusteringToolConf("TopoAutomatonClustering")) - HybridClusterProcessor.GPUTools += [TopoAutomatonClusteringDef] - - GPUClusterSplittingDef = result.popToolsAndMerge( self.GPUClusterSplitterToolConf("GPUTopoSplitter")) - HybridClusterProcessor.GPUTools += [GPUClusterSplittingDef] - - PropCalcDef = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("GPUClusterPropertiesCalculator")) - HybridClusterProcessor.GPUTools += [PropCalcDef] - - - - HybridClusterProcessor.AfterGPUTools = [] - - if self.TestGPUGrowing: - - TopoSplitter = result.popToolsAndMerge( self.DefaultClusterSplittingToolConf() ) - HybridClusterProcessor.AfterGPUTools += [TopoSplitter] - - if self.TestGPUSplitting: - if self.OutputCountsToFile: - CPUCount3 = result.popToolsAndMerge( self.CellsCounterCPUToolConf("./counts", "ModifiedGrowDefaultSplitCounter", "modified_grow_default_split") ) - HybridClusterProcessor.AfterGPUTools += [CPUCount3] - if self.OutputClustersToFile: - CPUOut3 = result.popToolsAndMerge( self.CPUOutputToolConf("./val_modified_grow_default_split", "ModifiedGrowDefaultSplitOutput") ) - HybridClusterProcessor.AfterGPUTools += [CPUOut3] - - - from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg - caloBadChanTool = result.popToolsAndMerge( CaloBadChanToolCfg(self.ConfigFlags) ) - CaloClusterBadChannelList=CompFactory.CaloClusterBadChannelList - BadChannelListCorr = CaloClusterBadChannelList(badChannelTool = caloBadChanTool) - HybridClusterProcessor.AfterGPUTools += [BadChannelListCorr] - - from CaloRec.CaloTopoClusterConfig import getTopoMoments - - momentsMaker=result.popToolsAndMerge(getTopoMoments(self.ConfigFlags)) - HybridClusterProcessor.AfterGPUTools += [momentsMaker] - - if self.ConfigFlags.Calo.TopoCluster.doTopoClusterLocalCalib: - #Took out CaloClusterSnapshot that wanted to be a part of a CaloClusterMaker. - #Possibly change in the future? - from CaloRec.CaloTopoClusterConfig import getTopoClusterLocalCalibTools - HybridClusterProcessor.AfterGPUTools += getTopoClusterLocalCalibTools(self.ConfigFlags) - - from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg - result.merge(caloTopoCoolFolderCfg(self.ConfigFlags)) - - result.addEventAlgo(HybridClusterProcessor,primary=True) - - return result - - - def PrepareTest(self, default_files): - - import argparse - - parser = argparse.ArgumentParser() - - parser.add_argument('-events','--numevents', default = 10) - parser.add_argument('-threads','--numthreads', default = 1) - parser.add_argument('-f','--files', action = 'extend', nargs = '*') - parser.add_argument('-t','--measuretimes', action = 'store_true') - parser.add_argument('-o','--outputclusters', action = 'store_true') - parser.add_argument('-c','--outputcounts', action = 'store_true') - - args = parser.parse_args() - - from AthenaConfiguration.AllConfigFlags import ConfigFlags - - if args.files is None: - ConfigFlags.Input.Files = default_files - elif len(args.files) == 0: - ConfigFlags.Input.Files = default_files - elif len(args.files) == 1: - if args.files[0] == 'default': - ConfigFlags.Input.Files = default_files - elif args.files[0] == 'ttbar': - ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000001.pool.root.1", - "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000002.pool.root.1", - "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000003.pool.root.1" ] - - elif args.files[0] == 'jets': - ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigEgammaValidation/valid3.147917.Pythia8_AU2CT10_jetjet_JZ7W.recon.RDO.e3099_s2578_r6596_tid05293007_00/RDO.05293007._000001.pool.root.1"] - else: - ConfigFlags.Input.Files = args.files - else: - ConfigFlags.Input.Files = args.files - - #ConfigFlags.Input.Files = defaultTestFiles.RDO_RUN2 - ConfigFlags.Concurrency.NumThreads = int(args.numthreads) - ConfigFlags.Concurrency.NumConcurrentEvents = int(args.numthreads) - #This is to ensure the measurments are multi-threaded in the way we expect, I guess? - ConfigFlags.lock() - - self.ConfigFlags = ConfigFlags - - from AthenaConfiguration.MainServicesConfig import MainServicesCfg - from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - - cfg=MainServicesCfg(ConfigFlags) - cfg.merge(PoolReadCfg(ConfigFlags)) - - self.MeasureTimes = args.measuretimes - self.OutputClustersToFile = args.outputclusters - self.OutputCountsToFile = args.outputcounts - - #self.NumPreAllocatedDataHolders = int(args.numthreads) - - if 'StreamRDO' in self.ConfigFlags.Input.ProcessingTags: - cfg.addEventAlgo(CompFactory.xAODMaker.EventInfoCnvAlg(),sequenceName="AthAlgSeq") - - return (cfg, int(args.numevents)) +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaCommon.SystemOfUnits import MeV, ns, cm, deg + +def SingleToolToPlot(tool_name, prefix): + return (tool_name, prefix) + +def ComparedToolsToPlot(tool_ref, tool_test, prefix, match_in_energy = False): + return (tool_ref, tool_test, prefix, match_in_energy) + +def MatchingOptions(min_similarity = 0.50, terminal_weight = 250., grow_weight = 500., seed_weight = 1000.): + return (min_similarity, terminal_weight, grow_weight, seed_weight) + +class CaloRecGPUConfigurator: + def __init__ (self, configFlags = None, cellsname ="AllCalo"): + self.ConfigFlags = configFlags + self.CellsName = cellsname + + self.TopoClusterSNRSeedThreshold = 4.0 + self.TopoClusterSNRGrowThreshold = 2.0 + self.TopoClusterSNRCellThreshold = 0.0 + self.ClusterSize = "Topo_420" + + self.TopoClusterSeedCutsInAbsE = True + self.TopoClusterNeighborCutsInAbsE = True + self.TopoClusterCellCutsInAbsE = True + + self.CalorimeterNames = ["LAREM", + "LARHEC", + "LARFCAL", + "TILE"] + self.TopoClusterSeedSamplingNames = ["PreSamplerB", "EMB1", "EMB2", "EMB3", + "PreSamplerE", "EME1", "EME2", "EME3", + "HEC0", "HEC1","HEC2", "HEC3", + "TileBar0", "TileBar1", "TileBar2", + "TileExt0", "TileExt1", "TileExt2", + "TileGap1", "TileGap2", "TileGap3", + "FCAL0", "FCAL1", "FCAL2"] + + self.NeighborOption = "super3D" + self.RestrictHECIWandFCalNeighbors = False + self.RestrictPSNeighbors = True + self.AlsoRestrictPSOnGPUSplitter = False + #This is to override vanilla behaviour with the possibility of also + #restricting neighbours in out GPU splitter. + + if configFlags is not None: + self.SeedCutsInT = configFlags.Calo.TopoCluster.doTimeCut + self.CutOOTseed = configFlags.Calo.TopoCluster.extendTimeCut and configFlags.Calo.TopoCluster.doTimeCut + self.UseTimeCutUpperLimit = configFlags.Calo.TopoCluster.useUpperLimitForTimeCut + else: + self.SeedCutsInT = False + self.CutOOTseed = False + self.UseTimeCutUpperLimit = False + + self.TimeCutUpperLimit = 20.0 + self.TreatL1PredictedCellsAsGood = True + + self.SeedThresholdOnTAbs = 12.5 * ns + + self.CutClustersInAbsEt = None + self.ClusterEtorAbsEtCut = -1e-16*MeV + + #Since we (by default) use absolute values, + #a cut off of 0 MeV could mean some clusters + #where the cells have just the right combination + #of energies could sum down to 0 on one side (CPU/GPU) + #and not on the other. This is actually valid + #for any threshold, but this way we accept all clusters... + + if configFlags is not None: + self.TwoGaussianNoise = configFlags.Calo.TopoCluster.doTwoGaussianNoise + else: + self.TwoGaussianNoise = False + + + self.SplitterNumberOfCellsCut = 4 + self.SplitterEnergyCut = 500 * MeV + self.SplitterSamplingNames = ["EMB2", "EMB3", + "EME2", "EME3", + "FCAL0"] + self.SplitterSecondarySamplingNames = ["EMB1","EME1", + "TileBar0","TileBar1","TileBar2", + "TileExt0","TileExt1","TileExt2", + "HEC0","HEC1","HEC2","HEC3", + "FCAL1","FCAL2"] + self.SplitterShareBorderCells = True + + self.EMShowerScale = 5.0 * cm + + if configFlags is not None: + self.SplitterUseNegativeClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute + else: + self.SplitterUseNegativeClusters = False + + if configFlags is not None: + self.UseAbsEnergyMoments = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute + else: + self.UseAbsEnergyMoments = False + + self.MomentsMaxAxisAngle = 20 * deg + + self.MomentsMinBadLArQuality = 4000 + + self.MomentsToCalculate = [ "FIRST_PHI", + "FIRST_ETA", + "SECOND_R", + "SECOND_LAMBDA", + "DELTA_PHI", + "DELTA_THETA", + "DELTA_ALPHA", + "CENTER_X", + "CENTER_Y", + "CENTER_Z", + "CENTER_MAG", + "CENTER_LAMBDA", + "LATERAL", + "LONGITUDINAL", + "ENG_FRAC_EM", + "ENG_FRAC_MAX", + "ENG_FRAC_CORE", + "FIRST_ENG_DENS", + "SECOND_ENG_DENS", + "ISOLATION", + "ENG_BAD_CELLS", + "N_BAD_CELLS", + "N_BAD_CELLS_CORR", + "BAD_CELLS_CORR_E", + "BADLARQ_FRAC", + "ENG_POS", + "SIGNIFICANCE", + "CELL_SIGNIFICANCE", + "CELL_SIG_SAMPLING", + "AVG_LAR_Q", + "AVG_TILE_Q", + "PTD", + "MASS", + "SECOND_TIME", + "NCELL_SAMPLING" ] + + self.MomentsMinRLateral = 4 * cm + self.MomentsMinLLongitudinal = 10 * cm + + if configFlags is not None: + if not configFlags.Common.isOnline: + self.MomentsToCalculate += ["ENG_BAD_HV_CELLS", + "N_BAD_HV_CELLS" ] + + self.ClustersOutputName = "Clusters" + + self.MeasureTimes = False + self.OutputCountsToFile = False + self.OutputClustersToFile = False + + self.DoMonitoring = False + + self.NumPreAllocatedDataHolders = 0 + + self.FillMissingCells = True + #We want a full (and ordered) cell container + #to get to the fast path. + + self.MissingCellsToFill = [] + + self.UseOriginalCriteria = False + #If True, use the original criteria + #(which disagree with the GPU implementation) + + def BasicConstantDataExporterToolConf(self, name = "ConstantDataExporter"): + result=ComponentAccumulator() + ConstantDataExporter = CompFactory.BasicConstantGPUDataExporter(name) + ConstantDataExporter.MeasureTimes = False + ConstantDataExporter.TimeFileOutput = "ConstantDataExporterTimes.txt" + result.setPrivateTools(ConstantDataExporter) + return result + + def BasicEventDataExporterToolConf(self, name = "EventDataExporter"): + result=ComponentAccumulator() + EventDataExporter = CompFactory.BasicEventDataGPUExporter(name) + EventDataExporter.MeasureTimes = self.MeasureTimes + EventDataExporter.TimeFileOutput = "EventDataExporterTimes.txt" + EventDataExporter.CellsName = self.CellsName + if self.FillMissingCells: + EventDataExporter.MissingCellsToFill = self.MissingCellsToFill + result.setPrivateTools(EventDataExporter) + return result + + def BasicAthenaClusterImporterToolConf(self, name = "AthenaClusterImporter"): + result=ComponentAccumulator() + AthenaClusterImporter = CompFactory.BasicGPUToAthenaImporter(name) + AthenaClusterImporter.MeasureTimes = self.MeasureTimes + AthenaClusterImporter.TimeFileOutput = "ClusterImporterTimes.txt" + AthenaClusterImporter.CellsName = self.CellsName + AthenaClusterImporter.ClusterSize = self.ClusterSize + if self.FillMissingCells: + AthenaClusterImporter.MissingCellsToFill = self.MissingCellsToFill + result.setPrivateTools(AthenaClusterImporter) + return result + + def CaloClusterDeleterToolConf(self, name = "ClusterDeleter"): + result=ComponentAccumulator() + ClusterDeleter = CompFactory.CaloClusterDeleter(name) + result.setPrivateTools(ClusterDeleter) + return result + + def CPUOutputToolConf(self, folder = "output", name = "CPUOutput", prefix = "", suffix = ""): + result=ComponentAccumulator() + CPUOutput = CompFactory.CaloCPUOutput(name) + CPUOutput.SavePath = folder + CPUOutput.FilePrefix = prefix + CPUOutput.FileSuffix = suffix + CPUOutput.CellsName = self.CellsName + result.setPrivateTools(CPUOutput) + return result + + def GPUOutputToolConf(self, folder = "output", name = "GPUOutput", prefix = "", suffix = "", OnlyOutputCells = None): + result=ComponentAccumulator() + GPUOutput = CompFactory.CaloGPUOutput(name) + GPUOutput.SavePath = folder + GPUOutput.FilePrefix = prefix + GPUOutput.FileSuffix = suffix + GPUOutput.UseSortedAndCutClusters = True + if OnlyOutputCells is not None: + GPUOutput.OnlyOutputCellInfo = OnlyOutputCells + result.setPrivateTools(GPUOutput) + return result + + def ClusterInfoCalcToolConf(self, name = "GPUClusterInfoCalculator", do_cut = True): + result=ComponentAccumulator() + CalcTool = CompFactory.BasicGPUClusterInfoCalculator(name) + CalcTool.MeasureTimes = self.MeasureTimes + CalcTool.TimeFileOutput = name + "Times.txt" + if do_cut: + if self.CutClustersInAbsEt is None: + CalcTool.ClusterCutsInAbsEt = self.TopoClusterSeedCutsInAbsE + else: + CalcTool.ClusterCutsInAbsEt = self.CutClustersInAbsEt + CalcTool.ClusterEtorAbsEtCut = self.ClusterEtorAbsEtCut + else: + CalcTool.ClusterCutsInAbsEt = True + CalcTool.ClusterEtorAbsEtCut = -1 + #Cutting on absolute value with a negative value => not cutting at all. + + result.setPrivateTools(CalcTool) + return result + + def TopoAutomatonClusteringToolConf(self, name = "TAClusterMaker"): + result=ComponentAccumulator() + # maker tools + TAClusterMaker = CompFactory.TopoAutomatonClustering(name) + + TAClusterMaker.MeasureTimes = self.MeasureTimes + TAClusterMaker.TimeFileOutput = "TopoAutomatonClusteringTimes.txt" + + TAClusterMaker.CalorimeterNames= self.CalorimeterNames + + TAClusterMaker.SeedSamplingNames = self.TopoClusterSeedSamplingNames + + TAClusterMaker.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold + TAClusterMaker.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold + TAClusterMaker.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold + + TAClusterMaker.SeedCutsInAbsE = self.TopoClusterSeedCutsInAbsE + TAClusterMaker.NeighborCutsInAbsE = self.TopoClusterNeighborCutsInAbsE + TAClusterMaker.CellCutsInAbsE = self.TopoClusterCellCutsInAbsE + + TAClusterMaker.TwoGaussianNoise = self.TwoGaussianNoise + + + TAClusterMaker.SeedCutsInT = self.SeedCutsInT + TAClusterMaker.CutOOTseed = self.CutOOTseed + TAClusterMaker.UseTimeCutUpperLimit = self.UseTimeCutUpperLimit + TAClusterMaker.TimeCutUpperLimit = self.TimeCutUpperLimit + TAClusterMaker.SeedThresholdOnTAbs = self.SeedThresholdOnTAbs + TAClusterMaker.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood + + TAClusterMaker.NeighborOption = self.NeighborOption + TAClusterMaker.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors + TAClusterMaker.RestrictPSNeighbors = self.RestrictPSNeighbors + + result.setPrivateTools(TAClusterMaker) + return result + + def DefaultTopologicalClusteringToolConf(self, name = "TopoMaker"): + result=ComponentAccumulator() + # maker tools + TopoMaker = CompFactory.CaloTopoClusterMaker(name) + + TopoMaker.CellsName = self.CellsName + TopoMaker.CalorimeterNames= self.CalorimeterNames + TopoMaker.SeedSamplingNames = self.TopoClusterSeedSamplingNames + TopoMaker.NeighborOption = self.NeighborOption + TopoMaker.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors + TopoMaker.RestrictPSNeighbors = self.RestrictPSNeighbors + TopoMaker.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold + TopoMaker.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold + TopoMaker.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold + + TopoMaker.SeedCutsInT = self.SeedCutsInT + TopoMaker.CutOOTseed = self.CutOOTseed + TopoMaker.UseTimeCutUpperLimit = self.UseTimeCutUpperLimit + TopoMaker.TimeCutUpperLimit = self.TimeCutUpperLimit + + TopoMaker.ClusterEtorAbsEtCut = self.ClusterEtorAbsEtCut + TopoMaker.TwoGaussianNoise = self.TwoGaussianNoise + TopoMaker.SeedCutsInAbsE = self.TopoClusterSeedCutsInAbsE + TopoMaker.NeighborCutsInAbsE = self.TopoClusterNeighborCutsInAbsE + TopoMaker.CellCutsInAbsE = self.TopoClusterCellCutsInAbsE + TopoMaker.SeedThresholdOnTAbs = self.SeedThresholdOnTAbs + + TopoMaker.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood + + TopoMaker.UseGPUCriteria = not self.UseOriginalCriteria + + result.setPrivateTools(TopoMaker) + return result + + + def TopoAutomatonSplitterToolConf(self, name = "TopoAutomatonSplitter"): + result=ComponentAccumulator() + # maker tools + Splitter = CompFactory.TopoAutomatonSplitting(name) + + Splitter.MeasureTimes = self.MeasureTimes + Splitter.TimeFileOutput = "ClusterSplitterTimes.txt" + + Splitter.NumberOfCellsCut = self.SplitterNumberOfCellsCut + Splitter.EnergyCut = self.SplitterEnergyCut + Splitter.SamplingNames = self.SplitterSamplingNames + Splitter.SecondarySamplingNames = self.SplitterSecondarySamplingNames + Splitter.ShareBorderCells = self.SplitterShareBorderCells + Splitter.EMShowerScale = self.EMShowerScale + Splitter.WeightingOfNegClusters = self.SplitterUseNegativeClusters + + Splitter.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood + + Splitter.NeighborOption = self.NeighborOption + Splitter.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors + Splitter.RestrictPSNeighbors = self.RestrictPSNeighbors and self.AlsoRestrictPSOnGPUSplitter + #Since the CPU version does not restrict this! + + result.setPrivateTools(Splitter) + return result + + def GPUClusterSplitterToolConf(self, name = "GPUClusterSplitter"): + result=ComponentAccumulator() + # maker tools + Splitter = CompFactory.CaloTopoClusterSplitterGPU(name) + + Splitter.MeasureTimes = self.MeasureTimes + Splitter.TimeFileOutput = "ClusterSplitterTimes.txt" + + Splitter.NumberOfCellsCut = self.SplitterNumberOfCellsCut + Splitter.EnergyCut = self.SplitterEnergyCut + Splitter.SamplingNames = self.SplitterSamplingNames + Splitter.SecondarySamplingNames = self.SplitterSecondarySamplingNames + Splitter.ShareBorderCells = self.SplitterShareBorderCells + Splitter.EMShowerScale = self.EMShowerScale + Splitter.WeightingOfNegClusters = self.SplitterUseNegativeClusters + + Splitter.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood + + result.setPrivateTools(Splitter) + return result + + def DefaultClusterSplittingToolConf(self, name = "TopoSplitter"): + result=ComponentAccumulator() + # maker tools + TopoSplitter = CompFactory.CaloTopoClusterSplitter(name) + + + TopoSplitter.NeighborOption = self.NeighborOption + TopoSplitter.RestrictHECIWandFCalNeighbors = self.RestrictHECIWandFCalNeighbors + + TopoSplitter.NumberOfCellsCut = self.SplitterNumberOfCellsCut + TopoSplitter.EnergyCut = self.SplitterEnergyCut + + TopoSplitter.SamplingNames = self.SplitterSamplingNames + TopoSplitter.SecondarySamplingNames = self.SplitterSecondarySamplingNames + + TopoSplitter.ShareBorderCells = self.SplitterShareBorderCells + TopoSplitter.EMShowerScale = self.EMShowerScale + + TopoSplitter.TreatL1PredictedCellsAsGood = self.TreatL1PredictedCellsAsGood + + TopoSplitter.WeightingOfNegClusters = self.SplitterUseNegativeClusters + + TopoSplitter.UseGPUCriteria = not self.UseOriginalCriteria + + result.setPrivateTools(TopoSplitter) + return result + + def GPUClusterMomentsCalculatorToolConf(self, name = "GPUTopoMoments"): + + result=ComponentAccumulator() + GPUTopoMoments = CompFactory.GPUClusterInfoAndMomentsCalculator(name) + + GPUTopoMoments.MeasureTimes = self.MeasureTimes + + if self.UseAbsEnergyMoments is None: + GPUTopoMoments.WeightingOfNegClusters = self.TopoClusterSeedCutsInAbsE + else: + GPUTopoMoments.WeightingOfNegClusters = self.UseAbsEnergyMoments + + GPUTopoMoments.MaxAxisAngle = self.MomentsMaxAxisAngle + + GPUTopoMoments.TwoGaussianNoise = self.TwoGaussianNoise + + GPUTopoMoments.MinBadLArQuality = self.MomentsMinBadLArQuality + + GPUTopoMoments.MinRLateral = self.MomentsMinRLateral + GPUTopoMoments.MinLLongitudinal = self.MomentsMinLLongitudinal + + result.setPrivateTools(GPUTopoMoments) + return result + + + def DefaultClusterMomentsCalculatorToolConf(self, name = "TopoMoments"): + result=ComponentAccumulator() + TopoMoments = CompFactory.CaloClusterMomentsMaker(name) + + if self.UseAbsEnergyMoments is None: + TopoMoments.WeightingOfNegClusters = self.TopoClusterSeedCutsInAbsE + else: + TopoMoments.WeightingOfNegClusters = self.UseAbsEnergyMoments + + TopoMoments.MaxAxisAngle = self.MomentsMaxAxisAngle + + TopoMoments.TwoGaussianNoise = self.TwoGaussianNoise + + TopoMoments.MinBadLArQuality = self.MomentsMinBadLArQuality + + TopoMoments.MomentsNames = self.MomentsToCalculate + + TopoMoments.MinRLateral = self.MomentsMinRLateral + TopoMoments.MinLLongitudinal = self.MomentsMinLLongitudinal + + if not self.ConfigFlags.Common.isOnline: + if self.ConfigFlags.Input.isMC: + TopoMoments.LArHVFraction=CompFactory.LArHVFraction(HVScaleCorrKey="LArHVScaleCorr") + else: + TopoMoments.LArHVFraction=CompFactory.LArHVFraction(HVScaleCorrKey="LArHVScaleCorrRecomputed") + + TopoMoments.UseGPUCriteria = not self.UseOriginalCriteria + + result.setPrivateTools(TopoMoments) + return result + + def AthenaClusterAndMomentsImporterToolConf(self, name = "AthenaClusterImporter"): + result=ComponentAccumulator() + AthenaClusterImporter = CompFactory.GPUToAthenaImporterWithMoments(name) + AthenaClusterImporter.CellsName = self.CellsName + AthenaClusterImporter.ClusterSize = self.ClusterSize + + AthenaClusterImporter.MeasureTimes = self.MeasureTimes + AthenaClusterImporter.TimeFileOutput = "ClusterAndMomentsImporterTimes.txt" + + + + if not self.ConfigFlags.Common.isOnline: + if self.ConfigFlags.Input.isMC: + AthenaClusterImporter.HVScaleCorrKey = "LArHVScaleCorr" + else: + AthenaClusterImporter.HVScaleCorrKey = "LArHVScaleCorrRecomputed" + + AthenaClusterImporter.MomentsNames = self.MomentsToCalculate + + if self.FillMissingCells: + AthenaClusterImporter.MissingCellsToFill = self.MissingCellsToFill + + result.setPrivateTools(AthenaClusterImporter) + return result + + def CellsCounterCPUToolConf(self, folder = "counts", name = "CPUCounts", prefix = "CPU", suffix = ""): + result=ComponentAccumulator() + CPUCount = CompFactory.CaloCellsCounterCPU(name) + CPUCount.SavePath = folder + CPUCount.FilePrefix = prefix + CPUCount.FileSuffix = suffix + CPUCount.CellsName = self.CellsName + + CPUCount.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold + CPUCount.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold + CPUCount.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold + + result.setPrivateTools(CPUCount) + return result + + def CellsCounterGPUToolConf(self, folder = "counts", name = "GPUCounts", prefix = "GPU", suffix = ""): + result=ComponentAccumulator() + GPUCount = CompFactory.CaloCellsCounterGPU(name) + GPUCount.SavePath = folder + GPUCount.FilePrefix = prefix + GPUCount.FileSuffix = suffix + + GPUCount.CellThresholdOnEorAbsEinSigma = self.TopoClusterSNRCellThreshold + GPUCount.NeighborThresholdOnEorAbsEinSigma = self.TopoClusterSNRGrowThreshold + GPUCount.SeedThresholdOnEorAbsEinSigma = self.TopoClusterSNRSeedThreshold + + result.setPrivateTools(GPUCount) + return result + + def MomentsDumperToolConf(self, folder = "moments", name = "MomentsDumper", prefix = "", suffix = ""): + result=ComponentAccumulator() + GPUCount = CompFactory.CaloMomentsDumper(name) + GPUCount.SavePath = folder + GPUCount.FilePrefix = prefix + GPUCount.FileSuffix = suffix + + result.setPrivateTools(GPUCount) + return result + + def PlotterMonitoringToolConf(self, name = "PlotterMonitoring"): + result=ComponentAccumulator() + PloTool = CompFactory.CaloGPUClusterAndCellDataMonitor(name) + + PloTool.CellThreshold = self.TopoClusterSNRCellThreshold + PloTool.NeighborThreshold = self.TopoClusterSNRGrowThreshold + PloTool.SeedThreshold = self.TopoClusterSNRSeedThreshold + + PloTool.CellsName = self.CellsName + + PloTool.ClusterMatchingParameters = MatchingOptions() + + #Tools and Combinations to plot + #should be set by the end user. + + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + + PloTool.MonitoringTool = GenericMonitoringTool(self.ConfigFlags, "PlotterMonitoringTool") + + result.setPrivateTools(PloTool) + return result + + def MonitorizationToolConf(self, name = "MonTool"): + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + + monTool = GenericMonitoringTool(self.ConfigFlags, name) + + maxNumberOfClusters=2500.0 + + monTool.defineHistogram('container_size', path='EXPERT', type='TH1F', title="Container Size; Number of Clusters; Number of Events", xbins=50, xmin=0.0, xmax=maxNumberOfClusters) + monTool.defineHistogram('Et', path='EXPERT', type='TH1F', title="Cluster E_T; E_T [ MeV ] ; Number of Clusters", xbins=135, xmin=-200.0, xmax=2500.0) + monTool.defineHistogram('Eta', path='EXPERT', type='TH1F', title="Cluster #eta; #eta ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5) + monTool.defineHistogram('Phi', path='EXPERT', type='TH1F', title="Cluster #phi; #phi ; Number of Clusters", xbins=64, xmin=-3.2, xmax=3.2) + monTool.defineHistogram('Eta,Phi', path='EXPERT', type='TH2F', title="Number of Clusters; #eta ; #phi ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5, ybins=128, ymin=-3.2, ymax=3.2) + monTool.defineHistogram('clusterSize', path='EXPERT', type='TH1F', title="Cluster Type; Type ; Number of Clusters", xbins=13, xmin=0.5, xmax=13.5) + monTool.defineHistogram('signalState', path='EXPERT', type='TH1F', title="Signal State; Signal State ; Number of Clusters", xbins=4, xmin=-1.5, xmax=2.5) + monTool.defineHistogram('size', path='EXPERT', type='TH1F', title="Cluster Size; Size [Cells] ; Number of Clusters", xbins=125, xmin=0.0, xmax=250.0) + monTool.defineHistogram('N_BAD_CELLS', path='EXPERT', type='TH1F', title="N_BAD_CELLS; N_BAD_CELLS ; Number of Clusters", xbins=250, xmin=0.5, xmax=250.5) + monTool.defineHistogram('ENG_FRAC_MAX', path='EXPERT', type='TH1F', title="ENG_FRAC_MAX; ENG_FRAC_MAX ; Number of Clusters", xbins=50, xmin=0.0, xmax=1.1) + monTool.defineHistogram('mu', path='EXPERT', type='TH1F', title="mu; mu; Number of Events", xbins=50, xmin=0.0, xmax=100) + monTool.defineHistogram('mu,container_size', path='EXPERT', type='TH2F', title="Container Size versus #mu; #mu; cluster container size", xbins=50, xmin=20.0, xmax=70, ybins=50, ymin=0.0, ymax=maxNumberOfClusters) + return monTool + + def DefaultCaloCellMakerConf(self, should_be_primary = False): + from LArCellRec.LArCellBuilderConfig import LArCellBuilderCfg,LArCellCorrectorCfg + from TileRecUtils.TileCellBuilderConfig import TileCellBuilderCfg + from CaloCellCorrection.CaloCellCorrectionConfig import CaloCellPedestalCorrCfg, CaloCellNeighborsAverageCorrCfg, CaloCellTimeCorrCfg, CaloEnergyRescalerCfg + result=ComponentAccumulator() + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(self.ConfigFlags)) + result.merge(TileGMCfg(self.ConfigFlags)) + + larCellBuilder = result.popToolsAndMerge(LArCellBuilderCfg(self.ConfigFlags)) + larCellCorrectors = result.popToolsAndMerge(LArCellCorrectorCfg(self.ConfigFlags)) + tileCellBuilder = result.popToolsAndMerge(TileCellBuilderCfg(self.ConfigFlags)) + cellFinalizer = CompFactory.CaloCellContainerFinalizerTool() + + if self.FillMissingCells: + tileCellBuilder.fakeCrackCells = True + + cellMakerTools=[larCellBuilder,tileCellBuilder,cellFinalizer]+larCellCorrectors + + #Add corrections tools that are not LAr or Tile specific: + if self.ConfigFlags.Calo.Cell.doPileupOffsetBCIDCorr or self.ConfigFlags.Cell.doPedestalCorr: + theCaloCellPedestalCorr=CaloCellPedestalCorrCfg(self.ConfigFlags) + cellMakerTools.append(result.popToolsAndMerge(theCaloCellPedestalCorr)) + + #LAr HV scale corr must come after pedestal corr + if self.ConfigFlags.LAr.doHVCorr: + from LArCellRec.LArCellBuilderConfig import LArHVCellContCorrCfg + theLArHVCellContCorr=LArHVCellContCorrCfg(self.ConfigFlags) + cellMakerTools.append(result.popToolsAndMerge(theLArHVCellContCorr)) + + + if self.ConfigFlags.Calo.Cell.doDeadCellCorr: + theCaloCellNeighborAvg=CaloCellNeighborsAverageCorrCfg(self.ConfigFlags) + cellMakerTools.append(result.popToolsAndMerge(theCaloCellNeighborAvg)) + + if self.ConfigFlags.Calo.Cell.doEnergyCorr: + theCaloCellEnergyRescaler=CaloEnergyRescalerCfg(self.ConfigFlags) + cellMakerTools.append(result.popToolsAndMerge(theCaloCellEnergyRescaler)) + if self.ConfigFlags.Calo.Cell.doTimeCorr: + theCaloTimeCorr=CaloCellTimeCorrCfg(self.ConfigFlags) + cellMakerTools.append(result.popToolsAndMerge(theCaloTimeCorr)) + + cellAlgo=CompFactory.CaloCellMaker(CaloCellMakerToolNames = cellMakerTools, + CaloCellsOutputName = self.CellsName) + result.addEventAlgo(cellAlgo, primary = should_be_primary) + return result + + #This simply uses the GPU versions. + #For the tests, we will build our own + #depending on what we want to compare against. + def HybridClusterProcessorConf(self, clustersname = None, should_be_primary = True): + result = ComponentAccumulator() + + HybridClusterProcessor = CompFactory.CaloGPUHybridClusterProcessor("HybridClusterProcessor") + HybridClusterProcessor.ClustersOutputName = self.ClustersOutputName + HybridClusterProcessor.MeasureTimes = self.MeasureTimes + HybridClusterProcessor.TimeFileOutput = "GlobalTimes.txt" + HybridClusterProcessor.DeferConstantDataPreparationToFirstEvent = True + HybridClusterProcessor.DoPlots = False + HybridClusterProcessor.PlotterTool = None + HybridClusterProcessor.DoMonitoring = self.DoMonitoring + + if self.DoMonitoring: + histSvc = CompFactory.THistSvc(Output = ["EXPERT DATAFILE='expert-monitoring.root', OPT='RECREATE'"]) + result.addService(histSvc) + HybridClusterProcessor.MonitoringTool = self.MonitorizationToolConf() + + HybridClusterProcessor.NumPreAllocatedDataHolders = self.NumPreAllocatedDataHolders + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(self.ConfigFlags)) + result.merge(TileGMCfg(self.ConfigFlags)) + + ConstantDataExporter = result.popToolsAndMerge( self.BasicConstantDataExporterToolConf() ) + EventDataExporter = result.popToolsAndMerge( self.BasicEventDataExporterToolConf() ) + AthenaClusterImporter = result.popToolsAndMerge( self.AthenaClusterAndMomentsImporterToolConf() ) + + HybridClusterProcessor.ConstantDataToGPUTool = ConstantDataExporter + HybridClusterProcessor.EventDataToGPUTool = EventDataExporter + HybridClusterProcessor.GPUToEventDataTool = AthenaClusterImporter + + HybridClusterProcessor.BeforeGPUTools = [] + + HybridClusterProcessor.GPUTools = [] + + TopoAutomatonClusteringDef = result.popToolsAndMerge( self.TopoAutomatonClusteringToolConf("TopoAutomatonClustering")) + HybridClusterProcessor.GPUTools += [TopoAutomatonClusteringDef] + + FirstPropCalcDef = result.popToolsAndMerge( self.ClusterInfoCalcToolConf("PostGrowGPUClusterPropertiesCalculator", True)) + HybridClusterProcessor.GPUTools += [FirstPropCalcDef] + + GPUClusterSplittingDef = result.popToolsAndMerge( self.TopoAutomatonSplitterToolConf("GPUSplitter") ) + HybridClusterProcessor.GPUTools += [GPUClusterSplittingDef] + + GPUMomentsCalcDef = result.popToolsAndMerge( self.GPUClusterMomentsCalculatorToolConf("GPUTopoMoments") ) + HybridClusterProcessor.GPUTools += [GPUMomentsCalcDef] + + HybridClusterProcessor.AfterGPUTools = [] + + from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg + caloBadChanTool = result.popToolsAndMerge( CaloBadChanToolCfg(self.ConfigFlags) ) + CaloClusterBadChannelList=CompFactory.CaloClusterBadChannelList + BadChannelListCorr = CaloClusterBadChannelList(badChannelTool = caloBadChanTool) + HybridClusterProcessor.AfterGPUTools += [BadChannelListCorr] + + + if self.ConfigFlags.Calo.TopoCluster.doTopoClusterLocalCalib: + #Took out CaloClusterSnapshot that wanted to be a part of a CaloClusterMaker. + #Possibly change in the future? + from CaloRec.CaloTopoClusterConfig import getTopoClusterLocalCalibTools + HybridClusterProcessor.AfterGPUTools += getTopoClusterLocalCalibTools(self.ConfigFlags) + + from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg + result.merge(caloTopoCoolFolderCfg(self.ConfigFlags)) + + result.addEventAlgo(HybridClusterProcessor, primary = should_be_primary) + + return result + + + + + diff --git a/Calorimeter/CaloRecGPU/python/GPUClusterSplitterConfig.py b/Calorimeter/CaloRecGPU/python/GPUClusterSplitterConfig.py deleted file mode 100644 index 80a6ca1ca4ad654b4b45084f70fc7048ec1e40dc..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/python/GPUClusterSplitterConfig.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator - -if __name__=="__main__": - - Configurator = CaloRecGPUConfigurator() - - Configurator.TestGPUGrowing = False - Configurator.TestGPUSplitting = True - - cfg, numevents = Configurator.PrepareTest(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root"]) - - theKey="CaloCalTopoClustersNew" - - topoAcc = Configurator.HybridClusterProcessorConf() - - topoAlg = topoAcc.getPrimary() - topoAlg.ClustersOutputName=theKey - - cfg.merge(topoAcc) - - cfg.run(numevents) - diff --git a/Calorimeter/CaloRecGPU/python/TopoAutomatonClusteringConfig.py b/Calorimeter/CaloRecGPU/python/TopoAutomatonClusteringConfig.py deleted file mode 100644 index 132a7d4afd53b8f5dce9ac685ab64d5e7c92df7c..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/python/TopoAutomatonClusteringConfig.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator - -if __name__=="__main__": - - Configurator = CaloRecGPUConfigurator() - - Configurator.TestGPUGrowing = True - Configurator.TestGPUSplitting = False - - cfg, numevents = Configurator.PrepareTest(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root"]) - - theKey="CaloCalTopoClustersNew" - - topoAcc = Configurator.HybridClusterProcessorConf() - - topoAlg = topoAcc.getPrimary() - topoAlg.ClustersOutputName=theKey - - cfg.merge(topoAcc) - - cfg.run(numevents) - diff --git a/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.cxx b/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.cxx index a5b07e5a886f8ce71b57415f5764b626d5f11613..d0f53cc4437f125d1377329dac41233082f643af 100644 --- a/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.cxx +++ b/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.cxx @@ -1,286 +1,347 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "BasicConstantGPUDataExporter.h" - -#include "CaloRecGPU/CUDAFriendlyClasses.h" - -#include "CxxUtils/checker_macros.h" - -#include "AthenaKernel/errorcheck.h" -#include "CaloIdentifier/CaloCell_ID.h" -#include "StoreGate/DataHandle.h" -#include "CaloConditions/CaloNoise.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -using namespace CaloRecGPU; - -BasicConstantGPUDataExporter::BasicConstantGPUDataExporter(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - CaloGPUTimed(this), - m_hasBeenInitialized(false) -{ - declareInterface<ICaloClusterGPUConstantTransformer> (this); -} - -#include "MacroHelpers.h" - -StatusCode BasicConstantGPUDataExporter::initialize() -{ - if (m_hasBeenInitialized) - { - ATH_MSG_DEBUG("Initializing data tool again..."); - return StatusCode::SUCCESS; - } - - ATH_CHECK(m_noiseCDOKey.initialize()); - ATH_CHECK(m_caloMgrKey.initialize()); - auto get_option_from_string = [](const std::string & str, bool & failed) - { - failed = false; - CRGPU_RECURSIVE_MACRO( - CRGPU_CHEAP_STRING_TO_ENUM( str, LArNeighbours, - prevInPhi, - nextInPhi, - prevInEta, - nextInEta, - faces2D, - corners2D, - all2D, - prevInSamp, - nextInSamp, - upAndDown, - prevSubDet, - nextSubDet, - all3D, - corners3D, - all3DwithCorners, - prevSuperCalo, - nextSuperCalo, - super3D - ) - ) - //I know Topological Clustering only supports a subset of those, - //but this is supposed to be a general data exporting tool... - else - { - failed = true; - return LArNeighbours::super3D; - } - }; - - bool neigh_failed = false; - m_neighborOption = get_option_from_string(m_neighborOptionString, neigh_failed); - - if (neigh_failed) - { - ATH_MSG_ERROR("Invalid Neighbour Option: " << m_neighborOptionString); - } - - if (neigh_failed) - { - return StatusCode::FAILURE; - } - - m_hasBeenInitialized = true; - - return StatusCode::SUCCESS; -} - -StatusCode BasicConstantGPUDataExporter::convert(ConstantDataHolder &) const -{ - ATH_MSG_ERROR("BasicConstantGPUDataExporter (" << this->name() << ") must be used with the " - "GPU data preparation happening on the first event."); - - return StatusCode::FAILURE; -} - -StatusCode BasicConstantGPUDataExporter::convert(const EventContext & ctx, ConstantDataHolder & cd) const -{ - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - auto start = clock_type::now(); - - SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey,ctx}; - const CaloDetDescrManager * calo_dd_man = *caloMgrHandle; - - cd.m_geometry.allocate(); - - const CaloCell_ID * calo_id = calo_dd_man->getCaloCell_ID(); - auto neigh_option_test = [&](const CaloCell_ID::SUBCALO sub_detector, const Identifier cell_id) - { - const bool doRestrictHECIWandFCal = m_restrictHECIWandFCalNeighbors && (m_neighborOption & LArNeighbours::nextInSamp); - const bool doRestrictPS = m_restrictPSNeighbors && (m_neighborOption & LArNeighbours::nextInSamp); - if (doRestrictHECIWandFCal && sub_detector != CaloCell_ID::LAREM) - { - if (sub_detector == CaloCell_ID::LARHEC && calo_id->region(cell_id) == 1) - { - return true; - } - if (sub_detector == CaloCell_ID::LARFCAL && calo_id->sampling(cell_id) > 1) - { - return true; - } - } - if (doRestrictPS && sub_detector == CaloCell_ID::LAREM && calo_id->sampling(cell_id) == 0) - { - return true; - } - return false; - }; - - std::vector<IdentifierHash> neighbour_vector; - - for (int cell = 0; cell < NCaloCells; ++cell) - { - cd.m_geometry->nNeighbours[cell] = 0; - } - - for (int cell = 0; cell < NCaloCells; ++cell) - { - const CaloDetDescrElement * caloElement = calo_dd_man->get_element((IdentifierHash) cell); - CaloCell_ID::SUBCALO sub_detector = caloElement->getSubCalo(); - - const LArNeighbours::neighbourOption opt = ( neigh_option_test(sub_detector, calo_id->cell_id((IdentifierHash) cell)) ? LArNeighbours::nextInSamp : m_neighborOption ); - - calo_id->get_neighbours((IdentifierHash) cell, opt, neighbour_vector); - - //Fill the GPU Geometry - cd.m_geometry->caloSample[cell] = calo_id->calo_sample(calo_id->cell_id((IdentifierHash) cell)); - cd.m_geometry->x[cell] = caloElement->x(); - cd.m_geometry->y[cell] = caloElement->y(); - cd.m_geometry->z[cell] = caloElement->z(); - cd.m_geometry->eta[cell] = caloElement->eta(); - cd.m_geometry->phi[cell] = caloElement->phi(); - //cd.m_geometry->nNeighbours[cell] = neighbour_vector.size(); - - for (size_t j = 0; j < neighbour_vector.size(); ++j) - { - const int neigh = neighbour_vector[j]; - int & neigh_num_neighs = cd.m_geometry->nNeighbours[neigh]; - cd.m_geometry->neighbours[neigh][neigh_num_neighs] = cell; - ++neigh_num_neighs; - } - //We want to list the cells from which a tag can be propagated, - //not the other way around. - - cd.m_geometry->nReverseNeighbours[cell] = neighbour_vector.size(); - for (size_t j = 0; j < neighbour_vector.size(); ++j) - { - cd.m_geometry->reverseNeighbours[cell][j] = neighbour_vector[j]; - } - - } - - auto after_geo = clock_type::now(); -/* - if (m_correctNonSymmetricNeighs) - { - - for (int cell = 0; cell < NCaloCells; ++cell) - { - const int n_neighs = cd.m_geometry->nNeighbours[cell]; - - for (int i = 0; i < n_neighs; ++i) - { - const int neigh = cd.m_geometry->neighbours[cell][i]; - - const int neigh_neighs = cd.m_geometry->nNeighbours[neigh]; - - bool symmetry = false; - - for (int j = 0; j < neigh_neighs; ++j) - { - if (cd.m_geometry->neighbours[neigh][j] == cell) - { - symmetry = true; - break; - } - } - if (symmetry == false) - { - cd.m_geometry->neighbours[neigh][neigh_neighs] = cell; - cd.m_geometry->nNeighbours[neigh] += 1; - ATH_MSG_INFO("Non-bijective neighbours: " << cell << "</- -> " << neigh); - } - } - } - } - - auto after_corr = clock_type::now(); - */ - - SG::ReadCondHandle<CaloNoise> noise_handle(m_noiseCDOKey, ctx); - CaloNoise * noise_tool ATLAS_THREAD_SAFE = const_cast<CaloNoise *>(*noise_handle); - //We are committing the sin of const-casting to access larStorage and tileStorage. - //I think const views into these could reasonably be added to the CaloNoise itself, - //but I don't want to change unrelated portions of the code and I promise I'll behave. - //Also suppress non-thread-safe complaints as we'll only be reading... - //(Furthermore, constant data preparation should only happen in one thread anyway.) - - IdentifierHash temp1, temp2; - calo_id->calo_cell_hash_range(CaloCell_ID::TILE, temp1, temp2); - - const int tile_offset = temp1; - - cd.m_cell_noise.allocate(); - - //Were it not for the fact that the LAr noise array inside - //the CaloNoise has three gains while the Tile has all four, - //we might try to do something more memcpy-y... - //(Still, with hope, it's highly optimized anyway.) - - for (int gain_state = 0; gain_state < CaloRecGPU::NumGainStates; ++gain_state) - { - for (int cell = 0; cell < tile_offset; ++cell) - { - cd.m_cell_noise->noise[gain_state][cell] = noise_tool->larStorage()[(gain_state > 2 ? 0 : gain_state)][cell]; - } - for (int cell = tile_offset; cell < NCaloCells; ++cell) - { - cd.m_cell_noise->noise[gain_state][cell] = noise_tool->tileStorage()[gain_state][cell - tile_offset]; - } - } - - auto after_noise = clock_type::now(); - - cd.sendToGPU(!m_keepCPUData); - - - auto after_send = clock_type::now(); - - if (m_measureTimes) - { - record_times(ctx.evt(), time_cast(start, after_geo), - time_cast(after_geo/*, after_corr), - time_cast(after_corr*/, after_noise), - time_cast(after_noise, after_send) - ); - } - - return StatusCode::SUCCESS; - -} - -StatusCode BasicConstantGPUDataExporter::finalize() -{ - - if (m_measureTimes) - { - print_times("Geometry Geometry_Correction Noise Transfer_to_GPU", 3 /*4*/); - } - return StatusCode::SUCCESS; -} - - -BasicConstantGPUDataExporter::~BasicConstantGPUDataExporter() -{ - //Nothing! -} +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "BasicConstantGPUDataExporter.h" + +#include "CaloRecGPU/CUDAFriendlyClasses.h" + +#include "CxxUtils/checker_macros.h" + +#include "AthenaKernel/errorcheck.h" +#include "CaloIdentifier/CaloCell_ID.h" +#include "StoreGate/DataHandle.h" +#include "CaloConditions/CaloNoise.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +#include <algorithm> + +using namespace CaloRecGPU; + +BasicConstantGPUDataExporter::BasicConstantGPUDataExporter(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this), + m_hasBeenInitialized(false) +{ + declareInterface<ICaloClusterGPUConstantTransformer> (this); +} + +StatusCode BasicConstantGPUDataExporter::initialize() +{ + if (m_hasBeenInitialized) + { + ATH_MSG_INFO("Initializing data tool again..."); + return StatusCode::SUCCESS; + } + + ATH_CHECK(m_noiseCDOKey.initialize()); + + ATH_CHECK(m_caloMgrKey.initialize()); + + m_hasBeenInitialized = true; + + return StatusCode::SUCCESS; +} + +StatusCode BasicConstantGPUDataExporter::convert(ConstantDataHolder &, const bool) const +{ + ATH_MSG_ERROR("BasicConstantGPUDataExporter (" << this->name() << ") must be used with the " + "GPU data preparation happening on the first event."); + + return StatusCode::FAILURE; +} + +StatusCode BasicConstantGPUDataExporter::convert(const EventContext & ctx, ConstantDataHolder & cd, const bool keep_CPU_info) const +{ + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + auto start = clock_type::now(); + + SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey, ctx}; + const CaloDetDescrManager * calo_dd_man = *caloMgrHandle; + + cd.m_geometry.allocate(); + + const CaloCell_ID * calo_id = calo_dd_man->getCaloCell_ID(); + + auto neigh_option_exclude = [&](const CaloCell_ID::SUBCALO sub_detector, const Identifier cell_id, + const bool restrict_HECIWandFCal = true, const bool restrict_PS = true) -> bool + { + const bool doRestrictHECIWandFCal = restrict_HECIWandFCal; + const bool doRestrictPS = restrict_PS; + if (doRestrictHECIWandFCal && sub_detector != CaloCell_ID::LAREM) + { + if (sub_detector == CaloCell_ID::LARHEC && calo_id->region(cell_id) == 1) + { + return true; + } + if (sub_detector == CaloCell_ID::LARFCAL && calo_id->sampling(cell_id) > 1) + { + return true; + } + } + if (doRestrictPS && sub_detector == CaloCell_ID::LAREM && calo_id->sampling(cell_id) == 0) + { + return true; + } + return false; + }; + + float min_eta_pos[NumSamplings], max_eta_pos[NumSamplings], + min_eta_neg[NumSamplings], max_eta_neg[NumSamplings], + min_phi_pos[NumSamplings], max_phi_pos[NumSamplings], + min_phi_neg[NumSamplings], max_phi_neg[NumSamplings], + min_deta [NumSamplings], min_dphi [NumSamplings]; + + for (int i = 0; i < NumSamplings; ++i) + { + min_eta_pos[i] = std::numeric_limits<float>::max(); + max_eta_pos[i] = std::numeric_limits<float>::lowest(); + min_eta_neg[i] = std::numeric_limits<float>::max(); + max_eta_neg[i] = std::numeric_limits<float>::lowest(); + min_phi_pos[i] = std::numeric_limits<float>::max(); + max_phi_pos[i] = std::numeric_limits<float>::lowest(); + min_phi_neg[i] = std::numeric_limits<float>::max(); + max_phi_neg[i] = std::numeric_limits<float>::lowest(); + min_deta [i] = std::numeric_limits<float>::max(); + min_dphi [i] = std::numeric_limits<float>::max(); + } + + for (int cell = 0; cell < NCaloCells; ++cell) + { + const CaloDetDescrElement * caloElement = calo_dd_man->get_element((IdentifierHash) cell); + + const int sampling = calo_id->calo_sample(calo_id->cell_id((IdentifierHash) cell)); + + cd.m_geometry->caloSample[cell] = sampling; + cd.m_geometry->x[cell] = caloElement->x(); + cd.m_geometry->y[cell] = caloElement->y(); + cd.m_geometry->z[cell] = caloElement->z(); + cd.m_geometry->r[cell] = caloElement->r(); + cd.m_geometry->eta[cell] = caloElement->eta(); + cd.m_geometry->phi[cell] = caloElement->phi(); + + cd.m_geometry->dx[cell] = caloElement->dx(); + cd.m_geometry->dy[cell] = caloElement->dy(); + cd.m_geometry->dz[cell] = caloElement->dz(); + cd.m_geometry->dr[cell] = caloElement->dr(); + cd.m_geometry->deta[cell] = caloElement->deta(); + cd.m_geometry->dphi[cell] = caloElement->dphi(); + + cd.m_geometry->volume[cell] = caloElement->volume(); + cd.m_geometry->neighbours.total_number[cell] = 0; + cd.m_geometry->neighbours.offsets[cell] = 0; + + if (caloElement->eta() >= 0) + { + min_eta_pos[sampling] = std::min(min_eta_pos[sampling], caloElement->eta() - caloElement->deta() / 2); + min_phi_pos[sampling] = std::min(min_phi_pos[sampling], caloElement->phi() - caloElement->dphi() / 2); + max_eta_pos[sampling] = std::max(max_eta_pos[sampling], caloElement->eta() + caloElement->deta() / 2); + max_phi_pos[sampling] = std::max(max_phi_pos[sampling], caloElement->phi() + caloElement->dphi() / 2); + } + else + { + min_eta_neg[sampling] = std::min(min_eta_neg[sampling], caloElement->eta() - caloElement->deta() / 2); + min_phi_neg[sampling] = std::min(min_phi_neg[sampling], caloElement->phi() - caloElement->dphi() / 2); + max_eta_neg[sampling] = std::max(max_eta_neg[sampling], caloElement->eta() + caloElement->deta() / 2); + max_phi_neg[sampling] = std::max(max_phi_neg[sampling], caloElement->phi() + caloElement->dphi() / 2); + } + min_deta[sampling] = std::min(min_deta[sampling], caloElement->deta()); + min_dphi[sampling] = std::min(min_dphi[sampling], caloElement->dphi()); + + } + + for (int i = 0; i < NumSamplings; ++i) + { + constexpr float corrective_factor = 0.99f; + cd.m_geometry->etaPhiToCell.initialize(i, min_eta_neg[i], min_phi_neg[i], max_eta_neg[i], max_phi_neg[i], + min_eta_pos[i], min_phi_pos[i], max_eta_pos[i], max_phi_pos[i], + min_deta[i]*corrective_factor, min_dphi[i]*corrective_factor); + } + + cd.m_geometry->fill_eta_phi_map(); + + std::vector<IdentifierHash> neighbour_vector, full_neighs, prev_neighs; + + for (int neigh_bit_set = 0; neigh_bit_set < NumNeighOptions; ++neigh_bit_set) + { + const unsigned int curr_neigh_opt = (1U << neigh_bit_set); + + for (int cell = 0; cell < NCaloCells; ++cell) + { + const CaloDetDescrElement * caloElement = calo_dd_man->get_element((IdentifierHash) cell); + CaloCell_ID::SUBCALO sub_detector = caloElement->getSubCalo(); + + if (neigh_option_exclude(sub_detector, calo_id->cell_id((IdentifierHash) cell), true, false)) + //Restrict HECIW and FCal. + { + cd.m_geometry->neighbours.offsets[cell] |= NeighOffsets::limited_HECIWandFCal_bitmask(); + } + if (neigh_option_exclude(sub_detector, calo_id->cell_id((IdentifierHash) cell), false, true)) + //Restrict PS + { + cd.m_geometry->neighbours.offsets[cell] |= NeighOffsets::limited_PS_bitmask(); + } + + if (curr_neigh_opt == LArNeighbours::corners2D || curr_neigh_opt == LArNeighbours::corners3D) + //Scanning the ATLAS codebase, neighbour handling has special cases + //for all2D (LarFCAL_Base_ID.cxx, LArMiniFCAL_ID.cxx, Tile_Base_ID.cxx) + //and all3DwithCorners (Tile_Base_ID.cxx), which include + //neighbours not returned when just the constituent bits are set separately. + //As an imperfect workaround, we stuff them in the immediately previous option + //(corners, for both 2D and 3D). + { + if (curr_neigh_opt == LArNeighbours::corners2D) + { + calo_id->get_neighbours((IdentifierHash) cell, + (LArNeighbours::neighbourOption) LArNeighbours::all2D, + full_neighs); + } + else /*if (curr_neigh_opt == LArNeighbours::corners3D)*/ + { + calo_id->get_neighbours((IdentifierHash) cell, + (LArNeighbours::neighbourOption) LArNeighbours::all3DwithCorners, + prev_neighs); + calo_id->get_neighbours((IdentifierHash) cell, + (LArNeighbours::neighbourOption) LArNeighbours::super3D, + neighbour_vector); + //We will exclude the cells that could come from later options + //(it seems, from Tile_Base_ID.cxx, all3DwithCorners will give more than super3D), + //which... might make some sense, but seems unexpected. + + + std::sort(neighbour_vector.begin(), neighbour_vector.end()); + std::sort(prev_neighs.begin(), prev_neighs.end()); + + full_neighs.clear(); + + std::set_difference( prev_neighs.begin(), prev_neighs.end(), + neighbour_vector.begin(), neighbour_vector.end(), + std::back_inserter(full_neighs) ); + + } + + prev_neighs.resize(cd.m_geometry->neighbours.total_number[cell]); + //We want to add just the neighbours that are not part of this. + + for (size_t neigh = 0; neigh < prev_neighs.size(); ++neigh) + { + prev_neighs[neigh] = cd.m_geometry->neighbours.get_neighbour(cell, neigh, false, false); + } + + std::sort(full_neighs.begin(), full_neighs.end()); + std::sort(prev_neighs.begin(), prev_neighs.end()); + + neighbour_vector.clear(); + + std::set_difference( full_neighs.begin(), full_neighs.end(), + prev_neighs.begin(), prev_neighs.end(), + std::back_inserter(neighbour_vector) ); + } + else + { + calo_id->get_neighbours((IdentifierHash) cell, (LArNeighbours::neighbourOption) curr_neigh_opt, neighbour_vector); + } + + std::sort(neighbour_vector.begin(), neighbour_vector.end()); + + const int neighs_start = cd.m_geometry->neighbours.total_number[cell]; + + for (size_t neigh_num = 0; neigh_num < neighbour_vector.size() && neighs_start + neigh_num < NMaxNeighbours; ++neigh_num) + { + cd.m_geometry->neighbours.set_neighbour(cell, neighs_start + neigh_num, neighbour_vector[neigh_num]); + } + cd.m_geometry->neighbours.total_number[cell] += neighbour_vector.size(); + + cd.m_geometry->neighbours.offsets[cell] += NeighOffsets::offset_delta(neigh_bit_set) * neighbour_vector.size(); + + } + } + + auto after_geo = clock_type::now(); + + SG::ReadCondHandle<CaloNoise> noise_handle(m_noiseCDOKey, ctx); + CaloNoise * noise_tool ATLAS_THREAD_SAFE = const_cast<CaloNoise *>(*noise_handle); + //We are committing the sin of const-casting to access larStorage and tileStorage. + //I think const views into these could reasonably be added to the CaloNoise itself, + //but I don't want to change unrelated portions of the code and I promise I'll behave. + //Also suppress non-thread-safe complaints as we'll only be reading... + //(Furthermore, constant data preparation should only happen in one thread anyway.) + + IdentifierHash t_start, t_end; + calo_id->calo_cell_hash_range(CaloCell_ID::TILE, t_start, t_end); + + if (t_start != cd.m_geometry->s_tileStart) + { + ATH_MSG_WARNING("Tile start (" << t_start << ") differs from assumed constant value (" << cd.m_geometry->s_tileStart << ")!"); + } + if (t_end != cd.m_geometry->s_tileEnd) + { + ATH_MSG_WARNING("Tile end (" << t_end << ") differs from assumed constant value (" << cd.m_geometry->s_tileEnd << ")!"); + } + + cd.m_cell_noise.allocate(); + + //Were it not for the fact that the LAr noise array inside + //the CaloNoise has three gains while the Tile has all four, + //we might try to do something more memcpy-y... + //(Still, with hope, it's highly optimized anyway.) + + for (int gain_state = 0; gain_state < CaloRecGPU::NumGainStates; ++gain_state) + { + for (int cell = 0; cell < int(t_start); ++cell) + { + cd.m_cell_noise->noise[gain_state][cell] = noise_tool->larStorage()[(gain_state > 2 ? 0 : gain_state)][cell]; + } + for (int cell = t_start; cell < int(t_end); ++cell) + { + cd.m_cell_noise->noise[gain_state][cell] = noise_tool->tileStorage()[gain_state][cell - t_start]; + } + for (int cell = t_end; cell < NCaloCells; ++cell) + { + cd.m_cell_noise->noise[gain_state][cell] = 0; + } + } + + auto after_noise = clock_type::now(); + + cd.sendToGPU(!(m_keepCPUData || keep_CPU_info)); + + + auto after_send = clock_type::now(); + + if (m_measureTimes) + { + record_times(ctx.evt(), time_cast(start, after_geo), + time_cast(after_geo, after_noise), + time_cast(after_noise, after_send) + ); + } + + return StatusCode::SUCCESS; + +} + +StatusCode BasicConstantGPUDataExporter::finalize() +{ + + if (m_measureTimes) + { + print_times("Geometry Geometry_Correction Noise Transfer_to_GPU", 3 /*4*/); + } + return StatusCode::SUCCESS; +} + + +BasicConstantGPUDataExporter::~BasicConstantGPUDataExporter() +{ + //Nothing! +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.h b/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.h index 8d8f3d1eb8f4d969412cabf3f75ffe0b0765d803..86f843918c040c263c7d4edb8a6e5bcd241976f2 100644 --- a/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.h +++ b/Calorimeter/CaloRecGPU/src/BasicConstantGPUDataExporter.h @@ -1,130 +1,70 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_BASICCONSTANTGPUDATAEXPORTER_H -#define CALORECGPU_BASICCONSTANTGPUDATAEXPORTER_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloRecGPU/CaloClusterGPUTransformers.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "CaloConditions/CaloNoise.h" -#include "CaloDetDescr/CaloDetDescrManager.h" - -/** - * @class BasicConstantGPUDataExporter - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 29 May 2022 - * @brief Standard tool to export calorimeter geometry and cell noise to GPU. - * - * For the time being, this must be run on first event, so that the noise tool exists and so on. - * Hopefully we can find a way around this in the future. - */ - -class BasicConstantGPUDataExporter : - public AthAlgTool, virtual public ICaloClusterGPUConstantTransformer, public CaloGPUTimed -{ - public: - - BasicConstantGPUDataExporter(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode initialize() override; - - virtual StatusCode convert (ConstantDataHolder & constant_data) const override; - - virtual StatusCode convert (const EventContext & ctx, ConstantDataHolder & constant_data) const override; - - virtual StatusCode finalize() override; - - virtual ~BasicConstantGPUDataExporter(); - - private: - - /** @brief If @p true, do not delete the CPU version of the GPU-friendly data representation. - * Defaults to @p true. - * - */ - - Gaudi::Property<bool> m_keepCPUData {this, "KeepCPUData", true, "Keep CPU version of GPU data format"}; - - /** @brief If @p true, check for and correct for cases where the neighbourhood relations between the cells - are not symmetric, that is, cell A is given as neighbour to cell B, but cell B is not given as neighbour to cell A - (which is a basic assumption necessary for the GPU automaton-based algorithm to work properly) - */ - //Gaudi::Property<bool> m_correctNonSymmetricNeighs {this, "CorrectNonSymmetricNeighbors", false, "Detect and correct non-symmetric neighbours"}; - //No longer necessary. - - /** @brief Key of the CaloNoise Conditions data object. Typical values - are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ - - SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"}; - - /** - * @brief Key for the CaloDetDescrManager in the Condition Store - */ - SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey { this - , "CaloDetDescrManager" - , "CaloDetDescrManager" - , "SG Key for CaloDetDescrManager in the Condition Store" }; - - /** - * @brief type of neighbor relations to use. - * - * The CaloIdentifier package defines different types of neighbors - * for the calorimeter cells. Currently supported neighbor relations - * for topological clustering are: - * - * @li "all2D" for all cells in the same layer (sampling or module) - * of one calorimeter subsystem. Note that endcap and barrel - * will be unconnected in this case even for the LAREM. - * - * @li "all3D" for all cells in the same calorimeter. This means all - * the "all2D" neighbors for each cell plus the cells in - * adjacent samplings overlapping at least partially in - * \f$\eta\f$ and \f$\phi\f$ with the cell. Note that endcap - * and barrel will be connected in this case for the LAREM. - * - * @li "super3D" for all cells. This means all the "all3D" neighbors - * for each cell plus the cells in adjacent samplings from - * other subsystems overlapping at least partially in - * \f$\eta\f$ and \f$\phi\f$ with the cell. All calorimeters - * are connected in this case. - * - * The default setting is "super3D". */ - Gaudi::Property<std::string> m_neighborOptionString {this, "NeighborOption", "super3D", - "Neighbor option to be used for cell neighborhood relations"}; - LArNeighbours::neighbourOption m_neighborOption; - - - /** - * @brief if set to true limit the neighbors in HEC IW and FCal2&3. - * - * The cells in HEC IW and FCal2&3 get very large in terms of eta - * and phi. Since this might pose problems on certain jet - * algorithms one might need to avoid expansion in eta and phi for - * those cells. If this property is set to true the 2d neighbors of - * these cells are not used - only the next sampling neighbors are - * probed. */ - Gaudi::Property<bool> m_restrictHECIWandFCalNeighbors {this, "RestrictHECIWandFCalNeighbors", - false, "Limit the neighbors in HEC IW and FCal2&3"}; - - /** - * @brief if set to true limit the neighbors in presampler Barrel and Endcap. - * - * The presampler cells add a lot of PileUp in the Hilum - * samples. With this option set to true the presampler cells do not - * expand the cluster in the presampler layer. Only the next - * sampling is used as valid neighbor source. */ - Gaudi::Property<bool> m_restrictPSNeighbors {this, "RestrictPSNeighbors", - false, "Limit the neighbors in presampler Barrel and Endcap"}; - - - - bool m_hasBeenInitialized; - -}; - -#endif //CALORECGPU_BASICCONSTANTGPUDATAEXPORTER_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_BASICCONSTANTGPUDATAEXPORTER_H +#define CALORECGPU_BASICCONSTANTGPUDATAEXPORTER_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUTransformers.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "CaloConditions/CaloNoise.h" +#include "CaloDetDescr/CaloDetDescrManager.h" + + +/** + * @class BasicConstantGPUDataExporter + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 29 May 2022 + * @brief Standard tool to export calorimeter geometry and cell noise to GPU. + * + * For the time being, this must be run on first event, so that the noise tool exists and so on. + * Hopefully we can find a way around this in the future. + */ + +class BasicConstantGPUDataExporter : + public AthAlgTool, virtual public ICaloClusterGPUConstantTransformer, public CaloGPUTimed +{ + public: + + BasicConstantGPUDataExporter(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode convert (CaloRecGPU::ConstantDataHolder & constant_data, const bool override_keep_CPU_info) const override; + + virtual StatusCode convert (const EventContext & ctx, CaloRecGPU::ConstantDataHolder & constant_data, const bool override_keep_CPU_info) const override; + + virtual StatusCode finalize() override; + + virtual ~BasicConstantGPUDataExporter(); + + private: + + /** @brief If @p true, do not delete the CPU version of the GPU-friendly data representation. + * Defaults to @p false. + * + */ + + Gaudi::Property<bool> m_keepCPUData {this, "KeepCPUData", true, "Keep CPU version of GPU data format"}; + + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ + + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"}; + + /** + * @brief Key for the CaloDetDescrManager in the Condition Store + */ + SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this, "CaloDetDescrManager", "CaloDetDescrManager", + "SG Key for CaloDetDescrManager in the Condition Store"}; + + + bool m_hasBeenInitialized; + +}; + +#endif //CALORECGPU_BASICCONSTANTGPUDATAEXPORTER_H diff --git a/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.cxx b/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.cxx index 387b9f87667a57570fdb915f4fac6d2dcc8a36ca..23ce970727ddfc95486baacd2b01b6403c3006b5 100644 --- a/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.cxx +++ b/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.cxx @@ -1,231 +1,323 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "BasicEventDataGPUExporter.h" - -#include "CaloRecGPU/CUDAFriendlyClasses.h" - -#include "AthenaKernel/errorcheck.h" -#include "CaloIdentifier/CaloCell_ID.h" -#include "StoreGate/DataHandle.h" -#include "CaloUtils/CaloBadCellHelper.h" -#include "CaloDetDescr/CaloDetDescrManager.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -using namespace CaloRecGPU; - -BasicEventDataGPUExporter::BasicEventDataGPUExporter(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - CaloGPUTimed(this) -{ - declareInterface<ICaloClusterGPUInputTransformer> (this); -} - - -StatusCode BasicEventDataGPUExporter::initialize() -{ - - ATH_CHECK( m_noiseCDOKey.initialize() ); - ATH_CHECK( m_cellsKey.value().initialize() ); - ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); - return StatusCode::SUCCESS; -} - - -static inline bool passCellTimeCut(const CaloCell * pCell, const float threshold) -//Copied from the standard algorithm. -//Could possibly make better use of available info -//in the point where this gets executed, -//but I hope the compiler is smart enough to figure it out. -{ - // get the cell time to cut on (the same as in CaloEvent/CaloCluster.h) - - // need sampling number already for time - CaloSampling::CaloSample sam = pCell->caloDDE()->getSampling(); - // check for unknown sampling - if (sam != CaloSampling::PreSamplerB && sam != CaloSampling::PreSamplerE && sam != CaloSampling::Unknown) - { - const unsigned pmask = pCell->caloDDE()->is_tile() ? 0x8080 : 0x2000; - //0x2000 is used to tell that time and quality information are available for this channel - //(from TWiki: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/CaloEventDataModel#The_Raw_Data_Model) - // Is time defined? - if (pCell->provenance() & pmask) - { - return std::abs(pCell->time()) < threshold; - } - } - return true; -} - -StatusCode BasicEventDataGPUExporter::convert(const EventContext & ctx, - const ConstantDataHolder & cd, - const xAOD::CaloClusterContainer * cluster_collection, - EventDataHolder & ed) const -{ - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - const auto start = clock_type::now(); - - ed.m_cell_info.allocate(); - - SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); - if ( !cell_collection.isValid() ) - { - ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); - return StatusCode::RECOVERABLE; - } - for (int i = 0; i < NCaloCells; ++i) - { - ed.m_cell_info->energy[i] = 0; - ed.m_cell_info->gain[i] = 0; - - GainConversion::mark_invalid_cell(ed.m_cell_info->gain[i]); - } - - SG::ReadCondHandle<CaloNoise> noise_handle(m_noiseCDOKey, ctx); - const CaloNoise * noise_tool = *noise_handle; - - for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) - { - const CaloCell * cell = (*iCells); - - const int index = m_calo_id->calo_cell_hash(cell->ID()); - - const float energy = cell->energy(); - - const int gain = static_cast<int>(GainConversion::from_standard_gain(cell->gain())); - - ed.m_cell_info->energy[index] = energy; - ed.m_cell_info->gain[index] = gain; - - if (CaloBadCellHelper::isBad(cell, m_treatL1PredictedCellsAsGood)) - { - GainConversion::mark_bad_cell(ed.m_cell_info->gain[index]); - - continue; - } - - if (m_cutCellsInTime) - { - if (!passCellTimeCut(cell, m_timeThreshold)) - { - const float snr = energy / (m_useCPUStoredNoise ? cd.m_cell_noise->noise[gain][index] : noise_tool->getNoise(index, cell->gain())); - - if (std::abs(snr) >= m_seedThreshold) - //We'll not worry about the cases with negative snr here - //since it's reasonable to expect these cells to be excluded - //from clustering anyway in the non-abs case, so no worries - //excluding them from yet another perspective... - { - if (!m_keepSignificantCells || snr <= m_thresholdForKeeping) - //If snr > m_thresholdForKeeping and m_keepSignificantCells is true, - //we still keep it as seed so the energy keeps the original value! - { - if (!m_excludeCutSeedsFromClustering) - //If m_excludeCutSeedsFromClustering is false, - //seed cells are still kept as candidates for neighbour or terminal. - { - GainConversion::mark_invalid_seed_cell(ed.m_cell_info->gain[index]); - } - else - { - GainConversion::mark_invalid_cell(ed.m_cell_info->gain[index]); - } - } - } - } - } - } - - const auto post_cells = clock_type::now(); - - if (cluster_collection->size() > 0) - { - ed.m_clusters.allocate(); - ed.m_cell_state.allocate(); - - for (int i = 0; i < NCaloCells; ++i) - { - ed.m_cell_state->clusterTag[i] = Tags::InvalidTag; - } - - const auto cluster_end = cluster_collection->end(); - auto cluster_iter = cluster_collection->begin(); - - for (int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number ) - { - const xAOD::CaloCluster * cluster = (*cluster_iter); - const CaloClusterCellLink * cell_links = cluster->getCellLinks(); - if (!cell_links) - { - ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); - return StatusCode::FAILURE; - } - - ed.m_clusters->clusterEnergy[cluster_number] = cluster->e(); - ed.m_clusters->clusterEt[cluster_number] = cluster->et(); - ed.m_clusters->clusterEta[cluster_number] = cluster->eta(); - ed.m_clusters->clusterPhi[cluster_number] = cluster->phi(); - - const int seed_cell_index = m_calo_id->calo_cell_hash(cluster->cell_begin()->ID()); - - ed.m_clusters->seedCellID[cluster_number] = seed_cell_index; - - const tag_type tag = Tags::make_seed_tag(0x7f7fffff, seed_cell_index, cluster_number); - //0x7f7fffff is the largest possible valid (finite non-NaN) floating point value. - - for (const CaloCell * cell : (*cell_links)) - { - IdentifierHash tmpHashid = m_calo_id->calo_cell_hash(cell->ID()); - const int cell_ID = tmpHashid; - ed.m_cell_state->clusterTag[cell_ID] = tag; - } - } - - ed.m_clusters->number = cluster_collection->size(); - } - - const auto post_clusters = clock_type::now(); - - const bool has_cluster_info = cluster_collection->size() > 0; - - ed.sendToGPU(!m_keepCPUData, has_cluster_info, has_cluster_info, false); - - const auto post_send = clock_type::now(); - - if (m_measureTimes) - { - record_times(ctx.evt(), - time_cast(start, post_cells), - time_cast(post_cells, post_clusters), - time_cast(post_clusters, post_send) - ); - } - - return StatusCode::SUCCESS; - -} - - -StatusCode BasicEventDataGPUExporter::finalize() -{ - - if (m_measureTimes) - { - print_times("Cells Clusters Transfer_to_GPU", 3); - } - return StatusCode::SUCCESS; -} - - -BasicEventDataGPUExporter::~BasicEventDataGPUExporter() -{ - //Nothing! -} +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "BasicEventDataGPUExporter.h" + +#include "CaloRecGPU/CUDAFriendlyClasses.h" + +#include "AthenaKernel/errorcheck.h" +#include "CaloIdentifier/CaloCell_ID.h" +#include "StoreGate/DataHandle.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "TileEvent/TileCell.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +using namespace CaloRecGPU; + +BasicEventDataGPUExporter::BasicEventDataGPUExporter(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this) +{ + declareInterface<ICaloClusterGPUInputTransformer> (this); +} + +StatusCode BasicEventDataGPUExporter::initialize() +{ + + ATH_CHECK( m_cellsKey.value().initialize() ); + + ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); + + return StatusCode::SUCCESS; +} + +StatusCode BasicEventDataGPUExporter::convert(const EventContext & ctx, + const ConstantDataHolder & /*cd*/, + const xAOD::CaloClusterContainer * cluster_collection, + EventDataHolder & ed) const +{ + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + const auto start = clock_type::now(); + + ed.m_cell_info.allocate(); + + SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); + if ( !cell_collection.isValid() ) + { + ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); + return StatusCode::RECOVERABLE; + } + + + if (cell_collection->isOrderedAndComplete()) + //Fast path: cell indices within the collection and identifierHashes match! + { + ATH_MSG_DEBUG("Taking quick path on event " << ctx.evt()); + int cell_index = 0; + for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells, ++cell_index) + { + const CaloCell * cell = (*iCells); + + const float energy = cell->energy(); + const unsigned int gain = GainConversion::from_standard_gain(cell->gain()); + ed.m_cell_info->energy[cell_index] = energy; + ed.m_cell_info->gain[cell_index] = gain; + ed.m_cell_info->time[cell_index] = cell->time(); + if (CaloRecGPU::GeometryArr::is_tile(cell_index)) + { + const TileCell * tile_cell = (TileCell *) cell; + + ed.m_cell_info->qualityProvenance[cell_index] = QualityProvenance{tile_cell->qual1(), + tile_cell->qual2(), + tile_cell->qbit1(), + tile_cell->qbit2()}; + } + else + { + ed.m_cell_info->qualityProvenance[cell_index] = QualityProvenance{cell->quality(), cell->provenance()}; + } + } + } + else if (m_missingCellsToFill.size() > 0) + //Remediated: we know the missing cells, force them to be invalid. + //(Tests so far, on samples both oldish and newish, had 186986 and 187352 missing...) + { + ATH_MSG_DEBUG("Taking remediated fast path on event " << ctx.evt()); + int cell_index = 0; + size_t missing_cell_count = 0; + for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells, ++cell_index) + { + const CaloCell * cell = (*iCells); + + if (missing_cell_count < m_missingCellsToFill.size() && cell_index == m_missingCellsToFill[missing_cell_count]) + { + --iCells; + ed.m_cell_info->gain[cell_index] = GainConversion::invalid_gain(); + ++missing_cell_count; + continue; + } + else + { + const float energy = cell->energy(); + const unsigned int gain = GainConversion::from_standard_gain(cell->gain()); + ed.m_cell_info->energy[cell_index] = energy; + ed.m_cell_info->gain[cell_index] = gain; + ed.m_cell_info->time[cell_index] = cell->time(); + if (CaloRecGPU::GeometryArr::is_tile(cell_index)) + { + const TileCell * tile_cell = (TileCell *) cell; + + ed.m_cell_info->qualityProvenance[cell_index] = QualityProvenance{tile_cell->qual1(), + tile_cell->qual2(), + tile_cell->qbit1(), + tile_cell->qbit2()}; + } + else + { + ed.m_cell_info->qualityProvenance[cell_index] = QualityProvenance{cell->quality(), cell->provenance()}; + } + } + } + } + else + //Slow path: be careful. + { + /* + std::vector<bool> has_cell(NCaloCells, false); + // */ + ATH_MSG_DEBUG("Taking slow path on event " << ctx.evt()); + for (int cell_index = 0; cell_index < NCaloCells; ++cell_index) + { + //ed.m_cell_info->energy[cell_index] = 0; + ed.m_cell_info->gain[cell_index] = GainConversion::invalid_gain(); + //ed.m_cell_info->time[cell_index] = 0; + //ed.m_cell_info->qualityProvenance[cell_index] = 0; + } + + for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) + { + const CaloCell * cell = (*iCells); + + //const int cell_index = m_calo_id->calo_cell_hash(cell->ID()); + const int cell_index = cell->caloDDE()->calo_hash(); + //See calodde + + /* + has_cell[cell_index] = true; + // */ + + const float energy = cell->energy(); + + const unsigned int gain = GainConversion::from_standard_gain(cell->gain()); + + ed.m_cell_info->energy[cell_index] = energy; + ed.m_cell_info->gain[cell_index] = gain; + ed.m_cell_info->time[cell_index] = cell->time(); + if (CaloRecGPU::GeometryArr::is_tile(cell_index)) + { + const TileCell * tile_cell = (TileCell *) cell; + + ed.m_cell_info->qualityProvenance[cell_index] = QualityProvenance{tile_cell->qual1(), + tile_cell->qual2(), + tile_cell->qbit1(), + tile_cell->qbit2()}; + } + else + { + ed.m_cell_info->qualityProvenance[cell_index] = QualityProvenance{cell->quality(), cell->provenance()}; + } + } + + /* + for (size_t i = 0; i < has_cell.size(); ++i) + { + if (!has_cell[i]) + { + const auto identifier = m_calo_id->cell_id(i); + const auto sampling = m_calo_id->calo_sample(m_calo_id->cell_id((IdentifierHash) i)); + std::cout << i << " " << sampling << std::endl; + } + } + // */ + } + + const auto post_cells = clock_type::now(); + + if (cluster_collection->size() > 0) + { + ed.m_clusters.allocate(); + ed.m_cell_state.allocate(); + + for (int i = 0; i < NCaloCells; ++i) + { + ed.m_cell_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + + const auto cluster_end = cluster_collection->end(); + auto cluster_iter = cluster_collection->begin(); + + for (int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number ) + { + const xAOD::CaloCluster * cluster = (*cluster_iter); + const CaloClusterCellLink * cell_links = cluster->getCellLinks(); + + ed.m_clusters->clusterEnergy[cluster_number] = cluster->e(); + ed.m_clusters->clusterEt[cluster_number] = cluster->et(); + ed.m_clusters->clusterEta[cluster_number] = cluster->eta(); + ed.m_clusters->clusterPhi[cluster_number] = cluster->phi(); + + const int seed_cell_index = m_calo_id->calo_cell_hash(cluster->cell_begin()->ID()); + + ed.m_clusters->seedCellID[cluster_number] = seed_cell_index; + + for (auto it = cell_links->begin(); it != cell_links->end(); ++it) + { + if (m_considerSharedCells) + { + const int cell_ID = m_calo_id->calo_cell_hash(it->ID()); + const float weight = it.weight(); + + uint32_t weight_as_int = 0; + std::memcpy(&weight_as_int, &weight, sizeof(float)); + //On the platforms we expect to be running this, it should be fine. + //Still UB. + //With C++20, we could do that bit-cast thing. + + if (weight_as_int == 0) + { + weight_as_int = 1; + //Subnormal, + //but just to distinguish from + //a non-shared cluster. + } + + const ClusterTag other_tag = ed.m_cell_state->clusterTag[cell_ID]; + + const int other_index = other_tag.is_part_of_cluster() ? other_tag.cluster_index() : -1; + + if (other_index < 0) + { + if (weight < 0.5f) + { + ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0); + } + else + { + ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number); + } + } + else if (weight > 0.5f) + { + ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, other_tag.secondary_cluster_weight(), other_index); + } + else if (weight == 0.5f) + //Unlikely, but... + { + const int max_cluster = cluster_number > other_index ? cluster_number : other_index; + const int min_cluster = cluster_number > other_index ? other_index : cluster_number; + ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster); + } + else /*if (weight < 0.5f)*/ + { + ed.m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number); + } + } + else + { + ed.m_cell_state->clusterTag[m_calo_id->calo_cell_hash(it->ID())] = ClusterTag::make_tag(cluster_number); + } + } + } + + ed.m_clusters->number = cluster_collection->size(); + + //std::cout << "Number: " << ed.m_clusters->number << std::endl; + } + + const auto post_clusters = clock_type::now(); + + const bool has_cluster_info = cluster_collection->size() > 0; + + ed.sendToGPU(!m_keepCPUData, has_cluster_info, has_cluster_info, false, false); + + const auto post_send = clock_type::now(); + + if (m_measureTimes) + { + record_times(ctx.evt(), + time_cast(start, post_cells), + time_cast(post_cells, post_clusters), + time_cast(post_clusters, post_send) + ); + } + + return StatusCode::SUCCESS; + +} + + +StatusCode BasicEventDataGPUExporter::finalize() +{ + + if (m_measureTimes) + { + print_times("Cells Clusters Transfer_to_GPU", 3); + } + return StatusCode::SUCCESS; +} + + +BasicEventDataGPUExporter::~BasicEventDataGPUExporter() +{ + //Nothing! +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.h b/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.h index 78015ec73fdc2daed71d087008efb41c713efe98..d1ee4a325e7028aceeed914a0fbf413dccdf9899 100644 --- a/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.h +++ b/Calorimeter/CaloRecGPU/src/BasicEventDataGPUExporter.h @@ -1,121 +1,78 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_BASICEVENTDATAGPUEXPORTER_H -#define CALORECGPU_BASICEVENTDATAGPUEXPORTER_H - -#include "AthenaBaseComps/AthAlgTool.h" - -#include "CLHEP/Units/SystemOfUnits.h" - -#include "CaloRecGPU/CaloClusterGPUTransformers.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/ReadHandleKey.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "CaloConditions/CaloNoise.h" - -class CaloCell_ID; - -/** - * @class BasicEventDataGPUExporter - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 29 May 2022 - * @brief Standard tool to export cell energy and gain to the GPU. - * - * @warning The two gaussian noise for evaluating the seed cell cuts - * based on out of time seeds is not implemented! We currently assume - * noise as estimated without that flag. - * - */ - -class BasicEventDataGPUExporter : - public AthAlgTool, virtual public ICaloClusterGPUInputTransformer, public CaloGPUTimed -{ - public: - - BasicEventDataGPUExporter(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode initialize() override; - - virtual StatusCode convert (const EventContext & ctx, const ConstantDataHolder & constant_data, - const xAOD::CaloClusterContainer * cluster_collection, EventDataHolder & event_data) const override; - - virtual StatusCode finalize() override; - - virtual ~BasicEventDataGPUExporter(); - - private: - - /** @brief If @p true, do not delete the CPU version of the GPU-friendly data representation. - * Defaults to @p true. - * - */ - Gaudi::Property<bool> m_keepCPUData {this, "KeepCPUData", true, "Keep CPU version of GPU data format"}; - - - /** @brief If @p true and the noise is necessary to exclude out of time seeds, - * reads the noise from the values kept in CPU memory inside the @p ConstantDataHolder - * Reads from the usual Athena CaloNoise if @p false. - * Defaults to @p true. - * - */ - Gaudi::Property<bool> m_useCPUStoredNoise {this, "UseCPUStoredNoise", true, "If necessary to use noise to exclude OOT seeds, use the CPU equivalent of the GPU stored noise rather than going through the normal interfaces"}; - - - /** @brief Key of the CaloNoise Conditions data object. Typical values - are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) - - Really only used if @p m_useCPUStoredNoise is @p false. - - */ - SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"}; - - /** - * @brief vector of names of the cell containers to use as input. - */ - Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; - - /** - * if set to true, time cut is applied to seed cells, no cut otherwise - */ - Gaudi::Property<bool> m_cutCellsInTime {this, "SeedCutsInT", false, "Do seed cuts in time"}; - - /** - * threshold used for timing cut on seed cells. Implemented as |seed_cell_time|<m_timeThreshold. No such cut on neighbouring cells.*/ - Gaudi::Property<float> m_timeThreshold {this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"}; - - /** - * upper limit on the energy significance, for applying the cell time cut */ - Gaudi::Property<float> m_thresholdForKeeping {this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"}; - - - /** - * @brief if set to true treat cells with a dead OTX which can be - * predicted by L1 trigger info as good instead of bad cells */ - Gaudi::Property<bool> m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}; - - /** - * @brief if set to true, seed cells failing the time cut are also excluded from cluster at all - */ - Gaudi::Property<bool> m_excludeCutSeedsFromClustering {this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"}; - - /** - * @brief if set to true, the time cut is not applied on cell of large significance - */ - Gaudi::Property<bool> m_keepSignificantCells {this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"}; - - /** @brief Value to consider for the threshold. Should be consistent with the - * one used in Topological Clustering to ensure seed cell time cuts work properly. - */ - Gaudi::Property<float> m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; - - /** - * @brief Pointer to Calo ID Helper - */ - const CaloCell_ID* m_calo_id{nullptr}; -}; - -#endif //CALORECGPU_BASICEVENTDATAGPUEXPORTER_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_BASICEVENTDATAGPUEXPORTER_H +#define CALORECGPU_BASICEVENTDATAGPUEXPORTER_H + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "CaloRecGPU/CaloClusterGPUTransformers.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadHandleKey.h" +#include "CaloRecGPU/CaloGPUTimed.h" + +class CaloCell_ID; + +/** + * @class BasicEventDataGPUExporter + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 29 May 2022 + * @brief Standard tool to export cell energy and gain to the GPU. + * + * @warning The two gaussian noise for evaluating the seed cell cuts + * based on out of time seeds is not implemented! We currently assume + * noise as estimated without that flag. + * + */ + +class BasicEventDataGPUExporter : + public AthAlgTool, virtual public ICaloClusterGPUInputTransformer, public CaloGPUTimed +{ + public: + + BasicEventDataGPUExporter(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode convert (const EventContext & ctx, const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection, CaloRecGPU::EventDataHolder & event_data) const override; + + virtual StatusCode finalize() override; + + virtual ~BasicEventDataGPUExporter(); + + private: + + /** @brief If @p true, do not delete the CPU version of the GPU-friendly data representation. + * Defaults to @p true. + * + */ + Gaudi::Property<bool> m_keepCPUData {this, "KeepCPUData", true, "Keep CPU version of GPU data format"}; + + /** + * @brief vector of names of the cell containers to use as input. + */ + Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; + + /** @brief If @p true, into account the possibility of a cell being shared between clusters. + * Hurts performance when not needed. + * Defaults to @p false. + * + */ + Gaudi::Property<bool> m_considerSharedCells {this, "ConsiderSharedCells", false, "Take into account the possibility of a cell being shared between clusters."}; + + /** @brief Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells). + */ + Gaudi::Property<std::vector<int>> m_missingCellsToFill {this, "MissingCellsToFill", {}, "Force fill these cells as disabled on empty containers."}; + + /** + * @brief Pointer to Calo ID Helper + */ + const CaloCell_ID * m_calo_id {nullptr}; + +}; + +#endif //CALORECGPU_BASICEVENTDATAGPUEXPORTER_H diff --git a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.cxx b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.cxx index 9873b0dce1fb4f65149c41d4692ff314fe3a9ec6..b7ac9bf8357558677c247f4f30fa9c6da13fd656 100644 --- a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.cxx +++ b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.cxx @@ -1,102 +1,79 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "BasicGPUClusterInfoCalculator.h" -#include "BasicGPUClusterInfoCalculatorImpl.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -using namespace CaloRecGPU; - -BasicGPUClusterInfoCalculator::BasicGPUClusterInfoCalculator(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - CaloGPUTimed(this) -{ - declareInterface<CaloClusterGPUProcessor> (this); -} - -StatusCode BasicGPUClusterInfoCalculator::initialize() -{ - - if (m_numPreAllocatedGPUData > 0) - { - ATH_MSG_DEBUG("Pre-allocating temporaries for " << m_numPreAllocatedGPUData << " events."); - - m_temporariesHolder.resize(m_numPreAllocatedGPUData); - //This will allocate the object holders. - - m_temporariesHolder.operate_on_all( [&](BasicGPUClusterInfoCalculatorTemporariesHolder & tth) - { - tth.allocate(); - } - ); - //This will allocate all the memory at this point. - //Also useful to prevent/debug potential allocation issues? - //But the main point is really reducing the execute times... - } - - return StatusCode::SUCCESS; -} - -StatusCode BasicGPUClusterInfoCalculator::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const -{ - - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - const auto start = clock_type::now(); - - BasicGPUClusterInfoCalculatorTemporariesHolder * temp_data_ptr = nullptr; - - Helpers::separate_thread_accessor<BasicGPUClusterInfoCalculatorTemporariesHolder> sep_th_acc(m_temporariesHolder, temp_data_ptr); - //This is a RAII wrapper to access an object held by Helpers::separate_thread_holder, - //to ensure the event data is appropriately released when we are done processing. - - temp_data_ptr->allocate(); - //Does nothing if it is already allocated. - - const auto before_seed_properties = clock_type::now(); - - updateSeedCellProperties(event_data, *temp_data_ptr, constant_data, m_measureTimes); - - const auto before_calculating = clock_type::now(); - - calculateClusterProperties(event_data, *temp_data_ptr, constant_data, m_measureTimes); - - const auto end = clock_type::now(); - - - if (m_measureTimes) - { - record_times(ctx.evt(), - time_cast(start, before_seed_properties), - time_cast(before_seed_properties, before_calculating), - time_cast(before_calculating, end) - ); - } - - - return StatusCode::SUCCESS; - -} - - -StatusCode BasicGPUClusterInfoCalculator::finalize() -{ - if (m_measureTimes) - { - print_times("Preprocessing Seed_Cell_Properties_Updating Cluster_Properties_Calculation", 3); - } - return StatusCode::SUCCESS; -} - - -BasicGPUClusterInfoCalculator::~BasicGPUClusterInfoCalculator() -{ - //Nothing! -} \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "BasicGPUClusterInfoCalculator.h" +#include "BasicGPUClusterInfoCalculatorImpl.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +using namespace CaloRecGPU; + +BasicGPUClusterInfoCalculator::BasicGPUClusterInfoCalculator(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this) +{ + declareInterface<CaloClusterGPUProcessor> (this); +} + +StatusCode BasicGPUClusterInfoCalculator::initialize() +{ + return StatusCode::SUCCESS; +} + +StatusCode BasicGPUClusterInfoCalculator::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, + EventDataHolder & event_data, void * temporary_buffer) const +{ + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + const auto start = clock_type::now(); + + Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries((ClusterInfoCalculatorTemporaries *) temporary_buffer); + + const auto before_seed_properties = clock_type::now(); + + updateSeedCellProperties(event_data, temporaries, constant_data, m_measureTimes); + + const auto before_calculating = clock_type::now(); + + calculateClusterProperties(event_data, temporaries, constant_data, m_measureTimes, m_cutClustersInAbsE, m_clusterETThreshold); + + const auto end = clock_type::now(); + + + if (m_measureTimes) + { + record_times(ctx.evt(), + time_cast(start, before_seed_properties), + time_cast(before_seed_properties, before_calculating), + time_cast(before_calculating, end) + ); + } + + + return StatusCode::SUCCESS; + +} + + +StatusCode BasicGPUClusterInfoCalculator::finalize() +{ + if (m_measureTimes) + { + print_times("Preprocessing Seed_Cell_Properties_Updating Cluster_Properties_Calculation", 3); + } + return StatusCode::SUCCESS; +} + + +BasicGPUClusterInfoCalculator::~BasicGPUClusterInfoCalculator() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.h b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.h index 10afe7283ac4477fd0ebe2818ac84b7fa8646b92..cbea64d9ea763445479b478ff7600b658f4543c7 100644 --- a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.h +++ b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculator.h @@ -1,55 +1,71 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - - -#ifndef CALORECGPU_BASICGPUCLUSTERINFOCALCULATOR_H -#define CALORECGPU_BASICGPUCLUSTERINFOCALCULATOR_H - -#include "CxxUtils/checker_macros.h" - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "BasicGPUClusterInfoCalculatorImpl.h" - -/** - * @class BasicGPUClusterInfoCalculator - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 11 August 2022 - * @brief Standard tool to calculate cluster info (energy, transverse energy, pseudo-rapidity and azimuthal angle). - */ - - -class BasicGPUClusterInfoCalculator: - public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed -{ - public: - - BasicGPUClusterInfoCalculator(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode initialize() override; - - virtual StatusCode execute (const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const override; - - virtual StatusCode finalize() override; - - virtual ~BasicGPUClusterInfoCalculator(); - - private: - - /** - * @brief Number of events for which to pre-allocate space on GPU memory - * (should ideally be set to the expected number of threads to be run with). - * - */ - Gaudi::Property<size_t> m_numPreAllocatedGPUData {this, "NumPreAllocatedDataHolders", 0, "Number of temporary data holders to pre-allocate on GPU memory"}; - - /** @brief A way to reduce allocations over multiple threads by keeping a cache - * of previously allocated objects that get assigned to the threads as they need them. - * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. - */ - mutable CaloRecGPU::Helpers::separate_thread_holder<BasicGPUClusterInfoCalculatorTemporariesHolder> m_temporariesHolder ATLAS_THREAD_SAFE; -}; - +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + + +#ifndef CALORECGPU_BASICGPUCLUSTERINFOCALCULATOR_H +#define CALORECGPU_BASICGPUCLUSTERINFOCALCULATOR_H + +#include "CxxUtils/checker_macros.h" + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "BasicGPUClusterInfoCalculatorImpl.h" + +#include "CLHEP/Units/SystemOfUnits.h" + +/** + * @class BasicGPUClusterInfoCalculator + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 11 August 2022 + * @brief Standard tool to calculate cluster info (energy, transverse energy, pseudo-rapidity and azimuthal angle) + * and apply E/ET cuts on clusters if desired. + */ + + +class BasicGPUClusterInfoCalculator: + public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed +{ + public: + + BasicGPUClusterInfoCalculator(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual StatusCode finalize() override; + + virtual ~BasicGPUClusterInfoCalculator(); + + virtual size_t size_of_temporaries() const + { + return sizeof(ClusterInfoCalculatorTemporaries); + }; + + private: + + /** + * @brief if set to @p true cluster cuts are on \f$|E|_\perp\f$, if @p false on \f$E_\perp\f$. Default is @p true. + * + */ + Gaudi::Property<bool> m_cutClustersInAbsE {this, "ClusterCutsInAbsEt", true, "Do cluster cuts in Abs Et instead of Et"}; + + /** + * @brief \f$E_\perp\f$ cut on the clusters. + * + * The clusters have to pass this cut (which is on \f$E_\perp\f$ + * or \f$|E|_\perp\f$ of the cluster depending on the above switch) + * in order to be inserted into the CaloClusterContainer. */ + + Gaudi::Property<float> m_clusterETThreshold {this, "ClusterEtorAbsEtCut", 0.*CLHEP::MeV, "Cluster E_t or Abs E_t cut"}; + +}; + #endif //CALORECGPU_TOPOAUTOMATONCLUSTERING_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.cu b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.cu index 0edf293699d94dd374c17f0f4e38903d7db0bce4..5cd891ebd5cc1a602b36b86f2f3f701a9521f8fd 100644 --- a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.cu +++ b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.cu @@ -1,189 +1,300 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "BasicGPUClusterInfoCalculatorImpl.h" - - -#include <cstring> -#include <cmath> -#include <iostream> -#include <stdio.h> - - -using namespace CaloRecGPU; - -void BasicGPUClusterInfoCalculatorTemporariesHolder::allocate() -{ - m_temporaries_dev.allocate(); -} - -constexpr static int SeedCellPropertiesBlockSize = 512; - -constexpr static int CalculateClusterInfoBlockSize = 320; -constexpr static int FinalizeClusterInfoBlockSize = 256; - -/**********************************************************************************/ - -__global__ static -void seedCellPropertiesKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, - Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries, - const Helpers::CUDA_kernel_object<GeometryArr> geometry, - const int cluster_number) -{ - const int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i < cluster_number) - { - clusters_arr->clusterEnergy[i] = 0.f; - clusters_arr->clusterEt[i] = 0.f; - clusters_arr->clusterEta[i] = 0.f; - clusters_arr->clusterPhi[i] = 0.f; - temporaries->seedCellPhi[i] = geometry->phi[clusters_arr->seedCellID[i]]; - } -} - - -__global__ static -void seedCellPropertiesDeferKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, - Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries, - const Helpers::CUDA_kernel_object<GeometryArr> geometry) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - { - const int cluster_number = clusters_arr->number; - - const int i_dimBlock = SeedCellPropertiesBlockSize; - const int i_dimGrid = Helpers::int_ceil_div(cluster_number, i_dimBlock); - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - seedCellPropertiesKernel <<< dimGrid, dimBlock >>>(clusters_arr, temporaries, geometry, cluster_number); - - } -} - -void updateSeedCellProperties(EventDataHolder & holder, BasicGPUClusterInfoCalculatorTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const bool synchronize) -{ - seedCellPropertiesDeferKernel <<<1, 1>>>(holder.m_clusters_dev, temps.m_temporaries_dev, instance_data.m_geometry_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - - -/**********************************************************************************/ - -__device__ static inline -float regularize_angle(const float b, const float a) -//a. k. a. proxim in Athena code. -{ - const float diff = b - a; - const float divi = (fabsf(diff) - Helpers::Constants::pi<float>) / (2 * Helpers::Constants::pi<float>); - return b - ceilf(divi) * ((b > a + Helpers::Constants::pi<float>) - (b < a - Helpers::Constants::pi<float>)) * 2 * Helpers::Constants::pi<float>; -} - -__global__ static -void calculateClusterInfoKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, - const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry, - const Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type tag = cell_state_arr->clusterTag[index]; - if (Tags::is_part_of_cluster(tag)) - //By this point they all have the terminals anyway, so... - { - const int cluster_index = Tags::get_index_from_tag(tag); - const float energy = cell_info_arr->energy[index]; - const float abs_energy = fabsf(energy); - const float phi_raw = geometry->phi[index]; - - atomicAdd(&(clusters_arr->clusterEnergy[cluster_index]), energy); - atomicAdd(&(clusters_arr->clusterEt[cluster_index]), abs_energy); - atomicAdd(&(clusters_arr->clusterEta[cluster_index]), abs_energy * geometry->eta[index]); - - const float phi_0 = temporaries->seedCellPhi[cluster_index]; - const float phi_real = regularize_angle(phi_raw, phi_0); - atomicAdd(&(clusters_arr->clusterPhi[cluster_index]), phi_real * abs_energy); - - } - } -} - - -__global__ static -void finalizeClusterInfoKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int cluster_number) -{ - const int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i < cluster_number) - { - - const float abs_energy = clusters_arr->clusterEt[i]; - - if (abs_energy > 0) - { - const float tempeta = clusters_arr->clusterEta[i] / abs_energy; - - clusters_arr->clusterEta[i] = tempeta; - - clusters_arr->clusterEt[i] = clusters_arr->clusterEnergy[i] / coshf(abs(tempeta)); - - clusters_arr->clusterPhi[i] = regularize_angle(clusters_arr->clusterPhi[i] / abs_energy, 0.f); - } - else - { - clusters_arr->seedCellID[i] = -1; - //This is just a way to signal that this is an invalid cluster. - } - } -} - -__global__ static -void finalizeClustersDeferKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - { - const int cluster_number = clusters_arr->number; - - const int i_dimBlock = FinalizeClusterInfoBlockSize; - const int i_dimGrid = Helpers::int_ceil_div(cluster_number, i_dimBlock); - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - finalizeClusterInfoKernel <<< dimGrid, dimBlock >>>(clusters_arr, cluster_number); - - } -} - -void calculateClusterProperties(EventDataHolder & holder, BasicGPUClusterInfoCalculatorTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const bool synchronize) -{ - - const int i_dimBlock = CalculateClusterInfoBlockSize; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - calculateClusterInfoKernel <<< dimGrid, dimBlock>>>(holder.m_clusters_dev, holder.m_cell_state_dev, - holder.m_cell_info_dev, instance_data.m_geometry_dev, temps.m_temporaries_dev); - - finalizeClustersDeferKernel <<< 1, 1>>>(holder.m_clusters_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "BasicGPUClusterInfoCalculatorImpl.h" + + +#include <cstring> +#include <cmath> +#include <iostream> +#include <stdio.h> + +using namespace CaloRecGPU; + +constexpr static int SeedCellPropertiesBlockSize = 512; + +constexpr static int CalculateClusterInfoBlockSize = 320; +constexpr static int FinalizeClusterInfoBlockSize = 256; +constexpr static int ClearInvalidCellsBlockSize = 512; + +#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ > 350 + #if CUDART_VERSION >= 12000 + #define CAN_USE_TAIL_LAUNCH 1 + #else + #define CAN_USE_TAIL_LAUNCH 0 + #endif +#elif defined(__CUDA_ARCH__) + #error "CUDA compute capability at least 3.5 is needed so we can have dynamic parallelism!" +#endif + +/**********************************************************************************/ + +__global__ static +void seedCellPropertiesKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const int cluster_number) +{ + const int i = blockIdx.x * blockDim.x + threadIdx.x; + if (i < cluster_number) + { + clusters_arr->clusterEnergy[i] = 0.f; + clusters_arr->clusterEt[i] = 0.f; + clusters_arr->clusterEta[i] = 0.f; + clusters_arr->clusterPhi[i] = 0.f; + const int seed_cell = clusters_arr->seedCellID[i]; + if (seed_cell >= 0) + { + temporaries->seedCellPhi[i] = geometry->phi[seed_cell]; + } + else + { + temporaries->seedCellPhi[i] = 0.f; + } + } +} + + +__global__ static +void seedCellPropertiesDeferKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries, + const Helpers::CUDA_kernel_object<GeometryArr> geometry) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + { + const int cluster_number = clusters_arr->number; + + const int i_dimBlock = SeedCellPropertiesBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(cluster_number, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); +#if CAN_USE_TAIL_LAUNCH + seedCellPropertiesKernel <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(clusters_arr, temporaries, geometry, cluster_number); +#else + seedCellPropertiesKernel <<< dimGrid, dimBlock>>>(clusters_arr, temporaries, geometry, cluster_number); +#endif + } +} + +void updateSeedCellProperties(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temps, + const ConstantDataHolder & instance_data, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + seedCellPropertiesDeferKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_clusters_dev, temps, instance_data.m_geometry_dev); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + + +/**********************************************************************************/ + +__global__ static +void calculateClusterInfoKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temporaries) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[index]; + if (tag.is_part_of_cluster()) + //By this point they all have the terminals anyway, so... + { + if (tag.is_shared_between_clusters()) + { + const int primary_cluster = tag.cluster_index(); + const int secondary_cluster = tag.secondary_cluster_index(); + + const float secondary_weight = __int_as_float(tag.secondary_cluster_weight()); + const float weight = 1.0f - secondary_weight; + + const float energy = cell_info_arr->energy[index]; + const float abs_energy = fabsf(energy); + const float phi_raw = geometry->phi[index]; + + atomicAdd(&(clusters_arr->clusterEnergy[primary_cluster]), energy * weight); + atomicAdd(&(clusters_arr->clusterEt[primary_cluster]), abs_energy * weight); + atomicAdd(&(clusters_arr->clusterEta[primary_cluster]), abs_energy * geometry->eta[index] * weight); + + const float primary_phi_0 = temporaries->seedCellPhi[primary_cluster]; + const float primary_phi_real = Helpers::regularize_angle(phi_raw, primary_phi_0); + atomicAdd(&(clusters_arr->clusterPhi[primary_cluster]), primary_phi_real * abs_energy * weight); + + atomicAdd(&(clusters_arr->clusterEnergy[secondary_cluster]), energy * secondary_weight); + atomicAdd(&(clusters_arr->clusterEt[secondary_cluster]), abs_energy * secondary_weight); + atomicAdd(&(clusters_arr->clusterEta[secondary_cluster]), abs_energy * geometry->eta[index] * secondary_weight); + + const float secondary_phi_0 = temporaries->seedCellPhi[secondary_cluster]; + const float secondary_phi_real = Helpers::regularize_angle(phi_raw, secondary_phi_0); + atomicAdd(&(clusters_arr->clusterPhi[secondary_cluster]), secondary_phi_real * abs_energy * secondary_weight); + } + else + { + const int cluster_index = tag.cluster_index(); + const float energy = cell_info_arr->energy[index]; + const float abs_energy = fabsf(energy); + const float phi_raw = geometry->phi[index]; + + atomicAdd(&(clusters_arr->clusterEnergy[cluster_index]), energy); + atomicAdd(&(clusters_arr->clusterEt[cluster_index]), abs_energy); + atomicAdd(&(clusters_arr->clusterEta[cluster_index]), abs_energy * geometry->eta[index]); + + const float phi_0 = temporaries->seedCellPhi[cluster_index]; + const float phi_real = Helpers::regularize_angle(phi_raw, phi_0); + atomicAdd(&(clusters_arr->clusterPhi[cluster_index]), phi_real * abs_energy); + } + } + } +} + + +__global__ static +void finalizeClusterInfoKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int cluster_number, + const bool cut_in_absolute_ET, const float ET_threshold ) +{ + const int i = blockIdx.x * blockDim.x + threadIdx.x; + if (i < cluster_number) + { + + const float abs_energy = clusters_arr->clusterEt[i]; + + if (abs_energy > 0) + { + const float tempeta = clusters_arr->clusterEta[i] / abs_energy; + + clusters_arr->clusterEta[i] = tempeta; + + const float temp_ET = clusters_arr->clusterEnergy[i] / coshf(abs(tempeta)); + + clusters_arr->clusterEt[i] = temp_ET; + + clusters_arr->clusterPhi[i] = Helpers::regularize_angle(clusters_arr->clusterPhi[i] / abs_energy, 0.f); + + if ( !(temp_ET > ET_threshold || (cut_in_absolute_ET && fabsf(temp_ET) > ET_threshold) ) ) + { + clusters_arr->seedCellID[i] = -1; + } + } + else + { + clusters_arr->seedCellID[i] = -1; + //This is just a way to signal that this is an invalid cluster. + } + } +} + +__global__ static +void finalizeClustersDeferKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const bool cut_in_absolute_ET, const float ET_threshold) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + { + const int cluster_number = clusters_arr->number; + + const int i_dimBlock = FinalizeClusterInfoBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(cluster_number, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); +#if CAN_USE_TAIL_LAUNCH + finalizeClusterInfoKernel <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(clusters_arr, cluster_number, cut_in_absolute_ET, ET_threshold); +#else + finalizeClusterInfoKernel <<< dimGrid, dimBlock>>>(clusters_arr, cluster_number, cut_in_absolute_ET, ET_threshold); +#endif + } +} + + +__global__ static +void clearInvalidCells(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[index]; + if (tag.is_part_of_cluster()) + //By this point they all have the terminals anyway, so... + { + if (tag.is_shared_between_clusters()) + { + const int first_cluster = tag.cluster_index(); + const int second_cluster = tag.secondary_cluster_index(); + + const int first_seed = clusters_arr->seedCellID[first_cluster]; + const int second_seed = clusters_arr->seedCellID[second_cluster]; + + if (first_seed < 0 && second_seed < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag:: make_invalid_tag(); + } + else if (first_seed < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(second_cluster); + } + else if (second_seed < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(first_cluster); + } + else /*if (first_seed >= 0 && second_seed >= 0)*/ + { + //Do nothing: the tag's already OK. + } + } + else + { + if (clusters_arr->seedCellID[tag.cluster_index()] < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag:: make_invalid_tag(); + } + } + } + } +} + +void calculateClusterProperties(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temps, + const ConstantDataHolder & instance_data, const bool synchronize, + const bool cut_in_absolute_ET, const float ET_threshold, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + const int i_dimBlock1 = CalculateClusterInfoBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(NCaloCells, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + + const int i_dimBlock2 = ClearInvalidCellsBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + calculateClusterInfoKernel <<< dimGrid1, dimBlock1, 0, stream_to_use>>>(holder.m_clusters_dev, holder.m_cell_state_dev, + holder.m_cell_info_dev, instance_data.m_geometry_dev, temps); + + finalizeClustersDeferKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_clusters_dev, cut_in_absolute_ET, ET_threshold); + + clearInvalidCells <<< dimGrid2, dimBlock2, 0, stream_to_use>>>(holder.m_cell_state_dev, holder.m_clusters_dev); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } } \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.h b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.h index 330fd35043e791ae1175a268aaeb843e4574adb6..ade75b90a5bd6a9b4b70e35a9690537ab7c3d539 100644 --- a/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.h +++ b/Calorimeter/CaloRecGPU/src/BasicGPUClusterInfoCalculatorImpl.h @@ -1,31 +1,27 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_BASICGPUCLUSTERINFOCALCULATORIMPL_H -#define CALORECGPU_BASICGPUCLUSTERINFOCALCULATORIMPL_H - -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/DataHolders.h" - -struct ClusterInfoCalculatorTemporaries -{ - float seedCellPhi[CaloRecGPU::NMaxClusters]; -}; - -struct BasicGPUClusterInfoCalculatorTemporariesHolder -{ - //Helpers::CPU_object<TopoAutomatonTemporaries> m_temporaries; - - CaloRecGPU::Helpers::CUDA_object<ClusterInfoCalculatorTemporaries> m_temporaries_dev; - - void allocate(); -}; - -void updateSeedCellProperties(EventDataHolder & holder, BasicGPUClusterInfoCalculatorTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const bool synchronize = false); - -void calculateClusterProperties(EventDataHolder & holder, BasicGPUClusterInfoCalculatorTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const bool synchronize = false); - -#endif //CALORECGPU_BASICGPUCLUSTERINFOCALCULATORIMPL_H \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_BASICGPUCLUSTERINFOCALCULATORIMPL_H +#define CALORECGPU_BASICGPUCLUSTERINFOCALCULATORIMPL_H + +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/DataHolders.h" + +struct ClusterInfoCalculatorTemporaries +{ + float seedCellPhi[CaloRecGPU::NMaxClusters]; +}; + +void updateSeedCellProperties(CaloRecGPU::EventDataHolder & holder, CaloRecGPU::Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void calculateClusterProperties(CaloRecGPU::EventDataHolder & holder, CaloRecGPU::Helpers::CUDA_kernel_object<ClusterInfoCalculatorTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const bool synchronize = false, + const bool cut_in_absolute_ET = true, const float absolute_ET_threshold = -1, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +#endif //CALORECGPU_BASICGPUCLUSTERINFOCALCULATORIMPL_H diff --git a/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.cxx b/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.cxx index 9366cbfdda30a139445dfb00df6f1a1a7d225651..04b798264473738dfa223f997880ec01ca1e52e3 100644 --- a/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.cxx +++ b/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.cxx @@ -1,237 +1,415 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "BasicGPUToAthenaImporter.h" - -#include "CaloRecGPU/CUDAFriendlyClasses.h" - -#include "AthenaKernel/errorcheck.h" - -#include <vector> -#include <algorithm> -#include <memory> - -#include "xAODCaloEvent/CaloClusterKineHelper.h" -#include "CaloDetDescr/CaloDetDescrManager.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -using namespace CaloRecGPU; - -BasicGPUToAthenaImporter::BasicGPUToAthenaImporter(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - CaloGPUTimed(this) -{ - declareInterface<ICaloClusterGPUOutputTransformer> (this); - -} - -#include "MacroHelpers.h" - -StatusCode BasicGPUToAthenaImporter::initialize() -{ - ATH_CHECK( m_cellsKey.value().initialize() ); - ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); - - auto get_option_from_string = [](const std::string & str, bool & failed) - { - failed = false; - CRGPU_RECURSIVE_MACRO( - CRGPU_CHEAP_STRING_TO_ENUM( str, xAOD::CaloCluster, - SW_55ele, - SW_35ele, - SW_37ele, - SW_55gam, - SW_35gam, - SW_37gam, - SW_55Econv, - SW_35Econv, - SW_37Econv, - SW_softe, - Topo_420, - Topo_633, - SW_7_11, - SuperCluster, - Tower_01_01, - Tower_005_005, - Tower_fixed_area - ) - ) - //I know Topological Clustering only supports a subset of those, - //but this is supposed to be a general data exporting tool... - else - { - //failed = true; - return xAOD::CaloCluster::CSize_Unknown; - } - }; - - bool size_failed = false; - m_clusterSize = get_option_from_string(m_clusterSizeString, size_failed); - - if (m_clusterSize == xAOD::CaloCluster::CSize_Unknown) - { - ATH_MSG_ERROR("Invalid Cluster Size: " << m_clusterSizeString); - } - - if (size_failed) - { - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - - - -StatusCode BasicGPUToAthenaImporter::convert (const EventContext & ctx, - const ConstantDataHolder &, - EventDataHolder & ed, - xAOD::CaloClusterContainer * cluster_container) const -{ - - - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - const auto start = clock_type::now(); - - SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); - if ( !cell_collection.isValid() ) - { - ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); - return StatusCode::RECOVERABLE; - } - const DataLink<CaloCellContainer> cell_collection_link (cell_collection.name(), ctx); - - ed.returnToCPU(!m_keepGPUData, true); - - const auto after_send = clock_type::now(); - - std::vector<std::unique_ptr<CaloClusterCellLink>> cell_links; - - cell_links.reserve(ed.m_clusters->number); - - for (int i = 0; i < ed.m_clusters->number; ++i) - { - if (ed.m_clusters->seedCellID[i] >= 0) - { - cell_links.emplace_back(std::make_unique<CaloClusterCellLink>(cell_collection_link)); - cell_links.back()->reserve(256); - //To be adjusted. - } - else - { - cell_links.emplace_back(nullptr); - //The excluded clusters don't have any cells. - } - } - - const auto after_creation = clock_type::now(); - - CaloCellContainer::const_iterator iCells = cell_collection->begin(); - - for (int cell_count = 0; iCells != cell_collection->end(); ++iCells, ++cell_count) - { - const CaloCell * cell = (*iCells); - - const int index = m_calo_id->calo_cell_hash(cell->ID()); - - const tag_type this_tag = ed.m_cell_state->clusterTag[index]; - - if (Tags::is_part_of_cluster(this_tag)) - { - const int this_index = Tags::get_index_from_tag(this_tag); - cell_links[this_index]->addCell(cell_count, 1.); - //So we put this in the right cell link. - } - } - - const auto after_cells = clock_type::now(); - - std::vector<int> cluster_order(ed.m_clusters->number); - - std::iota(cluster_order.begin(), cluster_order.end(), 0); - - std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) - { - return ed.m_clusters->clusterEt[a] > ed.m_clusters->clusterEt[b]; - } ); - - //Ordered by Et as in the default algorithm... - //The fact that some invalid clusters - //(with possibly trash values for Et) - //can crop up is irrelevant since - //we don't add those anyway: - //the rest is still ordered like we want it to be. - - const auto after_sort = clock_type::now(); - - cluster_container->clear(); - cluster_container->reserve(cell_links.size()); - - for (size_t i = 0; i < cluster_order.size(); ++i) - { - const int cluster_index = cluster_order[i]; - - const float cluster_Et = ed.m_clusters->clusterEt[cluster_index]; - - if ( cell_links[cluster_index] != nullptr && cell_links[cluster_index]->size() > 0 && - (m_cutClustersInAbsE ? std::abs(cluster_Et) : cluster_Et) > m_clusterETThreshold ) - { - xAOD::CaloCluster * cluster = new xAOD::CaloCluster(); - cluster_container->push_back(cluster); - - cluster->addCellLink(cell_links[cluster_index].release()); - cluster->setClusterSize(m_clusterSize); - if (m_useCPUPropertiesCalculation) - { - CaloClusterKineHelper::calculateKine(cluster, false, true); - } - else - { - cluster->setE(ed.m_clusters->clusterEnergy[cluster_index]); - cluster->setEta(ed.m_clusters->clusterEta[cluster_index]); - cluster->setPhi(ed.m_clusters->clusterPhi[cluster_index]); - } - } - - } - - const auto after_fill = clock_type::now(); - - if (m_measureTimes) - { - record_times(ctx.evt(), time_cast(start, after_send), - time_cast(after_send, after_creation), - time_cast(after_creation, after_cells), - time_cast(after_cells, after_sort), - time_cast(after_sort, after_fill) - ); - } - - return StatusCode::SUCCESS; - -} - - -StatusCode BasicGPUToAthenaImporter::finalize() -{ - - if (m_measureTimes) - { - print_times("Transfer_from_GPU Cluster_Creation Cell_Adding Sorting Collection_Filling", 5); - } - return StatusCode::SUCCESS; -} - - -BasicGPUToAthenaImporter::~BasicGPUToAthenaImporter() -{ - //Nothing! -} +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "BasicGPUToAthenaImporter.h" + +#include "CaloRecGPU/CUDAFriendlyClasses.h" + +#include "AthenaKernel/errorcheck.h" + +#include <vector> +#include <algorithm> +#include <memory> + +#include "xAODCaloEvent/CaloClusterKineHelper.h" +#include "CaloDetDescr/CaloDetDescrManager.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +using namespace CaloRecGPU; + +BasicGPUToAthenaImporter::BasicGPUToAthenaImporter(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this) +{ + declareInterface<ICaloClusterGPUOutputTransformer> (this); + +} + +#include "MacroHelpers.h" + +StatusCode BasicGPUToAthenaImporter::initialize() +{ + ATH_CHECK( m_cellsKey.value().initialize() ); + + ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); + + auto get_option_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, xAOD::CaloCluster, + SW_55ele, + SW_35ele, + SW_37ele, + SW_55gam, + SW_35gam, + SW_37gam, + SW_55Econv, + SW_35Econv, + SW_37Econv, + SW_softe, + Topo_420, + Topo_633, + SW_7_11, + SuperCluster, + Tower_01_01, + Tower_005_005, + Tower_fixed_area + ) + ) + //I know Topological Clustering only supports a subset of those, + //but this is supposed to be a general data exporting tool... + else + { + //failed = true; + return xAOD::CaloCluster::CSize_Unknown; + } + }; + + bool size_failed = false; + m_clusterSize = get_option_from_string(m_clusterSizeString, size_failed); + + if (m_clusterSize == xAOD::CaloCluster::CSize_Unknown) + { + ATH_MSG_ERROR("Invalid Cluster Size: " << m_clusterSizeString); + } + + if (size_failed) + { + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + + + +StatusCode BasicGPUToAthenaImporter::convert (const EventContext & ctx, + const ConstantDataHolder &, + EventDataHolder & ed, + xAOD::CaloClusterContainer * cluster_container) const +{ + + + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + const auto start = clock_type::now(); + + SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); + if ( !cell_collection.isValid() ) + { + ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); + return StatusCode::RECOVERABLE; + } + const DataLink<CaloCellContainer> cell_collection_link (cell_collection.name(), ctx); + + ed.returnToCPU(!m_keepGPUData, true, true, false); + + const auto after_send = clock_type::now(); + + std::vector<std::unique_ptr<CaloClusterCellLink>> cell_links; + + cell_links.reserve(ed.m_clusters->number); + + size_t valid_clusters = 0; + + for (int i = 0; i < ed.m_clusters->number; ++i) + { + if (ed.m_clusters->seedCellID[i] >= 0) + { + cell_links.emplace_back(std::make_unique<CaloClusterCellLink>(cell_collection_link)); + cell_links.back()->reserve(256); + //To be adjusted. + ++valid_clusters; + } + else + { + cell_links.emplace_back(nullptr); + //The excluded clusters don't have any cells. + } + } + + const auto after_creation = clock_type::now(); + + if (cell_collection->isOrderedAndComplete()) + //Fast path: cell indices within the collection and identifierHashes match! + { + for (int cell_index = 0; cell_index < NCaloCells; ++cell_index) + { + const ClusterTag this_tag = ed.m_cell_state->clusterTag[cell_index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_index = this_tag.cluster_index(); + const int32_t weight_pattern = this_tag.secondary_cluster_weight(); + + float tempf = 1.0f; + + std::memcpy(&tempf, &weight_pattern, sizeof(float)); + //C++20 would give us bit cast to do this more properly. + //Still, given how the bit pattern is created, + //it should be safe. + + const float reverse_weight = tempf; + + const float this_weight = 1.0f - reverse_weight; + + cell_links[this_index]->addCell(cell_index, this_weight); + + if (cell_index == ed.m_clusters->seedCellID[this_index] && cell_links[this_index]->size() > 1) + //Seed cells aren't shared, + //so no need to check this on the other case. + { + CaloClusterCellLink::iterator begin_it = cell_links[this_index]->begin(); + CaloClusterCellLink::iterator back_it = (--cell_links[this_index]->end()); + + const unsigned int first_idx = begin_it.index(); + const double first_wgt = begin_it.weight(); + + begin_it.reindex(back_it.index()); + begin_it.reweight(back_it.weight()); + + back_it.reindex(first_idx); + back_it.reweight(first_wgt); + + //Of course, this is to ensure the first cell is the seed cell, + //in accordance to the way some cluster properties + //(mostly phi-related) are calculated. + } + + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + cell_links[other_index]->addCell(cell_index, reverse_weight); + } + } + } + } + else if (m_missingCellsToFill.size() > 0) + { + size_t missing_cell_count = 0; + for (int cell_index = 0; cell_index < NCaloCells; ++cell_index) + { + if (missing_cell_count < m_missingCellsToFill.size() && cell_index == m_missingCellsToFill[missing_cell_count]) + { + ++missing_cell_count; + continue; + } + const ClusterTag this_tag = ed.m_cell_state->clusterTag[cell_index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_index = this_tag.cluster_index(); + const int32_t weight_pattern = this_tag.secondary_cluster_weight(); + + float tempf = 1.0f; + + std::memcpy(&tempf, &weight_pattern, sizeof(float)); + //C++20 would give us bit cast to do this more properly. + //Still, given how the bit pattern is created, + //it should be safe. + + const float reverse_weight = tempf; + + const float this_weight = 1.0f - reverse_weight; + + cell_links[this_index]->addCell(cell_index - missing_cell_count, this_weight); + + if (cell_index == ed.m_clusters->seedCellID[this_index] && cell_links[this_index]->size() > 1) + //Seed cells aren't shared, + //so no need to check this on the other case. + { + CaloClusterCellLink::iterator begin_it = cell_links[this_index]->begin(); + CaloClusterCellLink::iterator back_it = (--cell_links[this_index]->end()); + + const unsigned int first_idx = begin_it.index(); + const double first_wgt = begin_it.weight(); + + begin_it.reindex(back_it.index()); + begin_it.reweight(back_it.weight()); + + back_it.reindex(first_idx); + back_it.reweight(first_wgt); + + //Of course, this is to ensure the first cell is the seed cell, + //in accordance to the way some cluster properties + //(mostly phi-related) are calculated. + } + + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + cell_links[other_index]->addCell(cell_index - missing_cell_count, reverse_weight); + } + } + } + } + else + //Slow path: be careful. + { + CaloCellContainer::const_iterator iCells = cell_collection->begin(); + + for (int cell_count = 0; iCells != cell_collection->end(); ++iCells, ++cell_count) + { + const CaloCell * cell = (*iCells); + + //const int cell_index = m_calo_id->calo_cell_hash(cell->ID()); + const int cell_index = cell->caloDDE()->calo_hash(); + + const ClusterTag this_tag = ed.m_cell_state->clusterTag[cell_index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_index = this_tag.cluster_index(); + const int32_t weight_pattern = this_tag.secondary_cluster_weight(); + + float tempf = 1.0f; + + std::memcpy(&tempf, &weight_pattern, sizeof(float)); + //C++20 would give us bit cast to do this more properly. + //Still, given how the bit pattern is created, + //it should be safe. + + const float reverse_weight = tempf; + + const float this_weight = 1.0f - reverse_weight; + + cell_links[this_index]->addCell(cell_count, this_weight); + //So we put this in the right cell link. + + if (cell_index == ed.m_clusters->seedCellID[this_index] && cell_links[this_index]->size() > 1) + //Seed cells aren't shared, + //so no need to check this on the other case. + { + CaloClusterCellLink::iterator begin_it = cell_links[this_index]->begin(); + CaloClusterCellLink::iterator back_it = (--cell_links[this_index]->end()); + + const unsigned int first_idx = begin_it.index(); + const double first_wgt = begin_it.weight(); + + begin_it.reindex(back_it.index()); + begin_it.reweight(back_it.weight()); + + back_it.reindex(first_idx); + back_it.reweight(first_wgt); + + //Of course, this is to ensure the first cell is the seed cell, + //in accordance to the way some cluster properties + //(mostly phi-related) are calculated. + } + + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + cell_links[other_index]->addCell(cell_count, reverse_weight); + } + } + } + } + const auto after_cells = clock_type::now(); + + std::vector<int> cluster_order(ed.m_clusters->number); + + std::iota(cluster_order.begin(), cluster_order.end(), 0); + + std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) -> bool + { + const bool a_valid = ed.m_clusters->seedCellID[a] >= 0; + const bool b_valid = ed.m_clusters->seedCellID[b] >= 0; + if (a_valid && b_valid) + { + return ed.m_clusters->clusterEt[a] + > ed.m_clusters->clusterEt[b]; + } + else if (a_valid) + { + return true; + } + else if (b_valid) + { + return false; + } + else + { + return b > a; + } + } ); + + //Ordered by Et as in the default algorithm... + //The fact that some invalid clusters + //(with possibly trash values for Et) + //can crop up is irrelevant since + //we don't add those anyway: + //the rest is still ordered like we want it to be. + + const auto after_sort = clock_type::now(); + + cluster_container->clear(); + cluster_container->reserve(cell_links.size()); + + for (size_t i = 0; i < cluster_order.size(); ++i) + { + const int cluster_index = cluster_order[i]; + + if (cell_links[cluster_index] != nullptr && cell_links[cluster_index]->size() > 0) + { + xAOD::CaloCluster * cluster = new xAOD::CaloCluster(); + cluster_container->push_back(cluster); + + cluster->addCellLink(cell_links[cluster_index].release()); + cluster->setClusterSize(m_clusterSize); + if (m_useCPUPropertiesCalculation) + { + CaloClusterKineHelper::calculateKine(cluster, false, true, true); + } + else + { + cluster->setE(ed.m_clusters->clusterEnergy[cluster_index]); + cluster->setEta(ed.m_clusters->clusterEta[cluster_index]); + cluster->setPhi(ed.m_clusters->clusterPhi[cluster_index]); + } + } + + } + + const auto after_fill = clock_type::now(); + + if (m_measureTimes) + { + record_times(ctx.evt(), time_cast(start, after_send), + time_cast(after_send, after_creation), + time_cast(after_creation, after_cells), + time_cast(after_cells, after_sort), + time_cast(after_sort, after_fill) + ); + } + + return StatusCode::SUCCESS; + +} + + +StatusCode BasicGPUToAthenaImporter::finalize() +{ + + if (m_measureTimes) + { + print_times("Transfer_from_GPU Cluster_Creation Cell_Adding Sorting Collection_Filling", 5); + } + return StatusCode::SUCCESS; +} + + +BasicGPUToAthenaImporter::~BasicGPUToAthenaImporter() +{ + //Nothing! +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.h b/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.h index e133114fad7109b15135b6651d15500bd5f42a6a..0fc1a475754584ad013eae6a393015f06cbfc6d4 100644 --- a/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.h +++ b/Calorimeter/CaloRecGPU/src/BasicGPUToAthenaImporter.h @@ -1,90 +1,81 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_BASICGPUTOATHENAIMPORTER_H -#define CALORECGPU_BASICGPUTOATHENAIMPORTER_H - -#include "AthenaBaseComps/AthAlgTool.h" - -#include "CLHEP/Units/SystemOfUnits.h" - -#include "CaloRecGPU/CaloClusterGPUTransformers.h" -#include "StoreGate/ReadHandleKey.h" -#include "CaloRecGPU/CaloGPUTimed.h" - -class CaloCell_ID; - -/** - * @class BasicGPUToAthenaImporter - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 30 May 2022 - * @brief Standard tool to convert the GPU data representation back to CPU. - * - * - */ - -class BasicGPUToAthenaImporter : - public AthAlgTool, virtual public ICaloClusterGPUOutputTransformer, public CaloGPUTimed -{ - public: - - BasicGPUToAthenaImporter(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode initialize() override; - - virtual StatusCode convert (const EventContext & ctx, const ConstantDataHolder & constant_data, - EventDataHolder & event_data, xAOD::CaloClusterContainer * cluster_collection) const override; - - virtual StatusCode finalize() override; - - virtual ~BasicGPUToAthenaImporter(); - - private: - - /** @brief If @p true, do not delete the GPU data representation. - * Defaults to @p true. - * - */ - Gaudi::Property<bool> m_keepGPUData {this, "KeepGPUData", true, "Keep GPU allocated data"}; - - /** - * @brief if set to true, cluster properties are (re-)calculated using @p CaloClusterKineHelper::calculateKine. - * Else, the GPU-calculated values are used. Default is @p false. - */ - Gaudi::Property<bool> m_useCPUPropertiesCalculation {this, "UseCPUClusterPropertiesCalculation", false, "Use CaloClusterKineHelper::calculateKine instead of GPU-calculated cluster properties"}; - - /** - * @brief vector of names of the cell containers to use as input. - */ - Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; - - /** - * @brief if set to @p true cluster cuts are on \f$|E|_\perp\f$, if @p false on \f$E_\perp\f$. Default is @p true. - * - */ - Gaudi::Property<bool> m_cutClustersInAbsE {this, "ClusterCutsInAbsE", true, "Do cluster cuts in Abs E instead of E"}; - - /** - * @brief \f$E_\perp\f$ cut on the clusters. - * - * The clusters have to pass this cut (which is on \f$E_\perp\f$ - * or \f$|E|_\perp\f$ of the cluster depending on the above switch) - * in order to be inserted into the CaloClusterContainer. */ - - Gaudi::Property<float> m_clusterETThreshold {this, "ClusterEtorAbsEtCut", 0.*CLHEP::MeV, "Cluster E_t or Abs E_t cut"}; - - /// Cluster size. Set accordingly to the threshold. - Gaudi::Property<std::string> m_clusterSizeString{this, "ClusterSize", "Topo_420", "The size/type of the clusters"}; - - xAOD::CaloCluster::ClusterSize m_clusterSize; - - /** - * @brief Pointer to Calo ID Helper - */ - const CaloCell_ID* m_calo_id{nullptr}; -}; - -#endif //CALORECGPU_BASICGPUTOATHENAIMPORTER_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +//Dear emacs, this is -*-c++-*- + +#ifndef CALORECGPU_BASICGPUTOATHENAIMPORTER_H +#define CALORECGPU_BASICGPUTOATHENAIMPORTER_H + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "CaloRecGPU/CaloClusterGPUTransformers.h" +#include "StoreGate/ReadHandleKey.h" +#include "CaloRecGPU/CaloGPUTimed.h" + +class CaloCell_ID; + +/** + * @class BasicGPUToAthenaImporter + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 30 May 2022 + * @brief Standard tool to convert the GPU data representation back to CPU. + * + * + */ + +class BasicGPUToAthenaImporter : + public AthAlgTool, virtual public ICaloClusterGPUOutputTransformer, public CaloGPUTimed +{ + public: + + BasicGPUToAthenaImporter(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode convert (const EventContext & ctx, const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, xAOD::CaloClusterContainer * cluster_collection) const override; + + virtual StatusCode finalize() override; + + virtual ~BasicGPUToAthenaImporter(); + + private: + + /** @brief If @p true, do not delete the GPU data representation. + * Defaults to @p true. + * + */ + Gaudi::Property<bool> m_keepGPUData {this, "KeepGPUData", true, "Keep GPU allocated data"}; + + /** + * @brief if set to true, cluster properties are (re-)calculated using @p CaloClusterKineHelper::calculateKine. + * Else, the GPU-calculated values are used. Default is @p false. + */ + Gaudi::Property<bool> m_useCPUPropertiesCalculation {this, "UseCPUClusterPropertiesCalculation", false, "Use CaloClusterKineHelper::calculateKine instead of GPU-calculated cluster properties"}; + + /** + * @brief vector of names of the cell containers to use as input. + */ + Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; + + /// Cluster size. Should be set accordingly to the threshold. + Gaudi::Property<std::string> m_clusterSizeString {this, "ClusterSize", "Topo_420", "The size/type of the clusters"}; + + xAOD::CaloCluster::ClusterSize m_clusterSize; + + /** @brief Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells). + */ + Gaudi::Property<std::vector<int>> m_missingCellsToFill {this, "MissingCellsToFill", {}, "Force fill these cells as disabled on empty containers."}; + + /** + * @brief Pointer to Calo ID Helper + */ + const CaloCell_ID * m_calo_id {nullptr}; + + +}; + +#endif //CALORECGPU_BASICGPUTOATHENAIMPORTER_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CUDA_Helpers.cu b/Calorimeter/CaloRecGPU/src/CUDA_Helpers.cu index 1a2fc7e7786a5df2e28133a23e5024d9469558a3..bbcc7f3a6c1a2fceaaf060ba05f2ab3c91190060 100644 --- a/Calorimeter/CaloRecGPU/src/CUDA_Helpers.cu +++ b/Calorimeter/CaloRecGPU/src/CUDA_Helpers.cu @@ -1,7 +1,8 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// // Dear emacs, this is -*- c++ -*- -/* -// Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration -*/ +// #include "CaloRecGPU/Helpers.h" @@ -17,6 +18,20 @@ void CaloRecGPU::CUDA_Helpers::deallocate(void * address) CUDA_ERRCHECK(cudaFree(address)); } + +void * CaloRecGPU::CUDA_Helpers::allocate_pinned(const size_t num) +{ + void * ret; + CUDA_ERRCHECK(cudaMallocHost(&ret, num)); + return ret; +} + +void CaloRecGPU::CUDA_Helpers::deallocate_pinned(void * address) +{ + CUDA_ERRCHECK(cudaFreeHost(address)); +} + + void CaloRecGPU::CUDA_Helpers::GPU_to_CPU(void * dest, const void * const source, const size_t num) { CUDA_ERRCHECK(cudaMemcpy(dest, source, num, cudaMemcpyDeviceToHost)); @@ -30,4 +45,30 @@ void CaloRecGPU::CUDA_Helpers::CPU_to_GPU(void * dest, const void * const source void CaloRecGPU::CUDA_Helpers::GPU_to_GPU(void * dest, const void * const source, const size_t num) { CUDA_ERRCHECK(cudaMemcpy(dest, source, num, cudaMemcpyDeviceToDevice)); -} \ No newline at end of file +} + + + +void CaloRecGPU::CUDA_Helpers::GPU_to_CPU_async(void * dest, const void * const source, const size_t num, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + CUDA_ERRCHECK(cudaMemcpyAsync(dest, source, num, cudaMemcpyDeviceToHost, cudaStreamPerThread)); +} + +void CaloRecGPU::CUDA_Helpers::CPU_to_GPU_async(void * dest, const void * const source, const size_t num, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + CUDA_ERRCHECK(cudaMemcpyAsync(dest, source, num, cudaMemcpyHostToDevice, stream_to_use)); +} + +void CaloRecGPU::CUDA_Helpers::GPU_to_GPU_async(void * dest, const void * const source, const size_t num, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + CUDA_ERRCHECK(cudaMemcpyAsync(dest, source, num, cudaMemcpyDeviceToDevice, stream_to_use)); +} + +void CaloRecGPU::CUDA_Helpers::GPU_synchronize(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); +} diff --git a/Calorimeter/CaloRecGPU/src/CaloCPUOutput.cxx b/Calorimeter/CaloRecGPU/src/CaloCPUOutput.cxx index 7135478b5f54f0225a5094c73fe8b5d2edca07bc..d88869d3bebda888966621548bfebfa449cd44c1 100644 --- a/Calorimeter/CaloRecGPU/src/CaloCPUOutput.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloCPUOutput.cxx @@ -1,193 +1,198 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloCPUOutput.h" -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/StandaloneDataIO.h" -#include "StoreGate/DataHandle.h" -#include "CaloUtils/CaloBadCellHelper.h" - -using namespace CaloRecGPU; - -CaloCPUOutput::CaloCPUOutput(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent) -{ - declareInterface<CaloClusterCollectionProcessor> (this); -} - - -StatusCode CaloCPUOutput::initialize() -{ - ATH_CHECK( m_noiseCDOKey.initialize() ); - ATH_CHECK( m_cellsKey.value().initialize() ); - ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); - return StatusCode::SUCCESS; -} - -static inline bool passCellTimeCut(const CaloCell * pCell, float threshold) -//Copied from the standard algorithm. -//Could possibly make better use of available info -//in the point where this gets executed, -//but I hope the compiler is smart enough to figure it out. -{ - // get the cell time to cut on (the same as in CaloEvent/CaloCluster.h) - - // need sampling number already for time - CaloSampling::CaloSample sam = pCell->caloDDE()->getSampling(); - // check for unknown sampling - if (sam != CaloSampling::PreSamplerB && sam != CaloSampling::PreSamplerE && sam != CaloSampling::Unknown) - { - const unsigned pmask = pCell->caloDDE()->is_tile() ? 0x8080 : 0x2000; - //0x2000 is used to tell that time and quality information are available for this channel - //(from TWiki: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/CaloEventDataModel#The_Raw_Data_Model) - // Is time defined? - if (pCell->provenance() & pmask) - { - return std::abs(pCell->time()) < threshold; - } - } - return true; -} - -StatusCode CaloCPUOutput::execute (const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const -{ - - Helpers::CPU_object<CellInfoArr> ret_info; - Helpers::CPU_object<CellStateArr> ret_state; - Helpers::CPU_object<ClusterInfoArr> ret_clusts; - - SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); - if ( !cell_collection.isValid() ) - { - ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); - return StatusCode::RECOVERABLE; - } - - - ret_info.allocate(); - ret_state.allocate(); - ret_clusts.allocate(); - - for (int i = 0; i < NCaloCells; ++i) - { - ret_info->energy[i] = 0; - ret_info->gain[i] = 0; - - GainConversion::mark_invalid_cell(ret_info->gain[i]); - } - - SG::ReadCondHandle<CaloNoise> noise_handle(m_noiseCDOKey, ctx); - const CaloNoise * noise_tool = *noise_handle; - - for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) - { - const CaloCell * cell = (*iCells); - - const int index = m_calo_id->calo_cell_hash(cell->ID()); - - const float energy = cell->energy(); - - const int gain = static_cast<int>(GainConversion::from_standard_gain(cell->gain())); - - ret_state->clusterTag[index] = Tags::InvalidTag; - ret_info->energy[index] = energy; - ret_info->gain[index] = gain; - - if (CaloBadCellHelper::isBad(cell, m_treatL1PredictedCellsAsGood)) - { - GainConversion::mark_bad_cell(ret_info->gain[index]); - - continue; - } - - if (m_cutCellsInTime) - { - if (!passCellTimeCut(cell, m_timeThreshold)) - { - const float snr = energy / noise_tool->getNoise(index, cell->gain()); - - if (std::abs(snr) >= m_seedThreshold) - //We'll not worry about the cases with negative snr here - //since it's reasonable to expect these cells to be excluded - //from clustering anyway in the non-abs case, so no worries - //excluding them from yet another perspective... - { - if (!m_keepSignificantCells || snr <= m_thresholdForKeeping) - //If snr > m_thresholdForKeeping and m_keepSignificantCells is true, - //we still keep it as seed so the energy keeps the original value! - { - if (!m_excludeCutSeedsFromClustering) - //If m_excludeCutSeedsFromClustering is false, - //seed cells are still kept as candidates for neighbour or terminal. - { - GainConversion::mark_invalid_seed_cell(ret_info->gain[index]); - } - else - { - GainConversion::mark_invalid_cell(ret_info->gain[index]); - } - } - } - } - } - } - - const auto cluster_end = cluster_collection->end(); - auto cluster_iter = cluster_collection->begin(); - - for (int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number ) - { - const xAOD::CaloCluster * cluster = (*cluster_iter); - const CaloClusterCellLink * cell_links = cluster->getCellLinks(); - if (!cell_links) - { - ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); - return StatusCode::FAILURE; - } - - //--- fill data --- - ret_clusts->clusterEnergy[cluster_number] = cluster->e(); - ret_clusts->clusterEt[cluster_number] = cluster->et(); - ret_clusts->clusterEta[cluster_number] = cluster->eta(); - ret_clusts->clusterPhi[cluster_number] = cluster->phi(); - - const int seed_cell_index = m_calo_id->calo_cell_hash(cluster->cell_begin()->ID()); - - ret_clusts->seedCellID[cluster_number] = seed_cell_index; - - const tag_type tag = Tags::make_seed_tag(0x7f7fffff, seed_cell_index, cluster_number); - //0x7f7fffff is the largest possible valid (finite non-NaN) floating point value. - - for (const CaloCell * cell : (*cell_links)) - { - if (cell == nullptr) - { - continue; - } - IdentifierHash tmpHashid = m_calo_id->calo_cell_hash(cell->ID()); - const int cell_ID = tmpHashid; - ret_state->clusterTag[cell_ID] = tag; - } - } - - ret_clusts->number = cluster_collection->size(); - - const auto err = StandaloneDataIO::save_event_to_folder(ctx.evt(), std::string(m_savePath), ret_info, ret_state, ret_clusts, - m_filePrefix, m_fileSuffix, m_numWidth); - - if (err != StandaloneDataIO::ErrorState::OK) - { - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; - -} - - -CaloCPUOutput::~CaloCPUOutput() -{ - //Nothing! -} +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloCPUOutput.h" +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/StandaloneDataIO.h" +#include "StoreGate/DataHandle.h" + +using namespace CaloRecGPU; + +CaloCPUOutput::CaloCPUOutput(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent) +{ + declareInterface<CaloClusterCollectionProcessor> (this); +} + + +StatusCode CaloCPUOutput::initialize() +{ + ATH_CHECK( m_cellsKey.value().initialize() ); + + ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); + + return StatusCode::SUCCESS; +} + +StatusCode CaloCPUOutput::execute (const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const +{ + + Helpers::CPU_object<CellInfoArr> ret_info; + + Helpers::CPU_object<CellStateArr> ret_state; + Helpers::CPU_object<ClusterInfoArr> ret_clusts; + + SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); + if ( !cell_collection.isValid() ) + { + ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); + return StatusCode::RECOVERABLE; + } + + + ret_info.allocate(); + ret_state.allocate(); + ret_clusts.allocate(); + + for (int i = 0; i < NCaloCells; ++i) + { + ret_info->energy[i] = 0; + ret_info->gain[i] = GainConversion::invalid_gain(); + ret_info->time[i] = 0; + ret_info->qualityProvenance[i] = 0; + + ret_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + + } + + for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) + { + const CaloCell * cell = (*iCells); + + const int index = m_calo_id->calo_cell_hash(cell->ID()); + + const float energy = cell->energy(); + + const unsigned int gain = GainConversion::from_standard_gain(cell->gain()); + + ret_info->energy[index] = energy; + ret_info->gain[index] = gain; + ret_info->time[index] = cell->time(); + ret_info->qualityProvenance[index] = QualityProvenance{cell->quality(), cell->provenance()}; + + } + + size_t shared_count = 0; + + const auto cluster_end = cluster_collection->end(); + auto cluster_iter = cluster_collection->begin(); + + for (int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number ) + { + const xAOD::CaloCluster * cluster = (*cluster_iter); + const CaloClusterCellLink * cell_links = cluster->getCellLinks(); + if (!cell_links) + { + ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); + return StatusCode::FAILURE; + } + + //--- fill data --- + ret_clusts->clusterEnergy[cluster_number] = cluster->e(); + ret_clusts->clusterEt[cluster_number] = cluster->et(); + ret_clusts->clusterEta[cluster_number] = cluster->eta(); + ret_clusts->clusterPhi[cluster_number] = cluster->phi(); + + const int seed_cell_index = m_calo_id->calo_cell_hash(cluster->cell_begin()->ID()); + + ret_clusts->seedCellID[cluster_number] = seed_cell_index; + + for (auto it = cell_links->begin(); it != cell_links->end(); ++it) + { + + const int cell_ID = m_calo_id->calo_cell_hash(it->ID()); + const float weight = it.weight(); + + uint32_t weight_as_int = 0; + std::memcpy(&weight_as_int, &weight, sizeof(float)); + //On the platforms we expect to be running this, it should be fine. + //Still UB. + //With C++20, we could do that bit-cast thing. + + if (weight_as_int == 0) + { + weight_as_int = 1; + //Subnormal, + //but just to distinguish from + //a non-shared cluster. + } + + const ClusterTag other_tag = ret_state->clusterTag[cell_ID]; + + const int other_index = other_tag.is_part_of_cluster() ? other_tag.cluster_index() : -1; + + if (other_index < 0) + { + if (weight < 0.5f) + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0); + } + else + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number); + } + } + else if (weight > 0.5f) + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, other_tag.secondary_cluster_weight(), other_index); + ++shared_count; + } + else if (weight == 0.5f) + //Unlikely, but... + { + const int max_cluster = cluster_number > other_index ? cluster_number : other_index; + const int min_cluster = cluster_number > other_index ? other_index : cluster_number; + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster); + ++shared_count; + } + else /*if (weight < 0.5f)*/ + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number); + ++shared_count; + } + } + } + + ret_clusts->number = cluster_collection->size(); + + ATH_MSG_INFO("Clusters: " << ret_clusts->number); + ATH_MSG_INFO("Shared Cells: " << shared_count); + + if (m_saveCellInfo) + { + const auto err = StandaloneDataIO::save_event_to_folder(ctx.evt(), std::string(m_savePath), + ret_info, ret_state, ret_clusts, + m_filePrefix, m_fileSuffix, m_numWidth); + + if (err != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + } + else + { + const auto err1 = StandaloneDataIO::save_cell_state_to_folder(ctx.evt(), std::string(m_savePath), + ret_state, m_filePrefix, m_fileSuffix, m_numWidth); + + const auto err2 = StandaloneDataIO::save_clusters_to_folder(ctx.evt(), std::string(m_savePath), + ret_clusts, m_filePrefix, m_fileSuffix, m_numWidth); + + if (err1 != StandaloneDataIO::ErrorState::OK || err2 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + } + + return StatusCode::SUCCESS; + +} + + +CaloCPUOutput::~CaloCPUOutput() +{ + //Nothing! +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloCPUOutput.h b/Calorimeter/CaloRecGPU/src/CaloCPUOutput.h index cf9f5ab374f631c40baf3d1d3d26a18e36550859..912f4f420a3512cffb233c5a4e09cc073b60d370 100644 --- a/Calorimeter/CaloRecGPU/src/CaloCPUOutput.h +++ b/Calorimeter/CaloRecGPU/src/CaloCPUOutput.h @@ -1,124 +1,89 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOCPUOUTPUT_H -#define CALORECGPU_CALOCPUOUTPUT_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloUtils/CaloClusterCollectionProcessor.h" -#include <string> - -#include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/ReadHandleKey.h" -#include "CaloConditions/CaloNoise.h" - -#include "CLHEP/Units/SystemOfUnits.h" - -class CaloCell_ID; - -/** - * @class CaloCPUOutput - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 31 May 2022 - * @brief Standard tool to output CPU cluster info to the non-standard file format that - * we have been using for plotting and validation purposes. - * - * There are likely more elegant/general/generic/portable solutions, - * some of which might even avoid Root too, but our workflow was built around this one... - */ - -class CaloCPUOutput : - public AthAlgTool, virtual public CaloClusterCollectionProcessor -{ - public: - - CaloCPUOutput(const std::string & type, const std::string & name, const IInterface * parent); - - using CaloClusterCollectionProcessor::execute; - - virtual StatusCode initialize() override; - - virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; - - virtual ~CaloCPUOutput(); - - private: - - - /** - * @brief The path specifying the folder to which the files should be saved. - Default @p ./saved_clusters - */ - Gaudi::Property<std::string> m_savePath{this, "SavePath", "./saved_clusters", "Path to where the files should be saved"}; - - /** - * @brief The prefix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; - - /** - * @brief The suffix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; - - /** - * @brief The number of digits to reserve for the events. 9 by default. - */ - Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; - - /** - * @brief vector of names of the cell containers to use as input. - */ - Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; - - /** @brief Key of the CaloNoise Conditions data object. Typical values - are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) - - */ - SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"}; - - - /** - * if set to true, time cut is applied to seed cells, no cut otherwise - */ - Gaudi::Property<bool> m_cutCellsInTime {this, "SeedCutsInT", false, "Do seed cuts in time"}; - - /** - * threshold used for timing cut on seed cells. Implemented as |seed_cell_time|<m_timeThreshold. No such cut on neighbouring cells.*/ - Gaudi::Property<float> m_timeThreshold {this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"}; - - /** - * upper limit on the energy significance, for applying the cell time cut */ - Gaudi::Property<float> m_thresholdForKeeping {this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"}; - - - /** - * @brief if set to true treat cells with a dead OTX which can be - * predicted by L1 trigger info as good instead of bad cells */ - Gaudi::Property<bool> m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}; - - /** - * @brief if set to true, seed cells failing the time cut are also excluded from cluster at all - */ - Gaudi::Property<bool> m_excludeCutSeedsFromClustering {this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"}; - - /** - * @brief if set to true, the time cut is not applied on cell of large significance - */ - Gaudi::Property<bool> m_keepSignificantCells {this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"}; - - /** @brief Value to consider for the threshold. Should be consistent with the - * one used in Topological Clustering to ensure seed cell time cuts work properly. - */ - Gaudi::Property<float> m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; - - /** - * @brief Pointer to Calo ID Helper - */ - const CaloCell_ID* m_calo_id{nullptr}; -}; - -#endif //CALORECGPU_CALOCPUOUTPUT_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOCPUOUTPUT_H +#define CALORECGPU_CALOCPUOUTPUT_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloUtils/CaloClusterCollectionProcessor.h" +#include <string> + +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadHandleKey.h" + +class CaloCell_ID; + +/** + * @class CaloCPUOutput + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 31 May 2022 + * @brief Standard tool to output CPU cluster info to the non-standard file format that + * we have been using for plotting and validation purposes. + * + * There are likely more elegant/general/generic/portable solutions, + * some of which might even avoid Root too, but our workflow was built around this one... + */ + +class CaloCPUOutput : + public AthAlgTool, virtual public CaloClusterCollectionProcessor +{ + public: + + CaloCPUOutput(const std::string & type, const std::string & name, const IInterface * parent); + + using CaloClusterCollectionProcessor::execute; + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; + + virtual ~CaloCPUOutput(); + + private: + + + /** + * @brief The path specifying the folder to which the files should be saved. + Default @p ./saved_clusters + */ + Gaudi::Property<std::string> m_savePath{this, "SavePath", "./saved_clusters", "Path to where the files should be saved"}; + + /** + * @brief The prefix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; + + /** + * @brief The suffix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; + + /** + * @brief The number of digits to reserve for the events. 9 by default. + */ + Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; + + /** + * @brief If @c true, also outputs the cell energies, times, gains, qualities and provenances. + + As the GPU output contains exactly the same information, this will be redundant and thus it is defaulted to @c false. + */ + Gaudi::Property<bool> m_saveCellInfo{this, "AlsoOutputCellInfo", false, + "Whether to output cell energies, gains, times, etc., as this information is repeated in the GPU side too."}; + + /** + * @brief vector of names of the cell containers to use as input. + */ + Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; + + /** + * @brief Pointer to Calo ID Helper + */ + const CaloCell_ID* m_calo_id {nullptr}; + +}; + +#endif //CALORECGPU_CALOCPUOUTPUT_H diff --git a/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.cxx b/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.cxx index 395931396f491fd879a4aac6a1b31aba0dcf7746..6ede25354dcd21538dafae729b38058f01db67a8 100644 --- a/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.cxx @@ -1,304 +1,310 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloCellsCounterCPU.h" -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/StandaloneDataIO.h" -#include "StoreGate/DataHandle.h" -#include "CaloUtils/CaloBadCellHelper.h" - -#include <map> - -using namespace CaloRecGPU; - -CaloCellsCounterCPU::CaloCellsCounterCPU(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent) -{ - declareInterface<CaloClusterCollectionProcessor> (this); -} - - -StatusCode CaloCellsCounterCPU::initialize() -{ - ATH_CHECK( m_noiseCDOKey.initialize() ); - ATH_CHECK( m_cellsKey.value().initialize() ); - ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); - return StatusCode::SUCCESS; -} - -static inline bool passCellTimeCut(const CaloCell * pCell, float threshold) -//Copied from the standard algorithm. -//Could possibly make better use of available info -//in the point where this gets executed, -//but I hope the compiler is smart enough to figure it out. -{ - // get the cell time to cut on (the same as in CaloEvent/CaloCluster.h) - - // need sampling number already for time - CaloSampling::CaloSample sam = pCell->caloDDE()->getSampling(); - // check for unknown sampling - if (sam != CaloSampling::PreSamplerB && sam != CaloSampling::PreSamplerE && sam != CaloSampling::Unknown) - { - const unsigned pmask = pCell->caloDDE()->is_tile() ? 0x8080 : 0x2000; - //0x2000 is used to tell that time and quality information are available for this channel - //(from TWiki: https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/CaloEventDataModel#The_Raw_Data_Model) - // Is time defined? - if (pCell->provenance() & pmask) - { - return std::abs(pCell->time()) < threshold; - } - } - return true; -} - -struct size_struct -{ - unsigned int total = 0, seed = 0, grow = 0, term = 0, invalid = 0, bad = 0; - template <class Str> - friend Str & operator << (Str & s, const size_struct & sst) - { - s << sst.total << " " << sst.seed << " " << sst.grow << " " << sst.term << " " << sst.invalid << " " << sst.bad; - return s; - } -}; - -StatusCode CaloCellsCounterCPU::execute (const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const -{ - - SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); - if ( !cell_collection.isValid() ) - { - ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); - return StatusCode::RECOVERABLE; - } - - - SG::ReadCondHandle<CaloNoise> noise_handle(m_noiseCDOKey, ctx); - const CaloNoise * noise_tool = *noise_handle; - - unsigned int gain_counts[GainConversion::num_gain_values()] = {0}; - - size_struct global_counts, global_cluster_counts; - - for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) - { - const CaloCell * cell = (*iCells); - - const float energy = cell->energy(); - - const float SNR = std::abs( energy / noise_tool->getNoise(m_calo_id->calo_cell_hash(cell->ID()), cell->gain()) ); - - int gain = static_cast<int>(GainConversion::from_standard_gain(cell->gain())); - - if (CaloBadCellHelper::isBad(cell, m_treatL1PredictedCellsAsGood)) - { - GainConversion::mark_bad_cell(gain); - } - - if (m_cutCellsInTime && !GainConversion::is_bad_cell(gain)) - { - if (!passCellTimeCut(cell, m_timeThreshold)) - { - if (std::abs(SNR) >= m_seedThreshold) - //We'll not worry about the cases with negative snr here - //since it's reasonable to expect these cells to be excluded - //from clustering anyway in the non-abs case, so no worries - //excluding them from yet another perspective... - { - if (!m_keepSignificantCells || SNR <= m_thresholdForKeeping) - //If SNR > m_thresholdForKeeping and m_keepSignificantCells is true, - //we still keep it as seed so the energy keeps the original value! - { - if (!m_excludeCutSeedsFromClustering) - //If m_excludeCutSeedsFromClustering is false, - //seed cells are still kept as candidates for neighbour or terminal. - { - GainConversion::mark_invalid_seed_cell(gain); - } - else - { - GainConversion::mark_invalid_cell(gain); - } - } - } - } - } - - ++gain_counts[gain - GainConversion::min_gain_value()]; - - if (GainConversion::is_normal_cell(gain)) - { - if (SNR > m_seedThreshold) - { - ++global_counts.seed; - } - else if (SNR > m_growThreshold) - { - ++global_counts.grow; - } - else if (SNR > m_cellThreshold) - { - ++global_counts.term; - } - else - { - ++global_counts.invalid; - } - } - else - { - ++global_counts.bad; - } - } - - std::map<IdentifierHash, size_struct> cluster_sizes; - - for (const xAOD::CaloCluster * cluster : *cluster_collection) - { - //const xAOD::CaloCluster * cluster = (*cluster_iter); - const CaloClusterCellLink * cell_links = cluster->getCellLinks(); - if (!cell_links) - { - ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); - return StatusCode::FAILURE; - } - - float max_snr = -1; - IdentifierHash max_snr_hash; - - size_struct num_cells; - - for (const CaloCell * cell : (*cell_links)) - { - if (cell == nullptr) - { - continue; - } - - - const float this_snr = std::abs(cell->energy()) / noise_tool->getNoise(m_calo_id->calo_cell_hash(cell->ID()), cell->gain()); - - if (this_snr > max_snr) - { - max_snr = this_snr; - max_snr_hash = m_calo_id->calo_cell_hash(cell->ID()); - } - - int gain = static_cast<int>(GainConversion::from_standard_gain(cell->gain())); - - if (CaloBadCellHelper::isBad(cell, m_treatL1PredictedCellsAsGood)) - { - GainConversion::mark_bad_cell(gain); - } - - if (m_cutCellsInTime && !GainConversion::is_bad_cell(gain)) - { - if (!passCellTimeCut(cell, m_timeThreshold)) - { - if (std::abs(this_snr) >= m_seedThreshold) - //We'll not worry about the cases with negative snr here - //since it's reasonable to expect these cells to be excluded - //from clustering anyway in the non-abs case, so no worries - //excluding them from yet another perspective... - { - if (!m_keepSignificantCells || this_snr <= m_thresholdForKeeping) - //If SNR > m_thresholdForKeeping and m_keepSignificantCells is true, - //we still keep it as seed so the energy keeps the original value! - { - if (!m_excludeCutSeedsFromClustering) - //If m_excludeCutSeedsFromClustering is false, - //seed cells are still kept as candidates for neighbour or terminal. - { - GainConversion::mark_invalid_seed_cell(gain); - } - else - { - GainConversion::mark_invalid_cell(gain); - } - } - } - } - } - - if (GainConversion::is_normal_cell(gain)) - { - if (this_snr > m_seedThreshold) - { - ++global_cluster_counts.seed; - ++num_cells.seed; - } - else if (this_snr > m_growThreshold) - { - ++global_cluster_counts.grow; - ++num_cells.grow; - } - else if (this_snr > m_cellThreshold) - { - ++global_cluster_counts.term; - ++num_cells.term; - } - else - { - ++global_cluster_counts.invalid; - ++num_cells.invalid; - } - } - else - { - ++global_cluster_counts.bad; - ++num_cells.bad; - } - - ++num_cells.total; - } - cluster_sizes[max_snr_hash] = num_cells; - } - - const auto err1 = StandaloneDataIO::prepare_folder_for_output(std::string(m_savePath)); - if (err1 != StandaloneDataIO::ErrorState::OK) - { - return StatusCode::FAILURE; - } - - const boost::filesystem::path save_file = m_savePath + "/" + StandaloneDataIO::build_filename((m_filePrefix.size() > 0 ? m_filePrefix + "_counts" : "counts"), - ctx.evt(), m_fileSuffix, "txt", m_numWidth); - - - std::ofstream out_file(save_file); - - if (!out_file.is_open()) - { - return StatusCode::FAILURE; - } - - out_file << global_counts << "\n\n"; - out_file << global_cluster_counts << "\n\n"; - for (int i = 0; i < GainConversion::num_gain_values(); ++i) - { - out_file << gain_counts[i] << " "; - } - out_file << "\n\n"; - for (const auto & it : cluster_sizes) - { - out_file << it.first << " " << it.second << "\n"; - } - out_file << std::endl; - - if (!out_file.good()) - { - return StatusCode::FAILURE; - } - - out_file.close(); - - return StatusCode::SUCCESS; - -} - - -CaloCellsCounterCPU::~CaloCellsCounterCPU() -{ - //Nothing! -} +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloCellsCounterCPU.h" +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/StandaloneDataIO.h" +#include "StoreGate/DataHandle.h" + +#include <map> + +using namespace CaloRecGPU; + +CaloCellsCounterCPU::CaloCellsCounterCPU(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent) +{ + declareInterface<CaloClusterCollectionProcessor> (this); +} + + +StatusCode CaloCellsCounterCPU::initialize() +{ + ATH_CHECK( m_noiseCDOKey.initialize() ); + ATH_CHECK( m_cellsKey.value().initialize() ); + ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); + return StatusCode::SUCCESS; +} + +namespace { + +struct size_struct +{ + unsigned int total = 0, seed = 0, grow = 0, term = 0, invalid = 0, shared = 0; + template <class Str> + friend Str & operator << (Str & s, const size_struct & sst) + { + s << sst.total << " " << sst.seed << " " << sst.grow << " " << sst.term << " " << sst.invalid << " " << sst.shared; + return s; + } +}; + +struct cluster_info_struct +{ + size_struct size; + float seed_snr = -9e99; + float seed_energy = -9e99; + int seed_index = -1; + template <class Str> + friend Str & operator << (Str & s, const cluster_info_struct & cis) + { + s << cis.seed_index << " " << cis.size << " (" << cis.seed_snr << " " << cis.seed_energy << ")"; + return s; + } +}; + +} // anonymous namespace + +StatusCode CaloCellsCounterCPU::execute (const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const +{ + + SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); + if ( !cell_collection.isValid() ) + { + ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); + return StatusCode::RECOVERABLE; + } + + + SG::ReadCondHandle<CaloNoise> noise_handle(m_noiseCDOKey, ctx); + const CaloNoise * noise_tool = *noise_handle; + + unsigned int gain_counts[GainConversion::num_gain_values()] = {0}; + + size_struct global_counts, global_cluster_counts; + + for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) + { + const CaloCell * cell = (*iCells); + + const float energy = cell->energy(); + + float SNR = energy / noise_tool->getNoise(m_calo_id->calo_cell_hash(cell->ID()), cell->gain()); + + const unsigned int gain = GainConversion::from_standard_gain(cell->gain()); + + ++gain_counts[gain - GainConversion::min_gain_value()]; + + SNR = std::abs(SNR); + + if (SNR > m_seedThreshold) + { + ++global_counts.seed; + } + else if (SNR > m_growThreshold) + { + ++global_counts.grow; + } + else if (SNR > m_cellThreshold) + { + ++global_counts.term; + } + else + { + ++global_counts.invalid; + } + } + + struct cluster_cell_info + { + const xAOD::CaloCluster * cl_1 = nullptr, * cl_2 = nullptr; + double w_1 = -1, w_2 = -1, energy = -9e99, SNR = -9e99; + void add_cluster(const int cell_id, const xAOD::CaloCluster * cl, const double w) + { + if (cl_1 == nullptr) + { + cl_1 = cl; + w_1 = w; + } + else if (cl_2 == nullptr) + { + cl_2 = cl; + w_2 = w; + } + else + { + std::cout << "WARNING! Multiple shared cell: " << cell_id << " " << cl_1 << " " << cl_2 << " " << cl << std::endl; + } + } + + bool is_shared() const + { + return cl_1 != nullptr && cl_2 != nullptr; + } + + }; + + std::map<int, cluster_cell_info> cluster_cells; + + + for (const xAOD::CaloCluster * cluster : *cluster_collection) + { + //const xAOD::CaloCluster * cluster = (*cluster_iter); + const CaloClusterCellLink * cell_links = cluster->getCellLinks(); + if (!cell_links) + { + ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); + return StatusCode::FAILURE; + } + + for (auto it = cell_links->begin(); it != cell_links->end(); ++it) + { + const CaloCell * cell = *it; + const float weight = it.weight(); + + const float this_energy = std::abs(cell->energy()); + + const float this_snr = std::abs(this_energy / noise_tool->getNoise(m_calo_id->calo_cell_hash(cell->ID()), cell->gain())); + + const IdentifierHash this_hash = m_calo_id->calo_cell_hash(cell->ID()); + + auto & info = cluster_cells[this_hash]; + + info.energy = this_energy; + info.SNR = this_snr; + + info.add_cluster(this_hash, cluster, weight); + + } + } + + std::unordered_map<const xAOD::CaloCluster *, cluster_info_struct> cluster_sizes; + + auto update_clusters = [&](const cluster_cell_info & cci, const int cell) + { + auto update_one = [&](const xAOD::CaloCluster * cl) + { + if (cl) + { + auto & c_info = cluster_sizes[cl]; + ++c_info.size.total; + if (cci.SNR > m_seedThreshold) + { + ++c_info.size.seed; + } + else if (cci.SNR > m_growThreshold) + { + ++c_info.size.grow; + } + else if (cci.SNR > m_cellThreshold) + { + ++c_info.size.term; + } + else + { + ++c_info.size.invalid; + } + + if (cci.is_shared()) + { + ++c_info.size.shared; + } + else + { + if (cci.SNR > c_info.seed_snr || (cci.SNR == c_info.seed_snr && cell > c_info.seed_index)) + { + c_info.seed_index = cell; + c_info.seed_snr = cci.SNR; + c_info.seed_energy = cci.energy; + } + } + } + }; + + if (cci.cl_1 != nullptr || cci.cl_2 != nullptr) + { + ++global_cluster_counts.total; + if (cci.SNR > m_seedThreshold) + { + ++global_cluster_counts.seed; + } + else if (cci.SNR > m_growThreshold) + { + ++global_cluster_counts.grow; + } + else if (cci.SNR > m_cellThreshold) + { + ++global_cluster_counts.term; + } + else + { + ++global_cluster_counts.invalid; + } + if (cci.is_shared()) + { + ++global_cluster_counts.shared; + } + } + + update_one(cci.cl_1); + update_one(cci.cl_2); + }; + + for (auto & it : cluster_cells) + { + update_clusters(it.second, it.first); + } + + std::vector<cluster_info_struct> sorted_info; + + sorted_info.reserve(cluster_sizes.size()); + + for (auto & v : cluster_sizes) + { + sorted_info.push_back(v.second); + } + + std::sort(sorted_info.begin(), sorted_info.end(), + [](const auto & a, const auto & b) + { + return a.seed_index < b.seed_index; + }); + + + const auto err1 = StandaloneDataIO::prepare_folder_for_output(std::string(m_savePath)); + if (err1 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + + const boost::filesystem::path save_file = m_savePath + "/" + StandaloneDataIO::build_filename((m_filePrefix.size() > 0 ? m_filePrefix + "_counts" : "counts"), + ctx.evt(), m_fileSuffix, "txt", m_numWidth); + + std::ofstream out_file(save_file); + + if (!out_file.is_open()) + { + return StatusCode::FAILURE; + } + + out_file << "Cell counts: " << global_counts << "\n\n"; + + out_file << "Cells in clusters count: " << global_cluster_counts << "\n\n"; + out_file << "Clusters:\n\n"; + + for (const auto & info : sorted_info) + { + out_file << info << "\n"; + } + + out_file << std::endl; + + if (!out_file.good()) + { + return StatusCode::FAILURE; + } + + out_file.close(); + + return StatusCode::SUCCESS; + +} + + +CaloCellsCounterCPU::~CaloCellsCounterCPU() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.h b/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.h index 14375bfb71b89050a610300afeb810fcbff73080..c19f9f453e40955ca6670fc385861ad5bd7a8ace 100644 --- a/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.h +++ b/Calorimeter/CaloRecGPU/src/CaloCellsCounterCPU.h @@ -1,133 +1,100 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOCELLSCOUNTERCPU_H -#define CALORECGPU_CALOCELLSCOUNTERCPU_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloUtils/CaloClusterCollectionProcessor.h" -#include <string> - -#include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/ReadHandleKey.h" -#include "CaloConditions/CaloNoise.h" - -#include "CLHEP/Units/SystemOfUnits.h" - -class CaloCell_ID; - -/** - * @class CaloCellsCounterCPU - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 20 July 2022 - * @brief Outputs counts of cells, both by type and cluster presence, with each cluster being identified by its cell with the largest signal-to-noise ratio. - */ - -class CaloCellsCounterCPU : - public AthAlgTool, virtual public CaloClusterCollectionProcessor -{ - public: - - CaloCellsCounterCPU(const std::string & type, const std::string & name, const IInterface * parent); - - using CaloClusterCollectionProcessor::execute; - - virtual StatusCode initialize() override; - - virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; - - virtual ~CaloCellsCounterCPU(); - - private: - - - /** - * @brief The path specifying the folder to which the files should be saved. - Default @p ./cell_counts - */ - Gaudi::Property<std::string> m_savePath{this, "SavePath", "./cell_counts", "Path to where the files should be saved"}; - - /** - * @brief The prefix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; - - /** - * @brief The suffix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; - - /** - * @brief The number of digits to reserve for the events. 9 by default. - */ - Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; - - /** - * @brief vector of names of the cell containers to use as input. - */ - Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; - - /** @brief Key of the CaloNoise Conditions data object. Typical values - are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) - - */ - SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"}; - - - /** - * if set to true, time cut is applied to seed cells, no cut otherwise - */ - Gaudi::Property<bool> m_cutCellsInTime {this, "SeedCutsInT", false, "Do seed cuts in time"}; - - /** - * threshold used for timing cut on seed cells. Implemented as |seed_cell_time|<m_timeThreshold. No such cut on neighbouring cells.*/ - Gaudi::Property<float> m_timeThreshold {this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"}; - - /** - * upper limit on the energy significance, for applying the cell time cut */ - Gaudi::Property<float> m_thresholdForKeeping {this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"}; - - - /** - * @brief if set to true treat cells with a dead OTX which can be - * predicted by L1 trigger info as good instead of bad cells */ - Gaudi::Property<bool> m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}; - - /** - * @brief if set to true, seed cells failing the time cut are also excluded from cluster at all - */ - Gaudi::Property<bool> m_excludeCutSeedsFromClustering {this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"}; - - /** - * @brief if set to true, the time cut is not applied on cell of large significance - */ - Gaudi::Property<bool> m_keepSignificantCells {this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"}; - - /** @brief Value to consider for the seed threshold. Should be consistent with the - * one used in Topological Clustering to ensure cell classification is correct. - */ - Gaudi::Property<float> m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; - - /** @brief Value to consider for the seed threshold. Should be consistent with the - * one used in Topological Clustering to ensure cell classification is correct. - */ - Gaudi::Property<float> m_growThreshold {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; - - /** @brief Value to consider for the seed threshold. Should be consistent with the - * one used in Topological Clustering to ensure cell classification is correct. - */ - Gaudi::Property<float> m_cellThreshold {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; - - /** - * @brief Pointer to Calo ID Helper - */ - const CaloCell_ID* m_calo_id{nullptr}; - - //TO DO: Consider non-absolute SNR... - -}; - -#endif //CALORECGPU_CALOCELLSCOUNTERCPU_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOCELLSCOUNTERCPU_H +#define CALORECGPU_CALOCELLSCOUNTERCPU_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloUtils/CaloClusterCollectionProcessor.h" +#include <string> + +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadHandleKey.h" +#include "CaloConditions/CaloNoise.h" + +class CaloCell_ID; + +/** + * @class CaloCellsCounterCPU + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 20 July 2022 + * @brief Outputs counts of cells, both by type and cluster presence, with each cluster being identified by its cell with the largest signal-to-noise ratio. + */ + +class CaloCellsCounterCPU : + public AthAlgTool, virtual public CaloClusterCollectionProcessor +{ + public: + + CaloCellsCounterCPU(const std::string & type, const std::string & name, const IInterface * parent); + + using CaloClusterCollectionProcessor::execute; + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; + + virtual ~CaloCellsCounterCPU(); + + private: + + + /** + * @brief The path specifying the folder to which the files should be saved. + Default @p ./cell_counts + */ + Gaudi::Property<std::string> m_savePath{this, "SavePath", "./cell_counts", "Path to where the files should be saved"}; + + /** + * @brief The prefix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; + + /** + * @brief The suffix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; + + /** + * @brief The number of digits to reserve for the events. 9 by default. + */ + Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; + + /** + * @brief vector of names of the cell containers to use as input. + */ + Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; + + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) + */ + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"}; + + /** @brief Value to consider for the seed threshold. Should be consistent with the + * one used in Topological Clustering to ensure cell classification is correct. + */ + Gaudi::Property<float> m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; + + /** @brief Value to consider for the seed threshold. Should be consistent with the + * one used in Topological Clustering to ensure cell classification is correct. + */ + Gaudi::Property<float> m_growThreshold {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; + + /** @brief Value to consider for the seed threshold. Should be consistent with the + * one used in Topological Clustering to ensure cell classification is correct. + */ + Gaudi::Property<float> m_cellThreshold {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; + + //TO DO: Consider non-absolute SNR... + + /** + * @brief Pointer to Calo ID Helper + */ + const CaloCell_ID* m_calo_id {nullptr}; + +}; + +#endif //CALORECGPU_CALOCELLSCOUNTERCPU_H diff --git a/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.cxx b/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.cxx index 91acdab413f4ad9b015e2c27d7a28ed7080ab088..2a91483944e1f7d14cd190ae6435dc15ba4d33b4 100644 --- a/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.cxx @@ -1,189 +1,218 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloCellsCounterGPU.h" -#include "CaloRecGPU/StandaloneDataIO.h" - -#include <map> -#include <vector> - -using namespace CaloRecGPU; - -CaloCellsCounterGPU::CaloCellsCounterGPU(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent) -{ - declareInterface<CaloClusterGPUProcessor> (this); -} - - -struct size_struct -{ - unsigned int total = 0, seed = 0, grow = 0, term = 0, invalid = 0, bad = 0; - template <class Str> - friend Str & operator << (Str & s, const size_struct & sst) - { - s << sst.total << " " << sst.seed << " " << sst.grow << " " << sst.term << " " << sst.invalid << " " << sst.bad; - return s; - } -}; - -StatusCode CaloCellsCounterGPU::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const -{ - Helpers::CPU_object<CellNoiseArr> cell_noise(constant_data.m_cell_noise_dev); - //We could try to keep this in CPU memory by default, - //but, since it isn't quite needed and we don't mind taking a bit longer for this - //since we're only debugging, let this be as generic as possible. - - Helpers::CPU_object<CellInfoArr> cell_info(event_data.m_cell_info_dev); - Helpers::CPU_object<CellStateArr> cell_state(event_data.m_cell_state_dev); - Helpers::CPU_object<ClusterInfoArr> clusters(event_data.m_clusters_dev); - - - unsigned int gain_counts[GainConversion::num_gain_values()] = {0}; - - size_struct global_counts, global_cluster_counts; - - std::vector<int> cluster_max_cell(clusters->number, -1); - std::vector<float> cluster_max_snr(clusters->number, -1); - - std::vector<size_struct> cluster_counts(clusters->number); - - for (int i = 0; i < NCaloCells; ++i) - { - const int gain = cell_info->gain[i]; - ++gain_counts[gain - GainConversion::min_gain_value()]; - - - float SNR = 0.00001f; - - if (GainConversion::is_normal_cell(gain) || GainConversion::is_invalid_seed_cell(gain)) - { - const int corr_gain = GainConversion::recover_invalid_seed_cell_gain(gain); - SNR = std::abs( cell_info->energy[i] / cell_noise->noise[corr_gain][i] ); - } - - const tag_type tag = cell_state->clusterTag[i]; - const bool is_cluster = Tags::is_part_of_cluster(tag); - - if (GainConversion::is_normal_cell(gain)) - { - if (SNR > m_seedThreshold) - { - ++global_counts.seed; - global_cluster_counts.seed += is_cluster; - } - else if (SNR > m_growThreshold) - { - ++global_counts.grow; - global_cluster_counts.grow += is_cluster; - } - else if (SNR > m_cellThreshold) - { - ++global_counts.term; - global_cluster_counts.term += is_cluster; - } - else - { - ++global_counts.invalid; - global_cluster_counts.invalid += is_cluster; - } - } - else - { - ++global_counts.bad; - global_cluster_counts.bad += is_cluster; - } - if (is_cluster) - { - const int cluster = Tags::get_index_from_tag(tag); - if (SNR > cluster_max_snr[cluster]) - { - cluster_max_snr[cluster] = SNR; - cluster_max_cell[cluster] = i; - } - ++cluster_counts[cluster].total; - - if (GainConversion::is_normal_cell(gain)) - { - if (SNR > m_seedThreshold) - { - ++cluster_counts[cluster].seed; - } - else if (SNR > m_growThreshold) - { - ++cluster_counts[cluster].grow; - } - else if (SNR > m_cellThreshold) - { - ++cluster_counts[cluster].term; - } - else - { - ++cluster_counts[cluster].invalid; - } - } - else - { - ++cluster_counts[cluster].bad; - } - } - } - - std::map<int, size_struct> cluster_sizes; - - for (int i = 0; i < clusters->number; ++i) - { - if (cluster_max_cell[i] >= 0) - { - cluster_sizes[cluster_max_cell[i]] = cluster_counts[i]; - } - } - - - const auto err1 = StandaloneDataIO::prepare_folder_for_output(std::string(m_savePath)); - if (err1 != StandaloneDataIO::ErrorState::OK) - { - return StatusCode::FAILURE; - } - - const boost::filesystem::path save_file = m_savePath + "/" + StandaloneDataIO::build_filename((m_filePrefix.size() > 0 ? m_filePrefix + "_counts" : "counts"), - ctx.evt(), m_fileSuffix, "txt", m_numWidth); - - std::ofstream out_file(save_file); - - if (!out_file.is_open()) - { - return StatusCode::FAILURE; - } - - out_file << global_counts << "\n\n"; - out_file << global_cluster_counts << "\n\n"; - for (int i = 0; i < GainConversion::num_gain_values(); ++i) - { - out_file << gain_counts[i] << " "; - } - out_file << "\n\n"; - for (const auto & it : cluster_sizes) - { - out_file << it.first << " " << it.second << "\n"; - } - out_file << std::endl; - - if (!out_file.good()) - { - return StatusCode::FAILURE; - } - - out_file.close(); - - return StatusCode::SUCCESS; - - -} - - -CaloCellsCounterGPU::~CaloCellsCounterGPU() -{ - //Nothing! -} \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloCellsCounterGPU.h" +#include "CaloRecGPU/StandaloneDataIO.h" + +#include <map> +#include <vector> + +#include "FPHelpers.h" + +using namespace CaloRecGPU; + +CaloCellsCounterGPU::CaloCellsCounterGPU(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent) +{ + declareInterface<CaloClusterGPUProcessor> (this); +} + + +namespace { + + +struct size_struct +{ + unsigned int total = 0, seed = 0, grow = 0, term = 0, invalid = 0, shared = 0; + template <class Str> + friend Str & operator << (Str & s, const size_struct & sst) + { + s << sst.total << " " << sst.seed << " " << sst.grow << " " << sst.term << " " << sst.invalid << " " << sst.shared; + return s; + } +}; + +struct cluster_info_struct +{ + size_struct size; + float seed_snr = -9e99; + float seed_energy = -9e99; + template <class Str> + friend Str & operator << (Str & s, const cluster_info_struct & cis) + { + s << cis.size << " (" << cis.seed_snr << " " << cis.seed_energy << ")"; + return s; + } +}; + +} // anonymous namespace + +StatusCode CaloCellsCounterGPU::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data, void * /*temporary_buffer*/) const +{ + Helpers::CPU_object<CellNoiseArr> cell_noise(constant_data.m_cell_noise_dev); + //We could try to keep this in CPU memory by default, + //but, since it isn't quite needed and we don't mind taking a bit longer for this + //since we're only debugging, let this be as generic as possible. + + Helpers::CPU_object<CellInfoArr> cell_info(event_data.m_cell_info_dev); + Helpers::CPU_object<CellStateArr> cell_state(event_data.m_cell_state_dev); + Helpers::CPU_object<ClusterInfoArr> clusters(event_data.m_clusters_dev); + + unsigned int gain_counts[GainConversion::num_gain_values()] = {0}; + + size_struct global_counts, global_cluster_counts; + + std::vector<int> cluster_max_cell(clusters->number, -1); + std::vector<float> cluster_max_snr(clusters->number, -9e99); + std::vector<float> cluster_max_energy(clusters->number, -9e99); + + std::vector<size_struct> cluster_counts(clusters->number); + + std::vector<int> shared_cells; + + for (int i = 0; i < NCaloCells; ++i) + { + if (!cell_info->is_valid(i)) + { + continue; + } + + const int gain = cell_info->gain[i]; + ++gain_counts[gain - GainConversion::min_gain_value()]; + + const float energy = cell_info->energy[i]; + + const float SNR = std::abs( energy / cell_noise->noise[gain][i] ); + + const ClusterTag tag = cell_state->clusterTag[i]; + + const bool is_cluster = tag.is_part_of_cluster(); + + global_cluster_counts.total += is_cluster; + + if (SNR > m_seedThreshold) + { + ++global_counts.seed; + global_cluster_counts.seed += is_cluster; + } + else if (SNR > m_growThreshold) + { + ++global_counts.grow; + global_cluster_counts.grow += is_cluster; + } + else if (SNR > m_cellThreshold) + { + ++global_counts.term; + global_cluster_counts.term += is_cluster; + } + else + { + ++global_counts.invalid; + global_cluster_counts.invalid += is_cluster; + } + + if (is_cluster) + { + if (tag.is_shared_between_clusters()) + { + shared_cells.push_back(i); + } + const int cluster = tag.cluster_index(); + const int other_cluster = tag.is_shared_between_clusters() ? tag.secondary_cluster_index() : cluster; + if (!tag.is_shared_between_clusters() && (SNR > cluster_max_snr[cluster] || (SNR == cluster_max_snr[cluster] && i > cluster_max_cell[cluster]))) + { + cluster_max_snr[cluster] = SNR; + cluster_max_cell[cluster] = i; + cluster_max_energy[cluster] = std::abs(energy); + } + ++cluster_counts[cluster].total; + cluster_counts[other_cluster].total += (cluster != other_cluster); + + global_cluster_counts.shared += tag.is_shared_between_clusters(); + cluster_counts[cluster].shared += tag.is_shared_between_clusters(); + cluster_counts[other_cluster].shared += tag.is_shared_between_clusters(); + + if (SNR > m_seedThreshold) + { + ++cluster_counts[cluster].seed; + cluster_counts[other_cluster].seed += (cluster != other_cluster); + } + else if (SNR > m_growThreshold) + { + ++cluster_counts[cluster].grow; + cluster_counts[other_cluster].grow += (cluster != other_cluster); + } + else if (SNR > m_cellThreshold) + { + ++cluster_counts[cluster].term; + cluster_counts[other_cluster].term += (cluster != other_cluster); + } + else + { + ++cluster_counts[cluster].invalid; + cluster_counts[other_cluster].invalid += (cluster != other_cluster); + } + } + } + + std::map<int, cluster_info_struct> cluster_sizes; + + for (int i = 0; i < clusters->number; ++i) + { + if (cluster_max_cell[i] >= 0) + { + cluster_sizes[cluster_max_cell[i]] = cluster_info_struct{cluster_counts[i], cluster_max_snr[i], cluster_max_energy[i]}; + } + } + + std::sort(shared_cells.begin(), shared_cells.end()); + + + const auto err1 = StandaloneDataIO::prepare_folder_for_output(std::string(m_savePath)); + if (err1 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + + const boost::filesystem::path save_file = m_savePath + "/" + StandaloneDataIO::build_filename((m_filePrefix.size() > 0 ? m_filePrefix + "_counts" : "counts"), + ctx.evt(), m_fileSuffix, "txt", m_numWidth); + + std::ofstream out_file(save_file); + + if (!out_file.is_open()) + { + return StatusCode::FAILURE; + } + + out_file << "Cell counts: " << global_counts << "\n\n"; + + out_file << "Cells in clusters count: "<< global_cluster_counts << "\n\n"; + out_file << "Clusters:\n\n"; + + for (const auto & it : cluster_sizes) + { + out_file << it.first << " " << it.second << "\n"; + } + + out_file << std::endl; + + if (!out_file.good()) + { + return StatusCode::FAILURE; + } + + out_file.close(); + + return StatusCode::SUCCESS; + + +} + + +CaloCellsCounterGPU::~CaloCellsCounterGPU() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.h b/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.h index 85eb6d0a58d262288650554579b2552af14b6d3d..380b80b3a5eb2f123db68efbc92397791e46c03f 100644 --- a/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.h +++ b/Calorimeter/CaloRecGPU/src/CaloCellsCounterGPU.h @@ -1,76 +1,79 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOCELLSCOUNTERGPU_H -#define CALORECGPU_CALOCELLSCOUNTERGPU_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include <string> -#include <mutex> -#include <atomic> - -/** - * @class CaloCellsCounterGPU - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 22 July 2022 - * @brief Outputs counts of cells, both by type and cluster presence, with each cluster being identified by its cell with the largest signal-to-noise ratio. - */ - -class CaloCellsCounterGPU : - public AthAlgTool, virtual public CaloClusterGPUProcessor -{ - public: - - CaloCellsCounterGPU(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode execute (const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const override; - - virtual ~CaloCellsCounterGPU(); - - private: - - - /** - * @brief The path specifying the folder to which the files should be saved. - Default @p ./cell_counts - */ - Gaudi::Property<std::string> m_savePath{this, "SavePath", "./cell_counts", "Path to where the files should be saved"}; - - /** - * @brief The prefix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; - - /** - * @brief The suffix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; - - /** - * @brief The number of digits to reserve for the events. 9 by default. - */ - Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; - - /** @brief Value to consider for the seed threshold. Should be consistent with the - * one used in Topological Clustering to ensure cell classification is correct. - */ - Gaudi::Property<float> m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; - - /** @brief Value to consider for the seed threshold. Should be consistent with the - * one used in Topological Clustering to ensure cell classification is correct. - */ - Gaudi::Property<float> m_growThreshold {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; - - /** @brief Value to consider for the seed threshold. Should be consistent with the - * one used in Topological Clustering to ensure cell classification is correct. - */ - Gaudi::Property<float> m_cellThreshold {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; - - -}; - +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOCELLSCOUNTERGPU_H +#define CALORECGPU_CALOCELLSCOUNTERGPU_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include <string> +#include <mutex> +#include <atomic> + +/** + * @class CaloCellsCounterGPU + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 22 July 2022 + * @brief Outputs counts of cells, both by type and cluster presence, with each cluster being identified by its cell with the largest signal-to-noise ratio. + */ + +class CaloCellsCounterGPU : + public AthAlgTool, virtual public CaloClusterGPUProcessor +{ + public: + + CaloCellsCounterGPU(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual ~CaloCellsCounterGPU(); + + private: + + + /** + * @brief The path specifying the folder to which the files should be saved. + Default @p ./cell_counts + */ + Gaudi::Property<std::string> m_savePath{this, "SavePath", "./cell_counts", "Path to where the files should be saved"}; + + /** + * @brief The prefix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; + + /** + * @brief The suffix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; + + /** + * @brief The number of digits to reserve for the events. 9 by default. + */ + Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; + + /** @brief Value to consider for the seed threshold. Should be consistent with the + * one used in Topological Clustering to ensure cell classification is correct. + */ + Gaudi::Property<float> m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; + + /** @brief Value to consider for the seed threshold. Should be consistent with the + * one used in Topological Clustering to ensure cell classification is correct. + */ + Gaudi::Property<float> m_growThreshold {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; + + /** @brief Value to consider for the seed threshold. Should be consistent with the + * one used in Topological Clustering to ensure cell classification is correct. + */ + Gaudi::Property<float> m_cellThreshold {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; + + +}; + #endif //CALORECGPU_CALOCELLSCOUNTERGPU_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.cxx b/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.cxx index 32bee1134b19644493c4ed7af22658369ece3280..af986a8328f89013091388c6b0c1b272f984bc67 100644 --- a/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.cxx @@ -1,25 +1,27 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloClusterDeleter.h" - -CaloClusterDeleter::CaloClusterDeleter(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent) -{ - declareInterface<CaloClusterCollectionProcessor> (this); -} - -StatusCode CaloClusterDeleter::execute (const EventContext &, xAOD::CaloClusterContainer * cluster_collection) const -{ - cluster_collection->clear(); - - return StatusCode::SUCCESS; - -} - - -CaloClusterDeleter::~CaloClusterDeleter() -{ - //Nothing! -} \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloClusterDeleter.h" + +CaloClusterDeleter::CaloClusterDeleter(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent) +{ + declareInterface<CaloClusterCollectionProcessor> (this); +} + +StatusCode CaloClusterDeleter::execute (const EventContext &, xAOD::CaloClusterContainer * cluster_collection) const +{ + cluster_collection->clear(); + + return StatusCode::SUCCESS; + +} + + +CaloClusterDeleter::~CaloClusterDeleter() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.h b/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.h index 3582047644712feddfc3fd558f8a7c2b42efc3ab..20fa5359ee7532fd628054907e6ec081fb7e13c8 100644 --- a/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.h +++ b/Calorimeter/CaloRecGPU/src/CaloClusterDeleter.h @@ -1,36 +1,36 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOCLUSTERDELETER_H -#define CALORECGPU_CALOCLUSTERDELETER_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloUtils/CaloClusterCollectionProcessor.h" - -/** - * @class CaloClusterDeleter - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 02 June 2022 - * @brief Deletes clusters from the CPU collection. Used for testing and debugging purposes... - * - */ - -class CaloClusterDeleter : - public AthAlgTool, virtual public CaloClusterCollectionProcessor -{ - public: - - CaloClusterDeleter(const std::string & type, const std::string & name, const IInterface * parent); - - using CaloClusterCollectionProcessor::execute; - - virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; - - virtual ~CaloClusterDeleter(); - -}; - -#endif //CALORECGPU_CALOCPUOUTPUT_H \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOCLUSTERDELETER_H +#define CALORECGPU_CALOCLUSTERDELETER_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloUtils/CaloClusterCollectionProcessor.h" + +/** + * @class CaloClusterDeleter + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 02 June 2022 + * @brief Deletes clusters from the CPU collection. Used for testing and debugging purposes... + * + */ + +class CaloClusterDeleter : + public AthAlgTool, virtual public CaloClusterCollectionProcessor +{ + public: + + CaloClusterDeleter(const std::string & type, const std::string & name, const IInterface * parent); + + using CaloClusterCollectionProcessor::execute; + + virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; + + virtual ~CaloClusterDeleter(); + +}; + +#endif //CALORECGPU_CALOCPUOUTPUT_H diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitor.cxx b/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ebc8d622d86aa622412e2a84378bbc0a596a01fc --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitor.cxx @@ -0,0 +1,2056 @@ +// +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloGPUClusterAndCellDataMonitor.h" +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "StoreGate/DataHandle.h" +#include "CaloUtils/CaloClusterCollectionProcessor.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" + +#include "AthenaMonitoringKernel/Monitored.h" + +#include "CLHEP/Units/SystemOfUnits.h" + +#include <map> +#include <numeric> +#include <algorithm> + +using namespace CaloRecGPU; + +CaloGPUClusterAndCellDataMonitor::CaloGPUClusterAndCellDataMonitor(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + m_plottedVariablesInitialized(false) +{ + declareInterface<ICaloClusterGPUPlotter> (this); +} + +StatusCode CaloGPUClusterAndCellDataMonitor::initialize() +{ + ATH_CHECK( m_cellsKey.value().initialize() ); + + ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); + + const std::string this_name = this->name(); + + const std::string algorithm_name_prefix = this_name.substr(0, this_name.rfind('.')); + //This is so we take into account the fact that tools + //are prefixed with the parent algorithm's name. + + auto final_string = [& algorithm_name_prefix](const std::string & unpref_str) -> std::string + { + return algorithm_name_prefix + "." + unpref_str; + }; + + const MatchingOptions opts = m_matchingOptions; + + m_min_similarity = opts.min_similarity; + m_seed_weight = opts.seed_w; + m_grow_weight = opts.grow_w; + m_terminal_weight = opts.term_w; + + for (const auto & tool : m_toolsToPlot) + { + const std::string tool_name = final_string(tool.tool); + m_toolToIdMap[tool_name] = tool.plot_id; + m_toolsToCheckFor[tool_name] = -1; + } + + auto add_tool_from_pair = [this](const std::string & name) -> int + { + if (!m_toolsToCheckFor.count(name)) + { + m_toolsToCheckFor[name] = m_numToolsToKeep; + m_toolToIdMap[name] = ""; + return m_numToolsToKeep++; + } + else + { + const int current = m_toolsToCheckFor[name]; + if (current >= 0) + { + return current; + } + else + { + m_toolsToCheckFor[name] = m_numToolsToKeep; + return m_numToolsToKeep++; + } + } + }; + + for (const auto & pair : m_pairsToPlot) + { + const int first_index = add_tool_from_pair(final_string(pair.tool_ref)); + const int second_index = add_tool_from_pair(final_string(pair.tool_test)); + m_toolCombinations.emplace_back(pair_to_plot{first_index, second_index, pair.plot_id, pair.match_in_energy}); + } + + ATH_CHECK( m_moniTool.retrieve() ); + + return StatusCode::SUCCESS; +} + +StatusCode CaloGPUClusterAndCellDataMonitor::finalize_plots() const +{ + //Well, not do plots, just monitor the number of events and the total number of clusters... + + auto mon_num_events = Monitored::Scalar("num_events", m_numEvents); + + for (const auto & k_v : m_toolToIdMap) + { + auto mon_num_clust = Monitored::Scalar(k_v.second + "_num_total_clusters", m_numClustersPerTool.at(k_v.first).load()); + } + + return StatusCode::SUCCESS; +} + +StatusCode CaloGPUClusterAndCellDataMonitor::update_plots_start(const EventContext & /*ctx*/, + const ConstantDataHolder & /*constant_data*/, + const xAOD::CaloClusterContainer * /*cluster_collection_ptr*/) const +{ + if (!m_plottedVariablesInitialized.load()) + { + std::lock_guard<std::mutex> lock_guard(m_mutex); + if (!m_plottedVariablesInitialized.load()) + { + CaloGPUClusterAndCellDataMonitor * dhis ATLAS_THREAD_SAFE = const_cast<CaloGPUClusterAndCellDataMonitor *>(this); + //We have the mutex. + //It's safe. + ATH_CHECK( dhis->initialize_plotted_variables() ); + m_plottedVariablesInitialized.store(true); + } + } + if (m_numToolsToKeep > 0) + { + m_storageHolder.get_one().resize(m_numToolsToKeep); + } + //Allocate a vector of data holders for this thread and resize it to the necessary size. + + return StatusCode::SUCCESS; +} + +StatusCode CaloGPUClusterAndCellDataMonitor::update_plots_end(const EventContext & ctx, + const ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * /*cluster_collection_ptr*/) const +{ + ATH_MSG_INFO(""); + + for (const auto & combination : m_toolCombinations) + { + if (combination.index_ref < 0 || combination.index_test < 0) + { + ATH_MSG_WARNING("Invalid tool combination, please check your configuration! " << combination.prefix); + continue; + } + ATH_CHECK( add_combination(ctx, constant_data, combination.index_ref, combination.index_test, combination.prefix, combination.match_in_energy) ); + } + + ATH_MSG_INFO(""); + + if (m_numToolsToKeep > 0) + { + m_storageHolder.release_one(); + //Release the tool storage. + } + + return StatusCode::SUCCESS; +} + +StatusCode CaloGPUClusterAndCellDataMonitor::update_plots(const EventContext & ctx, + const ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloClusterCollectionProcessor * tool) const +{ + if (filter_tool_by_name(tool->name())) + { + Helpers::CPU_object<CellInfoArr> cell_info; + Helpers::CPU_object<CellStateArr> cell_state; + Helpers::CPU_object<ClusterInfoArr> clusters; + Helpers::CPU_object<ClusterMomentsArr> moments; + + ATH_CHECK( convert_to_GPU_data_structures(ctx, constant_data, cluster_collection_ptr, + cell_info, cell_state, clusters, moments ) ); + + return add_data(ctx, constant_data, cell_info, cell_state, clusters, moments, tool->name()); + } + else + { + return StatusCode::SUCCESS; + } +} + +StatusCode CaloGPUClusterAndCellDataMonitor::update_plots(const EventContext & ctx, + const ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * /*cluster_collection_ptr*/, + const EventDataHolder & event_data, + const ICaloClusterGPUInputTransformer * tool) const +{ + if (filter_tool_by_name(tool->name())) + { + return add_data(ctx, constant_data, event_data.m_cell_info_dev, event_data.m_cell_state_dev, + event_data.m_clusters_dev, event_data.m_moments_dev, tool->name()); + } + else + { + return StatusCode::SUCCESS; + } +} + +StatusCode CaloGPUClusterAndCellDataMonitor::update_plots(const EventContext & ctx, + const ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * /*cluster_collection_ptr*/, + const EventDataHolder & event_data, + const CaloClusterGPUProcessor * tool) const +{ + if (filter_tool_by_name(tool->name())) + { + Helpers::CPU_object<CellInfoArr> cell_info = event_data.m_cell_info_dev; + Helpers::CPU_object<CellStateArr> cell_state = event_data.m_cell_state_dev; + Helpers::CPU_object<ClusterInfoArr> clusters = event_data.m_clusters_dev; + Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> moments = event_data.m_moments_dev; + + ATH_CHECK( compactify_clusters(ctx, constant_data, cell_info, cell_state, clusters, moments) ); + + return add_data(ctx, constant_data, cell_info, cell_state, clusters, moments, tool->name()); + } + else + { + return StatusCode::SUCCESS; + } +} + +StatusCode CaloGPUClusterAndCellDataMonitor::update_plots(const EventContext & ctx, + const ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const EventDataHolder & /*event_data*/, + const ICaloClusterGPUOutputTransformer * tool) const +{ + if (filter_tool_by_name(tool->name())) + { + Helpers::CPU_object<CellInfoArr> cell_info; + Helpers::CPU_object<CellStateArr> cell_state; + Helpers::CPU_object<ClusterInfoArr> clusters; + Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> moments; + + ATH_CHECK( convert_to_GPU_data_structures(ctx, constant_data, cluster_collection_ptr, + cell_info, cell_state, clusters, moments ) ); + + return add_data(ctx, constant_data, cell_info, cell_state, clusters, moments, tool->name()); + } + else + { + return StatusCode::SUCCESS; + } +} + +bool CaloGPUClusterAndCellDataMonitor::filter_tool_by_name(const std::string & tool_name) +const +{ + ATH_MSG_DEBUG("Checking : '" << tool_name << "': " << m_toolsToCheckFor.count(tool_name)); + return m_toolsToCheckFor.count(tool_name) > 0; +} + +//Note: The following is essentially copied over from two tools. +// Maybe we could prevent the repetition? + +StatusCode CaloGPUClusterAndCellDataMonitor::convert_to_GPU_data_structures(const EventContext & ctx, + const ConstantDataHolder & /*constant_data*/, + const xAOD::CaloClusterContainer * cluster_collection, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & ret_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & ret_state, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & ret_clusts, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> & ret_moments) const +{ + SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); + if ( !cell_collection.isValid() ) + { + ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); + return StatusCode::RECOVERABLE; + } + + ret_info.allocate(); + + if (cluster_collection != nullptr) + { + ret_state.allocate(); + ret_clusts.allocate(); + ret_moments.allocate(); + } + + for (int i = 0; i < NCaloCells; ++i) + { + ret_info->energy[i] = 0; + ret_info->gain[i] = GainConversion::invalid_gain(); + ret_info->time[i] = 0; + ret_info->qualityProvenance[i] = 0; + + if (cluster_collection != nullptr) + { + ret_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + } + + for (CaloCellContainer::const_iterator iCells = cell_collection->begin(); iCells != cell_collection->end(); ++iCells) + { + const CaloCell * cell = (*iCells); + + const int index = m_calo_id->calo_cell_hash(cell->ID()); + + const float energy = cell->energy(); + + const unsigned int gain = GainConversion::from_standard_gain(cell->gain()); + + ret_info->energy[index] = energy; + ret_info->gain[index] = gain; + ret_info->time[index] = cell->time(); + ret_info->qualityProvenance[index] = QualityProvenance{cell->quality(), cell->provenance()}; + + } + + if (cluster_collection != nullptr) + { + const auto cluster_end = cluster_collection->end(); + auto cluster_iter = cluster_collection->begin(); + + for (int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number ) + { + const xAOD::CaloCluster * cluster = (*cluster_iter); + const CaloClusterCellLink * cell_links = cluster->getCellLinks(); + if (!cell_links) + { + ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); + return StatusCode::FAILURE; + } + + ret_clusts->clusterEnergy[cluster_number] = cluster->e(); + ret_clusts->clusterEt[cluster_number] = cluster->et(); + ret_clusts->clusterEta[cluster_number] = cluster->eta(); + ret_clusts->clusterPhi[cluster_number] = cluster->phi(); + ret_clusts->seedCellID[cluster_number] = m_calo_id->calo_cell_hash(cluster->cell_begin()->ID()); + for (int i = 0; i < NumSamplings; ++i) + { + ret_moments->energyPerSample[i][cluster_number] = cluster->eSample((CaloSampling::CaloSample) i); + ret_moments->maxEPerSample[i][cluster_number] = cluster->energy_max((CaloSampling::CaloSample) i); + ret_moments->maxPhiPerSample[i][cluster_number] = cluster->phimax((CaloSampling::CaloSample) i); + ret_moments->maxEtaPerSample[i][cluster_number] = cluster->etamax((CaloSampling::CaloSample) i); + ret_moments->etaPerSample[i][cluster_number] = cluster->etaSample((CaloSampling::CaloSample) i); + ret_moments->phiPerSample[i][cluster_number] = cluster->phiSample((CaloSampling::CaloSample) i); + ret_moments->nCellSampling[i][cluster_number] = cluster->numberCellsInSampling((CaloSampling::CaloSample) i); + } + ret_moments->time[cluster_number] = cluster->time(); + ret_moments->firstPhi[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::FIRST_PHI); + ret_moments->firstEta[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::FIRST_ETA); + ret_moments->secondR[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::SECOND_R); + ret_moments->secondLambda[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::SECOND_LAMBDA); + ret_moments->deltaPhi[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::DELTA_PHI); + ret_moments->deltaTheta[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::DELTA_THETA); + ret_moments->deltaAlpha[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::DELTA_ALPHA); + ret_moments->centerX[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CENTER_X); + ret_moments->centerY[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CENTER_Y); + ret_moments->centerZ[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CENTER_Z); + ret_moments->centerMag[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CENTER_MAG); + ret_moments->centerLambda[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CENTER_LAMBDA); + ret_moments->lateral[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::LATERAL); + ret_moments->longitudinal[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::LONGITUDINAL); + ret_moments->engFracEM[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_FRAC_EM); + ret_moments->engFracMax[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_FRAC_MAX); + ret_moments->engFracCore[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_FRAC_CORE); + ret_moments->firstEngDens[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::FIRST_ENG_DENS); + ret_moments->secondEngDens[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::SECOND_ENG_DENS); + ret_moments->isolation[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ISOLATION); + ret_moments->engBadCells[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_BAD_CELLS); + ret_moments->nBadCells[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::N_BAD_CELLS); + ret_moments->nBadCellsCorr[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::N_BAD_CELLS_CORR); + ret_moments->badCellsCorrE[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::BAD_CELLS_CORR_E); + ret_moments->badLArQFrac[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::BADLARQ_FRAC); + ret_moments->engPos[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_POS); + ret_moments->significance[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::SIGNIFICANCE); + ret_moments->cellSignificance[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CELL_SIGNIFICANCE); + ret_moments->cellSigSampling[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::CELL_SIG_SAMPLING); + ret_moments->avgLArQ[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::AVG_LAR_Q); + ret_moments->avgTileQ[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::AVG_TILE_Q); + ret_moments->engBadHVCells[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_BAD_HV_CELLS); + ret_moments->nBadHVCells[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::N_BAD_HV_CELLS); + ret_moments->PTD[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::PTD); + ret_moments->mass[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::MASS); + ret_moments->EMProbability[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::EM_PROBABILITY); + ret_moments->hadWeight[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::HAD_WEIGHT); + ret_moments->OOCweight[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::OOC_WEIGHT); + ret_moments->DMweight[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::DM_WEIGHT); + ret_moments->tileConfidenceLevel[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::TILE_CONFIDENCE_LEVEL); + ret_moments->secondTime[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::SECOND_TIME); + ret_moments->nExtraCellSampling[cluster_number] = cluster->numberCellsInSampling(CaloSampling::EME2, true); + ret_moments->numCells[cluster_number] = cluster->numberCells(); + ret_moments->vertexFraction[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::VERTEX_FRACTION); + ret_moments->nVertexFraction[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::NVERTEX_FRACTION); + ret_moments->etaCaloFrame[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ETACALOFRAME); + ret_moments->phiCaloFrame[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::PHICALOFRAME); + ret_moments->eta1CaloFrame[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ETA1CALOFRAME); + ret_moments->phi1CaloFrame[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::PHI1CALOFRAME); + ret_moments->eta2CaloFrame[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ETA2CALOFRAME); + ret_moments->phi2CaloFrame[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::PHI2CALOFRAME); + ret_moments->engCalibTot[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_TOT); + ret_moments->engCalibOutL[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_OUT_L); + ret_moments->engCalibOutM[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_OUT_M); + ret_moments->engCalibOutT[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_OUT_T); + ret_moments->engCalibDeadL[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_L); + ret_moments->engCalibDeadM[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_M); + ret_moments->engCalibDeadT[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_T); + ret_moments->engCalibEMB0[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_EMB0); + ret_moments->engCalibEME0[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_EME0); + ret_moments->engCalibTileG3[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_TILEG3); + ret_moments->engCalibDeadTot[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_TOT); + ret_moments->engCalibDeadEMB0[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_EMB0); + ret_moments->engCalibDeadTile0[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_TILE0); + ret_moments->engCalibDeadTileG3[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_TILEG3); + ret_moments->engCalibDeadEME0[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_EME0); + ret_moments->engCalibDeadHEC0[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_HEC0); + ret_moments->engCalibDeadFCAL[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_FCAL); + ret_moments->engCalibDeadLeakage[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_LEAKAGE); + ret_moments->engCalibDeadUnclass[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_UNCLASS); + ret_moments->engCalibFracEM[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_FRAC_EM); + ret_moments->engCalibFracHad[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_FRAC_HAD); + ret_moments->engCalibFracRest[cluster_number] = cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_FRAC_REST); + for (auto it = cell_links->begin(); it != cell_links->end(); ++it) + { + const int cell_ID = m_calo_id->calo_cell_hash(it->ID()); + const float weight = it.weight(); + + uint32_t weight_as_int = 0; + std::memcpy(&weight_as_int, &weight, sizeof(float)); + //On the platforms we expect to be running this, it should be fine. + //Still UB. + //With C++20, we could do that bit-cast thing. + + if (weight_as_int == 0) + { + weight_as_int = 1; + //Subnormal, + //but just to distinguish from + //a non-shared cluster. + } + + const ClusterTag other_tag = ret_state->clusterTag[cell_ID]; + + const int other_index = other_tag.is_part_of_cluster() ? other_tag.cluster_index() : -1; + + if (other_index < 0) + { + if (weight < 0.5f) + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0); + } + else + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number); + } + } + else if (weight > 0.5f) + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, other_tag.secondary_cluster_weight(), other_index); + } + else if (weight == 0.5f) + //Unlikely, but... + { + const int max_cluster = cluster_number > other_index ? cluster_number : other_index; + const int min_cluster = cluster_number > other_index ? other_index : cluster_number; + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster); + } + else /*if (weight < 0.5f)*/ + { + ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number); + } + } + } + + ret_clusts->number = cluster_collection->size(); + } + + return StatusCode::SUCCESS; +} + +StatusCode CaloGPUClusterAndCellDataMonitor::compactify_clusters(const EventContext &, + const CaloRecGPU::ConstantDataHolder &, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> & moments) const +{ + std::map<int, int> tag_map; + + std::vector<int> cluster_order(clusters->number); + + std::iota(cluster_order.begin(), cluster_order.end(), 0); + + std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) + { + if (clusters->seedCellID[a] < 0) + { + return false; + //This means that clusters with no cells + //(marked as invalid) always compare lower, + //so they appear in the end. + } + else if (clusters->seedCellID[b] < 0) + { + return true; + } + return clusters->clusterEt[a] > clusters->clusterEt[b]; + } ); + + int real_cluster_numbers = clusters->number; + + for (size_t i = 0; i < cluster_order.size(); ++i) + { + const int this_id = cluster_order[i]; + if (clusters->seedCellID[this_id] < 0) + { + tag_map[this_id] = -1; + --real_cluster_numbers; + } + else + { + tag_map[this_id] = i; + } + } + + const Helpers::CPU_object<ClusterInfoArr> temp_clusters(clusters); + const Helpers::CPU_object<ClusterMomentsArr> temp_moments(moments); + + clusters->number = real_cluster_numbers; + + for (int i = 0; i < temp_clusters->number; ++i) + { + clusters->clusterEnergy[i] = temp_clusters->clusterEnergy[cluster_order[i]]; + clusters->clusterEt[i] = temp_clusters->clusterEt[cluster_order[i]]; + clusters->clusterEta[i] = temp_clusters->clusterEta[cluster_order[i]]; + clusters->clusterPhi[i] = temp_clusters->clusterPhi[cluster_order[i]]; + clusters->seedCellID[i] = temp_clusters->seedCellID[cluster_order[i]]; + for (int j = 0; j < NumSamplings; ++j) + { + moments->energyPerSample[j][i] = temp_moments->energyPerSample[j][cluster_order[i]]; + moments->maxEPerSample[j][i] = temp_moments->maxEPerSample[j][cluster_order[i]]; + moments->maxPhiPerSample[j][i] = temp_moments->maxPhiPerSample[j][cluster_order[i]]; + moments->maxEtaPerSample[j][i] = temp_moments->maxEtaPerSample[j][cluster_order[i]]; + moments->etaPerSample[j][i] = temp_moments->etaPerSample[j][cluster_order[i]]; + moments->phiPerSample[j][i] = temp_moments->phiPerSample[j][cluster_order[i]]; + } + moments->time[i] = temp_moments->time[cluster_order[i]]; + moments->firstPhi[i] = temp_moments->firstPhi[cluster_order[i]]; + moments->firstEta[i] = temp_moments->firstEta[cluster_order[i]]; + moments->secondR[i] = temp_moments->secondR[cluster_order[i]]; + moments->secondLambda[i] = temp_moments->secondLambda[cluster_order[i]]; + moments->deltaPhi[i] = temp_moments->deltaPhi[cluster_order[i]]; + moments->deltaTheta[i] = temp_moments->deltaTheta[cluster_order[i]]; + moments->deltaAlpha[i] = temp_moments->deltaAlpha[cluster_order[i]]; + moments->centerX[i] = temp_moments->centerX[cluster_order[i]]; + moments->centerY[i] = temp_moments->centerY[cluster_order[i]]; + moments->centerZ[i] = temp_moments->centerZ[cluster_order[i]]; + moments->centerMag[i] = temp_moments->centerMag[cluster_order[i]]; + moments->centerLambda[i] = temp_moments->centerLambda[cluster_order[i]]; + moments->lateral[i] = temp_moments->lateral[cluster_order[i]]; + moments->longitudinal[i] = temp_moments->longitudinal[cluster_order[i]]; + moments->engFracEM[i] = temp_moments->engFracEM[cluster_order[i]]; + moments->engFracMax[i] = temp_moments->engFracMax[cluster_order[i]]; + moments->engFracCore[i] = temp_moments->engFracCore[cluster_order[i]]; + moments->firstEngDens[i] = temp_moments->firstEngDens[cluster_order[i]]; + moments->secondEngDens[i] = temp_moments->secondEngDens[cluster_order[i]]; + moments->isolation[i] = temp_moments->isolation[cluster_order[i]]; + moments->engBadCells[i] = temp_moments->engBadCells[cluster_order[i]]; + moments->nBadCells[i] = temp_moments->nBadCells[cluster_order[i]]; + moments->nBadCellsCorr[i] = temp_moments->nBadCellsCorr[cluster_order[i]]; + moments->badCellsCorrE[i] = temp_moments->badCellsCorrE[cluster_order[i]]; + moments->badLArQFrac[i] = temp_moments->badLArQFrac[cluster_order[i]]; + moments->engPos[i] = temp_moments->engPos[cluster_order[i]]; + moments->significance[i] = temp_moments->significance[cluster_order[i]]; + moments->cellSignificance[i] = temp_moments->cellSignificance[cluster_order[i]]; + moments->cellSigSampling[i] = temp_moments->cellSigSampling[cluster_order[i]]; + moments->avgLArQ[i] = temp_moments->avgLArQ[cluster_order[i]]; + moments->avgTileQ[i] = temp_moments->avgTileQ[cluster_order[i]]; + moments->engBadHVCells[i] = temp_moments->engBadHVCells[cluster_order[i]]; + moments->nBadHVCells[i] = temp_moments->nBadHVCells[cluster_order[i]]; + moments->PTD[i] = temp_moments->PTD[cluster_order[i]]; + moments->mass[i] = temp_moments->mass[cluster_order[i]]; + moments->EMProbability[i] = temp_moments->EMProbability[cluster_order[i]]; + moments->hadWeight[i] = temp_moments->hadWeight[cluster_order[i]]; + moments->OOCweight[i] = temp_moments->OOCweight[cluster_order[i]]; + moments->DMweight[i] = temp_moments->DMweight[cluster_order[i]]; + moments->tileConfidenceLevel[i] = temp_moments->tileConfidenceLevel[cluster_order[i]]; + moments->secondTime[i] = temp_moments->secondTime[cluster_order[i]]; + for (int j = 0; j < NumSamplings; ++j) + { + moments->nCellSampling[j][i] = temp_moments->nCellSampling[j][cluster_order[i]]; + } + moments->nExtraCellSampling[i] = temp_moments->nExtraCellSampling[cluster_order[i]]; + moments->numCells[i] = temp_moments->numCells[cluster_order[i]]; + moments->vertexFraction[i] = temp_moments->vertexFraction[cluster_order[i]]; + moments->nVertexFraction[i] = temp_moments->nVertexFraction[cluster_order[i]]; + moments->etaCaloFrame[i] = temp_moments->etaCaloFrame[cluster_order[i]]; + moments->phiCaloFrame[i] = temp_moments->phiCaloFrame[cluster_order[i]]; + moments->eta1CaloFrame[i] = temp_moments->eta1CaloFrame[cluster_order[i]]; + moments->phi1CaloFrame[i] = temp_moments->phi1CaloFrame[cluster_order[i]]; + moments->eta2CaloFrame[i] = temp_moments->eta2CaloFrame[cluster_order[i]]; + moments->phi2CaloFrame[i] = temp_moments->phi2CaloFrame[cluster_order[i]]; + moments->engCalibTot[i] = temp_moments->engCalibTot[cluster_order[i]]; + moments->engCalibOutL[i] = temp_moments->engCalibOutL[cluster_order[i]]; + moments->engCalibOutM[i] = temp_moments->engCalibOutM[cluster_order[i]]; + moments->engCalibOutT[i] = temp_moments->engCalibOutT[cluster_order[i]]; + moments->engCalibDeadL[i] = temp_moments->engCalibDeadL[cluster_order[i]]; + moments->engCalibDeadM[i] = temp_moments->engCalibDeadM[cluster_order[i]]; + moments->engCalibDeadT[i] = temp_moments->engCalibDeadT[cluster_order[i]]; + moments->engCalibEMB0[i] = temp_moments->engCalibEMB0[cluster_order[i]]; + moments->engCalibEME0[i] = temp_moments->engCalibEME0[cluster_order[i]]; + moments->engCalibTileG3[i] = temp_moments->engCalibTileG3[cluster_order[i]]; + moments->engCalibDeadTot[i] = temp_moments->engCalibDeadTot[cluster_order[i]]; + moments->engCalibDeadEMB0[i] = temp_moments->engCalibDeadEMB0[cluster_order[i]]; + moments->engCalibDeadTile0[i] = temp_moments->engCalibDeadTile0[cluster_order[i]]; + moments->engCalibDeadTileG3[i] = temp_moments->engCalibDeadTileG3[cluster_order[i]]; + moments->engCalibDeadEME0[i] = temp_moments->engCalibDeadEME0[cluster_order[i]]; + moments->engCalibDeadHEC0[i] = temp_moments->engCalibDeadHEC0[cluster_order[i]]; + moments->engCalibDeadFCAL[i] = temp_moments->engCalibDeadFCAL[cluster_order[i]]; + moments->engCalibDeadLeakage[i] = temp_moments->engCalibDeadLeakage[cluster_order[i]]; + moments->engCalibDeadUnclass[i] = temp_moments->engCalibDeadUnclass[cluster_order[i]]; + moments->engCalibFracEM[i] = temp_moments->engCalibFracEM[cluster_order[i]]; + moments->engCalibFracHad[i] = temp_moments->engCalibFracHad[cluster_order[i]]; + moments->engCalibFracRest[i] = temp_moments->engCalibFracRest[cluster_order[i]]; + } + + for (int i = 0; i < NCaloCells; ++i) + { + if (!cell_info->is_valid(i)) + { + continue; + } + const ClusterTag this_tag = cell_state->clusterTag[i]; + if (!this_tag.is_part_of_cluster()) + { + cell_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + else if (this_tag.is_part_of_cluster()) + { + const int old_idx = this_tag.cluster_index(); + const int new_idx = tag_map[old_idx]; + const int old_idx2 = this_tag.is_shared_between_clusters() ? this_tag.secondary_cluster_index() : -1; + const int new_idx2 = old_idx2 >= 0 ? tag_map[old_idx2] : -1; + if (new_idx < 0 && new_idx2 < 0) + { + cell_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + else if (new_idx < 0) + { + cell_state->clusterTag[i] = ClusterTag::make_tag(new_idx2); + } + else if (new_idx2 < 0) + { + cell_state->clusterTag[i] = ClusterTag::make_tag(new_idx); + } + else + { + cell_state->clusterTag[i] = ClusterTag::make_tag(new_idx, this_tag.secondary_cluster_weight(), new_idx2); + } + } + } + + return StatusCode::SUCCESS; +} + +namespace +{ + template <class ... Args> + struct multi_class_holder + { + static constexpr size_t size() + { + return sizeof...(Args); + } + }; + + //To deal with potential lack of maybe_unused in pack expansions. + template <class Arg> + static constexpr decltype(auto) suppress_warning(Arg && a) + { + return std::forward<Arg>(a); + } + + static constexpr void suppress_warning() + { + return; + } + + template <class F, class ... Types, class ... Args> + void apply_to_multi_class(F && f, const multi_class_holder<Types...> &, Args && ... args) + { + size_t i = 0; + if constexpr (std::is_same_v < decltype(f((Types{}, ...), i, std::forward<Args>(args)...)), void > ) + { + (f(Types{}, i++, std::forward<Args>(args)...), ...); + } + else + { + (suppress_warning(f(Types{}, i++, std::forward<Args>(args)...)), ...); + } + } + + static float float_unhack(const unsigned int bits) + { + float res; + std::memcpy(&res, &bits, sizeof(float)); + //In C++20, we should bit-cast. For now, for our platform, works. + return res; + } + + static double protect_from_zero(const double x) + { + return x == 0 ? 1e-15 : x; + } + + static float protect_from_zero(const float x) + { + return x == 0 ? 1e-7 : x; + } +} + +StatusCode CaloGPUClusterAndCellDataMonitor::match_clusters(sample_comparisons_holder & sch, + const CaloRecGPU::ConstantDataHolder & constant_data, + const CaloRecGPU::CellInfoArr & cell_info, + const CaloRecGPU::CellStateArr & cell_state_1, + const CaloRecGPU::CellStateArr & cell_state_2, + const CaloRecGPU::ClusterInfoArr & cluster_info_1, + const CaloRecGPU::ClusterInfoArr & cluster_info_2, + const CaloRecGPU::ClusterMomentsArr & /*moments_1*/, + const CaloRecGPU::ClusterMomentsArr & /*moments_2*/, + const bool match_in_energy) const +{ + sch.r2t_table.clear(); + sch.r2t_table.resize(cluster_info_1.number, -1); + + sch.t2r_table.clear(); + sch.t2r_table.resize(cluster_info_2.number, -1); + + std::vector<double> similarity_map(cluster_info_1.number * cluster_info_2.number, 0.); + + std::vector<double> ref_normalization(cluster_info_1.number, 0.); + std::vector<double> test_normalization(cluster_info_2.number, 0.); + + for (int i = 0; i < NCaloCells; ++i) + { + const ClusterTag ref_tag = cell_state_1.clusterTag[i]; + const ClusterTag test_tag = cell_state_2.clusterTag[i]; + + if (!cell_info.is_valid(i)) + { + continue; + } + + double SNR = 0.00001; + + if (!cell_info.is_bad(*(constant_data.m_geometry), i)) + { + const int gain = cell_info.gain[i]; + + const double cellNoise = constant_data.m_cell_noise->noise[gain][i]; + if (std::isfinite(cellNoise) && cellNoise > 0.0f) + { + SNR = std::abs(cell_info.energy[i] / cellNoise); + } + } + + const double quantity = ( match_in_energy ? std::abs(cell_info.energy[i]) : SNR ); + const double weight = (quantity + 1e-8) * + ( SNR > m_seedThreshold ? (match_in_energy ? 1000 : m_seed_weight) : + ( + SNR > m_growThreshold ? (match_in_energy ? 950 : m_grow_weight) : + ( + SNR > m_termThreshold ? (match_in_energy ? 900 : m_terminal_weight) : (match_in_energy ? 100 : 0) + ) + ) + ); + int ref_c1 = -1, ref_c2 = -1, test_c1 = -1, test_c2 = -1; + + if (ref_tag.is_part_of_cluster()) + { + ref_c1 = ref_tag.cluster_index(); + ref_c2 = ref_tag.is_shared_between_clusters() ? ref_tag.secondary_cluster_index() : ref_c1; + } + + if (test_tag.is_part_of_cluster()) + { + test_c1 = test_tag.cluster_index(); + test_c2 = test_tag.is_shared_between_clusters() ? test_tag.secondary_cluster_index() : test_c1; + } + + float ref_rev_cw = float_unhack(ref_tag.secondary_cluster_weight()); + float test_rev_cw = float_unhack(test_tag.secondary_cluster_weight()); + + float ref_cw = 1.0f - ref_rev_cw; + float test_cw = 1.0f - test_rev_cw; + + if (ref_c1 >= int(cluster_info_1.number) || ref_c2 >= int(cluster_info_1.number) || + test_c1 >= int(cluster_info_2.number) || test_c2 >= int(cluster_info_2.number) ) + { + ATH_MSG_DEBUG( "Error in matches: " << i << " " << ref_c1 << " " << ref_c2 << " " + << test_c1 << " " << test_c2 << " (" + << cluster_info_1.number << " | " << cluster_info_2.number << ")" ); + continue; + } + + if (ref_c1 >= 0 && test_c1 >= 0) + { + similarity_map[test_c1 * cluster_info_1.number + ref_c1] += weight * ref_cw * test_cw; + similarity_map[test_c1 * cluster_info_1.number + ref_c2] += weight * ref_rev_cw * test_cw; + similarity_map[test_c2 * cluster_info_1.number + ref_c1] += weight * ref_cw * test_rev_cw; + similarity_map[test_c2 * cluster_info_1.number + ref_c2] += weight * ref_rev_cw * test_rev_cw; + } + if (ref_c1 >= 0) + { + ref_normalization[ref_c1] += weight * ref_cw * ref_cw; + ref_normalization[ref_c2] += weight * ref_rev_cw * ref_rev_cw; + } + if (test_c1 >= 0) + { + test_normalization[test_c1] += weight * test_cw * test_cw; + test_normalization[test_c2] += weight * test_rev_cw * test_rev_cw; + } + } + + for (int testc = 0; testc < cluster_info_2.number; ++testc) + { + const double test_norm = test_normalization[testc] + double(test_normalization[testc] == 0.); + for (int refc = 0; refc < cluster_info_1.number; ++refc) + { + const double ref_norm = ref_normalization[refc] + double(ref_normalization[refc] == 0.); + similarity_map[testc * cluster_info_1.number + refc] /= std::sqrt(ref_norm * test_norm); + } + } + + //In essence, the Gale-Shapley Algorithm + + std::vector<std::vector<int>> sorted_GPU_matches; + + sorted_GPU_matches.reserve(cluster_info_2.number); + + for (int testc = 0; testc < cluster_info_2.number; ++testc) + { + std::vector<int> sorter(cluster_info_1.number); + std::iota(sorter.begin(), sorter.end(), 0); + + std::sort(sorter.begin(), sorter.end(), + [&](const int a, const int b) + { + const double a_weight = similarity_map[testc * cluster_info_1.number + a]; + const double b_weight = similarity_map[testc * cluster_info_1.number + b]; + return a_weight > b_weight; + } + ); + + size_t wanted_size = 0; + + for (; wanted_size < sorter.size(); ++wanted_size) + { + const double match_weight = similarity_map[testc * cluster_info_1.number + sorter[wanted_size]]; + if (match_weight < m_min_similarity) + { + break; + } + } + + //Yeah, we could do a binary search for best worst-case complexity, + //but we are expecting 1~2 similar clusters and the rest garbage, + //so we're expecting only 1~2 iterations. + //This actually means all that sorting is way way overkill, + //but we must make sure in the most general case that this works... + + sorter.resize(wanted_size); + + sorted_GPU_matches.push_back(sorter); + } + + int num_iter = 0; + + constexpr int max_iter = 32; + + std::vector<double> matched_weights(cluster_info_1.number, -1.); + + std::vector<size_t> skipped_matching(cluster_info_2.number, 0); + + for (int stop_counter = 0; stop_counter < cluster_info_2.number && num_iter < max_iter; ++num_iter) + { + stop_counter = 0; + for (int testc = 0; testc < int(sorted_GPU_matches.size()); ++testc) + { + if (skipped_matching[testc] < sorted_GPU_matches[testc].size()) + { + const int match_c = sorted_GPU_matches[testc][skipped_matching[testc]]; + const double match_weight = similarity_map[testc * cluster_info_1.number + match_c]; + if (match_weight >= m_min_similarity && match_weight > matched_weights[match_c]) + { + const int prev_match = sch.r2t_table[match_c]; + if (prev_match >= 0) + { + ++skipped_matching[prev_match]; + --stop_counter; + } + sch.r2t_table[match_c] = testc; + matched_weights[match_c] = match_weight; + ++stop_counter; + } + else + { + ++skipped_matching[testc]; + } + } + else + { + ++stop_counter; + } + } + } + + sch.unmatched_ref_list.clear(); + sch.unmatched_test_list.clear(); + + for (size_t i = 0; i < sch.r2t_table.size(); ++i) + { + const int match = sch.r2t_table[i]; + if (sch.r2t_table[i] < 0) + { + sch.unmatched_ref_list.push_back(i); + } + else + { + sch.t2r_table[match] = i; + } + } + + for (size_t i = 0; i < sch.t2r_table.size(); ++i) + { + if (sch.t2r_table[i] < 0) + { + sch.unmatched_test_list.push_back(i); + } + } + + { + char message_buffer[256]; + snprintf(message_buffer, 256, + "%2d: %5d / %5d || %5d / %5d || %3d || %5d | %5d || %5d", + num_iter, + int(sch.r2t_table.size()) - int(sch.unmatched_ref_list.size()), int(sch.r2t_table.size()), + int(sch.t2r_table.size()) - int(sch.unmatched_test_list.size()), int(sch.t2r_table.size()), + int(sch.r2t_table.size()) - int(sch.t2r_table.size()), + int(sch.unmatched_ref_list.size()), + int(sch.unmatched_test_list.size()), + int(sch.unmatched_ref_list.size()) - int(sch.unmatched_test_list.size()) + ); + ATH_MSG_INFO(message_buffer); + } + + return StatusCode::SUCCESS; + +} + +CaloGPUClusterAndCellDataMonitor::~CaloGPUClusterAndCellDataMonitor() +{ + //Nothing! +} + +namespace +{ + + namespace ClusterProperties + { +#define CALORECGPU_BASIC_CLUSTER_PROPERTY(NAME, ...) \ + struct clusters_ ## NAME \ + { \ + static std::string name() \ + { \ + return # NAME; \ + } \ + static double get_property([[maybe_unused]] const ConstantDataHolder & constant_data, \ + [[maybe_unused]] const CaloRecGPU::CellInfoArr & cell_info, \ + [[maybe_unused]] const CaloRecGPU::CellStateArr & cell_state, \ + [[maybe_unused]] const CaloRecGPU::ClusterInfoArr & cluster_info, \ + [[maybe_unused]] const CaloRecGPU::ClusterMomentsArr & cluster_moments, \ + [[maybe_unused]] const int cluster_index ) \ + { \ + __VA_ARGS__ \ + } \ + }; + + CALORECGPU_BASIC_CLUSTER_PROPERTY(E, return cluster_info.clusterEnergy[cluster_index] / CLHEP::MeV;) + + CALORECGPU_BASIC_CLUSTER_PROPERTY(abs_E, return std::abs(cluster_info.clusterEnergy[cluster_index]) / CLHEP::MeV;) + + CALORECGPU_BASIC_CLUSTER_PROPERTY(Et, return cluster_info.clusterEt[cluster_index] / CLHEP::MeV;) + + CALORECGPU_BASIC_CLUSTER_PROPERTY(eta, return cluster_info.clusterEta[cluster_index];) + + CALORECGPU_BASIC_CLUSTER_PROPERTY(phi, return cluster_info.clusterPhi[cluster_index];) + + CALORECGPU_BASIC_CLUSTER_PROPERTY(time, return cluster_moments.time[cluster_index] / CLHEP::us;) + +#define CALORECGPU_CLUSTER_MOMENT(NAME, PROPERTY) CALORECGPU_BASIC_CLUSTER_PROPERTY(moments_ ## NAME, return cluster_moments . PROPERTY [cluster_index];) + + CALORECGPU_CLUSTER_MOMENT(time, time) + CALORECGPU_CLUSTER_MOMENT(FIRST_PHI, firstPhi) + CALORECGPU_CLUSTER_MOMENT(FIRST_ETA, firstEta) + CALORECGPU_CLUSTER_MOMENT(SECOND_R, secondR) + CALORECGPU_CLUSTER_MOMENT(SECOND_LAMBDA, secondLambda) + CALORECGPU_CLUSTER_MOMENT(DELTA_PHI, deltaPhi) + CALORECGPU_CLUSTER_MOMENT(DELTA_THETA, deltaTheta) + CALORECGPU_CLUSTER_MOMENT(DELTA_ALPHA, deltaAlpha) + CALORECGPU_CLUSTER_MOMENT(CENTER_X, centerX) + CALORECGPU_CLUSTER_MOMENT(CENTER_Y, centerY) + CALORECGPU_CLUSTER_MOMENT(CENTER_Z, centerZ) + CALORECGPU_CLUSTER_MOMENT(CENTER_MAG, centerMag) + CALORECGPU_CLUSTER_MOMENT(CENTER_LAMBDA, centerLambda) + CALORECGPU_CLUSTER_MOMENT(LATERAL, lateral) + CALORECGPU_CLUSTER_MOMENT(LONGITUDINAL, longitudinal) + CALORECGPU_CLUSTER_MOMENT(ENG_FRAC_EM, engFracEM) + CALORECGPU_CLUSTER_MOMENT(ENG_FRAC_MAX, engFracMax) + CALORECGPU_CLUSTER_MOMENT(ENG_FRAC_CORE, engFracCore) + CALORECGPU_CLUSTER_MOMENT(FIRST_ENG_DENS, firstEngDens) + CALORECGPU_CLUSTER_MOMENT(SECOND_ENG_DENS, secondEngDens) + CALORECGPU_CLUSTER_MOMENT(ISOLATION, isolation) + CALORECGPU_CLUSTER_MOMENT(ENG_BAD_CELLS, engBadCells) + CALORECGPU_CLUSTER_MOMENT(N_BAD_CELLS, nBadCells) + CALORECGPU_CLUSTER_MOMENT(N_BAD_CELLS_CORR, nBadCellsCorr) + CALORECGPU_CLUSTER_MOMENT(BAD_CELLS_CORR_E, badCellsCorrE) + CALORECGPU_CLUSTER_MOMENT(BADLARQ_FRAC, badLArQFrac) + CALORECGPU_CLUSTER_MOMENT(ENG_POS, engPos) + CALORECGPU_CLUSTER_MOMENT(SIGNIFICANCE, significance) + CALORECGPU_CLUSTER_MOMENT(CELL_SIGNIFICANCE, cellSignificance) + CALORECGPU_CLUSTER_MOMENT(CELL_SIG_SAMPLING, cellSigSampling) + CALORECGPU_CLUSTER_MOMENT(AVG_LAR_Q, avgLArQ) + CALORECGPU_CLUSTER_MOMENT(AVG_TILE_Q, avgTileQ) + CALORECGPU_CLUSTER_MOMENT(ENG_BAD_HV_CELLS, engBadHVCells) + CALORECGPU_CLUSTER_MOMENT(N_BAD_HV_CELLS, nBadHVCells) + CALORECGPU_CLUSTER_MOMENT(PTD, PTD) + CALORECGPU_CLUSTER_MOMENT(MASS, mass) + CALORECGPU_CLUSTER_MOMENT(EM_PROBABILITY, EMProbability) + CALORECGPU_CLUSTER_MOMENT(HAD_WEIGHT, hadWeight) + CALORECGPU_CLUSTER_MOMENT(OOC_WEIGHT, OOCweight) + CALORECGPU_CLUSTER_MOMENT(DM_WEIGHT, DMweight) + CALORECGPU_CLUSTER_MOMENT(TILE_CONFIDENCE_LEVEL, tileConfidenceLevel) + CALORECGPU_CLUSTER_MOMENT(SECOND_TIME, secondTime) + CALORECGPU_CLUSTER_MOMENT(number_of_cells, numCells) + CALORECGPU_CLUSTER_MOMENT(VERTEX_FRACTION, vertexFraction) + CALORECGPU_CLUSTER_MOMENT(NVERTEX_FRACTION, nVertexFraction) + CALORECGPU_CLUSTER_MOMENT(ETACALOFRAME, etaCaloFrame) + CALORECGPU_CLUSTER_MOMENT(PHICALOFRAME, phiCaloFrame) + CALORECGPU_CLUSTER_MOMENT(ETA1CALOFRAME, eta1CaloFrame) + CALORECGPU_CLUSTER_MOMENT(PHI1CALOFRAME, phi1CaloFrame) + CALORECGPU_CLUSTER_MOMENT(ETA2CALOFRAME, eta2CaloFrame) + CALORECGPU_CLUSTER_MOMENT(PHI2CALOFRAME, phi2CaloFrame) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_TOT, engCalibTot) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_OUT_L, engCalibOutL) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_OUT_M, engCalibOutM) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_OUT_T, engCalibOutT) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_L, engCalibDeadL) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_M, engCalibDeadM) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_T, engCalibDeadT) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_EMB0, engCalibEMB0) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_EME0, engCalibEME0) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_TILEG3, engCalibTileG3) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_TOT, engCalibDeadTot) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_EMB0, engCalibDeadEMB0) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_TILE0, engCalibDeadTile0) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_TILEG3, engCalibDeadTileG3) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_EME0, engCalibDeadEME0) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_HEC0, engCalibDeadHEC0) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_FCAL, engCalibDeadFCAL) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_LEAKAGE, engCalibDeadLeakage) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_DEAD_UNCLASS, engCalibDeadUnclass) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_FRAC_EM, engCalibFracEM) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_FRAC_HAD, engCalibFracHad) + CALORECGPU_CLUSTER_MOMENT(ENG_CALIB_FRAC_REST, engCalibFracRest) + + using BasicClusterProperties = multi_class_holder < + + clusters_E, + clusters_abs_E, + clusters_Et, + clusters_eta, + clusters_phi, + clusters_time, + clusters_moments_FIRST_PHI, + clusters_moments_FIRST_ETA, + clusters_moments_SECOND_R, + clusters_moments_SECOND_LAMBDA, + clusters_moments_DELTA_PHI, + clusters_moments_DELTA_THETA, + clusters_moments_DELTA_ALPHA, + clusters_moments_CENTER_X, + clusters_moments_CENTER_Y, + clusters_moments_CENTER_Z, + clusters_moments_CENTER_MAG, + clusters_moments_CENTER_LAMBDA, + clusters_moments_LATERAL, + clusters_moments_LONGITUDINAL, + clusters_moments_ENG_FRAC_EM, + clusters_moments_ENG_FRAC_MAX, + clusters_moments_ENG_FRAC_CORE, + clusters_moments_FIRST_ENG_DENS, + clusters_moments_SECOND_ENG_DENS, + clusters_moments_ISOLATION, + clusters_moments_ENG_BAD_CELLS, + clusters_moments_N_BAD_CELLS, + clusters_moments_N_BAD_CELLS_CORR, + clusters_moments_BAD_CELLS_CORR_E, + clusters_moments_BADLARQ_FRAC, + clusters_moments_ENG_POS, + clusters_moments_SIGNIFICANCE, + clusters_moments_CELL_SIGNIFICANCE, + clusters_moments_CELL_SIG_SAMPLING, + clusters_moments_AVG_LAR_Q, + clusters_moments_AVG_TILE_Q, + clusters_moments_ENG_BAD_HV_CELLS, + clusters_moments_N_BAD_HV_CELLS, + clusters_moments_PTD, + clusters_moments_MASS, + clusters_moments_EM_PROBABILITY, + clusters_moments_HAD_WEIGHT, + clusters_moments_OOC_WEIGHT, + clusters_moments_DM_WEIGHT, + clusters_moments_TILE_CONFIDENCE_LEVEL, + clusters_moments_SECOND_TIME, + clusters_moments_number_of_cells, + clusters_moments_VERTEX_FRACTION, + clusters_moments_NVERTEX_FRACTION, + clusters_moments_ETACALOFRAME, + clusters_moments_PHICALOFRAME, + clusters_moments_ETA1CALOFRAME, + clusters_moments_PHI1CALOFRAME, + clusters_moments_ETA2CALOFRAME, + clusters_moments_PHI2CALOFRAME, + clusters_moments_ENG_CALIB_TOT, + clusters_moments_ENG_CALIB_OUT_L, + clusters_moments_ENG_CALIB_OUT_M, + clusters_moments_ENG_CALIB_OUT_T, + clusters_moments_ENG_CALIB_DEAD_L, + clusters_moments_ENG_CALIB_DEAD_M, + clusters_moments_ENG_CALIB_DEAD_T, + clusters_moments_ENG_CALIB_EMB0, + clusters_moments_ENG_CALIB_EME0, + clusters_moments_ENG_CALIB_TILEG3, + clusters_moments_ENG_CALIB_DEAD_TOT, + clusters_moments_ENG_CALIB_DEAD_EMB0, + clusters_moments_ENG_CALIB_DEAD_TILE0, + clusters_moments_ENG_CALIB_DEAD_TILEG3, + clusters_moments_ENG_CALIB_DEAD_EME0, + clusters_moments_ENG_CALIB_DEAD_HEC0, + clusters_moments_ENG_CALIB_DEAD_FCAL, + clusters_moments_ENG_CALIB_DEAD_LEAKAGE, + clusters_moments_ENG_CALIB_DEAD_UNCLASS, + clusters_moments_ENG_CALIB_FRAC_EM, + clusters_moments_ENG_CALIB_FRAC_HAD, + clusters_moments_ENG_CALIB_FRAC_REST + + >; + + } + + using ClusterProperties::BasicClusterProperties; + + namespace ExtraClusterComparisons + { +#define CALORECGPU_COMPARED_CLUSTER_PROPERTY(NAME, ...) \ + struct clusters_ ## NAME \ + { \ + static std::string name() \ + { \ + return # NAME; \ + } \ + static double get_property([[maybe_unused]] const ConstantDataHolder & constant_data, \ + [[maybe_unused]] const CaloRecGPU::CellInfoArr & cell_info_1, \ + [[maybe_unused]] const CaloRecGPU::CellStateArr & cell_state_1, \ + [[maybe_unused]] const CaloRecGPU::ClusterInfoArr & cluster_info_1, \ + [[maybe_unused]] const CaloRecGPU::ClusterMomentsArr & cluster_moments_1, \ + [[maybe_unused]] const int cluster_index_1, \ + [[maybe_unused]] const CaloRecGPU::CellInfoArr & cell_info_2, \ + [[maybe_unused]] const CaloRecGPU::CellStateArr & cell_state_2, \ + [[maybe_unused]] const CaloRecGPU::ClusterInfoArr & cluster_info_2, \ + [[maybe_unused]] const CaloRecGPU::ClusterMomentsArr & cluster_moments_2, \ + [[maybe_unused]] const int cluster_index_2) \ + { \ + __VA_ARGS__ \ + } \ + }; + + CALORECGPU_COMPARED_CLUSTER_PROPERTY(delta_phi_in_range, + return Helpers::regularize_angle( Helpers::regularize_angle(cluster_info_2.clusterPhi[cluster_index_2]) - + Helpers::regularize_angle(cluster_info_1.clusterPhi[cluster_index_1]) ); + ) + + CALORECGPU_COMPARED_CLUSTER_PROPERTY(delta_R, + const double delta_eta = cluster_info_2.clusterEta[cluster_index_2] - cluster_info_1.clusterEta[cluster_index_1]; + const double delta_phi = Helpers::regularize_angle( Helpers::regularize_angle(cluster_info_2.clusterPhi[cluster_index_2]) - + Helpers::regularize_angle(cluster_info_1.clusterPhi[cluster_index_1]) ); + return std::sqrt(delta_eta * delta_eta + delta_phi * delta_phi); + + ) + + + using ComparedClusterProperties = multi_class_holder < + + clusters_delta_phi_in_range, + clusters_delta_R + + >; + + } + + using ExtraClusterComparisons::ComparedClusterProperties; + + namespace CellProperties + { +#define CALORECGPU_BASIC_CELL_PROPERTY(NAME, ...) \ + struct cells_ ## NAME \ + { \ + static std::string name() \ + { \ + return # NAME; \ + } \ + static double get_property([[maybe_unused]] const ConstantDataHolder & constant_data, \ + [[maybe_unused]] const CaloRecGPU::CellInfoArr & cell_info, \ + [[maybe_unused]] const CaloRecGPU::CellStateArr & cell_state, \ + [[maybe_unused]] const CaloRecGPU::ClusterInfoArr & cluster_info, \ + [[maybe_unused]] const CaloRecGPU::ClusterMomentsArr & cluster_moments, \ + [[maybe_unused]] const int cell ) \ + { \ + __VA_ARGS__ \ + } \ + }; + + CALORECGPU_BASIC_CELL_PROPERTY(E, return cell_info.energy[cell] / CLHEP::MeV;) + CALORECGPU_BASIC_CELL_PROPERTY(abs_E, return std::abs(cell_info.energy[cell]) / CLHEP::MeV; ) + + CALORECGPU_BASIC_CELL_PROPERTY(gain, return cell_info.gain[cell];) + + CALORECGPU_BASIC_CELL_PROPERTY(noise, return constant_data.m_cell_noise->noise[cell_info.gain[cell]][cell];) + + CALORECGPU_BASIC_CELL_PROPERTY(SNR, return cell_info.energy[cell] / + protect_from_zero(constant_data.m_cell_noise->noise[cell_info.gain[cell]][cell]); + ) + + CALORECGPU_BASIC_CELL_PROPERTY(abs_SNR, return std::abs(cell_info.energy[cell] / + protect_from_zero(constant_data.m_cell_noise->noise[cell_info.gain[cell]][cell]));) + + CALORECGPU_BASIC_CELL_PROPERTY(time, return cell_info.time[cell] / CLHEP::us;) + + CALORECGPU_BASIC_CELL_PROPERTY(index, return cell;) + + CALORECGPU_BASIC_CELL_PROPERTY(sampling, return constant_data.m_geometry->caloSample[cell];) + + + CALORECGPU_BASIC_CELL_PROPERTY(x, return constant_data.m_geometry->x[cell] / CLHEP::cm; ) + CALORECGPU_BASIC_CELL_PROPERTY(y, return constant_data.m_geometry->y[cell] / CLHEP::cm; ) + CALORECGPU_BASIC_CELL_PROPERTY(z, return constant_data.m_geometry->z[cell] / CLHEP::cm; ) + + CALORECGPU_BASIC_CELL_PROPERTY(phi, return constant_data.m_geometry->phi[cell];) + + CALORECGPU_BASIC_CELL_PROPERTY(eta, return constant_data.m_geometry->eta[cell];) + + + CALORECGPU_BASIC_CELL_PROPERTY(primary_cluster_index, return ClusterTag{cell_state.clusterTag[cell]}.cluster_index(); ) + + CALORECGPU_BASIC_CELL_PROPERTY(secondary_cluster_index, return ClusterTag{cell_state.clusterTag[cell]}.secondary_cluster_index(); ) + + CALORECGPU_BASIC_CELL_PROPERTY(primary_weight, + { + const ClusterTag tag = cell_state.clusterTag[cell]; + if (tag.is_part_of_cluster()) + { + float rev_weight = float_unhack(tag.secondary_cluster_weight()); + return 1.0f - rev_weight; + } + else + { + return 0.f; + } + } + ) + + CALORECGPU_BASIC_CELL_PROPERTY(secondary_weight, + { + const ClusterTag tag = cell_state.clusterTag[cell]; + if (tag.is_part_of_cluster()) + { + float rev_weight = float_unhack(tag.secondary_cluster_weight()); + return rev_weight; + } + else + { + return 0.f; + } + } + ) + + using BasicCellProperties = multi_class_holder < + + cells_E, + cells_abs_E, + cells_gain, + cells_noise, + cells_SNR, + cells_abs_SNR, + cells_time, + cells_index, + cells_sampling, + cells_x, + cells_y, + cells_z, + cells_phi, + cells_eta, + cells_primary_cluster_index, + cells_secondary_cluster_index, + cells_primary_weight, + cells_secondary_weight + + >; + + } + + using CellProperties::BasicCellProperties; + + namespace CellTypes + { +#define CALORECGPU_BASIC_CELL_TYPE(NAME, ...) \ + struct cell_type_ ## NAME \ + { \ + static std::string name() \ + { \ + return # NAME; \ + } \ + static bool is_type([[maybe_unused]] const ConstantDataHolder & constant_data, \ + [[maybe_unused]] const CaloRecGPU::CellInfoArr & cell_info, \ + [[maybe_unused]] const CaloRecGPU::CellStateArr & cell_state, \ + [[maybe_unused]] const CaloRecGPU::ClusterInfoArr & cluster_info, \ + [[maybe_unused]] const CaloRecGPU::ClusterMomentsArr & cluster_moments, \ + [[maybe_unused]] const int cell ) \ + { \ + __VA_ARGS__ \ + } \ + }; + + CALORECGPU_BASIC_CELL_TYPE(intracluster, return ClusterTag{cell_state.clusterTag[cell]}.is_part_of_cluster();) + + CALORECGPU_BASIC_CELL_TYPE(extracluster, return !ClusterTag{cell_state.clusterTag[cell]}.is_part_of_cluster();) + + CALORECGPU_BASIC_CELL_TYPE(shared, + ClusterTag tag = cell_state.clusterTag[cell]; + return tag.is_part_of_cluster() && tag.is_shared_between_clusters(); ) + + using BasicCellTypes = multi_class_holder < + + cell_type_intracluster, + cell_type_extracluster, + cell_type_shared + + >; + + } + + using CellTypes::BasicCellTypes; + + + enum ExtraThingsToCalculate + { + ClusterSize = 0, + ClusterComparedSize, + DiffCells, + SameECells, + SameECellsCombined, + SameSNRCells, + SameSNRCellsCombined, + ExtraThingsSize + }; +} + +StatusCode CaloGPUClusterAndCellDataMonitor::initialize_plotted_variables() +{ + const std::vector<std::string> histo_strings = m_moniTool->histogramService()->getHists(); + //Small problem: other histograms with matching names. + //Mitigated by the fact that we use cell_<property> and cluster_<property>... + + m_clusterPropertiesToDo.resize(BasicClusterProperties::size(), false); + m_comparedClusterPropertiesToDo.resize(BasicClusterProperties::size(), false); + m_extraComparedClusterPropertiesToDo.resize(ComparedClusterProperties::size(), false); + m_cellPropertiesToDo.resize(BasicCellProperties::size(), false); + m_comparedCellPropertiesToDo.resize(BasicCellProperties::size(), false); + m_cellTypesToDo.resize(BasicCellTypes::size(), false); + m_comparedCellTypesToDo.resize(BasicCellTypes::size(), false); + m_extraThingsToDo.resize(ExtraThingsSize, false); + + auto string_contains = [](const std::string & container, const std::string & contained) -> bool + { + return container.find(contained) != std::string::npos; + }; + + auto search_lambda = [&](const auto & prop, const size_t count, bool & check, + const std::string & str, std::vector<bool> & to_do, + const std::string & prefix = "", const std::string & suffix = "") + { + if (string_contains(str, prefix + prop.name() + suffix)) + { + to_do[count] = true; + check = true; + } + }; + + for (const auto & str : histo_strings) + { + bool found = false; + + apply_to_multi_class(search_lambda, BasicCellProperties{}, found, str, m_cellPropertiesToDo, "_cell_"); + apply_to_multi_class(search_lambda, BasicCellTypes{}, found, str, m_cellTypesToDo, "_", "_cells"); + + if (found) + { + m_doCells = true; + } + + found = false; + + apply_to_multi_class(search_lambda, BasicClusterProperties{}, found, str, m_clusterPropertiesToDo, "_cluster_"); + + if (found) + { + m_doClusters = true; + } + + found = false; + + apply_to_multi_class(search_lambda, BasicCellProperties{}, found, str, m_comparedCellPropertiesToDo, "_cell_delta_"); + apply_to_multi_class(search_lambda, BasicCellProperties{}, found, str, m_comparedCellPropertiesToDo, "_cell_", "_ref"); + apply_to_multi_class(search_lambda, BasicCellProperties{}, found, str, m_comparedCellPropertiesToDo, "_cell_", "_test"); + apply_to_multi_class(search_lambda, BasicCellTypes{}, found, str, m_comparedCellTypesToDo, "num_ref_", "_cells"); + apply_to_multi_class(search_lambda, BasicCellTypes{}, found, str, m_comparedCellTypesToDo, "num_test_", "_cells"); + apply_to_multi_class(search_lambda, BasicCellTypes{}, found, str, m_comparedCellTypesToDo, "delta_", "_cells"); + + if (found) + { + m_doCombinedCells = true; + } + + found = false; + + apply_to_multi_class(search_lambda, BasicClusterProperties{}, found, str, m_comparedClusterPropertiesToDo, "_cluster_delta_", ""); + apply_to_multi_class(search_lambda, BasicClusterProperties{}, found, str, m_comparedClusterPropertiesToDo, "_cluster_", "_ref"); + apply_to_multi_class(search_lambda, BasicClusterProperties{}, found, str, m_comparedClusterPropertiesToDo, "_cluster_", "_test"); + apply_to_multi_class(search_lambda, ComparedClusterProperties{}, found, str, m_extraComparedClusterPropertiesToDo); + + if (found) + { + m_doCombinedClusters = true; + } + + if ( string_contains(str, "cluster_size_ref") || + string_contains(str, "cluster_size_test") || + string_contains(str, "cluster_delta_size") || + string_contains(str, "cluster_weighted_size_ref") || + string_contains(str, "cluster_weighted_size_test") || + string_contains(str, "cluster_delta_weighted_size") ) + { + m_extraThingsToDo[ClusterComparedSize] = true; + m_doCombinedCells = true; + m_doCombinedClusters = true; + } + else if ( string_contains(str, "cluster_size") || + string_contains(str, "cluster_weighted_size") ) + { + m_extraThingsToDo[ClusterSize] = true; + m_doCells = true; + m_doClusters = true; + } + + if (string_contains(str, "cluster_diff_cells")) + { + m_extraThingsToDo[DiffCells] = true; + m_doCombinedCells = true; + m_doCombinedClusters = true; + } + + if ( string_contains(str, "_num_same_E_cells_ref") || + string_contains(str, "_num_same_E_cells_test") || + string_contains(str, "delta_num_same_E_cells") || + string_contains(str, "_num_same_abs_E_cells_ref") || + string_contains(str, "_num_same_abs_E_cells_test") || + string_contains(str, "delta_num_same_abs_E_cells") ) + { + m_extraThingsToDo[SameECellsCombined] = true; + m_doCombinedCells = true; + } + else if ( string_contains(str, "_num_same_E_cells") || + string_contains(str, "_num_same_abs_E_cells") ) + { + m_extraThingsToDo[SameECells] = true; + m_doCells = true; + } + + if ( string_contains(str, "_num_same_SNR_cells_ref") || + string_contains(str, "_num_same_SNR_cells_test") || + string_contains(str, "delta_num_same_SNR_cells") || + string_contains(str, "_num_same_abs_SNR_cells_ref") || + string_contains(str, "_num_same_abs_SNR_cells_test") || + string_contains(str, "delta_num_same_abs_SNR_cells") ) + { + m_extraThingsToDo[SameSNRCellsCombined] = true; + m_doCombinedCells = true; + } + else if ( string_contains(str, "_num_same_SNR_cells") || + string_contains(str, "_num_same_abs_SNR_cells") ) + { + m_extraThingsToDo[SameSNRCells] = true; + m_doCells = true; + } + } + + return StatusCode::SUCCESS; + +} + + +StatusCode CaloGPUClusterAndCellDataMonitor::add_data(const EventContext & /*ctx*/, + const ConstantDataHolder & constant_data, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> & moments, + const std::string & tool_name) const +{ + m_numClustersPerTool[tool_name].fetch_add(clusters->number); + + const std::string prefix = m_toolToIdMap.at(tool_name); + + const int index = m_toolsToCheckFor.at(tool_name); + + if (index >= 0 && m_numToolsToKeep > 0) + { + std::vector<per_tool_storage> & store_vec = m_storageHolder.get_for_thread(); + store_vec[index].cell_info = *cell_info; + store_vec[index].cell_state = *cell_state; + store_vec[index].clusters = *clusters; + store_vec[index].moments = *moments; + } + + if (prefix != "") + //Tools that are not meant to be plotted individually + //have the empty string as a prefix. + { + std::unordered_map<std::string, std::vector<double>> cluster_properties, cell_properties; + + std::unordered_map<std::string, long long int> cell_counts; + + cluster_properties["size"].resize(clusters->number, 0.); + cluster_properties["weighted_size"].resize(clusters->number, 0.); + + long long int same_energy = 0, same_abs_energy = 0, same_snr = 0, same_abs_snr = 0; + + std::set<double> energies, snrs; + + if (m_doCells) + { + + for (int cell = 0; cell < NCaloCells; ++cell) + { + if (!cell_info->is_valid(cell)) + { + continue; + } + + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_cellPropertiesToDo[i]) + { + cell_properties[prop.name()].push_back(prop.get_property(constant_data, *cell_info, *cell_state, *clusters, *moments, cell)); + } + }, BasicCellProperties{}); + + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_cellTypesToDo[i]) + { + cell_counts[prop.name()] += prop.is_type(constant_data, *cell_info, *cell_state, *clusters, *moments, cell); + } + }, BasicCellTypes{}); + + const float this_energy = cell_info->energy[cell]; + + if (m_extraThingsToDo[SameECells]) + { + + if (energies.count(this_energy)) + { + ++same_energy; + ++same_abs_energy; + } + else if (energies.count(-this_energy)) + { + ++same_abs_energy; + } + energies.insert(this_energy); + } + + if (m_extraThingsToDo[SameSNRCells]) + { + + const float this_snr = this_energy / protect_from_zero(constant_data.m_cell_noise->noise[cell_info->gain[cell]][cell]); + + if (snrs.count(this_snr)) + { + ++same_snr; + ++same_abs_snr; + } + else if (snrs.count(-this_snr)) + { + ++same_abs_snr; + } + snrs.insert(this_snr); + } + + if (m_extraThingsToDo[ClusterSize]) + { + const ClusterTag tag = cell_state->clusterTag[cell]; + const float weight = float_unhack(tag.secondary_cluster_weight()); + if (tag.is_part_of_cluster()) + { + cluster_properties["size"][tag.cluster_index()] += 1; + cluster_properties["weighted_size"][tag.cluster_index()] += 1.0f - weight; + if (tag.is_shared_between_clusters()) + { + cluster_properties["size"][tag.secondary_cluster_index()] += 1; + cluster_properties["weighted_size"][tag.secondary_cluster_index()] += weight; + } + } + } + } + } + + if (m_doClusters) + { + for (int cluster = 0; cluster < clusters->number; ++cluster) + { + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_clusterPropertiesToDo[i]) + { + cluster_properties[prop.name()].push_back(prop.get_property(constant_data, *cell_info, *cell_state, *clusters, *moments, cluster)); + } + }, BasicClusterProperties{}); + } + } + + using coll_type = decltype(Monitored::Collection("", std::declval<std::vector<double> &>())); + using scalar_type = decltype(Monitored::Scalar("", std::declval<long long int>())); + + std::vector<coll_type> collections; + std::vector<scalar_type> count_scalars; + std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> cluster_group, cell_group, counts_group; + + collections.reserve(cluster_properties.size() + cell_properties.size()); + count_scalars.reserve(cell_counts.size()); + cluster_group.reserve(cluster_properties.size()); + cell_group.reserve(cell_properties.size()); + counts_group.reserve(cell_counts.size() + 5); + + auto mon_clus_num = Monitored::Scalar(prefix + "_num_clusters", clusters->number); + auto mon_same_energy = Monitored::Scalar(prefix + "_num_same_E_cells", same_energy); + auto mon_same_abs_energy = Monitored::Scalar(prefix + "_num_same_abs_E_cells", same_abs_energy); + auto mon_same_snr = Monitored::Scalar(prefix + "_num_same_SNR_cells", same_snr); + auto mon_same_abs_snr = Monitored::Scalar(prefix + "_num_same_abs_SNR_cells", same_abs_snr); + + counts_group.push_back(std::ref(mon_clus_num)); + counts_group.push_back(std::ref(mon_same_energy)); + counts_group.push_back(std::ref(mon_same_abs_energy)); + counts_group.push_back(std::ref(mon_same_snr)); + counts_group.push_back(std::ref(mon_same_abs_snr)); + + //If we're not doing these plots, + //we're still saving, + //which is slightly inefficient, but.. let's not complicate. + + for (const auto & k_v : cluster_properties) + { + collections.emplace_back(Monitored::Collection(prefix + "_cluster_" + k_v.first, k_v.second)); + cluster_group.push_back(std::ref(collections.back())); + } + + for (const auto & k_v : cell_properties) + { + collections.emplace_back(Monitored::Collection(prefix + "_cell_" + k_v.first, k_v.second)); + cell_group.push_back(std::ref(collections.back())); + } + + for (const auto & k_v : cell_counts) + { + count_scalars.emplace_back(Monitored::Scalar(prefix + "_num_" + k_v.first + "_cells", k_v.second)); + counts_group.push_back(std::ref(count_scalars.back())); + } + + auto monitor_clusters = Monitored::Group(m_moniTool, cluster_group); + auto monitor_cells = Monitored::Group(m_moniTool, cell_group); + auto monitor_counts = Monitored::Group(m_moniTool, counts_group); + + } + return StatusCode::SUCCESS; +} + + +StatusCode CaloGPUClusterAndCellDataMonitor::add_combination(const EventContext & /*ctx*/, + const CaloRecGPU::ConstantDataHolder & constant_data, + const int index_1, + const int index_2, + const std::string & prefix, + const bool match_in_energy) const +{ + + //Note: Part of the work here is superfluous in the case + // where we are monitoring the tools individually too, + // but in the most generic case that is not guaranteed. + // Partially wasted work, but it's cleaner than the alternative... + + std::vector<per_tool_storage> & store_vec = m_storageHolder.get_for_thread(); + + const CaloRecGPU::CellInfoArr & cell_info_1 = store_vec[index_1].cell_info; + const CaloRecGPU::CellStateArr & cell_state_1 = store_vec[index_1].cell_state; + const CaloRecGPU::ClusterInfoArr & clusters_1 = store_vec[index_1].clusters; + const CaloRecGPU::ClusterMomentsArr & moments_1 = store_vec[index_1].moments; + + const CaloRecGPU::CellInfoArr & cell_info_2 = store_vec[index_2].cell_info; + const CaloRecGPU::CellStateArr & cell_state_2 = store_vec[index_2].cell_state; + const CaloRecGPU::ClusterInfoArr & clusters_2 = store_vec[index_2].clusters; + const CaloRecGPU::ClusterMomentsArr & moments_2 = store_vec[index_2].moments; + + sample_comparisons_holder sch; + + ATH_CHECK( match_clusters(sch, constant_data, cell_info_1, cell_state_1, cell_state_2, clusters_1, clusters_2, moments_1, moments_2, match_in_energy) ); + + std::unordered_map<std::string, std::vector<double>> cluster_properties, cell_properties; + + std::unordered_map<std::string, long long int> cell_counts; + + std::vector<double> ref_size_vec(clusters_1.number, 0.), test_size_vec(clusters_2.number, 0.), + ref_weighted_size_vec(clusters_1.number, 0.), test_weighted_size_vec(clusters_2.number, 0.), + ref_diff_cells(clusters_1.number, 0.), test_diff_cells(clusters_2.number, 0.), + ref_diff_cells_weight(clusters_1.number, 0.), test_diff_cells_weight(clusters_2.number, 0.); + //We can store integers up to 2^53 on a double... + + long long int same_energy_1 = 0, same_energy_2 = 0, + same_abs_energy_1 = 0, same_abs_energy_2 = 0, + same_snr_1 = 0, same_snr_2 = 0, + same_abs_snr_1 = 0, same_abs_snr_2 = 0, + same_cluster_cells_count=0, diff_cluster_cells_count=0; + + std::set<double> energies_1, energies_2, snrs_1, snrs_2; + + if (m_doCombinedCells) + { + + for (int cell = 0; cell < NCaloCells; ++cell) + { + if (!cell_info_1.is_valid(cell) || !cell_info_2.is_valid(cell)) + { + continue; + } + + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_comparedCellPropertiesToDo[i]) + { + const auto prop_1 = prop.get_property(constant_data, cell_info_1, cell_state_1, clusters_1, moments_1, cell); + const auto prop_2 = prop.get_property(constant_data, cell_info_2, cell_state_2, clusters_2, moments_2, cell); + + cell_properties[prop.name() + "_ref"].push_back(prop_1); + cell_properties[prop.name() + "_test"].push_back(prop_2); + + cell_properties["delta_" + prop.name()].push_back(prop_2 - prop_1); + cell_properties["delta_" + prop.name() + "_rel_ref"].push_back((prop_2 - prop_1) / protect_from_zero(std::abs(prop_1))); + cell_properties["delta_" + prop.name() + "_rel_test"].push_back((prop_2 - prop_1) / protect_from_zero(std::abs(prop_2))); + } + }, BasicCellProperties{}); + + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_comparedCellTypesToDo[i]) + { + const auto is_1 = prop.is_type(constant_data, cell_info_1, cell_state_1, clusters_1, moments_1, cell); + const auto is_2 = prop.is_type(constant_data, cell_info_2, cell_state_2, clusters_2, moments_2, cell); + + cell_counts["num_" + prop.name() + "_cells_ref"] += is_1; + cell_counts["num_" + prop.name() + "_cells_test"] += is_2; + cell_counts["delta_num_" + prop.name() + "_cells"] += is_2 - is_1; + } + }, BasicCellTypes{}); + + const float this_energy_1 = cell_info_1.energy[cell]; + const float this_energy_2 = cell_info_2.energy[cell]; + + if (m_extraThingsToDo[SameECellsCombined]) + { + + if (energies_1.count(this_energy_1)) + { + ++same_energy_1; + ++same_abs_energy_1; + } + else if (energies_1.count(-this_energy_1)) + { + ++same_abs_energy_1; + } + energies_1.insert(this_energy_1); + + if (energies_2.count(this_energy_2)) + { + ++same_energy_2; + ++same_abs_energy_2; + } + else if (energies_2.count(-this_energy_2)) + { + ++same_abs_energy_2; + } + energies_2.insert(this_energy_2); + } + + if (m_extraThingsToDo[SameSNRCellsCombined]) + { + const float this_snr_1 = this_energy_1 / protect_from_zero(constant_data.m_cell_noise->noise[cell_info_1.gain[cell]][cell]); + + if (snrs_1.count(this_snr_1)) + { + ++same_snr_1; + ++same_abs_snr_1; + } + else if (snrs_1.count(-this_snr_1)) + { + ++same_abs_snr_1; + } + snrs_1.insert(this_snr_1); + + + const float this_snr_2 = this_energy_2 / protect_from_zero(constant_data.m_cell_noise->noise[cell_info_2.gain[cell]][cell]); + + if (snrs_2.count(this_snr_2)) + { + ++same_snr_2; + ++same_abs_snr_2; + } + else if (snrs_2.count(-this_snr_2)) + { + ++same_abs_snr_2; + } + snrs_2.insert(this_snr_2); + } + + if (m_extraThingsToDo[DiffCells] || m_extraThingsToDo[ClusterComparedSize]) + { + + const ClusterTag ref_tag = cell_state_1.clusterTag[cell]; + const ClusterTag test_tag = cell_state_2.clusterTag[cell]; + int ref_c1 = -2, ref_c2 = -2, test_c1 = -2, test_c2 = -2; + if (ref_tag.is_part_of_cluster()) + { + ref_c1 = ref_tag.cluster_index(); + ref_c2 = ref_tag.is_shared_between_clusters() ? ref_tag.secondary_cluster_index() : -2; + } + + if (test_tag.is_part_of_cluster()) + { + test_c1 = test_tag.cluster_index(); + test_c2 = test_tag.is_shared_between_clusters() ? test_tag.secondary_cluster_index() : -2; + } + + const int match_1 = test_c1 < 0 ? -2 : sch.t2r(test_c1); + const int match_2 = test_c2 < 0 ? -2 : sch.t2r(test_c2); + + const float ref_rev_weight = float_unhack(ref_tag.secondary_cluster_weight()); + const float test_rev_weight = float_unhack(test_tag.secondary_cluster_weight()); + + const float ref_weight = 1.0f - ref_rev_weight; + const float test_weight = 1.0f - test_rev_weight; + + bool cell_is_diff = false; + + if (( ref_c1 == match_1 && ref_c2 == match_2) || + (ref_c1 == match_2 && ref_c2 == match_1) ) + { + ++same_cluster_cells_count; + } + else + { + ++diff_cluster_cells_count; + cell_is_diff = true; + } + + if (ref_c1 >= 0) + { + ref_size_vec[ref_c1] += 1; + ref_weighted_size_vec[ref_c1] += ref_weight; + ref_diff_cells[ref_c1] += cell_is_diff; + ref_diff_cells_weight[ref_c1] += cell_is_diff * ref_weight; + } + if (ref_c2 >= 0) + { + ref_size_vec[ref_c2] += 1; + ref_weighted_size_vec[ref_c2] += ref_rev_weight; + ref_diff_cells[ref_c2] += cell_is_diff; + ref_diff_cells_weight[ref_c2] += cell_is_diff * ref_rev_weight; + } + + if (test_c1 >= 0) + { + test_size_vec[test_c1] += 1; + test_weighted_size_vec[test_c1] += test_weight; + test_diff_cells[test_c1] += cell_is_diff; + test_diff_cells_weight[test_c1] += cell_is_diff * test_weight; + } + if (test_c2 >= 0) + { + test_size_vec[test_c2] += 1; + test_weighted_size_vec[test_c2] += test_rev_weight; + test_diff_cells[test_c2] += cell_is_diff; + test_diff_cells_weight[test_c2] += cell_is_diff * test_rev_weight; + } + } + } + } + + if (m_doCombinedClusters) + { + + for (int cluster = 0; cluster < clusters_1.number; ++cluster) + { + const int match = sch.r2t(cluster); + if (match < 0) + //The cluster isn't matched. + { + continue; + } + + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_comparedClusterPropertiesToDo[i]) + { + const auto prop_1 = prop.get_property(constant_data, cell_info_1, cell_state_1, clusters_1, moments_1, cluster); + const auto prop_2 = prop.get_property(constant_data, cell_info_2, cell_state_2, clusters_2, moments_2, match); + + cluster_properties[prop.name() + "_ref"].push_back(prop_1); + cluster_properties[prop.name() + "_test"].push_back(prop_2); + + cluster_properties["delta_" + prop.name()].push_back(prop_2 - prop_1); + cluster_properties["delta_" + prop.name() + "_rel_ref"].push_back((prop_2 - prop_1) / protect_from_zero(std::abs(prop_1))); + cluster_properties["delta_" + prop.name() + "_rel_test"].push_back((prop_2 - prop_1) / protect_from_zero(std::abs(prop_2))); + } + }, BasicClusterProperties{}); + + apply_to_multi_class([&](const auto & prop, const size_t i) + { + if (m_extraComparedClusterPropertiesToDo[i]) + { + cluster_properties[prop.name()].push_back(prop.get_property(constant_data, cell_info_1, cell_state_1, clusters_1, moments_1, cluster, + cell_info_2, cell_state_2, clusters_2, moments_2, match)); + } + }, ComparedClusterProperties{}); + + if (m_extraThingsToDo[ClusterComparedSize]) + { + cluster_properties["size_ref"].push_back(ref_size_vec[cluster]); + cluster_properties["size_test"].push_back(test_size_vec[match]); + cluster_properties["delta_size"].push_back(ref_size_vec[cluster] - test_size_vec[match]); + cluster_properties["delta_size_rel_ref"].push_back((ref_size_vec[cluster] - test_size_vec[match]) / protect_from_zero(ref_size_vec[cluster])); + cluster_properties["delta_size_rel_test"].push_back((ref_size_vec[cluster] - test_size_vec[match]) / protect_from_zero(test_size_vec[match])); + + cluster_properties["weighted_size_ref"].push_back(ref_weighted_size_vec[cluster]); + cluster_properties["weighted_size_test"].push_back(test_weighted_size_vec[match]); + cluster_properties["delta_weighted_size"].push_back(ref_weighted_size_vec[cluster] - test_weighted_size_vec[match]); + cluster_properties["delta_weighted_size_rel_ref"].push_back((ref_weighted_size_vec[cluster] - test_weighted_size_vec[match]) / protect_from_zero(ref_weighted_size_vec[cluster])); + cluster_properties["delta_weighted_size_rel_test"].push_back((ref_weighted_size_vec[cluster] - test_weighted_size_vec[match]) / protect_from_zero(test_weighted_size_vec[match])); + } + + if (m_extraThingsToDo[DiffCells]) + { + cluster_properties["diff_cells_ref"].push_back(ref_diff_cells[cluster]); + cluster_properties["diff_cells_ref_rel_size"].push_back(ref_diff_cells[cluster] / protect_from_zero(ref_size_vec[cluster])); + cluster_properties["diff_cells_test"].push_back(test_diff_cells[match]); + cluster_properties["diff_cells_test_rel_size"].push_back(test_diff_cells[match] / protect_from_zero(test_size_vec[match])); + cluster_properties["diff_cells"].push_back(ref_diff_cells[cluster] + test_diff_cells[match]); + + cluster_properties["weighted_diff_cells_ref"].push_back(ref_diff_cells_weight[cluster]); + cluster_properties["weighted_diff_cells_ref_rel_size"].push_back(ref_diff_cells_weight[cluster] / protect_from_zero(ref_weighted_size_vec[cluster])); + cluster_properties["weighted_diff_cells_test"].push_back(test_diff_cells_weight[match]); + cluster_properties["weighted_diff_cells_test_rel_size"].push_back(test_diff_cells_weight[match] / protect_from_zero(test_weighted_size_vec[match])); + cluster_properties["weighted_diff_cells"].push_back(ref_diff_cells_weight[cluster] + test_diff_cells_weight[match]); + } + } + } + + using coll_type = decltype(Monitored::Collection("", std::declval<std::vector<double> &>())); + using scalar_type = decltype(Monitored::Scalar("", std::declval<long long int>())); + + std::vector<coll_type> collections; + std::vector<scalar_type> count_scalars; + std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> cluster_group, cell_group, counts_group; + + collections.reserve(cluster_properties.size() + cell_properties.size()); + count_scalars.reserve(cell_counts.size() + 6 * 3); + cluster_group.reserve(cluster_properties.size()); + cell_group.reserve(cell_properties.size()); + counts_group.reserve(cell_counts.size() + 3 + 6 * 3); + + auto add_count_vars = [&](const std::string & name, const long long int ref_num, const long long int test_num) + { + count_scalars.emplace_back(Monitored::Scalar(prefix + "_" + name + "_ref", ref_num)); + counts_group.push_back(std::ref(count_scalars.back())); + + count_scalars.emplace_back(Monitored::Scalar(prefix + "_" + name + "_test", test_num)); + counts_group.push_back(std::ref(count_scalars.back())); + + count_scalars.emplace_back(Monitored::Scalar(prefix + "_delta_" + name, test_num - ref_num)); + counts_group.push_back(std::ref(count_scalars.back())); + }; + + add_count_vars("num_clusters", clusters_1.number, clusters_2.number); + add_count_vars("num_unmatched_clusters", sch.ref_unmatched(), sch.test_unmatched()); + + add_count_vars("num_same_E_cells", same_energy_1, same_energy_2); + add_count_vars("num_same_abs_E_cells", same_abs_energy_1, same_abs_energy_2); + add_count_vars("num_same_SNR_cells", same_snr_1, same_snr_2); + add_count_vars("num_same_abs_SNR_cells", same_abs_snr_1, same_abs_snr_2); + + auto mon_total_unmatched = Monitored::Scalar(prefix + "_num_unmatched_clusters", sch.ref_unmatched() + sch.test_unmatched()); + auto mon_same_cluster_cell = Monitored::Scalar(prefix + "_same_cluster_cells", same_cluster_cells_count); + auto mon_diff_cluster_cell = Monitored::Scalar(prefix + "_diff_cluster_cells", diff_cluster_cells_count); + + counts_group.push_back(std::ref(mon_total_unmatched)); + counts_group.push_back(std::ref(mon_same_cluster_cell)); + counts_group.push_back(std::ref(mon_diff_cluster_cell)); + + for (const auto & k_v : cluster_properties) + { + collections.emplace_back(Monitored::Collection(prefix + "_cluster_" + k_v.first, k_v.second)); + cluster_group.push_back(std::ref(collections.back())); + } + + for (const auto & k_v : cell_properties) + { + collections.emplace_back(Monitored::Collection(prefix + "_cell_" + k_v.first, k_v.second)); + cell_group.push_back(std::ref(collections.back())); + } + + for (const auto & k_v : cell_counts) + { + count_scalars.emplace_back(Monitored::Scalar(prefix + "_" + k_v.first, k_v.second)); + counts_group.push_back(std::ref(count_scalars.back())); + } + + auto monitor_clusters = Monitored::Group(m_moniTool, cluster_group); + auto monitor_cells = Monitored::Group(m_moniTool, cell_group); + auto monitor_counts = Monitored::Group(m_moniTool, counts_group); + + return StatusCode::SUCCESS; +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitor.h b/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitor.h new file mode 100644 index 0000000000000000000000000000000000000000..277a34a867f0822041bf59d45fab5c928d41f449 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitor.h @@ -0,0 +1,301 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CaloGPUClusterAndCellDataMonitor_H +#define CALORECGPU_CaloGPUClusterAndCellDataMonitor_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUTransformers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/Helpers.h" +#include <string> +#include <vector> +#include <utility> +#include <memory> +#include <mutex> +#include <tuple> + +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" + +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadHandleKey.h" + +#include "CaloGPUClusterAndCellDataMonitorOptions.h" + +class CaloCell_ID; + +/** + * @class CaloGPUClusterAndCellDataMonitor + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 18 March 2023 + * @brief Places (matched) cluster and cell properties in monitored variables + * to enable plotting with the Athena THistSvc instead + * of the custom solution that was being used previously. + * Its histograms can be configured as in a MonitoringTool. + */ + +class CaloGPUClusterAndCellDataMonitor : + public AthAlgTool, virtual public ICaloClusterGPUPlotter +{ + public: + + CaloGPUClusterAndCellDataMonitor(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual ~CaloGPUClusterAndCellDataMonitor(); + + + virtual StatusCode update_plots_start(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr) const override; + + virtual StatusCode update_plots_end(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr) const override; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloClusterCollectionProcessor * tool) const override; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloRecGPU::EventDataHolder & event_data, + const ICaloClusterGPUInputTransformer * tool) const override; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloRecGPU::EventDataHolder & event_data, + const CaloClusterGPUProcessor * tool) const override; + + virtual StatusCode update_plots(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + const CaloRecGPU::EventDataHolder & event_data, + const ICaloClusterGPUOutputTransformer * tool) const override; + + virtual StatusCode finalize_plots() const override; + + private: + + StatusCode initialize_plotted_variables(); + + StatusCode add_data(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> & moments, + const std::string & tool_name) const; + + + StatusCode add_combination(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const int index_1, + const int index_2, + const std::string & prefix, + const bool match_in_energy) const; + + /*! Returns @p true if this tool should be plotted for. + */ + bool filter_tool_by_name(const std::string & tool_name) const; + + StatusCode convert_to_GPU_data_structures(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const xAOD::CaloClusterContainer * cluster_collection_ptr, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> & moments) const; + + ///Remove invalid clusters, reorder by ET and update the tags accordingly. + StatusCode compactify_clusters(const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + const CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellInfoArr> & cell_info, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellStateArr> & cell_state, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterInfoArr> & clusters, + CaloRecGPU::Helpers::CPU_object<CaloRecGPU::ClusterMomentsArr> & moments) const; + + + struct sample_comparisons_holder + { + std::vector<int> r2t_table, t2r_table; + std::vector<int> unmatched_ref_list, unmatched_test_list; + + ///Converts a cluster index from the reference tool (first) to the test tool (second). + ///Returns `-1` in case the cluster has not been matched. + int r2t(const int i) const + { + return r2t_table[i]; + } + ///Converts a cluster index from the test tool (second) to the reference tool (first). + ///Returns `-1` in case the cluster has not been matched. + int t2r(const int i) const + { + return t2r_table[i]; + } + ///Returns the number of unmatched clusters in the reference (first) tool. + int ref_unmatched() const + { + return unmatched_ref_list.size(); + } + ///Returns the number of unmatched clusters in the test (second) tool. + int test_unmatched() const + { + return unmatched_test_list.size(); + } + }; + + StatusCode match_clusters(sample_comparisons_holder & sch, + const CaloRecGPU::ConstantDataHolder & constant_data, + const CaloRecGPU::CellInfoArr & cell_info, + const CaloRecGPU::CellStateArr & cell_state_1, + const CaloRecGPU::CellStateArr & cell_state_2, + const CaloRecGPU::ClusterInfoArr & cluster_info_1, + const CaloRecGPU::ClusterInfoArr & cluster_info_2, + const CaloRecGPU::ClusterMomentsArr & /*moments_1*/, + const CaloRecGPU::ClusterMomentsArr & /*moments_2*/, + const bool match_in_energy) const; + + //-------------------------------------------------- + // + // GENERAL OPTIONS/SETTINGS + // + //-------------------------------------------------- + + /** + * @brief Cell (terminal) threshold to use for cluster matching. + */ + Gaudi::Property<float> m_termThreshold {this, "CellThreshold", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; + + /** + * @brief Neighbor (growing) threshold to use for cluster matching. + */ + Gaudi::Property<float> m_growThreshold {this, "NeighborThreshold", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; + + /** + * @brief Seed threshold to use for cluster matching. + */ + Gaudi::Property<float> m_seedThreshold {this, "SeedThreshold", 4., "Seed threshold (in units of noise Sigma)"}; + + /** + * @brief vector of names of the cell containers to use as input. + */ + Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; + + /** @brief Monitoring tool. + */ + ToolHandle< GenericMonitoringTool > m_moniTool { this, "MonitoringTool", "", "Monitoring tool" }; + + //-------------------------------------------------- + // + // PLOT OPTIONS + // + //-------------------------------------------------- + + /** @brief Tools to plot individually. + + @warning If a tool appears more than once with different identifiers, the last one is used. + */ + Gaudi::Property<std::vector<SimpleSingleTool>> m_toolsToPlot + {this, "ToolsToPlot", {}, "Tools to be plotted individually"}; + + /** @brief Pairs of tools to compare. + */ + Gaudi::Property< std::vector<SimpleToolPair> > m_pairsToPlot + {this, "PairsToPlot", {}, "Pairs of tools to be compared and plotted"}; + + /** @brief Option for adjusting the parameters for the cluster matching algorithm. + */ + Gaudi::Property<MatchingOptions> m_matchingOptions + {this, "ClusterMatchingParameters", {}, "Parameters for the cluster matching algorithm"}; + + //-------------------------------------------------- + // + // OTHER MEMBER VARIABLES + // + //-------------------------------------------------- + + /** + * @brief Parameters for the cluster matching algorithm, for easier access. + */ + double m_min_similarity = 0.5, m_seed_weight = 5000., m_grow_weight = 250., m_terminal_weight = 10.; + + /** + * @brief Pointer to Calo ID Helper + */ + const CaloCell_ID * m_calo_id {nullptr}; + + /** @brief Map of the strings corresponding to all the tools + that will be relevant for plotting (individually or in comparisons) + to the index that will be used to identify the tool within the plotter. + (Indices of -1 signal tools that are only plotted individually, + no need to keep them.) + */ + std::map<std::string, int> m_toolsToCheckFor; + + ///@brief Maps tools to their respective identifying prefix for variables. + std::map<std::string, std::string> m_toolToIdMap; + + ///@brief The number of tools that will actually need to be kept in memory for combined plotting. + int m_numToolsToKeep = 0; + + struct pair_to_plot + { + int index_ref = -1, index_test = -1; + std::string prefix; + bool match_in_energy = false; + }; + + std::vector<pair_to_plot> m_toolCombinations; + + ///@brief Counts the total number of clusters per tool. + mutable std::map<std::string, std::atomic<size_t>> m_numClustersPerTool ATLAS_THREAD_SAFE; + + ///@brief Counts the number of events. + size_t m_numEvents = 0; + + struct per_tool_storage + { + CaloRecGPU::CellInfoArr cell_info; + CaloRecGPU::CellStateArr cell_state; + CaloRecGPU::ClusterInfoArr clusters; + CaloRecGPU::ClusterMomentsArr moments; + }; + + /** @brief Stores the intermediate results needed for tool-level matching. + */ + mutable CaloRecGPU::Helpers::separate_thread_holder<std::vector<per_tool_storage>> m_storageHolder ATLAS_THREAD_SAFE; + + /** @brief Control which properties will actually be calculated and stored. + In principle, should be automagically filled based on the booked histograms. + */ + std::vector<bool> m_clusterPropertiesToDo, m_comparedClusterPropertiesToDo, + m_extraComparedClusterPropertiesToDo, m_cellPropertiesToDo, + m_comparedCellPropertiesToDo, m_cellTypesToDo, + m_comparedCellTypesToDo, m_extraThingsToDo; + + /** @brief If no properties are asked for, skip the relevant loops entirely... + */ + bool m_doCells = false, m_doClusters = false, m_doCombinedCells = false, m_doCombinedClusters = false; + + + /** @brief A flag to signal that the variables to be monitored have been detected + based on the booked histograms. + */ + mutable std::atomic<bool> m_plottedVariablesInitialized; + + + /** @brief This mutex is locked to ensure only one thread detects the monotired variables.. + */ + mutable std::mutex m_mutex; + +}; + +#endif //CALORECGPU_CaloGPUClusterAndCellDataMonitor_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitorOptions.h b/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitorOptions.h new file mode 100644 index 0000000000000000000000000000000000000000..d7b8aca188e03c9ec8ba532b1c9ba682e9af3170 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/CaloGPUClusterAndCellDataMonitorOptions.h @@ -0,0 +1,392 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOGPUCLUSTERANDCELLDATAMONITOROPTIONS_H +#define CALORECGPU_CALOGPUCLUSTERANDCELLDATAMONITOROPTIONS_H + +//This sets up some classes to be usable as options within Gaudi (and thus Athena), +//so that we can more ergonomically specify our plotter's options. +// +//For reference, see Gaudi/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp + + +#include <tuple> +#include <iostream> +#include <string> +#include <type_traits> + + + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "GaudiKernel/StatusCode.h" + +#include <Gaudi/Parsers/Factory.h> + +namespace Gaudi +{ + namespace Parsers + { + template <typename Iterator, typename Skipper, class Enable> + struct Grammar_<Iterator, SG::ReadHandleKey<CaloCellContainer>, Skipper, Enable> + { + using Grammar = typename Grammar_<Iterator, std::string, Skipper, Enable>::Grammar; + }; + } +} +//Suppress the warning that comes up from simply including Factory.h. + +//First, generic handling of tuples. +//This does set us up for handling more than we strictly need, +//but since this is only a local include +//and shouldn't bleed over to other parts of the code, +//we'll behave and (hopefully) not do anything too crazy. + + +//Since we're at C++17 level, +//we'll use SFINAE and enable_if +//to provide the *actual* parse and grammar and output +//that are necessary for custom types for Gaudi options. +//In C++20, of course we could use concepts +//for a more elegant implementation... + +namespace impl +{ + template <class Check> struct class_can_be_tuple + { + template<class T> inline static constexpr + auto tuple_type_checker(T *) -> decltype(typename T::TupleType {}); + template<class T> inline static constexpr + void tuple_type_checker(...); + template <class T> using tuple_type_checker_type = decltype( tuple_type_checker<T>(nullptr) ); + template <class T> inline static constexpr + bool tuple_type_exists = !std::is_same_v<tuple_type_checker_type<T>, void>; + + template<class T> inline static constexpr + auto to_tuple_checker(T *) -> decltype(&T::to_tuple); + template<class T> inline static constexpr + void to_tuple_checker(...); + template <class T> inline static constexpr + bool to_tuple_exists = std::is_pointer_v<decltype( to_tuple_checker<T>(nullptr) )>; + + template<class T> inline static constexpr + auto from_tuple_checker(T *) -> decltype(&T::from_tuple); + template<class T> inline static constexpr + void from_tuple_checker(...); + template <class T> inline static constexpr + bool from_tuple_exists = std::is_pointer_v<decltype( from_tuple_checker<T>(nullptr) )>; + + template<class T> inline static constexpr + auto tuple_size_checker(T *) -> decltype(T::TupleSize); + template<class T> inline static constexpr + void tuple_size_checker(...); + template <class T> inline static constexpr + bool tuple_size_exists = !std::is_void_v<decltype(tuple_size_checker<T>(nullptr))>; + + inline constexpr static bool value = tuple_type_exists<Check> && to_tuple_exists<Check> && from_tuple_exists<Check> && tuple_size_exists<Check>; + }; + + template <class T> + inline static constexpr bool class_can_be_tuple_v = class_can_be_tuple<T>::value; + + template <class T> + void tuple_safe_copy(T & dest, const T & source) + { + dest = source; + } +} + +//We use our macros to write a relatively limited form of variadic structured bindings +//for the tuple <-> struct conversions. + +#include "MacroHelpers.h" + +#define CALORECGPU_VARSB_APPENDER(THIS, PREFIX, IGNORE) , CRGPU_CONCAT(PREFIX, THIS) +#define CALORECGPU_VARSB_ASSIGNER(THIS, IGNORE1, IGNORE2) tuple_safe_copy(CRGPU_CONCAT(b, THIS), CRGPU_CONCAT(a, THIS)); + +#define CALORECGPU_VARSB_ENCAPSULATOR_A(...) CRGPU_MACRO_EXPANSION(CALORECGPU_VARSB_APPENDER, a, __VA_ARGS__ ) +#define CALORECGPU_VARSB_ENCAPSULATOR_B(...) CRGPU_MACRO_EXPANSION(CALORECGPU_VARSB_APPENDER, b, __VA_ARGS__ ) + +#define CALORECGPU_VARSB_ENCAPSULATOR_ASSIGN(...) CRGPU_MACRO_EXPANSION(CALORECGPU_VARSB_ASSIGNER, _ , __VA_ARGS__, ) + + +#define CALORECGPU_VARSB_EXPANDER(THIS_NUM, IGNORE, SMALLER_NUMS) \ + template <> struct struct_tuple_conversion<THIS_NUM> \ + { \ + template <class T, class TupleT> \ + static void s2t(const T & t, TupleT & tup) \ + { \ + const auto & [CRGPU_CONCAT(a, THIS_NUM) CALORECGPU_VARSB_ENCAPSULATOR_A SMALLER_NUMS] = t; \ + auto & [CRGPU_CONCAT(b, THIS_NUM) CALORECGPU_VARSB_ENCAPSULATOR_B SMALLER_NUMS] = tup; \ + tuple_safe_copy(CRGPU_CONCAT(b, THIS_NUM), CRGPU_CONCAT(a, THIS_NUM)); \ + CALORECGPU_VARSB_ENCAPSULATOR_ASSIGN SMALLER_NUMS \ + } \ + template <class TupleT, class T> \ + static void t2s(const TupleT & tup, T & t) \ + { \ + const auto & [CRGPU_CONCAT(a, THIS_NUM) CALORECGPU_VARSB_ENCAPSULATOR_A SMALLER_NUMS] = tup; \ + auto & [CRGPU_CONCAT(b, THIS_NUM) CALORECGPU_VARSB_ENCAPSULATOR_B SMALLER_NUMS] = t; \ + tuple_safe_copy(CRGPU_CONCAT(b, THIS_NUM), CRGPU_CONCAT(a, THIS_NUM)); \ + CALORECGPU_VARSB_ENCAPSULATOR_ASSIGN SMALLER_NUMS \ + } \ + }; \ + +//If only there were truly variadic structured bindings... + +namespace impl +{ + + template <size_t n> struct struct_tuple_conversion + { + template <class T, class TupleT> + static void s2t(const T &, TupleT &) { } + template <class T, class TupleT> + static T t2s(const TupleT &, T &) { } + }; + + CRGPU_RECURSIVE_MACRO(CRGPU_MACRO_EXPANSION(CALORECGPU_VARSB_EXPANDER, _, 9, 8, 7, 6, 5, 4, 3, 2, 1)) + //If we needed structs with more than 9 elements, just add more numbers to the left in descending order... + + template <class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + void tuple_safe_copy(T & s, const typename T::TupleType & tuple) + { + struct_tuple_conversion<T::TupleSize>::t2s(tuple, s); + } + + template <class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + void tuple_safe_copy(typename T::TupleType & tuple, const T & s) + { + struct_tuple_conversion<T::TupleSize>::s2t(s, tuple); + } + + template <class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + void tuple_safe_copy(std::vector<typename T::TupleType> & t_v, const std::vector<T> & s_v) + { + t_v.resize(s_v.size()); + for (size_t i = 0; i < s_v.size(); ++i) + { + tuple_safe_copy(t_v[i], s_v[i]); + } + } + + template <class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + void tuple_safe_copy(std::vector<T> & s_v, const std::vector<typename T::TupleType> & t_v) + { + s_v.resize(t_v.size()); + for (size_t i = 0; i < t_v.size(); ++i) + { + tuple_safe_copy(s_v[i], t_v[i]); + } + } + + + template <class T> + auto to_tuple_type_helper(const T &) + { + return T{}; + } + /* + template <class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + auto to_tuple_type_helper(const T&) + { + return typename T::TupleType{}; + } + */ + template <class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + auto to_tuple_type_helper(const std::vector<T> &) + { + return std::vector<typename T::TupleType> {}; + } + + /* + template <class ... Elems> + auto to_tuple_type_helper(const std::tuple<Elems...> &) + { + return std::tuple<decltype(to_tuple_type_helper(std::declval<Elems>))...>{}; + } + */ + //More specializations if needed? + + + template <class T> + using to_tuple_type = decltype(to_tuple_type_helper(std::declval<T>())); + + template <class T, class ... Elems> struct simple_tuple_conversion + { + using TupleType = std::tuple<to_tuple_type<Elems>...>; + + inline static constexpr size_t TupleSize = sizeof...(Elems); + + static TupleType to_tuple (const T & s) + { + TupleType ret; + struct_tuple_conversion<TupleSize>::s2t(s, ret); + return ret; + } + static T from_tuple(const TupleType & tup) + { + T ret; + struct_tuple_conversion<TupleSize>::t2s(tup, ret); + return ret; + } + /* + friend + std::ostream & operator<< (std::ostream & s, const T & t) + { + return s << to_tuple(t); + } + */ + }; + + //If we had reflection, this would be so much easier... + + template <class Stream, class T> + void output_helper(Stream & s, const T & t, const std::string & after) + { + Gaudi::Utils::toStream(t, s); + s << after; + } + + template <class Stream, class T> + void output_helper(Stream & s, const std::vector<T> & v, const std::string & after) + { + s << "["; + for (size_t i = 0; i < v.size(); ++i) + { + if (i > 0) + { + s << ", "; + } + impl::output_helper(s, v[i], ""); + } + s << "]" << after; + } + /* + template <class Stream, class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> + void output_helper(Stream & s, const T & t, const std::string & after) + { + s << t << after; + } + */ +} + +namespace Gaudi +{ + namespace Parsers + { + + template <typename Iterator, typename Skipper, class T> + struct Grammar_< Iterator, T, Skipper, typename std::enable_if_t < impl::class_can_be_tuple_v<T> > > + { + using Grammar = typename Grammar_<Iterator, typename T::TupleType, Skipper>::Grammar; + }; + + template <class ... Tup> + StatusCode parse(std::tuple<Tup...> & tup, const Gaudi::Parsers::InputData & input) + { + return parse_(tup, input); + } + + template <class T> + StatusCode parse(std::vector<T> & v, const Gaudi::Parsers::InputData & input) + { + return parse_(v, input); + } + + } +} + +template <class ... Tup> +std::ostream & operator<<(std::ostream & s, const std::tuple<Tup...> & tup ) +{ + std::apply( [&] (const Tup & ... arg) + { + s << "("; + + size_t num = 0; + + (void) ( (void) impl::output_helper(s, arg, (++num < sizeof...(Tup) ? ", " : "")), ... ); + + s << ")"; + + }, tup ); + + return s; +} + +template < class T, + std::enable_if_t< impl::class_can_be_tuple_v<T>>* = nullptr> +std::ostream & operator<<(std::ostream & s, const T & t ) +{ + return s << T::to_tuple(t); +} + +//And now for the classes proper. +// +//In general: +// +//struct ClassName: impl::simple_tuple_conversion<ClassName, T1, T2, ... , TN> +//{ +// T1 name1; +// T2 name2; +// ... +// TN nameN; +// +// ClassName() = default; +// ClassName(const TupleType & t) +// { +// (*this) = from_tuple(t); +// } +//}; +// +//One could use the helper macro below. +// +//If there are mismatches in the types on the simple_tuple_conversion list, +//ugly compilation issues may ensue! + +#define CALORECGPU_OPTIONCLASS_CONSTRUCTORS(CLASSNAME) \ + CLASSNAME() = default; \ + CLASSNAME(const TupleType & t) \ + { \ + (*this) = from_tuple(t); \ + } \ + +struct MatchingOptions: + impl::simple_tuple_conversion<MatchingOptions, double, double, double, double> +{ + double min_similarity = 0.50, term_w = 250., grow_w = 500., seed_w = 1000.; + + CALORECGPU_OPTIONCLASS_CONSTRUCTORS(MatchingOptions) +}; + +struct SimpleSingleTool: + impl::simple_tuple_conversion<SimpleSingleTool, std::string, std::string> +{ + std::string tool, plot_id; + + CALORECGPU_OPTIONCLASS_CONSTRUCTORS(SimpleSingleTool) +}; + +struct SimpleToolPair: + impl::simple_tuple_conversion<SimpleToolPair, std::string, std::string, std::string, bool> +{ + std::string tool_ref, tool_test, plot_id; + bool match_in_energy = false; + + CALORECGPU_OPTIONCLASS_CONSTRUCTORS(SimpleToolPair) +}; + +//This was used more heavily when we had the standalone plotter, +//but I would like to keep it here in case more changes are necessary... + +#endif //CALORECGPU_CALOGPUCLUSTERANDCELLDATAMONITOROPTIONS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.cxx b/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.cxx index 9aae6ffe429c49aa22f202e6127a20c1bd1c7dd7..85ec72894eea2aea0c89717eef599654a7de022b 100644 --- a/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.cxx @@ -1,298 +1,471 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloGPUHybridClusterProcessor.h" - -#include "AthenaKernel/errorcheck.h" - -#include <algorithm> - -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "CaloEvent/CaloClusterCellLinkContainer.h" -#include "CaloUtils/CaloClusterStoreHelper.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -using namespace CaloRecGPU; - -CaloGPUHybridClusterProcessor::CaloGPUHybridClusterProcessor(const std::string & name, ISvcLocator * pSvcLocator): - AthReentrantAlgorithm(name, pSvcLocator), - CaloGPUTimed(this), - m_transformConstantData(this), - m_preGPUoperations(this), - m_transformForGPU(this), - m_GPUoperations(this), - m_transformBackToCPU(this), - m_postGPUoperations(this), - m_clusterOutput(""), - m_clusterCellLinkOutput(""), - m_constantDataSent(false) -{ - //Tool for transforming the constant data and sending it to the GPU (before the run starts) - //(a CaloClusterGPUConstantTransformer tool) - declareProperty("ConstantDataToGPUTool", m_transformConstantData, "Tool for transforming the constant data and sending it to the GPU"); - - //Operations to be done on CPU before processing stuff on the GPU - //(array of CaloClusterCollectionProcessor tools) - declareProperty("BeforeGPUTools", m_preGPUoperations, "Tools to be applied to the clusters on the CPU before processing them on the GPU"); - - //Tool for transforming the event data and sending it to the GPU - //(a CaloClusterGPUInputTransformer tool) - declareProperty("EventDataToGPUTool", m_transformForGPU, "Tool for transforming the event data and sending it to the GPU"); - - //Operations to be done on the GPU - //(array of CaloClusterGPUProcessor tools) - declareProperty("GPUTools", m_GPUoperations, "Tools to be applied to the clusters on the GPU"); - - //Tool for getting the data from the GPU back to the CPU - //(a CaloClusterGPUOutputTransformer tool) - declareProperty("GPUToEventDataTool", m_transformBackToCPU, "Tool for getting the data from the GPU back to the CPU Athena datastructures"); - - //Operations to be done on CPU after having processed stuff on the GPU - //(array of CaloClusterCollectionProcessor tools) - declareProperty("AfterGPUTools", m_postGPUoperations, "Tools to be applied to the clusters on the CPU after returning from the GPU"); - - // Name of Cluster Container to be registered in TDS - declareProperty("ClustersOutputName", m_clusterOutput, "The name of the key in StoreGate for the output CaloClusterContainer"); - declareProperty("ClusterCellLinkOutputName", m_clusterCellLinkOutput, "The name of the key in StoreGate for the output CaloClusterCellLinkContainer"); -} - -CaloGPUHybridClusterProcessor::~CaloGPUHybridClusterProcessor() -{ - //Nothing! -} - - -StatusCode CaloGPUHybridClusterProcessor::initialize() -{ - - ATH_CHECK( m_clusterOutput.initialize() ); - - if (m_clusterCellLinkOutput.key().empty()) - { - m_clusterCellLinkOutput = m_clusterOutput.key() + "_links"; - } - ATH_CHECK( m_clusterCellLinkOutput.initialize() ); - - - bool any_failed = false; - - auto retrieve_and_report = [&](auto & var, const auto & type) - { - if (var.retrieve().isFailure()) - { - ATH_MSG_ERROR("Failed to retrieve " << type << ": " << var); - any_failed = true; - } - else - { - ATH_MSG_DEBUG("Successfully retrieved " << type << ": " << var); - } - }; - //A generic lambda to prevent code repetition. - - retrieve_and_report(m_transformConstantData, "constant data to GPU transformer"); - retrieve_and_report(m_preGPUoperations, "pre-GPU operations"); - retrieve_and_report(m_transformForGPU, "event data to GPU transformer"); - retrieve_and_report(m_GPUoperations, "GPU operations"); - retrieve_and_report(m_transformBackToCPU, "GPU to Athena transformer"); - retrieve_and_report(m_postGPUoperations, "post-GPU operations"); - - if (any_failed) - { - return StatusCode::FAILURE; - } - - if (!m_deferConstantDataToFirstEvent) - { - ATH_CHECK( m_transformConstantData->initialize() ); - //Not sure if this is needed or the tool will get initialized by this point. - - ATH_CHECK( m_transformConstantData->convert(m_constantData) ); - m_constantDataSent = true; - } - - - if (size_t(m_numPreAllocatedGPUData) > 0) - { - ATH_MSG_DEBUG("Pre-allocating event data for " << size_t(m_numPreAllocatedGPUData) << " events."); - - m_eventDataThreadedHolder.resize(m_numPreAllocatedGPUData); - //This will allocate the object holders. - - m_eventDataThreadedHolder.operate_on_all( [&](EventDataHolder & edh) - { - edh.allocate(true); - } - ); - //This will allocate all the memory at this point. - //Also useful to prevent/debug potential allocation issues? - //But the main point is really reducing the execute times... - } - - return StatusCode::SUCCESS; -} - - -StatusCode CaloGPUHybridClusterProcessor::execute(const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection_ptr) const -{ - if (m_deferConstantDataToFirstEvent){ - if (!m_constantDataSent.load()){ - std::lock_guard<std::mutex> lock_guard(m_mutex); - if(!m_constantDataSent.load()){ - ConstantDataHolder * cdh_ptr ATLAS_THREAD_SAFE = &m_constantData; - ATH_CHECK( m_transformConstantData->convert(ctx, *cdh_ptr) ); - m_constantDataSent.store(true); - } - } - } - - EventDataHolder * event_data_ptr = nullptr; - - Helpers::separate_thread_accessor<EventDataHolder> sep_th_acc(m_eventDataThreadedHolder, event_data_ptr); - //This is a RAII wrapper to access an object held by Helpers::separate_thread_holder, - //to ensure the event data is appropriately released when we are done processing. - - if (event_data_ptr == nullptr) - { - ATH_MSG_ERROR("Could not get valid Event Data Holder! Event: " << ctx.evt() ); - return StatusCode::FAILURE; - } - - const ConstantDataHolder & constant_data_holder ATLAS_THREAD_SAFE = m_constantData; - //Just to shut up the checker. We know what we are doing... - - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - std::vector<size_t> times; - - if (m_measureTimes) - { - const size_t time_size = m_preGPUoperations.size() + m_GPUoperations.size() + m_postGPUoperations.size() + 2; - times.reserve(time_size); - } - - for (auto & pre_GPU_tool : m_preGPUoperations) - { - auto t1 = clock_type::now(); - ATH_CHECK( pre_GPU_tool->execute(ctx, cluster_collection_ptr) ); - auto t2 = clock_type::now(); - if (m_measureTimes) - { - times.push_back(time_cast(t1, t2)); - } - } - - auto t3 = clock_type::now(); - ATH_CHECK( m_transformForGPU->convert(ctx, constant_data_holder, cluster_collection_ptr, *event_data_ptr) ); - auto t4 = clock_type::now(); - if (m_measureTimes) - { - times.push_back(time_cast(t3, t4)); - } - - for (auto & GPU_tool : m_GPUoperations) - { - auto t5 = clock_type::now(); - ATH_CHECK( GPU_tool->execute(ctx, constant_data_holder, *event_data_ptr) ); - auto t6 = clock_type::now(); - if (m_measureTimes) - { - times.push_back(time_cast(t5, t6)); - } - } - - auto t7 = clock_type::now(); - ATH_CHECK( m_transformBackToCPU->convert(ctx, constant_data_holder, *event_data_ptr, cluster_collection_ptr) ); - auto t8 = clock_type::now(); - if (m_measureTimes) - { - times.push_back(time_cast(t7, t8)); - } - - - for (auto & post_GPU_tool : m_postGPUoperations) - { - auto t9 = clock_type::now(); - ATH_CHECK( post_GPU_tool->execute(ctx, cluster_collection_ptr) ); - auto t10 = clock_type::now(); - if (m_measureTimes) - { - times.push_back(time_cast(t9, t10)); - } - } - - if (m_measureTimes) - { - record_times(ctx.evt(), times); - } - - return StatusCode::SUCCESS; -} - -StatusCode CaloGPUHybridClusterProcessor::execute(const EventContext & ctx) const -{ - SG::WriteHandle<xAOD::CaloClusterContainer> cluster_collection (m_clusterOutput, ctx); - - ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(cluster_collection)); - //ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(&(*evtStore()), cluster_collection, msg())); - - const StatusCode exec_return = this->execute(ctx, cluster_collection.ptr()); - - if (exec_return != StatusCode::SUCCESS) - { - return exec_return; - } - - ATH_MSG_DEBUG("Created cluster container with " << cluster_collection->size() << " clusters"); - - SG::WriteHandle<CaloClusterCellLinkContainer> cell_links(m_clusterCellLinkOutput, ctx); - - ATH_CHECK( CaloClusterStoreHelper::finalizeClusters(cell_links, cluster_collection.ptr()) ); - - return StatusCode::SUCCESS; - -} - -StatusCode CaloGPUHybridClusterProcessor::finalize() -{ - if (m_measureTimes) - { - std::string header_string; - - auto add_name_to_string = [&](const auto & obj) - { - std::string rep = obj->name(); - std::replace(rep.begin(), rep.end(), ' ', '_'); - header_string += rep + " "; - }; - - for (auto & pre_GPU_tool : m_preGPUoperations) - { - add_name_to_string(pre_GPU_tool); - } - - add_name_to_string(m_transformForGPU); - - for (auto & GPU_tool : m_GPUoperations) - { - add_name_to_string(GPU_tool); - } - - add_name_to_string(m_transformBackToCPU); - - for (auto & post_GPU_tool : m_postGPUoperations) - { - add_name_to_string(post_GPU_tool); - } - - print_times(header_string, m_preGPUoperations.size() + m_GPUoperations.size() + m_postGPUoperations.size() + 2); - } - return StatusCode::SUCCESS; -} \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloGPUHybridClusterProcessor.h" + +#include "AthenaKernel/errorcheck.h" + +#include "AthenaMonitoringKernel/Monitored.h" + +#include <algorithm> + +//We'll use a quick and dirty helper with placement new... +#include <new> + +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "CaloEvent/CaloClusterCellLinkContainer.h" +#include "CaloUtils/CaloClusterStoreHelper.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +using namespace CaloRecGPU; + +CaloGPUHybridClusterProcessor::CaloGPUHybridClusterProcessor(const std::string & name, ISvcLocator * pSvcLocator): + AthReentrantAlgorithm(name, pSvcLocator), + CaloGPUTimed(this), + m_temporariesSize(0), + m_constantDataSent(false), + m_preConvert(true), + m_postConvert(true) +{ + +} + +CaloGPUHybridClusterProcessor::~CaloGPUHybridClusterProcessor() +{ + //Nothing! +} + + +StatusCode CaloGPUHybridClusterProcessor::initialize() +{ + + ATH_CHECK( m_clusterOutput.initialize() ); + + if (m_clusterCellLinkOutput.key().empty()) + { + m_clusterCellLinkOutput = m_clusterOutput.key() + "_links"; + } + ATH_CHECK( m_clusterCellLinkOutput.initialize() ); + + + bool any_failed = false; + + auto retrieve_and_report = [&](auto & var, const auto & type, bool & falsify_if_empty) + { + if (var.empty()) + { + falsify_if_empty = false; + ATH_MSG_DEBUG("There is nothing to retrieve for " << type << "."); + } + else if (var.retrieve().isFailure()) + { + ATH_MSG_ERROR("Failed to retrieve " << type << ": " << var); + any_failed = true; + } + else + { + ATH_MSG_DEBUG("Successfully retrieved " << type << ": " << var); + } + }; + //A generic lambda to prevent code repetition. + + + bool checker = true; + retrieve_and_report(m_transformConstantData, "constant data to GPU transformer", checker); + if (!checker) + { + ATH_MSG_ERROR("No constant data transformer, error!"); + any_failed = true; + } + retrieve_and_report(m_preGPUoperations, "pre-GPU operations", checker); + retrieve_and_report(m_transformForGPU, "event data to GPU transformer", m_preConvert); + retrieve_and_report(m_GPUoperations, "GPU operations", checker); + retrieve_and_report(m_transformBackToCPU, "GPU to Athena transformer", m_postConvert); + retrieve_and_report(m_postGPUoperations, "post-GPU operations", checker); + + if (m_doPlots) + { + retrieve_and_report(m_plotterTool, "plotter tool", checker); + } + + if (m_doMonitoring) + { + retrieve_and_report(m_moniTool, "monitoring tool", checker); + } + + if (any_failed) + { + return StatusCode::FAILURE; + } + + ATH_CHECK( m_avgMuKey.initialize() ); + + if (!m_deferConstantDataToFirstEvent) + { + ATH_CHECK( m_transformConstantData->initialize() ); + //Not sure if this is needed or the tool will get initialized by this point. + + ATH_CHECK( m_transformConstantData->convert(m_constantData, m_doPlots) ); + m_constantDataSent = true; + } + + m_temporariesSize = 0; + + for (const auto & tool : m_GPUoperations) + { + m_temporariesSize = std::max(m_temporariesSize, tool->size_of_temporaries()); + } + + if (size_t(m_numPreAllocatedGPUData) > 0) + { + ATH_MSG_DEBUG("Pre-allocating event data and temporary buffer for " << size_t(m_numPreAllocatedGPUData) << " parellel events."); + + m_eventDataThreadedHolder.resize(m_numPreAllocatedGPUData); + m_temporariesThreadedHolder.resize(m_numPreAllocatedGPUData); + //This will allocate the object holders. + + m_eventDataThreadedHolder.operate_on_all( [&](EventDataHolder & edh) + { + edh.allocate(true); + } + ); + m_temporariesThreadedHolder.operate_on_all( [&](simple_GPU_pointer_holder & ph) + { + ph.allocate(m_temporariesSize); + } + ); + //This will allocate all the memory at this point. + //Also useful to prevent/debug potential allocation issues? + //But the main point is really reducing the execute times... + } + + return StatusCode::SUCCESS; +} + + +StatusCode CaloGPUHybridClusterProcessor::execute(const EventContext & ctx) const +{ + SG::WriteHandle<xAOD::CaloClusterContainer> cluster_collection (m_clusterOutput, ctx); + + ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(cluster_collection)); + //ATH_CHECK(CaloClusterStoreHelper::AddContainerWriteHandle(&(*evtStore()), cluster_collection, msg())); + + xAOD::CaloClusterContainer * cluster_collection_ptr = cluster_collection.ptr(); + + if (m_deferConstantDataToFirstEvent && !m_constantDataSent.load()) + { + std::lock_guard<std::mutex> lock_guard(m_mutex); + if (!m_constantDataSent.load()) + { + ConstantDataHolder * cdh_ptr ATLAS_THREAD_SAFE = &m_constantData; + ATH_CHECK( m_transformConstantData->convert(ctx, *cdh_ptr, m_doPlots) ); + m_constantDataSent.store(true); + } + } + + EventDataHolder * event_data_ptr = nullptr; + + Helpers::separate_thread_accessor<EventDataHolder> sep_th_acc_1(m_eventDataThreadedHolder, event_data_ptr); + //This is a RAII wrapper to access an object held by Helpers::separate_thread_holder, + //to ensure the event data is appropriately released when we are done processing. + + if (event_data_ptr == nullptr && (m_preConvert || m_postConvert || m_GPUoperations.size())) + { + ATH_MSG_ERROR("Could not get valid Event Data Holder! Event: " << ctx.evt() ); + return StatusCode::FAILURE; + } + + + simple_GPU_pointer_holder * temporaries_data_ptr_holder = nullptr; + + Helpers::separate_thread_accessor<simple_GPU_pointer_holder> sep_th_acc_2(m_temporariesThreadedHolder, temporaries_data_ptr_holder); + if (not temporaries_data_ptr_holder){ + ATH_MSG_ERROR("temporaries_data_ptr_holder is null in CaloGPUHybridClusterProcessor::execute" ); + return StatusCode::FAILURE; + } + temporaries_data_ptr_holder->allocate(m_temporariesSize); + //This will not perform any allocations if they've already been done. + + if ((temporaries_data_ptr_holder->get_pointer() == nullptr) && + (m_preConvert || m_postConvert || m_GPUoperations.size()) ) + { + ATH_MSG_ERROR("Could not get valid temporary buffer holder! Event: " << ctx.evt() ); + return StatusCode::FAILURE; + } + + const ConstantDataHolder & constant_data_holder ATLAS_THREAD_SAFE = m_constantData; + //Just to shut up the checker. We know what we are doing... + + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + std::vector<size_t> times; + + size_t plot_time = 0; + + if (m_measureTimes) + { + const size_t time_size = m_preGPUoperations.size() + m_GPUoperations.size() + m_postGPUoperations.size() + m_doPlots + m_preConvert + m_postConvert; + //+2 for the conversions + //+1 for the plotter (only added at the end) + times.reserve(time_size); + } + + if (m_doPlots) + { + auto t1 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots_start(ctx, constant_data_holder, cluster_collection_ptr) ); + auto t2 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t1, t2); + } + } + + + for (const auto & pre_GPU_tool : m_preGPUoperations) + { + auto t1 = clock_type::now(); + ATH_CHECK( pre_GPU_tool->execute(ctx, cluster_collection_ptr) ); + auto t2 = clock_type::now(); + if (m_measureTimes) + { + times.push_back(time_cast(t1, t2)); + } + if (m_doPlots) + { + auto t3 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, pre_GPU_tool.get()) ); + auto t4 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t3, t4); + } + } + } + + if (m_preConvert) + { + auto t3 = clock_type::now(); + ATH_CHECK( m_transformForGPU->convert(ctx, constant_data_holder, cluster_collection_ptr, *event_data_ptr) ); + auto t4 = clock_type::now(); + if (m_measureTimes) + { + times.push_back(time_cast(t3, t4)); + } + } + + if (m_doPlots) + { + auto t1 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, *event_data_ptr, m_transformForGPU.get()) ); + auto t2 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t1, t2); + } + } + + for (const auto & GPU_tool : m_GPUoperations) + { + auto t5 = clock_type::now(); + ATH_CHECK( GPU_tool->execute(ctx, constant_data_holder, *event_data_ptr, temporaries_data_ptr_holder->get_pointer()) ); + auto t6 = clock_type::now(); + if (m_measureTimes) + { + times.push_back(time_cast(t5, t6)); + } + if (m_doPlots) + { + auto t3 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, *event_data_ptr, GPU_tool.get()) ); + auto t4 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t3, t4); + } + } + } + + if (m_postConvert) + { + auto t7 = clock_type::now(); + ATH_CHECK( m_transformBackToCPU->convert(ctx, constant_data_holder, *event_data_ptr, cluster_collection_ptr) ); + auto t8 = clock_type::now(); + if (m_measureTimes) + { + times.push_back(time_cast(t7, t8)); + } + } + + if (m_doPlots) + { + auto t1 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, *event_data_ptr, m_transformBackToCPU.get()) ); + auto t2 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t1, t2); + } + } + + for (const auto & post_GPU_tool : m_postGPUoperations) + { + auto t9 = clock_type::now(); + ATH_CHECK( post_GPU_tool->execute(ctx, cluster_collection_ptr) ); + auto t10 = clock_type::now(); + if (m_measureTimes) + { + times.push_back(time_cast(t9, t10)); + } + if (m_doPlots) + { + auto t3 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots(ctx, constant_data_holder, cluster_collection_ptr, post_GPU_tool.get()) ); + auto t4 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t3, t4); + } + } + } + + if (m_doPlots) + { + auto t1 = clock_type::now(); + ATH_CHECK( m_plotterTool->update_plots_end(ctx, constant_data_holder, cluster_collection_ptr) ); + auto t2 = clock_type::now(); + if (m_measureTimes) + { + plot_time += time_cast(t1, t2); + } + } + + + + if (m_doMonitoring) + //For monitoring. + //Taken from TrigCaloClusterMaker from TrigCaloRec. + { + auto mon_container_size = Monitored::Scalar( "container_size", 0. ); + auto mon_clusEt = Monitored::Collection( "Et", *cluster_collection_ptr, &xAOD::CaloCluster::et ); + auto mon_clusSignalState = Monitored::Collection( "signalState", *cluster_collection_ptr, &xAOD::CaloCluster::signalState ); + auto mon_clusSize = Monitored::Collection( "clusterSize", *cluster_collection_ptr, &xAOD::CaloCluster::clusterSize ); + std::vector<double> clus_phi; + std::vector<double> clus_eta; + std::vector<double> N_BAD_CELLS; + std::vector<double> ENG_FRAC_MAX; + std::vector<unsigned int> sizeVec; + auto mon_clusPhi = Monitored::Collection( "Phi", clus_phi ); + auto mon_clusEta = Monitored::Collection( "Eta", clus_eta ); + auto mon_badCells = Monitored::Collection( "N_BAD_CELLS", N_BAD_CELLS ); + auto mon_engFrac = Monitored::Collection( "ENG_FRAC_MAX", N_BAD_CELLS ); + auto mon_size = Monitored::Collection( "size", sizeVec ); + auto monmu = Monitored::Scalar( "mu", -999.0 ); + auto monitorIt = Monitored::Group( m_moniTool, mon_container_size, mon_clusEt, + mon_clusPhi, mon_clusEta, mon_clusSignalState, mon_clusSize, + mon_badCells, mon_engFrac, mon_size, monmu ); + // fill monitored variables + for (xAOD::CaloCluster * cl : *cluster_collection_ptr) + { + const CaloClusterCellLink * num_cell_links = cl->getCellLinks(); + if (! num_cell_links) + { + sizeVec.push_back(0); + } + else + { + sizeVec.push_back(num_cell_links->size()); + } + clus_phi.push_back(cl->phi()); + clus_eta.push_back(cl->eta()); + N_BAD_CELLS.push_back(cl->getMomentValue(xAOD::CaloCluster::N_BAD_CELLS)); + ENG_FRAC_MAX.push_back(cl->getMomentValue(xAOD::CaloCluster::ENG_FRAC_MAX)); + } + SG::ReadDecorHandle<xAOD::EventInfo, float> eventInfoDecor(m_avgMuKey, ctx); + if (eventInfoDecor.isPresent()) + { + monmu = eventInfoDecor(0); + } + mon_container_size = cluster_collection_ptr->size(); + } + + if (m_measureTimes) + { + if (m_doPlots) + { + times.push_back(plot_time); + } + record_times(ctx.evt(), times); + } + + ATH_MSG_DEBUG("Created cluster container with " << cluster_collection->size() << " clusters"); + + SG::WriteHandle<CaloClusterCellLinkContainer> cell_links(m_clusterCellLinkOutput, ctx); + + ATH_CHECK( CaloClusterStoreHelper::finalizeClusters(cell_links, cluster_collection.ptr()) ); + + return StatusCode::SUCCESS; +} + +StatusCode CaloGPUHybridClusterProcessor::finalize() +{ + if (m_measureTimes) + { + std::string header_string; + + auto add_name_to_string = [&](const auto & obj) + { + std::string rep = obj->name(); + std::replace(rep.begin(), rep.end(), ' ', '_'); + header_string += rep + " "; + }; + + for (const auto & pre_GPU_tool : m_preGPUoperations) + { + add_name_to_string(pre_GPU_tool); + } + + if (m_preConvert) + { + add_name_to_string(m_transformForGPU); + } + + for (const auto & GPU_tool : m_GPUoperations) + { + add_name_to_string(GPU_tool); + } + + if (m_postConvert) + { + add_name_to_string(m_transformBackToCPU); + } + + for (const auto & post_GPU_tool : m_postGPUoperations) + { + add_name_to_string(post_GPU_tool); + } + + if (m_doPlots) + { + add_name_to_string(m_plotterTool); + } + + print_times(header_string, m_preGPUoperations.size() + m_GPUoperations.size() + m_postGPUoperations.size() + m_preConvert + m_postConvert + m_doPlots); + } + + if (m_doPlots) + { + ATH_CHECK(m_plotterTool->finalize_plots()); + } + + return StatusCode::SUCCESS; +} diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.h b/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.h index 8ede861f36f56bcf25856255016466e92ce02bee..993a4d4fd0cb37ece6334694047257774606d1a3 100644 --- a/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.h +++ b/Calorimeter/CaloRecGPU/src/CaloGPUHybridClusterProcessor.h @@ -1,143 +1,245 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H -#define CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H - - -#include "AthenaBaseComps/AthReentrantAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "CxxUtils/checker_macros.h" - -#include "CaloUtils/CaloClusterCollectionProcessor.h" -#include "CaloRecGPU/CaloClusterGPUTransformers.h" -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "CaloRecGPU/DataHolders.h" - -#include "xAODCaloEvent/CaloClusterContainer.h" - -#include <string> -#include <mutex> -#include <atomic> - -/** - * @class CaloGPUHybridClusterProcessor - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 27 May 2022 - * @brief Algorithm to reconstruct CaloCluster objects with GPU acceleration, - * providing interoperability for calling standard CPU algorithms before and after - * the GPU processing part. - * - * This class is meant as a replacement for @c CaloClusterMaker in that - * it creates a CaloClusterCollection and runs several tools over it. - * The main addition is the fact that, besides CPU-based tools, - * GPU-accelerated versions of the standard tools can be run, - * with adequate memory sharing between them to minimize transfers - * and (re-)conversions from and to the GPU-friendly data representation. */ - -class CaloGPUHybridClusterProcessor : public AthReentrantAlgorithm, public CaloGPUTimed -{ - public: - - CaloGPUHybridClusterProcessor(const std::string & name, ISvcLocator * pSvcLocator); - virtual ~CaloGPUHybridClusterProcessor() override; - virtual StatusCode initialize() override; - virtual StatusCode execute(const EventContext & ctx) const override; - virtual StatusCode execute(const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const; - //This second version is so we can 'hack' this into simply processing other containers - //via AlgToToolHelperHack for debugging purposes... - virtual StatusCode finalize() override; - - private: - - /** - * @brief The tool that will convert the constant data from the CPU to the GPU. - * - */ - ToolHandle<ICaloClusterGPUConstantTransformer> m_transformConstantData; - - /** - * @brief Tools to be applied to the clusters before being sent to the GPU for processing. - * - */ - ToolHandleArray<CaloClusterCollectionProcessor> m_preGPUoperations; - - - /** - * @brief The tool that will actually convert the data from the CPU to the GPU. - * - */ - ToolHandle<ICaloClusterGPUInputTransformer> m_transformForGPU; - - /** - * @brief Tools to be applied to the clusters on the GPU. - * - */ - ToolHandleArray<CaloClusterGPUProcessor> m_GPUoperations; - - /** - * @brief The tool that will convert the data from the GPU back to the CPU. - * - */ - ToolHandle<ICaloClusterGPUOutputTransformer> m_transformBackToCPU; - - /** - * @brief Tools to be applied to the clusters after returning from the GPU. - * - */ - ToolHandleArray<CaloClusterCollectionProcessor> m_postGPUoperations; - - /** - * @brief Number of events for which to pre-allocate space on GPU memory - * (should ideally be set to the expected number of threads to be run with). - * - */ - Gaudi::Property<size_t> m_numPreAllocatedGPUData{this, "NumPreAllocatedDataHolders", 0, "Number of event data holders to pre-allocate on GPU memory"}; - - /** @brief The name of the key in StoreGate for the output - CaloClusterContainer */ - SG::WriteHandleKey<xAOD::CaloClusterContainer> m_clusterOutput; - - /** @brief The name of the key in StoreGate for the output - CaloClusterCellLinkContainer */ - SG::WriteHandleKey<CaloClusterCellLinkContainer> m_clusterCellLinkOutput; - - /** @brief If @p true, the constant data is only converted and - sent to the GPU on the first event, in case not all the necessary - information is available during the @p initialize phase. - */ - Gaudi::Property<bool> m_deferConstantDataToFirstEvent {this, "DeferConstantDataPreparationToFirstEvent", true, "Convert and send event data on first event instead of during initialize (needed for exporting geometry and noise properly?)"}; - - /** @brief A way to reduce allocations over multiple threads by keeping a cache - * of previously allocated objects that get assigned to the threads as they need them. - * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. - */ - mutable CaloRecGPU::Helpers::separate_thread_holder<EventDataHolder> m_eventDataThreadedHolder ATLAS_THREAD_SAFE; - - /** @brief Constant data, common for all events and persisted throughout the run. - * - * Is @p mutable to deal with the cases where the data preparation is deferred to the first event. - */ - - mutable ConstantDataHolder m_constantData ATLAS_THREAD_SAFE; - - /** @brief A flag to signal that the constant data has been adequately sent to the GPU. - * This is required for everything to work properly in a multi-threaded context... - */ - - mutable std::atomic<bool> m_constantDataSent; - - - /** @brief This mutex is locked when sending the constant data on the first event - * to ensure thread safety. Otherwise, it's unused. - */ - mutable std::mutex m_mutex; - -}; - -#endif //CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H +#define CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H + + +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" + +#include "CxxUtils/checker_macros.h" + +#include "CaloUtils/CaloClusterCollectionProcessor.h" +#include "CaloRecGPU/CaloClusterGPUTransformers.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "CaloRecGPU/DataHolders.h" + +#include "xAODCaloEvent/CaloClusterContainer.h" + +#include "StoreGate/ReadDecorHandle.h" + +#include <string> +#include <mutex> +#include <atomic> +#include <utility> + +/** + * @class CaloGPUHybridClusterProcessor + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 27 May 2022 + * @brief Algorithm to reconstruct CaloCluster objects with GPU acceleration, + * providing interoperability for calling standard CPU algorithms before and after + * the GPU processing part. + * + * This class is meant as a replacement for @c CaloClusterMaker in that + * it creates a CaloClusterCollection and runs several tools over it. + * The main addition is the fact that, besides CPU-based tools, + * GPU-accelerated versions of the standard tools can be run, + * with adequate memory sharing between them to minimize transfers + * and (re-)conversions from and to the GPU-friendly data representation. */ + +class CaloGPUHybridClusterProcessor : public AthReentrantAlgorithm, public CaloGPUTimed +{ + public: + + CaloGPUHybridClusterProcessor(const std::string & name, ISvcLocator * pSvcLocator); + virtual ~CaloGPUHybridClusterProcessor() override; + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext & ctx) const override; + virtual StatusCode finalize() override; + + private: + + + /** + * @brief The tool that will convert the constant data from the CPU to the GPU. + * + */ + ToolHandle<ICaloClusterGPUConstantTransformer> m_transformConstantData{this, "ConstantDataToGPUTool", "", "Tool for transforming the constant data and sending it to the GPU"}; + + /** + * @brief Tools to be applied to the clusters before being sent to the GPU for processing. + * + */ + ToolHandleArray<CaloClusterCollectionProcessor> m_preGPUoperations{this, "BeforeGPUTools", {}, "Tools to be applied to the clusters on the CPU before processing them on the GPU"}; + + + /** + * @brief The tool that will actually convert the data from the CPU to the GPU. + * + */ + ToolHandle<ICaloClusterGPUInputTransformer> m_transformForGPU{this, "EventDataToGPUTool", "", "Tool for transforming the event data and sending it to the GPU"}; + + /** + * @brief Tools to be applied to the clusters on the GPU. + * + */ + ToolHandleArray<CaloClusterGPUProcessor> m_GPUoperations{this, "GPUTools", {}, "Tools to be applied to the clusters on the GPU"}; + + /** + * @brief The tool that will convert the data from the GPU back to the CPU. + * + */ + ToolHandle<ICaloClusterGPUOutputTransformer> m_transformBackToCPU{this, "GPUToEventDataTool", {}, "Tool for getting the data from the GPU back to the CPU Athena data structures"}; + + /** + * @brief Tools to be applied to the clusters after returning from the GPU. + * + */ + ToolHandleArray<CaloClusterCollectionProcessor> m_postGPUoperations{this, "AfterGPUTools", {}, "Tools to be applied to the clusters on the CPU after returning from the GPU"}; + + + /** @brief If @p true, calls the plotter specified by @p m_plotterTool at every tool execution. + It should be the plotter's responsibility to only take data from the tools it wants to. + */ + Gaudi::Property<bool> m_doPlots{this, "DoPlots", false, "Do plots based on the plotter tool optionally provided."}; + + /** + * @brief An optional plotter, for testing and/or debugging purposes. + * + */ + ToolHandle<ICaloClusterGPUPlotter> m_plotterTool{this, "PlotterTool", "", "An optional plotter, for testing and/or debugging purposes"}; + + + /** @brief If @p true, uses the monitoring tool specified by @p m_monitorTool. + */ + Gaudi::Property<bool> m_doMonitoring{this, "DoMonitoring", false, "Do monitoring."}; + + /** @brief Monitoring tool. + */ + ToolHandle< GenericMonitoringTool > m_moniTool { this, "MonitoringTool", "", "Monitoring tool" }; + + ///Event input: To get <mu> from Event Info + SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" }; + + + /** + * @brief Number of events for which to pre-allocate space on GPU memory + * (should ideally be set to the expected number of threads to be run with). + * + */ + Gaudi::Property<size_t> m_numPreAllocatedGPUData{this, "NumPreAllocatedDataHolders", 0, "Number of event data holders to pre-allocate on GPU memory"}; + /** @brief The name of the key in StoreGate for the output + CaloClusterContainer */ + SG::WriteHandleKey<xAOD::CaloClusterContainer> m_clusterOutput {this, "ClustersOutputName", "", "The name of the key in StoreGate for the output CaloClusterContainer"}; + + /** @brief The name of the key in StoreGate for the output + CaloClusterCellLinkContainer */ + SG::WriteHandleKey<CaloClusterCellLinkContainer> m_clusterCellLinkOutput{this, "ClusterCellLinkOutputName", "", "The name of the key in StoreGate for the output CaloClusterCellLinkContainer"}; + + /** @brief If @p true, the constant data is only converted and + sent to the GPU on the first event, in case not all the necessary + information is available during the @p initialize phase. + */ + Gaudi::Property<bool> m_deferConstantDataToFirstEvent {this, "DeferConstantDataPreparationToFirstEvent", true, "Convert and send event data on first event instead of during initialize (needed for exporting geometry and noise properly?)"}; + + /** @brief A way to reduce allocations over multiple threads by keeping a cache + * of previously allocated objects that get assigned to the threads as they need them. + * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. + */ + mutable CaloRecGPU::Helpers::separate_thread_holder<CaloRecGPU::EventDataHolder> m_eventDataThreadedHolder ATLAS_THREAD_SAFE; + + /** @class simple_GPU_pointer_holder + @brief A simple RAII wrapper to ensure proper allocation and deallocation of GPU memory in a @p void * + for the temporaries. + */ + struct simple_GPU_pointer_holder + { + private: + void * m_ptr; + + public: + + void allocate(const size_t size) + { + if (m_ptr == nullptr && size > 0) + { + m_ptr = CaloRecGPU::CUDA_Helpers::allocate(size); + } + } + + simple_GPU_pointer_holder(): + m_ptr(nullptr) + { + } + simple_GPU_pointer_holder(const simple_GPU_pointer_holder &) = delete; + simple_GPU_pointer_holder(simple_GPU_pointer_holder && other) + { + m_ptr = other.m_ptr; + other.m_ptr = nullptr; + } + simple_GPU_pointer_holder & operator= (const simple_GPU_pointer_holder &) = delete; + + simple_GPU_pointer_holder & operator= (simple_GPU_pointer_holder && other) + { + std::swap(m_ptr, other.m_ptr); + return (*this); + } + + ~simple_GPU_pointer_holder() + { + if (m_ptr != nullptr) + //This check might still be needed to ensure the code behaves on non-CUDA enabled platforms + //where some destructors might still be called with nullptr. + { + CaloRecGPU::CUDA_Helpers::deallocate(m_ptr); + } + } + + void * operator* () + { + return m_ptr; + } + + void * get_pointer() + { + return m_ptr; + } + + }; + + /** @brief A way to reduce allocations over multiple threads by keeping a cache + * of previously allocated objects that get assigned to the threads as they need them. + * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. + */ + mutable CaloRecGPU::Helpers::separate_thread_holder<simple_GPU_pointer_holder> m_temporariesThreadedHolder ATLAS_THREAD_SAFE; + + /** @brief The size of the temporary buffer to allocate for the GPU tools that will be called. + + Will correspond to the maximum of all the necessary sizes for all the GPU tools. + + @warning Every tool should consider the buffer as filled with uninitialized memory at their start. + */ + size_t m_temporariesSize; + + /** @brief Constant data, common for all events and persisted throughout the run. + * + * Is @p mutable to deal with the cases where the data preparation is deferred to the first event. + */ + + mutable CaloRecGPU::ConstantDataHolder m_constantData ATLAS_THREAD_SAFE; + + /** @brief A flag to signal that the constant data has been adequately sent to the GPU. + * This is required for everything to work properly in a multi-threaded context... + */ + + mutable std::atomic<bool> m_constantDataSent; + + + /** @brief This mutex is locked when sending the constant data on the first event + * to ensure thread safety. Otherwise, it's unused. + */ + mutable std::mutex m_mutex; + + ///@brief Do pre or post conversions of energy? (Used internally to ensure the conversion tools are given.) + bool m_preConvert, m_postConvert; + +}; + +#endif //CALORECGPU_CALOGPUHYBRIDCLUSTERPROCESSOR_H diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUOutput.cxx b/Calorimeter/CaloRecGPU/src/CaloGPUOutput.cxx index 69c007ded8d6efd61db3b16bf4f1845245107279..eccaf116da5282c7afdcc5062b7faaade72e2b4c 100644 --- a/Calorimeter/CaloRecGPU/src/CaloGPUOutput.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloGPUOutput.cxx @@ -1,135 +1,171 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloGPUOutput.h" - -#include "CaloRecGPU/StandaloneDataIO.h" - -#include <unordered_map> - -using namespace CaloRecGPU; - -CaloGPUOutput::CaloGPUOutput(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - m_constantDataSaved(false) -{ - declareInterface<CaloClusterGPUProcessor> (this); -} - -StatusCode CaloGPUOutput::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const -{ - if (!m_constantDataSaved.load()){ - std::lock_guard<std::mutex> lock_guard(m_mutex); - if (!m_constantDataSaved.load()){ - const auto err1 = StandaloneDataIO::save_constants_to_folder(std::string(m_savePath), constant_data.m_geometry, - constant_data.m_cell_noise, m_filePrefix, m_fileSuffix); - if (err1 != StandaloneDataIO::ErrorState::OK){ - return StatusCode::FAILURE; - } - m_constantDataSaved.store(true); - } - } - - Helpers::CPU_object<CellInfoArr> cell_info(event_data.m_cell_info_dev); - Helpers::CPU_object<CellStateArr> cell_state(event_data.m_cell_state_dev); - Helpers::CPU_object<ClusterInfoArr> clusters(event_data.m_clusters_dev); - - std::unordered_map<int, int> tag_map; - - if (m_sortedAndCutClusters) - { - std::vector<int> cluster_order(clusters->number); - - std::iota(cluster_order.begin(), cluster_order.end(), 0); - - std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) - { - if (clusters->seedCellID[a] < 0) - { - return false; - //This means that clusters with no cells - //(marked as invalid) always compare lower, - //so they appear in the end. - } - else if (clusters->seedCellID[b] < 0) - { - return true; - } - return clusters->clusterEt[a] > clusters->clusterEt[b]; - } ); - - int real_cluster_numbers = clusters->number; - - for (size_t i = 0; i < cluster_order.size(); ++i) - { - const int this_id = cluster_order[i]; - if ( clusters->seedCellID[this_id] < 0 || - (m_cutClustersInAbsE ? - std::abs(clusters->clusterEt[this_id]) : - clusters->clusterEt[this_id]) < m_clusterETThreshold ) - { - tag_map[this_id] = -1; - --real_cluster_numbers; - } - else - { - tag_map[this_id] = i; - } - } - - const Helpers::CPU_object<ClusterInfoArr> temp_clusters(clusters); - - clusters->number = real_cluster_numbers; - - for (int i = 0; i < temp_clusters->number; ++i) - { - clusters->clusterEnergy[i] = temp_clusters->clusterEnergy[cluster_order[i]]; - clusters->clusterEt[i] = temp_clusters->clusterEt[cluster_order[i]]; - clusters->clusterEta[i] = temp_clusters->clusterEta[cluster_order[i]]; - clusters->clusterPhi[i] = temp_clusters->clusterPhi[cluster_order[i]]; - clusters->seedCellID[i] = temp_clusters->seedCellID[cluster_order[i]]; - } - - } - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type this_tag = cell_state->clusterTag[i]; - if (!Tags::is_part_of_cluster(this_tag) || GainConversion::is_invalid_cell(cell_info->gain[i])) - { - cell_state->clusterTag[i] = Tags::InvalidTag; - } - else if (Tags::is_part_of_cluster(this_tag) && m_sortedAndCutClusters) - { - const int old_idx = Tags::get_index_from_tag(this_tag); - const int new_idx = tag_map[old_idx]; - if (new_idx < 0) - { - cell_state->clusterTag[i] = Tags::InvalidTag; - } - else - { - cell_state->clusterTag[i] = Tags::make_seed_tag(0x7f7fffff, clusters->seedCellID[new_idx], new_idx); - //To match what we do on the CPU side... - } - } - } - - const auto err2 = StandaloneDataIO::save_event_to_folder(ctx.evt(), std::string(m_savePath), cell_info, cell_state, clusters, - m_filePrefix, m_fileSuffix, m_numWidth); - - if (err2 != StandaloneDataIO::ErrorState::OK) - { - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; - - -} - - -CaloGPUOutput::~CaloGPUOutput() -{ - //Nothing! +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloGPUOutput.h" + +#include "CaloRecGPU/StandaloneDataIO.h" + +#include <unordered_map> + +using namespace CaloRecGPU; + +CaloGPUOutput::CaloGPUOutput(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + m_constantDataSaved(false) +{ + declareInterface<CaloClusterGPUProcessor> (this); +} + +StatusCode CaloGPUOutput::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data, void * /*temporary_buffer*/) const +{ + if (!m_constantDataSaved.load()) + { + std::lock_guard<std::mutex> lock_guard(m_mutex); + if (!m_constantDataSaved.load()) + { + const auto err1 = StandaloneDataIO::save_constants_to_folder(std::string(m_savePath), constant_data.m_geometry_dev, + constant_data.m_cell_noise_dev, m_filePrefix, m_fileSuffix); + if (err1 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + m_constantDataSaved.store(true); + } + } + + Helpers::CPU_object<CellInfoArr> cell_info(event_data.m_cell_info_dev); + + if (m_onlyCellInfo) + { + const auto err2 = StandaloneDataIO::save_cell_info_to_folder(ctx.evt(), std::string(m_savePath), cell_info, m_filePrefix, m_fileSuffix, m_numWidth); + + if (err2 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + + + Helpers::CPU_object<CellStateArr> cell_state(event_data.m_cell_state_dev); + Helpers::CPU_object<ClusterInfoArr> clusters(event_data.m_clusters_dev); + + std::unordered_map<int, int> tag_map; + + if (m_sortedAndCutClusters) + { + std::vector<int> cluster_order(clusters->number); + + std::iota(cluster_order.begin(), cluster_order.end(), 0); + + std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) + { + if (clusters->seedCellID[a] < 0) + { + return false; + //This means that clusters with no cells + //(marked as invalid) always compare lower, + //so they appear in the end. + } + else if (clusters->seedCellID[b] < 0) + { + return true; + } + return clusters->clusterEt[a] > clusters->clusterEt[b]; + } ); + + int real_cluster_numbers = clusters->number; + + for (size_t i = 0; i < cluster_order.size(); ++i) + { + const int this_id = cluster_order[i]; + if (clusters->seedCellID[this_id] < 0) + { + tag_map[this_id] = -1; + --real_cluster_numbers; + } + else + { + tag_map[this_id] = i; + } + } + + const Helpers::CPU_object<ClusterInfoArr> temp_clusters(clusters); + + clusters->number = real_cluster_numbers; + + for (int i = 0; i < temp_clusters->number; ++i) + { + clusters->clusterEnergy[i] = temp_clusters->clusterEnergy[cluster_order[i]]; + clusters->clusterEt[i] = temp_clusters->clusterEt[cluster_order[i]]; + clusters->clusterEta[i] = temp_clusters->clusterEta[cluster_order[i]]; + clusters->clusterPhi[i] = temp_clusters->clusterPhi[cluster_order[i]]; + clusters->seedCellID[i] = temp_clusters->seedCellID[cluster_order[i]]; + } + + } + size_t shared_count = 0; + for (int i = 0; i < NCaloCells; ++i) + { + if (!cell_info->is_valid(i)) + { + continue; + } + const ClusterTag this_tag = cell_state->clusterTag[i]; + if (!this_tag.is_part_of_cluster()) + { + cell_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + else if (this_tag.is_part_of_cluster() && m_sortedAndCutClusters) + { + const int old_idx = this_tag.cluster_index(); + const int new_idx = tag_map[old_idx]; + const int old_idx2 = this_tag.is_shared_between_clusters() ? this_tag.secondary_cluster_index() : -1; + const int new_idx2 = old_idx2 >= 0 ? tag_map[old_idx2] : -1; + if (new_idx < 0 && new_idx2 < 0) + { + cell_state->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + else if (new_idx < 0) + { + cell_state->clusterTag[i] = ClusterTag::make_tag(new_idx2); + } + else if (new_idx2 < 0) + { + cell_state->clusterTag[i] = ClusterTag::make_tag(new_idx); + } + else + { + ++shared_count; + cell_state->clusterTag[i] = ClusterTag::make_tag(new_idx, this_tag.secondary_cluster_weight(), new_idx2); + } + } + } + + + ATH_MSG_INFO("Clusters: " << clusters->number << " (" << tag_map.size() << " total)"); + ATH_MSG_INFO("Shared Cells: " << shared_count); + + + const auto err2 = StandaloneDataIO::save_event_to_folder(ctx.evt(), std::string(m_savePath), cell_info, cell_state, clusters, + m_filePrefix, m_fileSuffix, m_numWidth); + + if (err2 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + + +} + + +CaloGPUOutput::~CaloGPUOutput() +{ + //Nothing! } \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloGPUOutput.h b/Calorimeter/CaloRecGPU/src/CaloGPUOutput.h index 32440af0d1b0763a1a21b9a2e85422c68fd457c3..9785dda6ec3b3256373e351867de9aa61aae4b93 100644 --- a/Calorimeter/CaloRecGPU/src/CaloGPUOutput.h +++ b/Calorimeter/CaloRecGPU/src/CaloGPUOutput.h @@ -1,99 +1,88 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_CALOGPUOUTPUT_H -#define CALORECGPU_CALOGPUOUTPUT_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include <string> -#include <mutex> -#include <atomic> - -#include "CLHEP/Units/SystemOfUnits.h" - -/** - * @class CaloGPUOutput - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 30 May 2022 - * @brief Standard tool to output the GPU data representation to the non-standard file format that - * we have been using for plotting and validation purposes. - * - * There are likely more elegant/general/generic/portable solutions, - * some of which might even avoid Root too, but our workflow was built around this one... - */ - -class CaloGPUOutput : - public AthAlgTool, virtual public CaloClusterGPUProcessor -{ - public: - - CaloGPUOutput(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode execute (const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const override; - - virtual ~CaloGPUOutput(); - - private: - - - /** - * @brief The path specifying the folder to which the files should be saved. - Default @p ./saved_clusters - */ - Gaudi::Property<std::string> m_savePath{this, "SavePath", "./saved_clusters", "Path to where the files should be saved"}; - - /** - * @brief The prefix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; - - /** - * @brief The suffix of the saved files. Empty string by default. - */ - Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; - - /** - * @brief The number of digits to reserve for the events. 9 by default. - */ - Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; - - /** - * @brief If @p true, sort the clusters by transverse energy, apply a cut and compactify the tags - to ensure sequentiality. - */ - Gaudi::Property<bool> m_sortedAndCutClusters {this, "UseSortedAndCutClusters", true, "Sort the clusters by transverse energy, apply a cut and ensure contiguous tags"}; - - /** - * @brief if set to @p true cluster cuts are on \f$|E|_\perp\f$, if @p false on \f$E_\perp\f$. Default is @p true. - * - */ - Gaudi::Property<bool> m_cutClustersInAbsE {this, "ClusterCutsInAbsE", true, "Do cluster cuts in Abs E instead of E"}; - - /** - * @brief \f$E_\perp\f$ cut on the clusters. - * - * The clusters have to pass this cut (which is on \f$E_\perp\f$ - * or \f$|E|_\perp\f$ of the cluster depending on the above switch) - * in order to be inserted into the CaloClusterContainer. */ - - Gaudi::Property<float> m_clusterETThreshold {this, "ClusterEtorAbsEtCut", 0.*CLHEP::MeV, "Cluster E_t or Abs E_t cut"}; - - - /** - * @brief A flag to signal that the constant data has been adequately saved. - * This is required for everything to work properly in a multi-threaded context... - */ - mutable std::atomic<bool> m_constantDataSaved; - - /** @brief This mutex is locked when saving the constant data on the first event - * to ensure thread safety. Otherwise, it's unused. - */ - mutable std::mutex m_mutex; - -}; - -#endif //CALORECGPU_CALOGPUOUTPUT_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOGPUOUTPUT_H +#define CALORECGPU_CALOGPUOUTPUT_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include <string> +#include <mutex> +#include <atomic> + +/** + * @class CaloGPUOutput + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 30 May 2022 + * @brief Standard tool to output the GPU data representation to the non-standard file format that + * we have been using for plotting and validation purposes. + * + * There are likely more elegant/general/generic/portable solutions, + * some of which might even avoid Root too, but our workflow was built around this one... + */ + +class CaloGPUOutput : + public AthAlgTool, virtual public CaloClusterGPUProcessor +{ + public: + + CaloGPUOutput(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual ~CaloGPUOutput(); + + private: + + + /** + * @brief The path specifying the folder to which the files should be saved. + Default @p ./saved_clusters + */ + Gaudi::Property<std::string> m_savePath{this, "SavePath", "./saved_clusters", "Path to where the files should be saved"}; + + /** + * @brief The prefix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; + + /** + * @brief The suffix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; + + /** + * @brief The number of digits to reserve for the events. 9 by default. + */ + Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; + + /** + * @brief If @p true, sort the clusters by transverse energy and compactify the tags to ensure sequentiality. + */ + Gaudi::Property<bool> m_sortedAndCutClusters {this, "UseSortedAndCutClusters", true, "Sort the clusters by transverse energy, apply a cut and ensure contiguous tags"}; + + /** + * @brief If @p true, only output cell info (useful for reducing disk usage when running the full standalone version of the algorithms). + */ + Gaudi::Property<bool> m_onlyCellInfo {this, "OnlyOutputCellInfo", false, "Only output cell info"}; + + /** + * @brief A flag to signal that the constant data has been adequately saved. + * This is required for everything to work properly in a multi-threaded context... + */ + mutable std::atomic<bool> m_constantDataSaved; + + /** @brief This mutex is locked when saving the constant data on the first event + * to ensure thread safety. Otherwise, it's unused. + */ + mutable std::mutex m_mutex; + +}; + +#endif //CALORECGPU_CALOGPUOUTPUT_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloMomentsDumper.cxx b/Calorimeter/CaloRecGPU/src/CaloMomentsDumper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..64e7a2dc9b0435674e551315e1fb0055cc1a41fa --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/CaloMomentsDumper.cxx @@ -0,0 +1,163 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloMomentsDumper.h" +#include "CaloRecGPU/StandaloneDataIO.h" + +#include <fstream> + +using namespace CaloRecGPU; + +CaloMomentsDumper::CaloMomentsDumper(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent) +{ + declareInterface<CaloClusterCollectionProcessor> (this); +} + + +StatusCode CaloMomentsDumper::initialize() +{ + return StatusCode::SUCCESS; +} + +StatusCode CaloMomentsDumper::execute (const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const +{ + + const auto err1 = StandaloneDataIO::prepare_folder_for_output(std::string(m_savePath)); + if (err1 != StandaloneDataIO::ErrorState::OK) + { + return StatusCode::FAILURE; + } + + const boost::filesystem::path save_file = m_savePath + "/" + StandaloneDataIO::build_filename((m_filePrefix.size() > 0 ? m_filePrefix + "_moments" : "moments"), + ctx.evt(), m_fileSuffix, "txt", m_numWidth); + + std::ofstream out_file(save_file); + + for (auto cluster_iter = cluster_collection->begin(); cluster_iter != cluster_collection->end(); ++cluster_iter) + { + const xAOD::CaloCluster * cluster = (*cluster_iter); + const CaloClusterCellLink * cell_links = cluster->getCellLinks(); + if (!cell_links) + { + ATH_MSG_ERROR("Can't get valid links to CaloCells (CaloClusterCellLink)!"); + return StatusCode::FAILURE; + } + + out_file << cluster->pt() << " " << cluster->eta() << " " << cluster->phi() << " " << cluster->m() << " " << cluster->e() << " " << cluster->rapidity() << " " << cluster->et() << "\n"; + out_file << "------------------------------------------------\n"; + + for (int i = 0; i < 28; ++i) + { + out_file << cluster->eSample((CaloSampling::CaloSample) i) << " " << cluster->etaSample((CaloSampling::CaloSample) i) + << " " << cluster->phiSample((CaloSampling::CaloSample) i) << " " << cluster->energy_max((CaloSampling::CaloSample) i) + << " " << cluster->etamax((CaloSampling::CaloSample) i) << " " << cluster->phimax((CaloSampling::CaloSample) i) + << " " << cluster->numberCellsInSampling((CaloSampling::CaloSample) i) << "\n"; + } + + out_file << "------------------------------------------------\n"; + out_file << cluster->numberCells() << " " << cluster->time() << " " << cluster->secondTime() << " " << cluster->samplingPattern() << " " << cluster->size() << "\n"; + out_file << "------------------------------------------------\n"; + + out_file << cluster->getMomentValue(xAOD::CaloCluster::FIRST_PHI) + << " " << cluster->getMomentValue(xAOD::CaloCluster::FIRST_ETA) + << " " << cluster->getMomentValue(xAOD::CaloCluster::SECOND_R) + << " " << cluster->getMomentValue(xAOD::CaloCluster::SECOND_LAMBDA) + << " " << cluster->getMomentValue(xAOD::CaloCluster::DELTA_PHI) + << " " << cluster->getMomentValue(xAOD::CaloCluster::DELTA_THETA) + << " " << cluster->getMomentValue(xAOD::CaloCluster::DELTA_ALPHA) + + << "\n2:\n" << cluster->getMomentValue(xAOD::CaloCluster::CENTER_X) + << " " << cluster->getMomentValue(xAOD::CaloCluster::CENTER_Y) + << " " << cluster->getMomentValue(xAOD::CaloCluster::CENTER_Z) + << " " << cluster->getMomentValue(xAOD::CaloCluster::CENTER_MAG) + << " " << cluster->getMomentValue(xAOD::CaloCluster::CENTER_LAMBDA) + << " " << cluster->getMomentValue(xAOD::CaloCluster::LATERAL) + << " " << cluster->getMomentValue(xAOD::CaloCluster::LONGITUDINAL) + + << "\n3:\n" << cluster->getMomentValue(xAOD::CaloCluster::ENG_FRAC_EM) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_FRAC_MAX) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_FRAC_CORE) + << " " << cluster->getMomentValue(xAOD::CaloCluster::FIRST_ENG_DENS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::SECOND_ENG_DENS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ISOLATION) + + << "\n4:\n" << cluster->getMomentValue(xAOD::CaloCluster::ENG_BAD_CELLS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::N_BAD_CELLS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::N_BAD_CELLS_CORR) + << " " << cluster->getMomentValue(xAOD::CaloCluster::BAD_CELLS_CORR_E) + << " " << cluster->getMomentValue(xAOD::CaloCluster::BADLARQ_FRAC) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_POS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::SIGNIFICANCE) + << " " << cluster->getMomentValue(xAOD::CaloCluster::CELL_SIGNIFICANCE) + << " " << cluster->getMomentValue(xAOD::CaloCluster::CELL_SIG_SAMPLING) + + << "\n5:\n" << cluster->getMomentValue(xAOD::CaloCluster::AVG_LAR_Q) + << " " << cluster->getMomentValue(xAOD::CaloCluster::AVG_TILE_Q) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_BAD_HV_CELLS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::N_BAD_HV_CELLS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::PTD) + << " " << cluster->getMomentValue(xAOD::CaloCluster::MASS) + + << "\n6:\n" << cluster->getMomentValue(xAOD::CaloCluster::EM_PROBABILITY) + << " " << cluster->getMomentValue(xAOD::CaloCluster::HAD_WEIGHT) + << " " << cluster->getMomentValue(xAOD::CaloCluster::OOC_WEIGHT) + << " " << cluster->getMomentValue(xAOD::CaloCluster::DM_WEIGHT) + << " " << cluster->getMomentValue(xAOD::CaloCluster::TILE_CONFIDENCE_LEVEL) + + << "\n" << cluster->getMomentValue(xAOD::CaloCluster::SECOND_TIME) + + << "\n7:\n" << cluster->getMomentValue(xAOD::CaloCluster::VERTEX_FRACTION) + << " " << cluster->getMomentValue(xAOD::CaloCluster::NVERTEX_FRACTION) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ETACALOFRAME) + << " " << cluster->getMomentValue(xAOD::CaloCluster::PHICALOFRAME) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ETA1CALOFRAME) + << " " << cluster->getMomentValue(xAOD::CaloCluster::PHI1CALOFRAME) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ETA2CALOFRAME) + << " " << cluster->getMomentValue(xAOD::CaloCluster::PHI2CALOFRAME) + + << "\n8:\n" << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_TOT) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_OUT_L) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_OUT_M) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_OUT_T) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_L) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_M) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_T) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_EMB0) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_EME0) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_TILEG3) + + << "\n9:\n" << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_TOT) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_EMB0) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_TILE0) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_TILEG3) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_EME0) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_HEC0) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_FCAL) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_LEAKAGE) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_DEAD_UNCLASS) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_FRAC_EM) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_FRAC_HAD) + << " " << cluster->getMomentValue(xAOD::CaloCluster::ENG_CALIB_FRAC_REST); + + out_file << "\n------------------------------------------------\n"; + out_file << "------------------------------------------------\n"; + + out_file << "\n\n"; + + } + + out_file << std::endl; + + return StatusCode::SUCCESS; + +} + + +CaloMomentsDumper::~CaloMomentsDumper() +{ + //Nothing! +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloMomentsDumper.h b/Calorimeter/CaloRecGPU/src/CaloMomentsDumper.h new file mode 100644 index 0000000000000000000000000000000000000000..e5bb8955f9456f41bde3f648f7e0cdd57342aa9c --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/CaloMomentsDumper.h @@ -0,0 +1,65 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOMOMENTSDUMPER_H +#define CALORECGPU_CALOMOMENTSDUMPER_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloUtils/CaloClusterCollectionProcessor.h" +#include <string> + + +class CaloCell_ID; + +/** + * @class CaloMomentsDumper + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 05 March 2023 + * @brief Outputs cluster moments (and other assorted properties) to text files. + */ + +class CaloMomentsDumper : + public AthAlgTool, virtual public CaloClusterCollectionProcessor +{ + public: + + CaloMomentsDumper(const std::string & type, const std::string & name, const IInterface * parent); + + using CaloClusterCollectionProcessor::execute; + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext& ctx, xAOD::CaloClusterContainer* cluster_collection) const override; + + virtual ~CaloMomentsDumper(); + + private: + + + /** + * @brief The path specifying the folder to which the files should be saved. + Default @p ./saved_clusters + */ + Gaudi::Property<std::string> m_savePath{this, "SavePath", "./cluster_dump", "Path to where the files should be saved"}; + + /** + * @brief The prefix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_filePrefix{this, "FilePrefix", "", "Prefix of the saved files"}; + + /** + * @brief The suffix of the saved files. Empty string by default. + */ + Gaudi::Property<std::string> m_fileSuffix{this, "FileSuffix", "", "Suffix of the saved files"}; + + /** + * @brief The number of digits to reserve for the events. 9 by default. + */ + Gaudi::Property<unsigned int> m_numWidth{this, "NumberWidth", 9, "The number of digits to reserve for the events"}; + +}; + +#endif //CALORECGPU_CALOMOMENTSDUMPER_H diff --git a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.cxx b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.cxx index b3f2332436a1469213ff1168a7ef4ec02b6548cf..5ea6f920848bc8604d7efdde4b92116058562f77 100644 --- a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.cxx +++ b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.cxx @@ -1,248 +1,219 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "CaloTopoClusterSplitterGPU.h" -#include "CaloTopoClusterSplitterGPUImpl.h" - - -#include <string> -#include <climits> //For CHAR_BIT... though it's a slightly inefficient way of saying 8. - -#include "CaloIdentifier/CaloCell_ID.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -#include "MacroHelpers.h" - -using namespace CaloRecGPU; - -CaloTopoClusterSplitterGPU::CaloTopoClusterSplitterGPU(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - CaloGPUTimed(this) -{ - declareInterface<CaloClusterGPUProcessor> (this); -} - -StatusCode CaloTopoClusterSplitterGPU::initialize() -{ - - m_options.allocate(); - - - using PackType = decltype(m_options.m_options->m_useSampling); - - static_assert(CaloCell_ID::getNumberOfSamplings() <= sizeof(PackType) * CHAR_BIT, "We are assuming that we have fewer samplings that bits per int!"); - - auto get_option_from_string = [](const std::string & str, bool & failed) - { - failed = false; - CRGPU_RECURSIVE_MACRO( - CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID, - PreSamplerB, - EMB1, - EMB2, - EMB3, - PreSamplerE, - EME1, - EME2, - EME3, - HEC0, - HEC1, - HEC2, - HEC3, - TileBar0, - TileBar1, - TileBar2, - TileGap1, - TileGap2, - TileGap3, - TileExt0, - TileExt1, - TileExt2, - FCAL0, - FCAL1, - FCAL2 - ) - ) - else - { - failed = true; - return CaloCell_ID::Unknown; - } - }; - - - auto process_sampling = [&get_option_from_string](const std::vector<std::string> & sampling_names, std::string & invalid_names, PackType & sampling_option) - { - sampling_option = 0; - for (const std::string & samp_name : sampling_names) - { - bool failed = false; - const PackType sampling = (PackType) get_option_from_string(samp_name, failed); - - if (failed) - { - if (invalid_names.size() == 0) - { - invalid_names = "'" + samp_name + "'"; - } - else - { - invalid_names += ", '" + samp_name + "'"; - } - } - else - { - sampling_option |= ((PackType) 1) << sampling; - } - } - }; - - std::string invalid_names; - - process_sampling(m_samplingNames, invalid_names, m_options.m_options->m_useSampling); - - if (invalid_names.size() > 0) - { - ATH_MSG_ERROR( "Calorimeter samplings " << invalid_names - << " are not a valid Calorimeter sampling name and will be ignored! " - << "Valid names are: " - << "PreSamplerB, EMB1, EMB2, EMB3, " - << "PreSamplerE, EME1, EME2, EME3, " - << "HEC0, HEC1, HEC2, HEC3, " - << "TileBar0, TileBar1, TileBar2, " - << "TileGap1, TileGap2, TileGap3, " - << "TileExt0, TileExt1, TileExt2, " - << "FCAL0, FCAL1, FCAL2." ); - } - - invalid_names.clear(); - - process_sampling(m_secondarySamplingNames, invalid_names, m_options.m_options->m_useSecondarySampling); - - if (invalid_names.size() > 0) - { - ATH_MSG_ERROR( "Calorimeter samplings " << invalid_names - << " are not a valid Calorimeter sampling name and will be ignored! " - << "Valid names are: " - << "PreSamplerB, EMB1, EMB2, EMB3, " - << "PreSamplerE, EME1, EME2, EME3, " - << "HEC0, HEC1, HEC2, HEC3, " - << "TileBar0, TileBar1, TileBar2, " - << "TileGap1, TileGap2, TileGap3, " - << "TileExt0, TileExt1, TileExt2, " - << "FCAL0, FCAL1, FCAL2." ); - } - - - //We must repeat this printing part because ATH_MSG_ERROR - //is a macro that apparently calls a this->msg(...) function. - //Of course it won't work within a lambda... - - m_options.m_options->m_nCells = m_nCells; - m_options.m_options->m_minEnergy = m_minEnergy; - m_options.m_options->m_emShowerScale = m_emShowerScale; - m_options.m_options->m_shareBorderCells = m_shareBorderCells; - m_options.m_options->m_absOpt = m_absOpt; - - m_options.sendToGPU(true); - - - if (m_numPreAllocatedGPUData > 0) - { - ATH_MSG_DEBUG("Pre-allocating temporaries for " << m_numPreAllocatedGPUData << " events."); - - m_temporariesHolder.resize(m_numPreAllocatedGPUData); - //This will allocate the object holders. - - m_temporariesHolder.operate_on_all( [&](GPUSplitterTemporariesHolder & tth) - { - tth.allocate(); - } - ); - //This will allocate all the memory at this point. - //Also useful to prevent/debug potential allocation issues? - //But the main point is really reducing the execute times... - } - - return StatusCode::SUCCESS; - -} - -StatusCode CaloTopoClusterSplitterGPU::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const -{ - - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - const auto start = clock_type::now(); - - GPUSplitterTemporariesHolder * temp_data_ptr = nullptr; - - Helpers::separate_thread_accessor<GPUSplitterTemporariesHolder> sep_th_acc(m_temporariesHolder, temp_data_ptr); - //This is a RAII wrapper to access an object held by Helpers::separate_thread_holder, - //to ensure the event data is appropriately released when we are done processing. - - if (temp_data_ptr == nullptr) - { - ATH_MSG_ERROR("Could not get valid Temporary Data Holder! Event: " << ctx.evt() ); - return StatusCode::FAILURE; - } - - temp_data_ptr->allocate(); - //Does nothing if it is already allocated - //(which it should be unless a new holder had to be created - // due to m_numPreAllocatedGPUData being less than the number of threads.) - - preProcessingPreparation(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto before_maxima = clock_type::now(); - - findLocalMaxima(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto before_propagate = clock_type::now(); - - propagateTags(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto before_refill = clock_type::now(); - - refillClusters(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto end = clock_type::now(); - - - if (m_measureTimes) - { - record_times(ctx.evt(), - time_cast(start, before_maxima), - time_cast(before_maxima, before_propagate), - time_cast(before_propagate, before_refill), - time_cast(before_refill, end) - ); - } - - return StatusCode::SUCCESS; - - -} - - -StatusCode CaloTopoClusterSplitterGPU::finalize() -{ - if (m_measureTimes) - { - print_times("Preprocessing Find_Local_Maxima Splitter_Tag_Propagation Cluster_Refilling", 4); - } - return StatusCode::SUCCESS; -} - - -CaloTopoClusterSplitterGPU::~CaloTopoClusterSplitterGPU() -{ - //Nothing! -} \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloTopoClusterSplitterGPU.h" +#include "CaloTopoClusterSplitterGPUImpl.h" + + +#include <string> +#include <climits> //For CHAR_BIT... though it's a slightly inefficient way of saying 8. + +#include "CaloIdentifier/CaloCell_ID.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +#include "MacroHelpers.h" + +using namespace CaloRecGPU; + +CaloTopoClusterSplitterGPU::CaloTopoClusterSplitterGPU(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this) +{ + declareInterface<CaloClusterGPUProcessor> (this); +} + +StatusCode CaloTopoClusterSplitterGPU::initialize() +{ + + m_options.allocate(); + + + using PackType = decltype(m_options.m_options->m_useSampling); + + static_assert(CaloCell_ID::getNumberOfSamplings() <= sizeof(PackType) * CHAR_BIT, "We are assuming that we have fewer samplings that bits per int!"); + + auto get_option_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID, + PreSamplerB, + EMB1, + EMB2, + EMB3, + PreSamplerE, + EME1, + EME2, + EME3, + HEC0, + HEC1, + HEC2, + HEC3, + TileBar0, + TileBar1, + TileBar2, + TileGap1, + TileGap2, + TileGap3, + TileExt0, + TileExt1, + TileExt2, + FCAL0, + FCAL1, + FCAL2 + ) + ) + else + { + failed = true; + return CaloCell_ID::Unknown; + } + }; + + + auto process_sampling = [&get_option_from_string](const std::vector<std::string> & sampling_names, std::string & invalid_names, PackType & sampling_option) + { + sampling_option = 0; + for (const std::string & samp_name : sampling_names) + { + bool failed = false; + const PackType sampling = (PackType) get_option_from_string(samp_name, failed); + + if (failed) + { + if (invalid_names.size() == 0) + { + invalid_names = "'" + samp_name + "'"; + } + else + { + invalid_names += ", '" + samp_name + "'"; + } + } + else + { + sampling_option |= ((PackType) 1) << sampling; + } + } + }; + + std::string invalid_names; + + process_sampling(m_samplingNames, invalid_names, m_options.m_options->m_useSampling); + + if (invalid_names.size() > 0) + { + ATH_MSG_ERROR( "Calorimeter samplings " << invalid_names + << " are not a valid Calorimeter sampling name and will be ignored! " + << "Valid names are: " + << "PreSamplerB, EMB1, EMB2, EMB3, " + << "PreSamplerE, EME1, EME2, EME3, " + << "HEC0, HEC1, HEC2, HEC3, " + << "TileBar0, TileBar1, TileBar2, " + << "TileGap1, TileGap2, TileGap3, " + << "TileExt0, TileExt1, TileExt2, " + << "FCAL0, FCAL1, FCAL2." ); + } + + invalid_names.clear(); + + process_sampling(m_secondarySamplingNames, invalid_names, m_options.m_options->m_useSecondarySampling); + + if (invalid_names.size() > 0) + { + ATH_MSG_ERROR( "Calorimeter samplings " << invalid_names + << " are not a valid Calorimeter sampling name and will be ignored! " + << "Valid names are: " + << "PreSamplerB, EMB1, EMB2, EMB3, " + << "PreSamplerE, EME1, EME2, EME3, " + << "HEC0, HEC1, HEC2, HEC3, " + << "TileBar0, TileBar1, TileBar2, " + << "TileGap1, TileGap2, TileGap3, " + << "TileExt0, TileExt1, TileExt2, " + << "FCAL0, FCAL1, FCAL2." ); + } + + + //We must repeat this printing part because ATH_MSG_ERROR + //is a macro that apparently calls a this->msg(...) function. + //Of course it won't work within a lambda... + + m_options.m_options->m_nCells = m_nCells; + m_options.m_options->m_minEnergy = m_minEnergy; + m_options.m_options->m_emShowerScale = m_emShowerScale; + m_options.m_options->m_shareBorderCells = m_shareBorderCells; + m_options.m_options->m_absOpt = m_absOpt; + m_options.m_options->m_treatL1PredictedCellsAsGood = m_treatL1PredictedCellsAsGood; + + m_options.sendToGPU(true); + + return StatusCode::SUCCESS; + +} + +StatusCode CaloTopoClusterSplitterGPU::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, + EventDataHolder & event_data, void * temporary_buffer ) const +{ + + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + const auto start = clock_type::now(); + + Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries((GPUSplitterTemporaries *) temporary_buffer); + + preProcessingPreparation(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto before_maxima = clock_type::now(); + + findLocalMaxima(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto before_propagate = clock_type::now(); + + propagateTags(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto before_refill = clock_type::now(); + + refillClusters(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto end = clock_type::now(); + + + if (m_measureTimes) + { + record_times(ctx.evt(), + time_cast(start, before_maxima), + time_cast(before_maxima, before_propagate), + time_cast(before_propagate, before_refill), + time_cast(before_refill, end) + ); + } + + return StatusCode::SUCCESS; + + +} + + +StatusCode CaloTopoClusterSplitterGPU::finalize() +{ + if (m_measureTimes) + { + print_times("Preprocessing Find_Local_Maxima Splitter_Tag_Propagation Cluster_Refilling", 4); + } + return StatusCode::SUCCESS; +} + + +CaloTopoClusterSplitterGPU::~CaloTopoClusterSplitterGPU() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.h b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.h index efef6ea0dc1867285f8284a5eae8abd5f64170a4..5677317b113289f7097e1c336c1b4bd4ffab0dc8 100644 --- a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.h +++ b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPU.h @@ -1,146 +1,147 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - - -#ifndef CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_H -#define CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_H - -#include "AthenaBaseComps/AthAlgTool.h" - -#include "CLHEP/Units/SystemOfUnits.h" - -#include "CxxUtils/checker_macros.h" - -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "CaloTopoClusterSplitterGPUImpl.h" -#include <string> -#include <mutex> - -/** - * @class CaloTopoClusterSplitterGPU - * @author Cosmin-Gabriel Samoila <cosmin.samoila@cern.ch> (Algorithm & Implementation) - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> (Interfacing with the rest of the GPU code) - * @date 08 August 2022 - * @brief Cluster splitter algorithm to be run on GPUs. - */ - - -class CaloTopoClusterSplitterGPU : - public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed -{ - public: - - CaloTopoClusterSplitterGPU(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode initialize() override; - - virtual StatusCode execute (const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const override; - - virtual StatusCode finalize() override; - - virtual ~CaloTopoClusterSplitterGPU(); - - private: - - - /** - * @brief vector of names of the calorimeter samplings to consider - * for seeds. - * - * The default is to use all calorimeter samplings. Excluding a - * sampling from this vector prevents the definition of a seed cell - * in this sampling. Cells in those samplings are still used and - * incorporated in the topo clusters (both on the neighbor and the - * cell level) they can therefore even expand a cluster but not seed - * one ...*/ - Gaudi::Property<std::vector<std::string>> m_samplingNames {this, "SamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for local maxima"}; - - /** - * @brief vector of names of the secondary calorimeter samplings to - * consider. - * - * Samplings in this list will be considered for local maxima only - * if no local max in the primary list is overlapping. By default this - * list is empty */ - Gaudi::Property<std::vector<std::string>> m_secondarySamplingNames {this, "SecondarySamplingNames", {}, "Name(s) of secondary Calorimeter Samplings to consider for local maxima"}; - - /** - * @brief local maxima need at least this number of neighbors to - * become seeds - * - * each cell above the energy cut having at least this many - * neighbors in the parent cluster and only neighbors with smaller - * energy seed a split cluster. */ - Gaudi::Property<int> m_nCells {this, "NumberOfCellsCut", 4, "Local maxima need at least this number of neighbors to become seeds"}; - - /** - * @brief local maxima need at least this energy content - * - * potential seed cells have to pass this cut on the energy - * content. */ - Gaudi::Property<float> m_minEnergy {this, "EnergyCut", 500 * CLHEP::MeV, "Minimal energy for a local max"}; - - - /** - * @brief share cells at the border between two local maxima - * - * this property needs to be set to true in order to treat cells - * which would be included in 2 clusters (for more then 2 the 2 with - * the largest E for the current seed cells are used) as shared - * cells. Shared cells are first excluded from the clustering and - * then clustered after all normal cells are clustered. The shared - * clusters are added to the 2 clusters they neighbor with the - * weights \f$w_1 = E_1/(E_1+r E_2)\f$ and \f$w_2 = 1-w_1\f$, where - * \f$E_{1,2}\f$ are the current energies of the 2 neighboring - * clusters without the shared cells and \f$r=\exp(d_1-d_2)\f$ is - * the ratio of the expected dependencies on the distances \f$d_i\f$ - * (in units of a typical em shower scale) of each shared cell to - * the cluster centers. If the property is set to false the border - * cells are included in the normal clustering and the cluster with - * the largest E for the current seed cells gets the current border - * cell. */ - Gaudi::Property<bool> m_shareBorderCells {this, "ShareBorderCells", false, "Whether or not to share cells at the boundary between two clusters"}; - - - /** - * @brief typical EM shower scale to use for distance criteria in - * shared cells - * - * a shared cell is included in both clusters neighboring the cell - * with weights depending on the cluster energies and the distance - * of the shared cell to the cluster centroids. The distance is - * measured in units of this property to roughly describe the - * exponential slope of the energy density distribution for em - * showers. The exact choice of this property is not critical but - * should roughly match the Moliere radius in the LArEM since here - * the sharing of cells has the biggest use case. */ - Gaudi::Property<float> m_emShowerScale {this, "EMShowerScale", 5 * CLHEP::cm, "Typical EM shower distance for which the energy density should drop to 1/e"}; - - /** - * @brief if set to true, splitter only looks at absolute - * value of Energy in order to identify potential seed cells */ - Gaudi::Property<bool> m_absOpt {this, "WeightingOfNegClusters", false, "Should absolute value be used to identify potential seed cells"}; - - /** - * @brief Number of events for which to pre-allocate space on GPU memory - * (should ideally be set to the expected number of threads to be run with). - * - */ - Gaudi::Property<size_t> m_numPreAllocatedGPUData {this, "NumPreAllocatedDataHolders", 0, "Number of temporary data holders to pre-allocate on GPU memory"}; - - /** @brief A way to reduce allocations over multiple threads by keeping a cache - * of previously allocated objects that get assigned to the threads as they need them. - * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. - */ - mutable CaloRecGPU::Helpers::separate_thread_holder<GPUSplitterTemporariesHolder> m_temporariesHolder ATLAS_THREAD_SAFE; - - - /** @brief Options for the algorithm, held in a GPU-friendly way. - */ - GPUSplitterOptionsHolder m_options; - -}; - +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + + +#ifndef CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_H +#define CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_H + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "CLHEP/Units/SystemOfUnits.h" + +#include "CxxUtils/checker_macros.h" + +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "CaloTopoClusterSplitterGPUImpl.h" +#include <string> +#include <mutex> + +/** + * @class CaloTopoClusterSplitterGPU + * @author Cosmin-Gabriel Samoila <cosmin.samoila@cern.ch> (Algorithm & Implementation) + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> (Interfacing with the rest of the GPU code) + * @date 08 August 2022 + * @brief Cluster splitter algorithm to be run on GPUs. + */ + + +class CaloTopoClusterSplitterGPU : + public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed +{ + public: + + CaloTopoClusterSplitterGPU(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual StatusCode finalize() override; + + virtual ~CaloTopoClusterSplitterGPU(); + + virtual size_t size_of_temporaries() const + { + return sizeof(GPUSplitterTemporaries); + }; + + private: + + + /** + * @brief vector of names of the calorimeter samplings to consider + * for seeds. + * + * The default is to use all calorimeter samplings. Excluding a + * sampling from this vector prevents the definition of a seed cell + * in this sampling. Cells in those samplings are still used and + * incorporated in the topo clusters (both on the neighbor and the + * cell level) they can therefore even expand a cluster but not seed + * one ...*/ + Gaudi::Property<std::vector<std::string>> m_samplingNames {this, "SamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for local maxima"}; + + /** + * @brief vector of names of the secondary calorimeter samplings to + * consider. + * + * Samplings in this list will be considered for local maxima only + * if no local max in the primary list is overlapping. By default this + * list is empty */ + Gaudi::Property<std::vector<std::string>> m_secondarySamplingNames {this, "SecondarySamplingNames", {}, "Name(s) of secondary Calorimeter Samplings to consider for local maxima"}; + + /** + * @brief local maxima need at least this number of neighbors to + * become seeds + * + * each cell above the energy cut having at least this many + * neighbors in the parent cluster and only neighbors with smaller + * energy seed a split cluster. */ + Gaudi::Property<int> m_nCells {this, "NumberOfCellsCut", 4, "Local maxima need at least this number of neighbors to become seeds"}; + + /** + * @brief local maxima need at least this energy content + * + * potential seed cells have to pass this cut on the energy + * content. */ + Gaudi::Property<float> m_minEnergy {this, "EnergyCut", 500 * CLHEP::MeV, "Minimal energy for a local max"}; + + + /** + * @brief share cells at the border between two local maxima + * + * this property needs to be set to true in order to treat cells + * which would be included in 2 clusters (for more then 2 the 2 with + * the largest E for the current seed cells are used) as shared + * cells. Shared cells are first excluded from the clustering and + * then clustered after all normal cells are clustered. The shared + * clusters are added to the 2 clusters they neighbor with the + * weights \f$w_1 = E_1/(E_1+r E_2)\f$ and \f$w_2 = 1-w_1\f$, where + * \f$E_{1,2}\f$ are the current energies of the 2 neighboring + * clusters without the shared cells and \f$r=\exp(d_1-d_2)\f$ is + * the ratio of the expected dependencies on the distances \f$d_i\f$ + * (in units of a typical em shower scale) of each shared cell to + * the cluster centers. If the property is set to false the border + * cells are included in the normal clustering and the cluster with + * the largest E for the current seed cells gets the current border + * cell. */ + Gaudi::Property<bool> m_shareBorderCells {this, "ShareBorderCells", false, "Whether or not to share cells at the boundary between two clusters"}; + + + /** + * @brief typical EM shower scale to use for distance criteria in + * shared cells + * + * a shared cell is included in both clusters neighboring the cell + * with weights depending on the cluster energies and the distance + * of the shared cell to the cluster centroids. The distance is + * measured in units of this property to roughly describe the + * exponential slope of the energy density distribution for em + * showers. The exact choice of this property is not critical but + * should roughly match the Moliere radius in the LArEM since here + * the sharing of cells has the biggest use case. */ + Gaudi::Property<float> m_emShowerScale {this, "EMShowerScale", 5 * CLHEP::cm, "Typical EM shower distance for which the energy density should drop to 1/e"}; + + /** + * @brief if set to true, splitter only looks at absolute + * value of Energy in order to identify potential seed cells */ + Gaudi::Property<bool> m_absOpt {this, "WeightingOfNegClusters", false, "Should absolute value be used to identify potential seed cells"}; + + /** + * @brief if set to true treat cells with a dead OTX which can be + * predicted by L1 trigger info as good instead of bad cells */ + Gaudi::Property<bool> m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}; + + /** @brief Options for the algorithm, held in a GPU-friendly way. + */ + GPUSplitterOptionsHolder m_options; + +}; + #endif //CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.cu b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.cu index 2b01f50f539845eb81976984123e3fb67ad9fd84..e9be42000b93591dbf65552904165262f67d95d6 100644 --- a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.cu +++ b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.cu @@ -1,376 +1,422 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloTopoClusterSplitterGPUImpl.h" - - -#include <cstring> -#include <cmath> -#include <iostream> -#include <stdio.h> - -using namespace CaloRecGPU; - -void GPUSplitterTemporariesHolder::allocate() -{ - m_temporaries_dev.allocate(); -} - -void GPUSplitterOptionsHolder::allocate() -{ - m_options.allocate(); - m_options_dev.allocate(); -} - -void GPUSplitterOptionsHolder::sendToGPU(const bool clear_CPU) -{ - m_options_dev = m_options; - if (clear_CPU) - { - m_options.clear(); - } -} - - -#define check_if_secondary(cell_id, d_meta, d_fullclusters) ((d_fullcalogeometry)->caloSample[(cell_id)] >= (d_meta)->m_minSecondarySampling &&\ - (d_fullcalogeometry)->caloSample[(cell_id)] <= (d_meta)->m_maxSecondarySampling &&\ - ((d_meta)->m_useSecondarySampling & (1 << ((d_fullcalogeometry)->caloSample[(cell_id)] - (d_meta)->m_minSecondarySampling)))) - -constexpr static int DefaultBlockSize = 512; - - -/************************************************************************/ - - -void preProcessingPreparation(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) -{ - CUDA_ERRCHECK(cudaMemsetAsync((void *) temps.m_temporaries_dev->max_cells, 0, NCaloCells * sizeof(temps.m_temporaries_dev->max_cells[0]), cudaStreamPerThread)); - CUDA_ERRCHECK(cudaMemsetAsync((void *) temps.m_temporaries_dev->secondary_max_cells, 0, NCaloCells * sizeof(temps.m_temporaries_dev->secondary_max_cells[0]), cudaStreamPerThread)); - CUDA_ERRCHECK(cudaMemsetAsync((void *) temps.m_temporaries_dev->splitter_seeds, 0, NMaxClusters * sizeof(temps.m_temporaries_dev->splitter_seeds[0]), cudaStreamPerThread)); - CUDA_ERRCHECK(cudaMemsetAsync((void *) temps.m_temporaries_dev->secondary_splitter_seeds, 0, NMaxClusters * sizeof(temps.m_temporaries_dev->secondary_splitter_seeds[0]), cudaStreamPerThread)); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - - - -/***********************************************************************/ - -static __global__ void find_local_maximums(const Helpers::CUDA_kernel_object<CaloTopoClusterSplitterMetadata> d_meta, - const Helpers::CUDA_kernel_object<GeometryArr> d_fullcalogeometry, - const Helpers::CUDA_kernel_object<CellInfoArr> d_cellsfulldata, - const Helpers::CUDA_kernel_object<CellStateArr> d_cellstate, - Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries) -{ - unsigned cell_id = blockIdx.x * blockDim.x + threadIdx.x; - int num_neighbours, n_id; - int cell_tag; - int i; - int count_neigh = 0; - bool max = true; - float energy, n_energy, n_eta, n_phi; - bool is_secondary = false, is_primary = true; - int calo_sample, n_sample; - - if (cell_id > NCaloCells) - return; - - num_neighbours = d_fullcalogeometry->nReverseNeighbours[cell_id]; - calo_sample = d_fullcalogeometry->caloSample[cell_id]; - energy = d_cellsfulldata->energy[cell_id]; - cell_tag = Tags::get_index_from_tag(d_cellstate->clusterTag[cell_id]); - - if (d_meta->m_absOpt) - energy = fabs(energy); - - if (energy < d_meta->m_minEnergy) - return; - - if (!GainConversion::is_bad_cell(d_cellsfulldata->gain[cell_id]) && energy > 0) { - - /* check if cell can be used for local max */ - if (d_meta->uses_sampling(calo_sample)) { - is_primary = true; - } else if (d_meta->uses_secondary_sampling(calo_sample)) { - is_secondary = true; - } - } - - for (i = 0; i < num_neighbours; i++) { - n_id = d_fullcalogeometry->reverseNeighbours[cell_id][i]; - - /* skip if both cells aren't in the same cluster */ - if (cell_tag != Tags::get_index_from_tag(d_cellstate->clusterTag[n_id])) - continue; - - n_energy = d_meta->m_absOpt ? fabs(d_cellsfulldata->energy[n_id]) : d_cellsfulldata->energy[n_id]; - n_phi = d_fullcalogeometry->phi[n_id]; - n_eta = d_fullcalogeometry->eta[n_id]; - n_sample = d_fullcalogeometry->caloSample[n_id]; - - if (energy > n_energy) - count_neigh++; - else - max = false; - - if (n_energy >= d_meta->m_minEnergy && - is_secondary && - d_meta->uses_sampling(n_sample)) { - if (fabs(n_eta - d_fullcalogeometry->eta[cell_id]) < 0.0025) { - double diff_phi = n_phi - d_fullcalogeometry->phi[cell_id]; - if (diff_phi > M_PI) - diff_phi = diff_phi - 2 * M_PI; - else if (diff_phi < -M_PI) - diff_phi = diff_phi + 2 * M_PI; - - if (fabs(diff_phi) < 0.02) - max = false; - } - } - } - - if (count_neigh < d_meta->m_nCells) - max = false; - - if (max) { - if (is_primary) { - temporaries->max_cells[cell_id] = 1; - atomicAdd(&temporaries->splitter_seeds[cell_tag], 1); - } else if (is_secondary) { - temporaries->secondary_max_cells[cell_id] = 1; - atomicAdd(&temporaries->secondary_splitter_seeds[cell_tag], 1); - } - } -} - - -void findLocalMaxima(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) -{ - const int block_size = DefaultBlockSize; - const int num_blocks = Helpers::int_ceil_div(NCaloCells, block_size); - - dim3 bsize(block_size, 1, 1); - dim3 gsize(num_blocks, 1, 1); - - find_local_maximums<<<gsize, bsize>>>(options.m_options_dev, instance_data.m_geometry_dev, - holder.m_cell_info_dev, holder.m_cell_state_dev, temps.m_temporaries_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - - - /***********************************************************************/ - -__global__ void splitter_tag_propagation(const Helpers::CUDA_kernel_object<GeometryArr> d_fullcalogeometry, - const Helpers::CUDA_kernel_object<CellStateArr> d_cellstate, - Helpers::CUDA_kernel_object<ClusterInfoArr> d_fullclusters, - Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries) -{ - int tid = threadIdx.x; - int cell_tag, n_cell_tag; - int cell_id, n_cell_id; - int old_val; - /*int offset = d_fullclusters->number;*/ - int i, k, steps = 0; - __shared__ int *aux, *first_q, *sec_q; - - - __shared__ int current; - __shared__ int Q_len, Q2_len; - - if (tid == 0) { - current = 0; - Q_len = 0; - first_q = temporaries->queue1; - sec_q = temporaries->queue2; - - //NSF: We need this so the new clusters can be properly processed... - //(Obviously, since this is all on one block, - // it's fine to zero it here...) - d_fullclusters->number = 0; - - } - - __syncthreads(); - - /* Iterate through all cells and: - * - queue the local max and secondary maximums - * - assign a new cluster tag = call_id + n_clusters - * Compared to the CPU implementation, this doesn't start from the cells - * with highest energy since we don't sort the array on GPU so we might - * obtain slightly different results because of that. - */ - for (cell_id = tid; cell_id < NCaloCells; cell_id += blockDim.x) { - if (temporaries->max_cells[cell_id] || temporaries->secondary_max_cells[cell_id]) { - - old_val = atomicAdd(¤t, 1); - temporaries->tags[cell_id] = old_val /*+ offset*/; - - old_val = atomicAdd(&Q_len, 1); - temporaries->queue1[old_val] = cell_id; - - - //NSF: We need this so the new clusters can be properly processed... - const int old_size = atomicAdd(&(d_fullclusters->number), 1); - d_fullclusters->seedCellID[old_size] = cell_id; - - } else { - temporaries->tags[cell_id] = -1; - } - } - - __syncthreads(); - - /* Start iterate through cells in queue built at previous step and: - * - check what cell neighbour doesn't have a tag assigned in d_tags but - * has the same original cluster tag with current cell - * - if the tag is -1 (unused yet), change its tag with current cell - * tag and add the neighbour cell in a secondary queue. - * This algorithm will be repeated until the secondary queue is empty. - */ - do { - if (tid == 0) - Q2_len = 0; - - __syncthreads(); - - for (i = tid; i < Q_len; i += blockDim.x) { - cell_id = first_q[i]; - cell_tag = Tags::get_index_from_tag(d_cellstate->clusterTag[cell_id]); - int num_neighbours = d_fullcalogeometry->nReverseNeighbours[cell_id]; - - for (k = 0; k < num_neighbours; k++) { - n_cell_id = d_fullcalogeometry->reverseNeighbours[cell_id][k]; - n_cell_tag = Tags::get_index_from_tag(d_cellstate->clusterTag[n_cell_id]); - - if (cell_tag == n_cell_tag) { - old_val = atomicCAS(&temporaries->tags[n_cell_id], -1, temporaries->tags[cell_id]); - if (old_val == -1) { - int j = atomicAdd(&Q2_len, 1); - sec_q[j] = n_cell_id; - } - } - } - } - - __syncthreads(); - - if (tid == 0) { - steps ++; - aux = sec_q; - sec_q = first_q; - first_q = aux; - Q_len = Q2_len; - } - - __syncthreads(); - } while(Q2_len > 0); -} - - -void propagateTags(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) -{ - splitter_tag_propagation<<<1, 2 * DefaultBlockSize>>>(instance_data.m_geometry_dev, - holder.m_cell_state_dev, - holder.m_clusters_dev, - temps.m_temporaries_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } - -} - - /***********************************************************************/ - - -static __global__ void refill_clusters(const Helpers::CUDA_kernel_object<GeometryArr> d_fullcalogeometry, - Helpers::CUDA_kernel_object<ClusterInfoArr> d_fullclusters, - Helpers::CUDA_kernel_object<CellStateArr> d_cellstate, - Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries) -{ - unsigned int i = blockIdx.x * blockDim.x + threadIdx.x; - - if (i >= NCaloCells) - return; - - /* reset all clusters to 0 */ - /* - if (i < NMaxClusters) { - d_fullclusters->clusterSize[i] = 0; - d_fullclusters->clusterEnergy[i] = 0; - d_fullclusters->clusterEt[i] = 0; - d_fullclusters->clusterEta[i] = 0; - } - */ - - int tag = temporaries->tags[i]; - - /* set the seed tags accordingly to what we found in splitter algorithm */ - if (tag >= 0) { - d_cellstate->clusterTag[i] = Tags::make_seed_tag(0x7f7fffff, d_fullclusters->seedCellID[tag], tag); - } - else - { - tag = -1; - d_cellstate->clusterTag[i] = Tags::InvalidTag; - } - - //NSF: As there's no synchronization, there might be trouble between the zeroing and the calculation... - - /* - if (tag >= 0) { - float energy = d_fullclusters->cellSN2[i]; - atomicAdd(&d_fullclusters->clusterEnergy[tag], energy); - atomicAdd(&d_fullclusters->clusterEt[tag], abs(energy)); - atomicAdd(&d_fullclusters->clusterEta[tag], d_fullcalogeometry->eta[i] * abs(energy)); - - // TODO: why? - float phi0 = d_fullcalogeometry->phi[i]; - float phi = phi0; - if (phi > phi0 + M_PI) - phi = phi - 2 * M_PI; - if (phi < phi0 - M_PI) - phi = phi + 2 * M_PI; - atomicAdd(&d_fullclusters->clusterPhi[tag], phi * abs(energy)); - } - */ -} - -void refillClusters(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) -{ - const int block_size = DefaultBlockSize; - const int num_blocks = Helpers::int_ceil_div(NCaloCells, block_size); - - dim3 bsize(block_size, 1, 1); - dim3 gsize(num_blocks, 1, 1); - - refill_clusters<<<gsize, bsize>>>(instance_data.m_geometry_dev, holder.m_clusters_dev, - holder.m_cell_state_dev, temps.m_temporaries_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - - +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloTopoClusterSplitterGPUImpl.h" + + +#include <cstring> +#include <cmath> +#include <iostream> +#include <stdio.h> + +using namespace CaloRecGPU; + +void GPUSplitterOptionsHolder::allocate() +{ + m_options.allocate(); + m_options_dev.allocate(); +} + +void GPUSplitterOptionsHolder::sendToGPU(const bool clear_CPU) +{ + m_options_dev = m_options; + if (clear_CPU) + { + m_options.clear(); + } +} + + +#define check_if_secondary(cell_id, d_meta, d_fullclusters) ((d_fullcalogeometry)->caloSample[(cell_id)] >= (d_meta)->m_minSecondarySampling &&\ + (d_fullcalogeometry)->caloSample[(cell_id)] <= (d_meta)->m_maxSecondarySampling &&\ + ((d_meta)->m_useSecondarySampling & (1 << ((d_fullcalogeometry)->caloSample[(cell_id)] - (d_meta)->m_minSecondarySampling)))) + +constexpr static int DefaultBlockSize = 512; + + +/************************************************************************/ + + +void preProcessingPreparation(EventDataHolder & holder, Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) +{ + CUDA_ERRCHECK(cudaMemsetAsync((void *) temps->max_cells, 0, NCaloCells * sizeof(temps->max_cells[0]), cudaStreamPerThread)); + CUDA_ERRCHECK(cudaMemsetAsync((void *) temps->secondary_max_cells, 0, NCaloCells * sizeof(temps->secondary_max_cells[0]), cudaStreamPerThread)); + CUDA_ERRCHECK(cudaMemsetAsync((void *) temps->splitter_seeds, 0, NMaxClusters * sizeof(temps->splitter_seeds[0]), cudaStreamPerThread)); + CUDA_ERRCHECK(cudaMemsetAsync((void *) temps->secondary_splitter_seeds, 0, NMaxClusters * sizeof(temps->secondary_splitter_seeds[0]), cudaStreamPerThread)); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); + } +} + + + +/***********************************************************************/ + +static __global__ void find_local_maximums(const Helpers::CUDA_kernel_object<CaloTopoClusterSplitterMetadata> d_meta, + const Helpers::CUDA_kernel_object<GeometryArr> d_fullcalogeometry, + const Helpers::CUDA_kernel_object<CellInfoArr> d_cellsfulldata, + const Helpers::CUDA_kernel_object<CellStateArr> d_cellstate, + Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries) +{ + unsigned cell_id = blockIdx.x * blockDim.x + threadIdx.x; + int num_neighbours, n_id; + int cell_tag; + int i; + int count_neigh = 0; + bool max = true; + float energy, n_energy, n_eta, n_phi; + bool is_secondary = false, is_primary = true; + int calo_sample, n_sample; + + if (cell_id > NCaloCells) + { + return; + } + + num_neighbours = d_fullcalogeometry->neighbours.get_number_of_neighbours(cell_id); + calo_sample = d_fullcalogeometry->caloSample[cell_id]; + energy = d_cellsfulldata->energy[cell_id]; + cell_tag = ClusterTag::cluster_index(d_cellstate->clusterTag[cell_id]); + + if (d_meta->m_absOpt) + { + energy = fabs(energy); + } + + if (energy < d_meta->m_minEnergy) + { + return; + } + + if (d_cellsfulldata->is_bad(*d_fullcalogeometry, cell_id, d_meta->m_treatL1PredictedCellsAsGood) && energy > 0) + { + + /* check if cell can be used for local max */ + if (d_meta->uses_sampling(calo_sample)) + { + is_primary = true; + } + else if (d_meta->uses_secondary_sampling(calo_sample)) + { + is_secondary = true; + } + } + + for (i = 0; i < num_neighbours; i++) + { + n_id = d_fullcalogeometry->neighbours.get_neighbour(cell_id, i); + //FUTURE TODO WARNING FIX ALERT ERROR PAY ATTENTION: + //this is not taking into account limited neighbours! + + /* skip if both cells aren't in the same cluster */ + if (cell_tag != ClusterTag::cluster_index(d_cellstate->clusterTag[n_id])) + { + continue; + } + + n_energy = d_meta->m_absOpt ? fabs(d_cellsfulldata->energy[n_id]) : d_cellsfulldata->energy[n_id]; + n_phi = d_fullcalogeometry->phi[n_id]; + n_eta = d_fullcalogeometry->eta[n_id]; + n_sample = d_fullcalogeometry->caloSample[n_id]; + + if (energy > n_energy) + { + count_neigh++; + } + else + { + max = false; + } + + if (n_energy >= d_meta->m_minEnergy && + is_secondary && + d_meta->uses_sampling(n_sample)) + { + if (fabs(n_eta - d_fullcalogeometry->eta[cell_id]) < 0.0025) + { + double diff_phi = n_phi - d_fullcalogeometry->phi[cell_id]; + if (diff_phi > M_PI) + { + diff_phi = diff_phi - 2 * M_PI; + } + else if (diff_phi < -M_PI) + { + diff_phi = diff_phi + 2 * M_PI; + } + + if (fabs(diff_phi) < 0.02) + { + max = false; + } + } + } + } + + if (count_neigh < d_meta->m_nCells) + { + max = false; + } + + if (max) + { + if (is_primary) + { + temporaries->max_cells[cell_id] = 1; + atomicAdd(&temporaries->splitter_seeds[cell_tag], 1); + } + else if (is_secondary) + { + temporaries->secondary_max_cells[cell_id] = 1; + atomicAdd(&temporaries->secondary_splitter_seeds[cell_tag], 1); + } + } +} + + +void findLocalMaxima(EventDataHolder & holder, Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) +{ + const int block_size = DefaultBlockSize; + const int num_blocks = Helpers::int_ceil_div(NCaloCells, block_size); + + dim3 bsize(block_size, 1, 1); + dim3 gsize(num_blocks, 1, 1); + + find_local_maximums <<< gsize, bsize>>>(options.m_options_dev, instance_data.m_geometry_dev, + holder.m_cell_info_dev, holder.m_cell_state_dev, temps); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); + } +} + + +/***********************************************************************/ + +__global__ void splitter_tag_propagation(const Helpers::CUDA_kernel_object<GeometryArr> d_fullcalogeometry, + const Helpers::CUDA_kernel_object<CellStateArr> d_cellstate, + Helpers::CUDA_kernel_object<ClusterInfoArr> d_fullclusters, + Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries) +{ + int tid = threadIdx.x; + int cell_tag, n_cell_tag; + int cell_id, n_cell_id; + int old_num; + /*int offset = d_fullclusters->number;*/ + int i, k, steps = 0; + __shared__ int * aux, *first_q, *sec_q; + + + __shared__ int current; + __shared__ int Q_len, Q2_len; + + if (tid == 0) + { + current = 0; + Q_len = 0; + first_q = temporaries->queue1; + sec_q = temporaries->queue2; + + //NSF: We need this so the new clusters can be properly processed... + //(Obviously, since this is all on one block, + // it's fine to zero it here...) + d_fullclusters->number = 0; + + } + + __syncthreads(); + + /* Iterate through all cells and: + * - queue the local max and secondary maximums + * - assign a new cluster tag = call_id + n_clusters + * Compared to the CPU implementation, this doesn't start from the cells + * with highest energy since we don't sort the array on GPU so we might + * obtain slightly different results because of that. + */ + for (cell_id = tid; cell_id < NCaloCells; cell_id += blockDim.x) + { + if (temporaries->max_cells[cell_id] || temporaries->secondary_max_cells[cell_id]) + { + + old_num = atomicAdd(¤t, 1); + temporaries->tags[cell_id] = old_num /*+ offset*/; + + old_num = atomicAdd(&Q_len, 1); + temporaries->queue1[old_num] = cell_id; + + + //NSF: We need this so the new clusters can be properly processed... + const int old_size = atomicAdd(&(d_fullclusters->number), 1); + d_fullclusters->seedCellID[old_size] = cell_id; + + } + else + { + temporaries->tags[cell_id] = -1; + } + } + + __syncthreads(); + + /* Start iterate through cells in queue built at previous step and: + * - check what cell neighbour doesn't have a tag assigned in d_tags but + * has the same original cluster tag with current cell + * - if the tag is -1 (unused yet), change its tag with current cell + * tag and add the neighbour cell in a secondary queue. + * This algorithm will be repeated until the secondary queue is empty. + */ + do + { + if (tid == 0) + { + Q2_len = 0; + } + + __syncthreads(); + + for (i = tid; i < Q_len; i += blockDim.x) + { + cell_id = first_q[i]; + cell_tag = ClusterTag::cluster_index(d_cellstate->clusterTag[cell_id]); + int num_neighbours = d_fullcalogeometry->neighbours.get_number_of_neighbours(cell_id); + //FUTURE TODO WARNING FIX ALERT ERROR PAY ATTENTION: + //this is not taking into account limited neighbours! + + for (k = 0; k < num_neighbours; k++) + { + n_cell_id = d_fullcalogeometry->neighbours.get_neighbour(cell_id, k); + n_cell_tag = ClusterTag::cluster_index(d_cellstate->clusterTag[n_cell_id]); + + if (cell_tag == n_cell_tag) + { + old_num = atomicCAS(&temporaries->tags[n_cell_id], -1, temporaries->tags[cell_id]); + if (old_num == -1) + { + int j = atomicAdd(&Q2_len, 1); + sec_q[j] = n_cell_id; + } + } + } + } + + __syncthreads(); + + if (tid == 0) + { + steps ++; + aux = sec_q; + sec_q = first_q; + first_q = aux; + Q_len = Q2_len; + } + + __syncthreads(); + } + while (Q2_len > 0); +} + + +void propagateTags(EventDataHolder & holder, Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) +{ + splitter_tag_propagation <<< 1, 2 * DefaultBlockSize>>>(instance_data.m_geometry_dev, + holder.m_cell_state_dev, + holder.m_clusters_dev, + temps); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); + } + +} + +/***********************************************************************/ + + +static __global__ void refill_clusters(const Helpers::CUDA_kernel_object<GeometryArr> d_fullcalogeometry, + Helpers::CUDA_kernel_object<ClusterInfoArr> d_fullclusters, + Helpers::CUDA_kernel_object<CellStateArr> d_cellstate, + Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temporaries) +{ + unsigned int i = blockIdx.x * blockDim.x + threadIdx.x; + + if (i >= NCaloCells) + { + return; + } + + /* reset all clusters to 0 */ + /* + if (i < NMaxClusters) { + d_fullclusters->clusterSize[i] = 0; + d_fullclusters->clusterEnergy[i] = 0; + d_fullclusters->clusterEt[i] = 0; + d_fullclusters->clusterEta[i] = 0; + } + */ + + int tag = temporaries->tags[i]; + + /* set the seed tags accordingly to what we found in splitter algorithm */ + if (tag >= 0) + { + d_cellstate->clusterTag[i] = ClusterTag::make_tag(tag); + } + else + { + tag = -1; + d_cellstate->clusterTag[i] = ClusterTag::make_invalid_tag(); + } + + //NSF: As there's no synchronization, there might be trouble between the zeroing and the calculation... + + /* + if (tag >= 0) { + float energy = d_fullclusters->cellSN2[i]; + atomicAdd(&d_fullclusters->clusterEnergy[tag], energy); + atomicAdd(&d_fullclusters->clusterEt[tag], abs(energy)); + atomicAdd(&d_fullclusters->clusterEta[tag], d_fullcalogeometry->eta[i] * abs(energy)); + + // TODO: why? + float phi0 = d_fullcalogeometry->phi[i]; + float phi = phi0; + if (phi > phi0 + M_PI) + phi = phi - 2 * M_PI; + if (phi < phi0 - M_PI) + phi = phi + 2 * M_PI; + atomicAdd(&d_fullclusters->clusterPhi[tag], phi * abs(energy)); + } + */ +} + +void refillClusters(EventDataHolder & holder, Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize) +{ + const int block_size = DefaultBlockSize; + const int num_blocks = Helpers::int_ceil_div(NCaloCells, block_size); + + dim3 bsize(block_size, 1, 1); + dim3 gsize(num_blocks, 1, 1); + + refill_clusters <<< gsize, bsize>>>(instance_data.m_geometry_dev, holder.m_clusters_dev, + holder.m_cell_state_dev, temps); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); + } +} diff --git a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.h b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.h index af5b2fb5dd0f11b41e13b04a5189bc91c1a651d2..d9cc1dfd5ea6b2e9888f5a3b3140ba482d4fa022 100644 --- a/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.h +++ b/Calorimeter/CaloRecGPU/src/CaloTopoClusterSplitterGPUImpl.h @@ -1,93 +1,91 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_CUDA_H -#define CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_CUDA_H - -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/DataHolders.h" - -struct GPUSplitterTemporaries -{ - int max_cells[CaloRecGPU::NCaloCells]; - int secondary_max_cells[CaloRecGPU::NCaloCells]; - int queue1[CaloRecGPU::NCaloCells]; - int queue2[CaloRecGPU::NCaloCells]; - int tags[CaloRecGPU::NCaloCells]; - - int splitter_seeds[CaloRecGPU::NMaxClusters]; - int secondary_splitter_seeds[CaloRecGPU::NMaxClusters]; - -}; - -struct CaloTopoClusterSplitterMetadata -{ - //int m_minSampling; - //int m_maxSampling; - //int m_minSecondarySampling; - //int m_maxSecondarySampling; - - /* We can have up to 64 sample values stored in this bitfield. - * At this moment, we have enough space to accomodate all the - * samples but it might need to be "enlarged" in the future - * - * This is a bitfield and each bit on position pos tells if - * the sample with id = pos can be used. - */ - unsigned long long m_useSampling; - unsigned long long m_useSecondarySampling; - - //unsigned int m_hashMin; - //unsigned int m_hashMax; - - int m_nCells; - int m_nOption; - float m_minEnergy; - float m_emShowerScale; - bool m_shareBorderCells; - bool m_absOpt; - - - constexpr bool uses_sampling(const int sampling) const - { - return (m_useSampling >> sampling) & 1; - } - constexpr bool uses_secondary_sampling(const int sampling) const - { - return (m_useSecondarySampling >> sampling) & 1; - } -}; - -struct GPUSplitterTemporariesHolder -{ - //Helpers::CPU_object<TopoAutomatonTemporaries> m_temporaries; - - CaloRecGPU::Helpers::CUDA_object<GPUSplitterTemporaries> m_temporaries_dev; - - void allocate(); -}; - -struct GPUSplitterOptionsHolder -{ - CaloRecGPU::Helpers::CPU_object<CaloTopoClusterSplitterMetadata> m_options; - - CaloRecGPU::Helpers::CUDA_object<CaloTopoClusterSplitterMetadata> m_options_dev; - - void allocate(); - void sendToGPU(const bool clear_CPU = true); -}; - -void preProcessingPreparation(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); - -void findLocalMaxima(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); - -void propagateTags(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); - -void refillClusters(EventDataHolder & holder, GPUSplitterTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); - +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_CUDA_H +#define CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_CUDA_H + +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/DataHolders.h" + +struct GPUSplitterTemporaries +{ + int max_cells[CaloRecGPU::NCaloCells]; + int secondary_max_cells[CaloRecGPU::NCaloCells]; + int queue1[CaloRecGPU::NCaloCells]; + int queue2[CaloRecGPU::NCaloCells]; + int tags[CaloRecGPU::NCaloCells]; + + int splitter_seeds[CaloRecGPU::NMaxClusters]; + int secondary_splitter_seeds[CaloRecGPU::NMaxClusters]; + +}; + +struct CaloTopoClusterSplitterMetadata +{ + //int m_minSampling; + //int m_maxSampling; + //int m_minSecondarySampling; + //int m_maxSecondarySampling; + + /* We can have up to 64 sample values stored in this bitfield. + * At this moment, we have enough space to accomodate all the + * samples but it might need to be "enlarged" in the future + * + * This is a bitfield and each bit on position pos tells if + * the sample with id = pos can be used. + */ + unsigned long long m_useSampling; + unsigned long long m_useSecondarySampling; + + //unsigned int m_hashMin; + //unsigned int m_hashMax; + + int m_nCells; + int m_nOption; + float m_minEnergy; + float m_emShowerScale; + bool m_shareBorderCells; + bool m_absOpt; + bool m_treatL1PredictedCellsAsGood; + + + constexpr bool uses_sampling(const int sampling) const + { + return (m_useSampling >> sampling) & 1; + } + constexpr bool uses_secondary_sampling(const int sampling) const + { + return (m_useSecondarySampling >> sampling) & 1; + } +}; + +struct GPUSplitterOptionsHolder +{ + CaloRecGPU::Helpers::CPU_object<CaloTopoClusterSplitterMetadata> m_options; + + CaloRecGPU::Helpers::CUDA_object<CaloTopoClusterSplitterMetadata> m_options_dev; + + void allocate(); + void sendToGPU(const bool clear_CPU = true); +}; + +void preProcessingPreparation(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); + +void findLocalMaxima(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); + +void propagateTags(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); + +void refillClusters(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<GPUSplitterTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const GPUSplitterOptionsHolder & options, const bool synchronize = false); + #endif //CALORECGPU_CALOTOPOCLUSTERSPLITTERGPU_CUDA_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/DataHolders.cu b/Calorimeter/CaloRecGPU/src/DataHolders.cu index 7ae85039aab67b2abe301d1e07bf84e58b514049..b13c7411e64e6e9ba08976f9e6da4cfeff9650c7 100644 --- a/Calorimeter/CaloRecGPU/src/DataHolders.cu +++ b/Calorimeter/CaloRecGPU/src/DataHolders.cu @@ -1,10 +1,14 @@ -/* -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// #include "CaloRecGPU/DataHolders.h" -void ConstantDataHolder::sendToGPU(const bool clear_CPU) +#include "MacroHelpers.h" + +void CaloRecGPU::ConstantDataHolder::sendToGPU(const bool clear_CPU) { m_cell_noise_dev = m_cell_noise; m_geometry_dev = m_geometry; @@ -15,7 +19,9 @@ void ConstantDataHolder::sendToGPU(const bool clear_CPU) } } -void EventDataHolder::sendToGPU(const bool clear_CPU, const bool has_state, const bool has_clusters, const bool has_pairs) +void CaloRecGPU::EventDataHolder::sendToGPU(const bool clear_CPU, const bool has_state, + const bool has_clusters, const bool has_pairs, + const bool has_moments) { m_cell_info_dev = m_cell_info; if (has_state) @@ -42,6 +48,14 @@ void EventDataHolder::sendToGPU(const bool clear_CPU, const bool has_state, cons { m_pairs_dev.allocate(); } + if (has_moments) + { + m_moments_dev = m_moments; + } + else + { + m_moments_dev.allocate(); + } if (!has_clusters) { @@ -60,31 +74,211 @@ void EventDataHolder::sendToGPU(const bool clear_CPU, const bool has_state, cons m_cell_info.clear(); m_cell_state.clear(); m_pairs.clear(); + m_moments.clear(); } } -void EventDataHolder::returnToCPU(const bool clear_GPU, const bool return_clusters) +void CaloRecGPU::EventDataHolder::returnToCPU(const bool clear_GPU, + const bool return_cells, + const bool return_clusters, + const bool return_moments) { - m_cell_state = m_cell_state_dev; + if (return_cells) + { + m_cell_state = m_cell_state_dev; + } if (return_clusters) { m_clusters = m_clusters_dev; } + if (return_moments) + { + m_moments = m_moments_dev; + } if (clear_GPU) { m_cell_state_dev.clear(); m_clusters_dev.clear(); m_pairs_dev.clear(); m_cell_info_dev.clear(); + m_moments_dev.clear(); } } -void EventDataHolder::allocate(const bool also_GPU) + + +void CaloRecGPU::EventDataHolder::returnCellsToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + cudaMemcpyAsync((CaloRecGPU::CellStateArr *) m_cell_state, + (CaloRecGPU::CellStateArr *) m_cell_state_dev, + sizeof(CaloRecGPU::CellStateArr), + cudaMemcpyDeviceToHost, stream_to_use); +} + +void CaloRecGPU::EventDataHolder::returnClustersToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + cudaMemcpyAsync((CaloRecGPU::ClusterInfoArr *) m_clusters, + (CaloRecGPU::ClusterInfoArr *) m_clusters_dev, + sizeof(CaloRecGPU::ClusterInfoArr), + cudaMemcpyDeviceToHost, stream_to_use); +} + +void CaloRecGPU::EventDataHolder::returnMomentsToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + cudaMemcpyAsync((CaloRecGPU::ClusterMomentsArr *) m_moments, + (CaloRecGPU::ClusterMomentsArr *) m_moments_dev, + sizeof(CaloRecGPU::ClusterMomentsArr), + cudaMemcpyDeviceToHost, stream_to_use); +} + +void CaloRecGPU::EventDataHolder::returnClusterNumberToCPU(CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + cudaMemcpyAsync(&(m_clusters->number), &(m_clusters_dev->number), sizeof(int), cudaMemcpyDeviceToHost, stream_to_use); +} + + +#define CALORECGPU_ASYNC_TRANSFER_HELPER(OBJ, MEMBER, TYPE, NUM, STREAM) \ + CUDA_ERRCHECK( cudaMemcpyAsync ( &( OBJ -> MEMBER [0]), \ + &( OBJ ## _dev -> MEMBER [0]), \ + sizeof(TYPE) * (NUM), \ + cudaMemcpyDeviceToHost, \ + STREAM ) ); + +#define CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(OBJ, MEMBER, TYPE, NUM, STREAM) \ + for (int sampling = 0; sampling < NumSamplings; ++sampling) \ + { \ + CUDA_ERRCHECK( cudaMemcpyAsync ( &( OBJ -> MEMBER [sampling][0]), \ + &( OBJ ## _dev -> MEMBER [sampling][0]), \ + sizeof(TYPE) * (NUM), \ + cudaMemcpyDeviceToHost, \ + STREAM ) ); \ + } + +//I almost felt tempted to do some +//variadic structured binding magic +//and compile time stuff +//to allow us to convert on-the-fly +//like this per-struct-member +//directly from the helpers. +//Emphasis on almost. +//Let's just hope for C++26... + +void CaloRecGPU::EventDataHolder::returnSomeClustersToCPU(const size_t num_clusters, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + //We assume the cluster number we take is the known number of clusters, + //so we skip copying that. + + CALORECGPU_ASYNC_TRANSFER_HELPER( m_clusters, clusterEnergy, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_clusters, clusterEt, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_clusters, clusterEta, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_clusters, clusterPhi, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_clusters, seedCellID, int, num_clusters, stream_to_use); +} + +void CaloRecGPU::EventDataHolder::returnSomeMomentsToCPU(const size_t num_clusters, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, energyPerSample, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, maxEPerSample, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, maxPhiPerSample, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, maxEtaPerSample, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, etaPerSample, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, phiPerSample, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, time, float, num_clusters, stream_to_use); + + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, firstPhi, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, firstEta, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, secondR, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, secondLambda, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, deltaPhi, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, deltaTheta, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, deltaAlpha, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, centerX, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, centerY, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, centerZ, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, centerMag, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, centerLambda, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, lateral, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, longitudinal, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engFracEM, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engFracMax, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engFracCore, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, firstEngDens, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, secondEngDens, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, isolation, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engBadCells, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, nBadCells, int, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, nBadCellsCorr, int, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, badCellsCorrE, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, badLArQFrac, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engPos, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, significance, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, cellSignificance, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, cellSigSampling, int, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, avgLArQ, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, avgTileQ, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engBadHVCells, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, nBadHVCells, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, PTD, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, mass, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, EMProbability, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, hadWeight, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, OOCweight, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, DMweight, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, tileConfidenceLevel, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, secondTime, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, nBadHVCells, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_PER_SAMPLE_HELPER(m_moments, nCellSampling, int, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, nExtraCellSampling, int, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, numCells, int, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, vertexFraction, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, nVertexFraction, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, etaCaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, etaCaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, phiCaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, eta1CaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, phi1CaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, eta2CaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, phi2CaloFrame, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibTot, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibOutL, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibOutM, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibOutT, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadL, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadM, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadT, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadT, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibEMB0, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibEME0, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibTileG3, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadTot, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadEMB0, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadTile0, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadTileG3, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadEME0, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadHEC0, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadFCAL, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadLeakage, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibDeadUnclass, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibFracEM, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibFracHad, float, num_clusters, stream_to_use); + CALORECGPU_ASYNC_TRANSFER_HELPER( m_moments, engCalibFracRest, float, num_clusters, stream_to_use); +} + +void CaloRecGPU::EventDataHolder::allocate(const bool also_GPU) { m_cell_info.allocate(); m_cell_state.allocate(); m_pairs.allocate(); m_clusters.allocate(); + m_moments.allocate(); if (also_GPU) { @@ -92,5 +286,15 @@ void EventDataHolder::allocate(const bool also_GPU) m_cell_state_dev.allocate(); m_pairs_dev.allocate(); m_clusters_dev.allocate(); + m_moments_dev.allocate(); } -} \ No newline at end of file +} + +void CaloRecGPU::EventDataHolder::clear_GPU() +{ + m_cell_info_dev.clear(); + m_cell_state_dev.clear(); + m_pairs_dev.clear(); + m_clusters_dev.clear(); + m_moments_dev.clear(); +} diff --git a/Calorimeter/CaloRecGPU/src/ExtraTagDefinitions.h b/Calorimeter/CaloRecGPU/src/ExtraTagDefinitions.h new file mode 100644 index 0000000000000000000000000000000000000000..ae8bfb65586badb6b2acebe3c4ee521e56203dcd --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/ExtraTagDefinitions.h @@ -0,0 +1,645 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_EXTRATAGDEFINITIONS_H +#define CALORECGPU_EXTRATAGDEFINITIONS_H + +#include <cstdint> +#include "CaloRecGPU/TagDefinitions.h" + +//This holds several possible definitions for tags, +//used throughout development (in particular of the splitter). +//The current implementation only really uses Tag_1_1_12_32_18, +//but it could be relevant to keep the others here too +//for possible future changes to the algorithms... + + +namespace CaloRecGPU +{ + + /*! @class GenericTagBase + + A base class to implement the constructor, destructor and conversion operators. + */ + struct GenericTagBase + { + public: + + using carrier = CaloRecGPU::TagBase::carrier; + //uint64_t is unsigned long long int in CUDA. + + carrier value; + + constexpr operator carrier () const + { + return value; + } + + constexpr GenericTagBase (const carrier v): value(v) + { + } + + constexpr GenericTagBase & operator = (const carrier v) + { + value = v; + return (*this); + } + + [[nodiscard]] static constexpr carrier make_invalid_tag() + { + return 0ULL; + } + }; + + /*! @class Tag_1_30_18_15 + + A tag with a bit flag, then 30 bit (intended for a truncated float), + 18 bit (for a cell index) and 15 bit (for a cluster index). + */ + struct Tag_1_30_18_15 : public GenericTagBase + { + public: + + using GenericTagBase::GenericTagBase; + + protected: + + constexpr static carrier s_one_bit_mask = 0x8000000000000000ULL; + constexpr static carrier s_30_bit_mask = 0x7FFFFFFE00000000ULL; + constexpr static carrier s_18_bit_mask = 0x00000001FFFF8000ULL; + constexpr static carrier s_15_bit_mask = 0x0000000000007FFFULL; + + public: + + [[nodiscard]] constexpr bool get_flag() const + { + return value & s_one_bit_mask; + } + + [[nodiscard]] constexpr uint32_t get_30_bits() const + { + return (value & s_30_bit_mask) >> 33; + } + + [[nodiscard]] constexpr uint32_t get_18_bits() const + { + return (value & s_18_bit_mask) >> 15; + } + + [[nodiscard]] constexpr uint32_t get_15_bits() const + { + return (value & s_15_bit_mask); + } + + [[nodiscard]] static constexpr carrier make_generic_tag(const uint16_t bits_15, const uint32_t bits_18, const uint32_t bits_30, const bool flag) + { + constexpr uint32_t thirty_bits_mask = 0x3FFFFFFFU; + constexpr uint32_t eighteen_bits_mask = 0x3FFFF ; + constexpr uint16_t fifteen_bits_mask = 0x7FFFU; + + carrier ret = bits_30 & thirty_bits_mask; + + ret = (ret << 18) | (bits_18 & eighteen_bits_mask); + + ret = (ret << 15) | (bits_15 & fifteen_bits_mask); + + ret = ret | (s_one_bit_mask * flag); + + return ret; + } + + }; + + + /*! @class Tag_1_1_12_16_18_16 + + A tag with two bit flags, then 12 bits (for a counter), + 16 bits (for a half-precision float), 18 bits (for a cell index) + and 16 bits (for a cluster index) + + */ + struct Tag_1_1_12_16_18_16 : public GenericTagBase + { + public: + + using GenericTagBase::GenericTagBase; + + protected: + + constexpr static carrier s_first_flag_mask = 0x8000000000000000ULL; + constexpr static carrier s_second_flag_mask = 0x4000000000000000ULL; + constexpr static carrier s_12_bit_mask = 0x3FFC000000000000ULL; + constexpr static carrier s_first_16_bit_mask = 0x0003FFFC00000000ULL; + constexpr static carrier s_18_bit_mask = 0x00000003FFFF0000ULL; + constexpr static carrier s_second_16_bit_mask = 0x000000000000FFFFULL; + + constexpr static unsigned int s_second_16_bit_offset = 0; + constexpr static unsigned int s_18_bit_offset = s_second_16_bit_offset + 16; + constexpr static unsigned int s_first_16_bit_offset = s_18_bit_offset + 18; + constexpr static unsigned int s_12_bit_offset = s_first_16_bit_offset + 16; + + public: + + [[nodiscard]] constexpr bool get_first_flag() const + { + return value & s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier set_first_flag() const + { + return value | s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_first_flag() const + { + return value & (~s_first_flag_mask); + } + + [[nodiscard]] constexpr bool get_second_flag() const + { + return value & s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier set_second_flag() const + { + return value | s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_second_flag() const + { + return value & (~s_second_flag_mask); + } + + [[nodiscard]] constexpr uint32_t get_12_bits() const + { + return (value & s_12_bit_mask) >> s_12_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_first_16_bits() const + { + return (value & s_first_16_bit_mask) >> s_first_16_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_18_bits() const + { + return (value & s_18_bit_mask) >> s_18_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_second_16_bits() const + { + return (value & s_second_16_bit_mask) >> s_second_16_bit_offset; + } + + [[nodiscard]] static constexpr carrier make_generic_tag(const uint16_t second_bits_16, const uint32_t bits_18, + const uint16_t first_bits_16, const uint16_t bits_12, + const bool flag_2, const bool flag_1 ) + { + constexpr uint16_t twelve_bits_mask = 0xFFFU; + constexpr uint32_t eighteen_bits_mask = 0x3FFFFU; + + carrier ret = bits_12 & twelve_bits_mask; + + ret = (ret << 16) | first_bits_16; + + ret = (ret << 18) | (bits_18 & eighteen_bits_mask); + + ret = (ret << 16) | second_bits_16; + + ret = ret | (s_second_flag_mask * flag_2) | (s_first_flag_mask * flag_1); + + return ret; + } + + }; + + + /*! @class Tag_1_1_7_31_8_16 + + A tag with two bit flags, then 7 bits (for a counter), + 31 bits (for a float with one bit shaved off), 8 bits (for an extra factor) + and 16 bits (for a cluster index) + + */ + struct Tag_1_1_7_31_8_16 : public GenericTagBase + { + public: + + using GenericTagBase::GenericTagBase; + + protected: + + constexpr static carrier s_first_flag_mask = 0x8000000000000000ULL; + constexpr static carrier s_second_flag_mask = 0x4000000000000000ULL; + constexpr static carrier s_7_bit_mask = 0x3F80000000000000ULL; + constexpr static carrier s_31_bit_mask = 0x007FFFFFFF000000ULL; + constexpr static carrier s_8_bit_mask = 0x0000000000FF0000ULL; + constexpr static carrier s_16_bit_mask = 0x000000000000FFFFULL; + + constexpr static unsigned int s_16_bit_offset = 0; + constexpr static unsigned int s_8_bit_offset = s_16_bit_offset + 16; + constexpr static unsigned int s_31_bit_offset = s_8_bit_offset + 8; + constexpr static unsigned int s_7_bit_offset = s_31_bit_offset + 31; + + public: + + [[nodiscard]] constexpr bool get_first_flag() const + { + return value & s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier set_first_flag() const + { + return value | s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_first_flag() const + { + return value & (~s_first_flag_mask); + } + + [[nodiscard]] constexpr bool get_second_flag() const + { + return value & s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier set_second_flag() const + { + return value | s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier make_first_flag(const bool flag) const + { + return (value & (~(s_first_flag_mask * (!flag)))) | (s_first_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier make_second_flag(const bool flag) const + { + return (value & (~(s_second_flag_mask * (!flag)))) | (s_second_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier unset_second_flag() const + { + return value & (~s_second_flag_mask); + } + + [[nodiscard]] constexpr uint32_t get_7_bits() const + { + return (value & s_7_bit_mask) >> s_7_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_31_bits() const + { + return (value & s_31_bit_mask) >> s_31_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_8_bits() const + { + return (value & s_8_bit_mask) >> s_8_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_16_bits() const + { + return (value & s_16_bit_mask) >> s_16_bit_offset; + } + + [[nodiscard]] static constexpr carrier make_generic_tag(const uint16_t bits_16, const uint8_t bits_8, + const uint32_t bits_31, const uint8_t bits_7, + const bool flag_2, const bool flag_1 ) + { + constexpr uint32_t bits_31_mask = 0x7FFFFFFFU; + constexpr uint8_t bits_7_mask = 0x7FU; + + carrier ret = bits_7 & bits_7_mask; + + ret = (ret << 31) | (bits_31 & bits_31_mask); + + ret = (ret << 8) | bits_8; + + ret = (ret << 16) | bits_16; + + ret = ret | (s_second_flag_mask * flag_2) | (s_first_flag_mask * flag_1); + + return ret; + } + + }; + + + /*! @class Tag_1_7_1_31_8_16 + + A tag with a bit flag, then 7 bits (for a counter), then another bit flag, + 31 bits (for a float with one bit shaved off), 8 bits (for an extra factor) + and 16 bits (for a cluster index) + + */ + struct Tag_1_7_1_31_8_16 : public GenericTagBase + { + public: + + using GenericTagBase::GenericTagBase; + + protected: + + constexpr static carrier s_first_flag_mask = 0x8000000000000000ULL; + constexpr static carrier s_7_bit_mask = 0x7F00000000000000ULL; + constexpr static carrier s_second_flag_mask = 0x0080000000000000ULL; + constexpr static carrier s_31_bit_mask = 0x007FFFFFFF000000ULL; + constexpr static carrier s_8_bit_mask = 0x0000000000FF0000ULL; + constexpr static carrier s_16_bit_mask = 0x000000000000FFFFULL; + + constexpr static unsigned int s_16_bit_offset = 0; + constexpr static unsigned int s_8_bit_offset = s_16_bit_offset + 16; + constexpr static unsigned int s_31_bit_offset = s_8_bit_offset + 8; + constexpr static unsigned int s_7_bit_offset = s_31_bit_offset + 31 + 1; + + public: + + [[nodiscard]] constexpr bool get_first_flag() const + { + return value & s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier set_first_flag() const + { + return value | s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_first_flag() const + { + return value & (~s_first_flag_mask); + } + + [[nodiscard]] constexpr bool get_second_flag() const + { + return value & s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier set_second_flag() const + { + return value | s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_second_flag() const + { + return value & (~s_second_flag_mask); + } + + [[nodiscard]] constexpr carrier make_first_flag(const bool flag) const + { + return (value & (~(s_first_flag_mask * (!flag)))) | (s_first_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier make_second_flag(const bool flag) const + { + return (value & (~(s_second_flag_mask * (!flag)))) | (s_second_flag_mask * flag); + } + + [[nodiscard]] constexpr uint32_t get_7_bits() const + { + return (value & s_7_bit_mask) >> s_7_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_31_bits() const + { + return (value & s_31_bit_mask) >> s_31_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_8_bits() const + { + return (value & s_8_bit_mask) >> s_8_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_16_bits() const + { + return (value & s_16_bit_mask) >> s_16_bit_offset; + } + + [[nodiscard]] static constexpr carrier make_generic_tag(const uint16_t bits_16, const uint8_t bits_8, + const uint32_t bits_31, const uint8_t bits_7, + const bool flag_2, const bool flag_1 ) + { + constexpr uint32_t bits_31_mask = 0x7FFFFFFFU; + constexpr uint8_t bits_7_mask = 0x7FU; + + carrier ret = bits_7 & bits_7_mask; + + ret = (ret << 32) | (bits_31 & bits_31_mask); + + ret = (ret << 8) | bits_8; + + ret = (ret << 16) | bits_16; + + ret = ret | (s_second_flag_mask * flag_2) | (s_first_flag_mask * flag_1); + + return ret; + } + + }; + + + /*! @class Tag_1_1_12_32_18 + + A tag with two bit flags, then 12 bits (for a counter), + 32 bits (for a float) and 18 bits (for a cell index) + + */ + struct Tag_1_1_12_32_18 : public GenericTagBase + { + public: + + using GenericTagBase::GenericTagBase; + + protected: + + constexpr static carrier s_first_flag_mask = 0x8000000000000000ULL; + constexpr static carrier s_second_flag_mask = 0x4000000000000000ULL; + constexpr static carrier s_12_bit_mask = 0x3FFC000000000000ULL; + constexpr static carrier s_32_bit_mask = 0x0003FFFFFFFC0000ULL; + constexpr static carrier s_18_bit_mask = 0x000000000003FFFFULL; + + constexpr static unsigned int s_18_bit_offset = 0; + constexpr static unsigned int s_32_bit_offset = s_18_bit_offset + 18; + constexpr static unsigned int s_12_bit_offset = s_32_bit_offset + 32; + + public: + + [[nodiscard]] constexpr bool get_first_flag() const + { + return value & s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier set_first_flag() const + { + return value | s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_first_flag() const + { + return value & (~s_first_flag_mask); + } + + [[nodiscard]] constexpr bool get_second_flag() const + { + return value & s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier set_second_flag() const + { + return value | s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier make_first_flag(const bool flag) const + { + return (value & (~(s_first_flag_mask * (!flag)))) | (s_first_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier make_second_flag(const bool flag) const + { + return (value & (~(s_second_flag_mask * (!flag)))) | (s_second_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier unset_second_flag() const + { + return value & (~s_second_flag_mask); + } + + [[nodiscard]] constexpr uint32_t get_12_bits() const + { + return (value & s_12_bit_mask) >> s_12_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_32_bits() const + { + return (value & s_32_bit_mask) >> s_32_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_18_bits() const + { + return (value & s_18_bit_mask) >> s_18_bit_offset; + } + + [[nodiscard]] static constexpr carrier make_generic_tag(const uint32_t bits_18, const uint32_t bits_32, + const uint32_t bits_12, const bool flag_2, const bool flag_1 ) + { + constexpr uint32_t bits_18_mask = 0x0003FFFFU; + constexpr uint32_t bits_12_mask = 0x00000FFFU; + + carrier ret = bits_12 & bits_12_mask; + + ret = (ret << 32) | bits_32; + + ret = (ret << 18) | (bits_18 & bits_18_mask); + + ret = ret | (s_second_flag_mask * flag_2) | (s_first_flag_mask * flag_1); + + return ret; + } + + }; + + /*! @class Tag_1_12_1_32_18 + + A tag with a bit flag, then 12 bits (for a counter), + then another bit flag, then 32 bits (for a float) + and finally 18 bits (for a cell index) + + */ + struct Tag_1_12_1_32_18 : public GenericTagBase + { + public: + + using GenericTagBase::GenericTagBase; + + protected: + + constexpr static carrier s_first_flag_mask = 0x8000000000000000ULL; + constexpr static carrier s_12_bit_mask = 0x7FF8000000000000ULL; + constexpr static carrier s_second_flag_mask = 0x0004000000000000ULL; + constexpr static carrier s_32_bit_mask = 0x0003FFFFFFFC0000ULL; + constexpr static carrier s_18_bit_mask = 0x000000000003FFFFULL; + + constexpr static unsigned int s_18_bit_offset = 0; + constexpr static unsigned int s_32_bit_offset = s_18_bit_offset + 18; + constexpr static unsigned int s_12_bit_offset = s_32_bit_offset + 32 + 1; + + public: + + [[nodiscard]] constexpr bool get_first_flag() const + { + return value & s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier set_first_flag() const + { + return value | s_first_flag_mask; + } + + [[nodiscard]] constexpr carrier unset_first_flag() const + { + return value & (~s_first_flag_mask); + } + + [[nodiscard]] constexpr bool get_second_flag() const + { + return value & s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier set_second_flag() const + { + return value | s_second_flag_mask; + } + + [[nodiscard]] constexpr carrier make_first_flag(const bool flag) const + { + return (value & (~(s_first_flag_mask * (!flag)))) | (s_first_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier make_second_flag(const bool flag) const + { + return (value & (~(s_second_flag_mask * (!flag)))) | (s_second_flag_mask * flag); + } + + [[nodiscard]] constexpr carrier unset_second_flag() const + { + return value & (~s_second_flag_mask); + } + + [[nodiscard]] constexpr uint32_t get_12_bits() const + { + return (value & s_12_bit_mask) >> s_12_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_32_bits() const + { + return (value & s_32_bit_mask) >> s_32_bit_offset; + } + + [[nodiscard]] constexpr uint32_t get_18_bits() const + { + return (value & s_18_bit_mask) >> s_18_bit_offset; + } + + [[nodiscard]] static constexpr carrier make_generic_tag(const uint32_t bits_18, const uint32_t bits_32, + const uint32_t bits_12, const bool flag_2, const bool flag_1 ) + { + constexpr uint32_t bits_18_mask = 0x0003FFFFU; + constexpr uint32_t bits_12_mask = 0x00000FFFU; + + carrier ret = bits_12 & bits_12_mask; + + ret = (ret << 33) | bits_32; + + ret = (ret << 18) | (bits_18 & bits_18_mask); + + ret = ret | (s_second_flag_mask * flag_2) | (s_first_flag_mask * flag_1); + + return ret; + } + + }; +} + +#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/FPHelpers.h b/Calorimeter/CaloRecGPU/src/FPHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..eb7b1ac722eeece45799b94564c88b28d4307a0c --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/FPHelpers.h @@ -0,0 +1,1101 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_FPHELPERS_H +#define CALORECGPU_FPHELPERS_H + +#ifndef CALORECGPU_INCLUDE_CUDA_SUPPORT + + #define CALORECGPU_INCLUDE_CUDA_SUPPORT 1 + + //If CUDA is available, we will support its native floating point operations. + //We can disable this by defining CALORECGPU_INCLUDE_CUDA_SUPPORT as 0... + +#endif + +#include <cstdint> +#include <climits> +#include <cstring> + +#if defined (__CUDA_ARCH__) && CALORECGPU_INCLUDE_CUDA_SUPPORT + + #include "cuda_fp16.h" + + #include "cuda_bf16.h" + +#endif + +#if __cpp_lib_bitops + + #include <bit> + +#endif + + +/** @file FPHelpers.h + * Contains functions to deal with arbitrary IEEE754-like floating point formats. + */ + +//In its current form, it is really only used +//to provide to_total_ordering for floats +//used in the GPU. For a while (before we +//came up with the current tag assignment +//for the splitter), it provided us with +//several utilities to emulate less precise +//floating point numbers so we could +//squash the energy of the tags... + +namespace FloatingPointHelpers +{ + + /*! @enum RoundingModes + * Specifies the rounding mode to use for the operations. + */ + enum class RoundingModes + { + ToPlusInfinity, ToMinusInfinity, ToZero, ToNearestEven, ToNearestAwayFromZero, Default = ToNearestEven + }; + + namespace LeadingZerosPortability + { + +#if __cpp_lib_bitops + + template <class T> + inline static constexpr unsigned int count_leading_zeros(const T num) + { + return std::countl_zero(num); + } + +#else + + template <class T> + inline static constexpr unsigned int count_leading_zeros(const T num) + //I know this could be greatly optimized. + //The point is, either pray for the compiler's smartness + //or replace this with a non-portable built-in + //whenever / wherever necessary... + { + T probe = T(1) << (sizeof(T) * CHAR_BIT - 1); + unsigned int ret = 0; + while ((num & probe) == 0 && probe) + { + ++ret; + probe >>= 1; + } + return ret; + } + +#endif + +#define CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(ATTRIB, TYPE, BUILTIN) \ + template<> \ + ATTRIB inline unsigned int count_leading_zeros(const TYPE num) \ + { \ + if (!num) \ + { \ + return sizeof(TYPE) * CHAR_BIT; \ + } \ + return BUILTIN(num); \ + } \ + + + +#if defined (__CUDA_ARCH__) && CALORECGPU_INCLUDE_CUDA_SUPPORT + + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(__device__, int, __clz) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(__device__, unsigned int, __clz) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(__device__, long long, __clzll) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(__device__, unsigned long long, __clzll) + + +#elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, int, __builtin_clz) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, unsigned int, __builtin_clz) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, long, __builtin_clzl) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, unsigned long, __builtin_clzl) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, long long, __builtin_clzll) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, unsigned long long, __builtin_clzll) + + +#if defined(__clang__) + + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, short, __builtin_clzs) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(constexpr, unsigned short, __builtin_clzs) + +#endif + + +#elif defined(_MSC_VER) + + + } +} + +#include <intrin.h> + +namespace FloatingPointHelpers +{ + namespace LeadingZerosPortability + { + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(, unsigned short, __lzcnt16) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(, unsigned int, __lzcnt) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(, short, __lzcnt16) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(, int, __lzcnt) + +#if defined(_WIN64) + + //__lzcnt64 is only available in 64 bit, I think? + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(, unsigned long long int, __lzcnt64) + + CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER(, long long int, __lzcnt64) + +#else + template <> + inline unsigned long long int count_leading_zeros<unsigned long long int>(unsigned long long int T num) + { + const auto res_1 = count_leading_zeros<unsigned int>(num >> 32); + return res_1 + (res_1 == 32) * count_leading_zeros<unsigned int>(num); + } + + template <> + inline long long int count_leading_zeros<long long int>(long long int T num) + { + return count_leading_zeros<unsigned long long int>(num); + } + +#endif + + +#endif + + //We could add more compilers here if needed, + //but the "big three" and CUDA should already be covered. + +#undef CALORECGPU_MULTIPLE_PORTABILITY_CLZ_FUNC_HELPER + + } + + namespace OperatorsHelper + { + //Left and right shifts larger than the variable size are UB. + + template <class T> + inline static constexpr T safe_lshift(const T x, const T amount) + { + const bool valid = amount < sizeof(T) * CHAR_BIT; + return (x << (amount * valid)) * valid; + } + + template <class T> + inline static constexpr T safe_rshift(const T x, const T amount) + { + const bool valid = amount < sizeof(T) * CHAR_BIT; + return (x >> (amount * valid)) * valid; + } + + //To prevent underflow for unsigned variables + template <class T> + inline static constexpr T clamped_sub(const T x1, const T x2) + { + return (x1 - x2) * (x1 >= x2); + } + + template <class T> + inline static constexpr T min(const T x1, const T x2) + { + return (x1 > x2) * x2 + (x1 <= x2) * x1; + } + + template <class T> + inline static constexpr T max(const T x1, const T x2) + { + return (x1 > x2) * x1 + (x1 <= x2) * x2; + } + + template <class T> + inline static constexpr T clamp(const T x, const T low, const T high) + { + return low * (x < low) + high * (x > high) + x * (x >= low && x <= high); + } + + //Just for occasional clarity with the arguments. + + template <class T> + inline static constexpr T bit_and(const T x1, const T x2) + { + return x1 & x2; + } + + template <class T> + inline static constexpr T bit_or(const T x1, const T x2) + { + return x1 | x2; + } + + } + + namespace BitCastHelper + { + +#if __cpp_lib_bit_cast + + + template <class To, class From> + constexpr inline static To bitcast(const From & x) + { + return bit_cast<To, From>(x); + } + +#else + + //The disadvantage here is that this won't be actually constexpr due to memcpy... + + template <class To, class From> + constexpr inline static To bitcast(const From & x) + { + To ret = 0; + std::memcpy(&ret, &x, sizeof(To)); + return ret; + } + +#endif + +#if defined (__CUDA_ARCH__) && CALORECGPU_INCLUDE_CUDA_SUPPORT + +#define CALORECGPU_CUDACAST_HELPER(TYPE_TO, TYPE_FROM, CONVFUNC) \ + template <> __device__ constexpr inline \ + TYPE_TO bitcast< TYPE_TO, TYPE_FROM >(const TYPE_FROM &x) \ + { \ + return CONVFUNC (x); \ + } \ + + + CALORECGPU_CUDACAST_HELPER( int64_t, double, __double_as_longlong ); + CALORECGPU_CUDACAST_HELPER( uint64_t, double, __double_as_longlong ); + CALORECGPU_CUDACAST_HELPER( double, int64_t, __longlong_as_double ); + CALORECGPU_CUDACAST_HELPER( double, uint64_t, __longlong_as_double ); + + CALORECGPU_CUDACAST_HELPER( int32_t, float, __float_as_int ); + CALORECGPU_CUDACAST_HELPER( uint32_t, float, __float_as_uint ); + CALORECGPU_CUDACAST_HELPER( int64_t, float, __float_as_uint ); + CALORECGPU_CUDACAST_HELPER( uint64_t, float, __float_as_uint ); + CALORECGPU_CUDACAST_HELPER( float, int32_t, __int_as_float ); + CALORECGPU_CUDACAST_HELPER( float, uint32_t, __uint_as_float ); + CALORECGPU_CUDACAST_HELPER( float, int64_t, __uint_as_float ); + CALORECGPU_CUDACAST_HELPER( float, uint64_t, __uint_as_float ); + + CALORECGPU_CUDACAST_HELPER( int16_t, __half, __half_as_short ); + CALORECGPU_CUDACAST_HELPER( uint16_t, __half, __half_as_ushort ); + CALORECGPU_CUDACAST_HELPER( int32_t, __half, __half_as_ushort ); + CALORECGPU_CUDACAST_HELPER( uint32_t, __half, __half_as_ushort ); + CALORECGPU_CUDACAST_HELPER( int64_t, __half, __half_as_ushort ); + CALORECGPU_CUDACAST_HELPER( uint64_t, __half, __half_as_ushort ); + CALORECGPU_CUDACAST_HELPER( __half, int16_t, __short_as_half ); + CALORECGPU_CUDACAST_HELPER( __half, uint16_t, __ushort_as_half ); + CALORECGPU_CUDACAST_HELPER( __half, int32_t, __ushort_as_half ); + CALORECGPU_CUDACAST_HELPER( __half, uint32_t, __ushort_as_half ); + CALORECGPU_CUDACAST_HELPER( __half, int64_t, __ushort_as_half ); + CALORECGPU_CUDACAST_HELPER( __half, uint64_t, __ushort_as_half ); + /* + CALORECGPU_CUDACAST_HELPER( int16_t, __nv_bfloat16, __bfloat16_as_short ); + CALORECGPU_CUDACAST_HELPER( uint16_t, __nv_bfloat16, __bfloat16_as_ushort ); + CALORECGPU_CUDACAST_HELPER( int32_t, __nv_bfloat16, __bfloat16_as_ushort ); + CALORECGPU_CUDACAST_HELPER( uint32_t, __nv_bfloat16, __bfloat16_as_ushort ); + CALORECGPU_CUDACAST_HELPER( int64_t, __nv_bfloat16, __bfloat16_as_ushort ); + CALORECGPU_CUDACAST_HELPER( uint64_t, __nv_bfloat16, __bfloat16_as_ushort ); + CALORECGPU_CUDACAST_HELPER( __nv_bfloat16, int16_t, __short_as_bfloat16 ); + CALORECGPU_CUDACAST_HELPER( __nv_bfloat16, uint16_t, __ushort_as_bfloat16 ); + CALORECGPU_CUDACAST_HELPER( __nv_bfloat16, int32_t, __ushort_as_bfloat16 ); + CALORECGPU_CUDACAST_HELPER( __nv_bfloat16, uint32_t, __ushort_as_bfloat16 ); + CALORECGPU_CUDACAST_HELPER( __nv_bfloat16, int64_t, __ushort_as_bfloat16 ); + CALORECGPU_CUDACAST_HELPER( __nv_bfloat16, uint64_t, __ushort_as_bfloat16 ); + + This is apparently not working?! Why?! + */ +#endif + + } + + + /*! @class IEEE754_like + Specifies a floating point format like those described in IEEE-754, + with an adjustable number of bits in the exponent and mantissa. + + @p tag just allows differing floating point definitions with the same size, + in case there are e. g. multiple implementations of native/faster + operations available. Tag 0 is reserved for the default (i. e. non-native) + implementation. + */ + template <unsigned int mantiss, unsigned int exp, unsigned int tag = 1> struct IEEE754_like + { + + static_assert(mantiss > 0 && exp > 0, "The exponent and mantissa must contain a positive number of bits!"); + + constexpr inline static unsigned int total_size_bits() + { + return mantiss + exp + 1; + } + + constexpr inline static unsigned int mantissa_size_bits() + { + return mantiss; + } + + constexpr inline static unsigned int exponent_size_bits() + { + return exp; + } + + template <class T> + constexpr inline static T mantissa_mask() + { + static_assert(sizeof(T) * CHAR_BIT >= (mantiss + exp + 1), + "The type must be large enough to hold the bit representation of the floating point." ); + T ret = (T(1) << mantiss) - 1; + return ret; + } + + template <class T> + constexpr inline static T exponent_mask() + { + static_assert(sizeof(T) * CHAR_BIT >= (mantiss + exp + 1), + "The type must be large enough to hold the bit representation of the floating point." ); + + T ret = (T(1) << exp) - 1; + return ret << mantiss; + } + + template <class T> + constexpr inline static T sign_mask() + { + static_assert(sizeof(T) * CHAR_BIT >= (mantiss + exp + 1), + "The type must be large enough to hold the bit representation of the floating point." ); + T ret = T(1) << (exp + mantiss); + return ret; + } + + template <class T> + constexpr inline static T full_mask() + { + return mantissa_mask<T>() | exponent_mask<T>() | sign_mask<T>(); + } + + template <class T> + constexpr inline static T exponent_bias() + { + static_assert(sizeof(T) * CHAR_BIT >= (mantiss + exp + 1), + "The type must be large enough to hold the bit representation of the floating point." ); + return (T(1) << (exp - 1)) - 1; + } + + template <class T> + constexpr inline static T max_exponent_with_bias() + { + static_assert(sizeof(T) * CHAR_BIT >= (mantiss + exp + 1), + "The type must be large enough to hold the bit representation of the floating point." ); + return exponent_bias<T>() * 2; + } + + template <class T> + constexpr inline static bool is_infinite(const T pattern) + { + return (pattern & (~sign_mask<T>())) == exponent_mask<T>(); + } + + template <class T> + constexpr inline static bool is_NaN(const T pattern) + { + return (pattern & (~sign_mask<T>())) > exponent_mask<T>(); + //If it also has bits in the mantissa, it's greater than the mask. + //Last bit is sign, so signedness of T is of no concern. + } + + template <class T> + constexpr inline static T absolute_value(const T pattern) + { + return pattern & (~sign_mask<T>()); + } + + /*! @warning Even though +0 and -0 should technically compare equal, + we will convert between them too so the operation becomes fully reversible. + */ + template <class T> + constexpr inline static T to_total_ordering(const T pattern) + { + const T xor_mask = (!!(pattern & sign_mask<T>()) * full_mask<T>()) | sign_mask<T>(); + return pattern ^ xor_mask; + } + + /*! @warning Even though +0 and -0 should technically compare equal, + we will convert between them too so the operation becomes fully reversible. + */ + template <class T> + constexpr inline static T from_total_ordering(const T pattern) + { + const T xor_mask = (!(pattern & sign_mask<T>()) * full_mask<T>()) | sign_mask<T>(); + return pattern ^ xor_mask; + } + + template <class T> + constexpr inline static T positive_zero() + { + return T(0); + } + + template <class T> + constexpr inline static T negative_zero() + { + return sign_mask<T>(); + } + + template <class T> + constexpr inline static T positive_infinity() + { + return exponent_mask<T>(); + } + + template <class T> + constexpr inline static T negative_infinity() + { + return sign_mask<T>() | exponent_mask<T>(); + } + + template <class T> + constexpr inline static bool round_results(const bool is_negative, const bool is_odd, + const bool is_nearer_to_up, const bool is_tied, + RoundingModes rt) + { + switch (rt) + { + case RoundingModes::ToPlusInfinity: + return !is_negative; + case RoundingModes::ToMinusInfinity: + return is_negative; + case RoundingModes::ToZero: + return 0; + //Truncate => do nothing + case RoundingModes::ToNearestEven: + return is_nearer_to_up || (is_odd && is_tied); + case RoundingModes::ToNearestAwayFromZero: + return is_nearer_to_up || is_tied; + default: + return 0; + } + } + + + /*! The absolute value of @a must be greater than or equal than that of @b. + We also don't handle zero, NaN or infinities here. + */ + template <class T> + constexpr inline static T add_patterns (const T a, const T b, const RoundingModes rt = RoundingModes::Default) + { + using namespace OperatorsHelper; + + constexpr unsigned int extra_bits = 2; + //One sign and at least one exponent bit, we're safe! + + constexpr T first_not_mantissa_bit = T(1) << mantissa_size_bits(); + + const T exp_a = (a & exponent_mask<T>()) >> mantissa_size_bits(); + const T exp_b = (b & exponent_mask<T>()) >> mantissa_size_bits(); + + const bool a_denormal = (exp_a != 0); + const bool b_denormal = (exp_b != 0); + + const bool use_second = (exp_a - exp_b) <= mantissa_size_bits() + 1 + extra_bits; + const bool is_negative = a & sign_mask<T>(); + + const T mantiss_a = ((a & mantissa_mask<T>()) | (first_not_mantissa_bit * a_denormal)) << extra_bits; + const T mantiss_b = ((b & mantissa_mask<T>()) | (first_not_mantissa_bit * b_denormal)) << extra_bits; + //To account for the overflow and rounding. + + T mantiss_ret = mantiss_a; + + mantiss_ret += safe_rshift(mantiss_b, exp_a - exp_b); + + mantiss_ret |= !!(safe_lshift(mantiss_b, exp_a - exp_b) & mantissa_mask<T>()) * use_second; + + const unsigned int leading_zeros = LeadingZerosPortability::count_leading_zeros<T>(mantiss_ret); + constexpr unsigned int desired_number_of_zeros = sizeof(T) * CHAR_BIT - mantissa_size_bits() - 1 - extra_bits; + const unsigned int shift_amount = clamped_sub(desired_number_of_zeros, leading_zeros); + + const T last_bit_mask = T(1) << (shift_amount + extra_bits); + const T last_discarded_bit_mask = last_bit_mask >> 1; + const T round_mask = (last_bit_mask - 1) * !!(last_bit_mask); + const bool round_up = (mantiss_ret & round_mask) > last_discarded_bit_mask; + const bool tied = last_discarded_bit_mask && ((mantiss_ret & round_mask) == last_discarded_bit_mask); + + bool round_bit = round_results<T>(is_negative, (mantiss_ret & last_bit_mask), round_up, tied, rt) && !!last_bit_mask; + + mantiss_ret = safe_rshift(mantiss_ret, shift_amount + extra_bits); + + mantiss_ret += round_bit * (shift_amount + extra_bits <= sizeof(T) * CHAR_BIT); + + const T exponent_ret = exp_a + shift_amount + (exp_a == 0 && mantiss_ret > mantissa_mask<T>()); + + mantiss_ret &= mantissa_mask<T>(); + + mantiss_ret &= ~( ( exponent_ret > max_exponent_with_bias<T>() ) * mantissa_mask<T>() ); + //If we somehow summed up to infinity, + //unset the remaining bits. + + return (is_negative * sign_mask<T>()) | (exponent_ret << mantissa_size_bits()) | mantiss_ret; + } + + /*! The absolute value of @a must be greater than or equal than that of @b. + We also don't handle zero, NaN or infinities here. + */ + template <class T> + constexpr inline static T subtract_patterns (const T a, const T b, const RoundingModes rt = RoundingModes::Default) + { + using namespace OperatorsHelper; + + constexpr unsigned int extra_bits = 2; + //One sign and at least one exponent bit, we're safe! + + constexpr T first_not_mantissa_bit = T(1) << mantissa_size_bits(); + + const T exp_a = (a & exponent_mask<T>()) >> mantissa_size_bits(); + const T exp_b = (b & exponent_mask<T>()) >> mantissa_size_bits(); + + const bool use_second = (exp_a - exp_b) <= mantissa_size_bits() + 1 + extra_bits; + const bool is_negative = a & sign_mask<T>(); + + const T mantiss_a = ((a & mantissa_mask<T>()) | (first_not_mantissa_bit * (exp_a != 0))) << extra_bits; + const T mantiss_b = ((b & mantissa_mask<T>()) | (first_not_mantissa_bit * (exp_b != 0))) << extra_bits; + //To account for the overflow and rounding. + + T mantiss_ret = mantiss_a; + + mantiss_ret -= safe_rshift(mantiss_b, exp_a - exp_b) * use_second; + + mantiss_ret |= !!(safe_lshift(-mantiss_b, exp_a - exp_b) & mantissa_mask<T>()) * use_second; + + const unsigned int leading_zeros = LeadingZerosPortability::count_leading_zeros<T>(mantiss_ret); + constexpr unsigned int desired_number_of_zeros = sizeof(T) * CHAR_BIT - mantissa_size_bits() - 1 - extra_bits; + const unsigned int shift_amount = clamped_sub(leading_zeros, desired_number_of_zeros); + + const T last_bit_mask = T(1) << extra_bits; + const T last_discarded_bit_mask = last_bit_mask >> 1; + const T round_mask = (last_bit_mask - 1) * !!(last_bit_mask); + const bool round_up = (mantiss_ret & round_mask) > last_discarded_bit_mask; + const bool tied = last_discarded_bit_mask && ((mantiss_ret & round_mask) == last_discarded_bit_mask); + + bool round_bit = round_results<T>(is_negative, (mantiss_ret & last_bit_mask), round_up, tied, rt) && !!last_bit_mask; + + mantiss_ret >>= extra_bits; + + mantiss_ret += round_bit; + + mantiss_ret = safe_lshift(mantiss_ret, shift_amount); + + const T exponent_ret = clamped_sub(exp_a, shift_amount); + + mantiss_ret = safe_rshift(mantiss_ret, clamped_sub(shift_amount, exp_a)); + + mantiss_ret &= mantissa_mask<T>(); + + return (is_negative * sign_mask<T>()) | (exponent_ret << mantissa_size_bits()) | mantiss_ret; + } + + /*! @warning Branchy as everything, and thus quite inefficient. + * The addition/subtraction routines themselves could be branchless, + * but we must select between them... + * + * Probably the overhead from all the operations makes it worth it? + * + */ + template <class T> + constexpr inline static T add(const T a, const T b, const RoundingModes rt = RoundingModes::Default) + { + const T abs_a = absolute_value<T>(a); + const T abs_b = absolute_value<T>(b); + + const bool sign_a = a & sign_mask<T>(); + const bool sign_b = b & sign_mask<T>(); + + if (abs_b == 0) + { + return a; + } + if (abs_a == 0) + { + return b; + } + + if (is_infinite<T>(a) && is_infinite<T>(b)) + { + if (sign_a == sign_b) + { + return a; + } + else + { + return abs_a | (T(1) << (mantissa_size_bits() - 1)); + //A "quiet" NaN in most platforms. + } + } + else if (is_NaN<T>(a)) + { + return a; + } + else if (is_NaN<T>(b)) + { + return b; + } + + if (sign_a == sign_b) + { + if (abs_a >= abs_b) + { + return add_patterns<T>(a, b, rt); + } + else + { + return add_patterns<T>(b, a, rt); + } + } + else + { + if (abs_a > abs_b) + { + return (sign_a * sign_mask<T>()) | subtract_patterns<T>(abs_a, abs_b, rt); + } + else if (abs_a == abs_b) + { + return 0; + } + else + { + return (sign_b * sign_mask<T>()) | subtract_patterns<T>(abs_b, abs_a, rt); + } + } + } + + + template <class T> + constexpr inline static T subtract(const T a, const T b, const RoundingModes rt = RoundingModes::Default) + { + return add<T>(a, b ^ sign_mask<T>(), rt); + } + + }; + + template <class FLarge, class FSmall> + struct ConversionHelper + { + static_assert(FSmall::mantissa_size_bits() <= FLarge::mantissa_size_bits() && + FSmall::exponent_size_bits() <= FLarge::exponent_size_bits() ); + + + template <class T> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + using FDest = FSmall; + using FSource = FLarge; + using namespace OperatorsHelper; + + const bool sign_bit = pattern & FSource::template sign_mask<T>(); + + const T exponent = (pattern & FSource::template exponent_mask<T>()) >> FSource::mantissa_size_bits(); + const T mantissa = pattern & FSource::template mantissa_mask<T>(); + + constexpr T delta_exponents = FSource::template exponent_bias<T>() - FDest::template exponent_bias<T>(); + + const bool exponent_full = (exponent > delta_exponents + FDest::template max_exponent_with_bias<T>()); + const bool delete_mantissa = exponent_full && exponent <= FSource::template max_exponent_with_bias<T>(); + //If the number is clamped to infinity, we must delete the mantissa + //so we don't get a NaN! + const bool denormal = exponent <= delta_exponents; + const bool zero = exponent + FDest::mantissa_size_bits() <= delta_exponents; + + const T final_exponent = min(clamped_sub(exponent, delta_exponents), FDest::template max_exponent_with_bias<T>() + 1); + + const T extra_mantissa_shift = clamped_sub(delta_exponents + 1, exponent) * denormal; + const T total_mantissa_shift = (FSource::mantissa_size_bits() - FDest::mantissa_size_bits()) + extra_mantissa_shift; + + const T mantissa_keep_mask = safe_lshift(FDest::template mantissa_mask<T>(), total_mantissa_shift) & FSource::template mantissa_mask<T>(); + const T check_for_rounding_mask = FSource::template mantissa_mask<T>() & (~mantissa_keep_mask); + const T last_mantissa_bit = safe_lshift(FDest::template mantissa_mask<T>(), total_mantissa_shift) & FSource::template mantissa_mask<T>(); + const T first_discarded_bit_mask = last_mantissa_bit >> 1; + //In case total_mantissa_shift == 0, this is 0 too. + + const T extra_denormal_bit = safe_rshift(T(denormal) << FDest::mantissa_size_bits(), extra_mantissa_shift); + + const bool round_up = (mantissa & check_for_rounding_mask) > first_discarded_bit_mask; + const bool tie_break = ((mantissa & check_for_rounding_mask) == first_discarded_bit_mask); + + const bool round_bit = FDest::template round_results<T>(sign_bit, mantissa & last_mantissa_bit, round_up, tie_break, rt) && !(exponent_full && !delete_mantissa && !denormal); + //The last part is so that NaN get truncated instead of rounded. + + T final_mantissa = (safe_rshift(mantissa, total_mantissa_shift) | extra_denormal_bit) + round_bit; + + final_mantissa *= !delete_mantissa; + + return sign_bit * FDest::template sign_mask<T>() | ((final_exponent << FDest::mantissa_size_bits()) | final_mantissa) * !zero; + + } + + template <class T> + constexpr inline static T up_convert(const T pattern, [[maybe_unused]] const RoundingModes rt = RoundingModes::Default) + { + using FDest = FLarge; + using FSource = FSmall; + using namespace OperatorsHelper; + + const bool sign_bit = pattern & FSource::template sign_mask<T>(); + T exponent = (pattern & FSource::template exponent_mask<T>()) >> FSource::mantissa_size_bits(); + T mantissa = pattern & FSource::template mantissa_mask<T>(); + + constexpr T delta_exponents = (FDest::template exponent_bias<T>() - FSource::template exponent_bias<T>()); + + if (exponent == 0 && FDest::exponent_size_bits() > FSource::exponent_size_bits()) + { + const unsigned int leading_zeros = LeadingZerosPortability::count_leading_zeros<T>(mantissa); + const unsigned int shift_amount = leading_zeros - (sizeof(T) * CHAR_BIT - FSource::mantissa_size_bits()) + 1; + const unsigned int exponent_offset = (mantissa != 0) * (shift_amount - 1); + mantissa = (mantissa << shift_amount) & FSource::template mantissa_mask<T>(); + + exponent = delta_exponents - exponent_offset; + } + else if (exponent > FSource::template max_exponent_with_bias<T>()) + //Infinity or NaN + { + exponent = FDest::template max_exponent_with_bias<T>() + 1; + } + else + { + exponent = exponent + delta_exponents; + } + + + return sign_bit * FDest::template sign_mask<T>() | (exponent << FDest::mantissa_size_bits()) | (mantissa << (FDest::mantissa_size_bits() - FSource::mantissa_size_bits())); + + } + }; + + /*! + Converts @p pattern from the larger floating point format @p FSource to @p FDest. + + Note: A few tests show that, under some circumstances, compilers may make this branchless. + Clang seemed to do it, but not GCC. NVCC (for the GPU) surely did. + There's probably still room for improvement, but... + */ + template <class T, class FDest, class FSource> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + static_assert(FDest::mantissa_size_bits() <= FSource::mantissa_size_bits() && + FDest::exponent_size_bits() <= FSource::exponent_size_bits(), + "The destination type must not be a larger floating point type than the source one."); + + return ConversionHelper<FSource, FDest>::template down_convert<T>(pattern, rt); + } + + + /*! + Converts @p pattern from the smaller floating point format @p FSource to @p FDest. + + @warning: This could be re-written in a more branchless way, so performance might be sub-optimal... + */ + template <class T, class FDest, class FSource> + constexpr inline static T up_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + static_assert(FDest::mantissa_size_bits() >= FSource::mantissa_size_bits() && + FDest::exponent_size_bits() >= FSource::exponent_size_bits(), + "The source type must not be a larger floating point type than the destination one."); + return ConversionHelper<FDest, FSource>::template up_convert<T>(pattern, rt); + } + + + using StandardFloat = IEEE754_like<23, 8>; + + using StandardDouble = IEEE754_like<52, 11>; + + template <> template<class T> + constexpr inline T StandardFloat::add (const T a, const T b, const RoundingModes) + { + const float float_a = BitCastHelper::bitcast<float, T>(a); + const float float_b = BitCastHelper::bitcast<float, T>(b); + + float float_ret = float_a + float_b; + + return BitCastHelper::bitcast<uint32_t, float>(float_ret); + } + + template <> template<class T> + constexpr inline T StandardDouble::add (const T a, const T b, const RoundingModes) + { + const double double_a = BitCastHelper::bitcast<double, T>(a); + const double double_b = BitCastHelper::bitcast<double, T>(b); + + double double_ret = double_a + double_a; + + return BitCastHelper::bitcast<uint64_t, double>(double_ret); + } + + template <> template<class T> + constexpr inline T StandardFloat::subtract (const T a, const T b, const RoundingModes) + { + const float float_a = BitCastHelper::bitcast<float, T>(a); + const float float_b = BitCastHelper::bitcast<float, T>(b); + + float float_ret = float_a - float_b; + + return BitCastHelper::bitcast<uint32_t, float>(float_ret); + } + + template <> template<class T> + constexpr inline T StandardDouble::subtract (const T a, const T b, const RoundingModes) + { + const double double_a = BitCastHelper::bitcast<double, T>(a); + const double double_b = BitCastHelper::bitcast<double, T>(b); + + double double_ret = double_a - double_a; + + return BitCastHelper::bitcast<uint64_t, double>(double_ret); + } + + template<> + struct ConversionHelper<StandardDouble, StandardFloat> + { + template <class T> + constexpr inline static T up_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const float f = BitCastHelper::bitcast<float, uint32_t>(pattern); + const double d = f; + return BitCastHelper::bitcast<T, double>(d); + } + template <class T> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const double d = BitCastHelper::bitcast<double, uint64_t>(pattern); + const float f = d; + return BitCastHelper::bitcast<uint32_t, float>(f); + } + }; + + + template<class Format> + struct ConversionHelper<Format, Format> + { + template <class T> + constexpr inline static T up_convert(const T pattern, [[maybe_unused]] const RoundingModes rt = RoundingModes::Default) + { + return pattern; + } + template <class T> + constexpr inline static T down_convert(const T pattern, [[maybe_unused]] const RoundingModes rt = RoundingModes::Default) + { + return pattern; + } + }; + + using CUDAHalfFloat = IEEE754_like<10, 5>; + using CUDABFloat16 = IEEE754_like<7, 8>; + +#if defined (__CUDA_ARCH__) && CALORECGPU_INCLUDE_CUDA_SUPPORT + + //If not, the CUDA-related ones will just default back to the slower, emulated operations. + + + template <> template<class T> + __device__ constexpr inline T CUDAHalfFloat::add (const T a, const T b, const RoundingModes) + { + const __half conv_a = BitCastHelper::bitcast<__half, T>(a); + const __half conv_b = BitCastHelper::bitcast<__half, T>(b); + + __half conv_ret = __hadd(conv_a, conv_b); + + return BitCastHelper::bitcast<uint16_t, __half>(conv_ret); + } + + template <> template<class T> + __device__ constexpr inline T CUDAHalfFloat::subtract (const T a, const T b, const RoundingModes) + { + const __nv_bfloat16 conv_a = BitCastHelper::bitcast<__half, T>(a); + const __nv_bfloat16 conv_b = BitCastHelper::bitcast<__half, T>(b); + + __half conv_ret = __hsub(conv_a, conv_b); + + return BitCastHelper::bitcast<uint16_t, __half>(conv_ret); + } + + template <> template<class T> + __device__ constexpr inline T CUDABFloat16::add (const T a, const T b, const RoundingModes) + { + const __nv_bfloat16 conv_a = BitCastHelper::bitcast<__nv_bfloat16, T>(a); + const __nv_bfloat16 conv_b = BitCastHelper::bitcast<__nv_bfloat16, T>(b); + + __nv_bfloat16 conv_ret = __hadd(conv_a, conv_b); + + return BitCastHelper::bitcast<uint16_t, __nv_bfloat16>(conv_ret); + } + + template <> template<class T> + __device__ constexpr inline T CUDABFloat16::subtract (const T a, const T b, const RoundingModes) + { + const __nv_bfloat16 conv_a = BitCastHelper::bitcast<__nv_bfloat16, T>(a); + const __nv_bfloat16 conv_b = BitCastHelper::bitcast<__nv_bfloat16, T>(b); + + __nv_bfloat16 conv_ret = __hsub(conv_a, conv_b); + + return BitCastHelper::bitcast<uint16_t, __nv_bfloat16>(conv_ret); + } + + template<> + struct ConversionHelper<StandardFloat, CUDAHalfFloat> + { + template <class T> + constexpr inline static T up_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const __half hf = BitCastHelper::bitcast<__half, T>(pattern); + const float fl = __half2float(hf); + return BitCastHelper::bitcast<T, float>(fl); + } + template <class T> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const float pre_conv = BitCastHelper::bitcast<float, T>(pattern); + __half ret; + switch (rt) + { + case RoundingModes::ToPlusInfinity: + ret = __float2half_ru(pre_conv); + break; + case RoundingModes::ToMinusInfinity: + ret = __float2half_rd(pre_conv); + break; + case RoundingModes::ToZero: + ret = __float2half_rz(pre_conv); + break; + case RoundingModes::ToNearestEven: + ret = __float2half_rn(pre_conv); + break; + //case RoundingModes::ToNearestAwayFromZero: + //No support for this + default: + ret = __float2half(pre_conv); + break; + } + return BitCastHelper::bitcast<T, __half>(ret); + } + }; + + + template<> + struct ConversionHelper<StandardFloat, CUDABFloat16> + { + template <class T> + constexpr inline static T up_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const __nv_bfloat16 hf = BitCastHelper::bitcast<__nv_bfloat16, T>(pattern); + const float fl = __bfloat162float(hf); + return BitCastHelper::bitcast<T, float>(fl); + } + template <class T> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const float pre_conv = BitCastHelper::bitcast<float, T>(pattern); + __nv_bfloat16 ret; + switch (rt) + { + case RoundingModes::ToPlusInfinity: + ret = __float2bfloat16_ru(pre_conv); + break; + case RoundingModes::ToMinusInfinity: + ret = __float2bfloat16_rd(pre_conv); + break; + case RoundingModes::ToZero: + ret = __float2bfloat16_rz(pre_conv); + break; + case RoundingModes::ToNearestEven: + ret = __float2bfloat16_rn(pre_conv); + break; + //case RoundingModes::ToNearestAwayFromZero: + //No support for this + default: + ret = __float2bfloat16(pre_conv) + break; + } + return BitCastHelper::bitcast<T, __nv_bfloat16>(ret); + } + }; + + template<> + struct ConversionHelper<StandardDouble, CUDAHalfFloat> + { + template <class T> + constexpr inline static T up_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const T first_step = ConversionHelper<StandardFloat, CUDAHalfFloat>::template up_convert<T>(pattern, rt); + return ConversionHelper<StandardDouble, StandardFloat>::template up_convert<T>(first_step, rt); + } + template <class T> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + if (rt == RoundingModes::Default || rt == RoundingModes::ToNearestEven) + { + const double d = BitCastHelper::bitcast<double, uint64_t>(pattern); + return BitCastHelper::bitcast<T, __half>(__double2half(d)); + } + else + { + const T first_step = ConversionHelper<StandardDouble, StandardFloat>::template down_convert<T>(first_step, rt); + return ConversionHelper<StandardFloat, CUDAHalfFloat>::template down_convert<T>(first_step, rt); + } + } + }; + + template<> + struct ConversionHelper<StandardDouble, CUDABFloat16> + { + template <class T> + constexpr inline static T up_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + const T first_step = ConversionHelper<StandardFloat, CUDABFloat16>::template up_convert<T>(first_step, rt); + return ConversionHelper<StandardDouble, StandardFloat>::template up_convert<T>(first_step, rt); + } + template <class T> + constexpr inline static T down_convert(const T pattern, const RoundingModes rt = RoundingModes::Default) + { + if (rt == RoundingModes::Default || rt == RoundingModes::ToNearestEven) + { + const double d = BitCastHelper::bitcast<double, uint64_t>(pattern); + return BitCastHelper::bitcast<T, __nv_bfloat16>(__double2bfloat16(d)); + } + else + { + const T first_step = ConversionHelper<StandardDouble, StandardFloat>::template down_convert<T>(first_step, rt); + return ConversionHelper<StandardFloat, CUDABFloat16>::template down_convert<T>(first_step, rt); + } + } + }; + +#endif + +} + + +#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculator.cxx b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..69f489c35b82b71b472fe973bece34274dbc7953 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculator.cxx @@ -0,0 +1,52 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "GPUClusterInfoAndMomentsCalculator.h" +#include "GPUClusterInfoAndMomentsCalculatorImpl.h" + + +using namespace CaloRecGPU; + +GPUClusterInfoAndMomentsCalculator::GPUClusterInfoAndMomentsCalculator(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent) +{ + declareInterface<CaloClusterGPUProcessor> (this); +} + +StatusCode GPUClusterInfoAndMomentsCalculator::initialize() +{ + m_options.allocate(); + + m_options.m_options->use_abs_energy = m_absOpt; + m_options.m_options->use_two_gaussian_noise = m_twoGaussianNoise; + m_options.m_options->min_LAr_quality = m_minBadLArQuality; + m_options.m_options->max_axis_angle = m_maxAxisAngle; + m_options.m_options->eta_inner_wheel = m_etaInnerWheel; + m_options.m_options->min_l_longitudinal = m_minLLongitudinal; + m_options.m_options->min_r_lateral = m_minRLateral; + + m_options.sendToGPU(true); + + return StatusCode::SUCCESS; +} + +StatusCode GPUClusterInfoAndMomentsCalculator::execute(const EventContext & /*ctx*/, const ConstantDataHolder & constant_data, + EventDataHolder & event_data, void * /*temporary_buffer*/) const +{ + calculateClusterPropertiesAndMoments(event_data, constant_data, m_options, m_measureTimes); + return StatusCode::SUCCESS; + +} + +StatusCode GPUClusterInfoAndMomentsCalculator::finalize() +{ + return StatusCode::SUCCESS; +} + +GPUClusterInfoAndMomentsCalculator::~GPUClusterInfoAndMomentsCalculator() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculator.h b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculator.h new file mode 100644 index 0000000000000000000000000000000000000000..ac6a148742434f7e15eaaf813fd20a2ec96ddeb9 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculator.h @@ -0,0 +1,108 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + + +#ifndef CALORECGPU_GPUCLUSTERINFOANDMOMENTSCALCULATOR_H +#define CALORECGPU_GPUCLUSTERINFOANDMOMENTSCALCULATOR_H + +#include "CxxUtils/checker_macros.h" + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include "GPUClusterInfoAndMomentsCalculatorImpl.h" + +#include "CLHEP/Units/SystemOfUnits.h" + +/** + * @class GPUClusterInfoAndMomentsCalculator + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 01 March 2023 + * @brief Standard tool to calculate cluster info (energy, transverse energy, pseudo-rapidity and azimuthal angle). + */ + + +class GPUClusterInfoAndMomentsCalculator: + public AthAlgTool, virtual public CaloClusterGPUProcessor +{ + public: + + GPUClusterInfoAndMomentsCalculator(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual StatusCode finalize() override; + + virtual ~GPUClusterInfoAndMomentsCalculator(); + + virtual size_t size_of_temporaries() const + { + return 0; + }; + + private: + + + /** @brief the maximal allowed deviation from the + * IP-to-ClusterCenter-axis. */ + Gaudi::Property<double> m_maxAxisAngle {this, "MaxAxisAngle", 20 * CLHEP::deg, "The maximal allowed deviation from the IP-to-ClusterCenter-axis"}; + + /** + * @brief the minimal \f$r\f$ in the definition of the Lateral moment + * + * This defines the minimal distance the two leading cells might + * have before this value is used instead of their real distance in + * the normalization of the LATERAL moment. */ + Gaudi::Property<double> m_minRLateral {this, "MinRLateral", 4 * CLHEP::cm, "The minimal r in the definition of the Lateral moment"}; + + /** + * @brief the minimal \f$\lambda\f$ in the definition of the + * Longitudinal moment + * + * This defines the minimal distance along the shower axis from the + * cluster center the two leading cells might have before this value + * is used instead of their real distance in the normalization of + * the LONGITUDINAL moment. */ + Gaudi::Property<double> m_minLLongitudinal {this, "MinLLongitudinal", 10 * CLHEP::cm, "The minimal lambda in the definition of the Longitudinal moment"}; + + /** + * @brief the minimal cell quality in the LAr for declaring a cell bad + * + * This defines the minimal quality (large values mean worse shape) + * a cell needs to exceed in order to be considered as not + * compatible with a normal ionization signal. */ + Gaudi::Property<double> m_minBadLArQuality {this, "MinBadLArQuality", 4000, "The minimal cell quality in the LAr for declaring a cell bad"}; + + /** + * @brief if set to true use abs E value of cells to calculate + * cluster moments */ + Gaudi::Property<bool> m_absOpt {this, "WeightingOfNegClusters", false, "If set to true use abs E value of cells to calculate cluster moments"}; + + /** + * @brief Transition from outer to inner wheel in EME2 */ + Gaudi::Property<double> m_etaInnerWheel {this, "EMECAbsEtaWheelTransition", 2.52, "Transition from outer to inner wheel in EME2"}; + + /** + * @brief if set to true use 2-gaussian noise description for + * TileCal */ + Gaudi::Property<bool> m_twoGaussianNoise {this, "TwoGaussianNoise", false, "If set to true use 2-gaussian noise description for TileCal"}; + + /** @brief Options for the algorithm, held in a GPU-friendly way. + */ + CMCOptionsHolder m_options; + + + /** @brief If @p true, synchronize the kernel calls to ensure accurate per-step/per-tool time measurements. + * Defaults to @p false. + */ + Gaudi::Property<bool> m_measureTimes {this, "MeasureTimes", false, "Synchronize for time measurements"}; +}; + +#endif //CALORECGPU_TOPOAUTOMATONCLUSTERING_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculatorImpl.cu b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculatorImpl.cu new file mode 100644 index 0000000000000000000000000000000000000000..525495aebff32cce160d8154606b557525c93d83 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculatorImpl.cu @@ -0,0 +1,1881 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "GPUClusterInfoAndMomentsCalculatorImpl.h" +#include "FPHelpers.h" + + +#include "CaloGeoHelpers/CaloSampling.h" +//Just enums and stuff, CUDA compatible. + +#include <cmath> + +using namespace CaloRecGPU; + +void CMCOptionsHolder::allocate() +{ + m_options.allocate(); + m_options_dev.allocate(); +} + +void CMCOptionsHolder::sendToGPU(const bool clear_CPU) +{ + m_options_dev = m_options; + if (clear_CPU) + { + m_options.clear(); + } +} + +constexpr static int ClusterPassBlockSize = 1024; +constexpr static int CellPassBlockSize = 1024; +constexpr static int FinalClusterPassBlocksize = 1024; +//Maximize throughput? +//Needs measurements, perhaps... + +namespace +{ + + namespace CMCHack + { + //A generic TempSpecifier has typedef called "type" to specify the type of the return array + //(e. g. should be float for most things), a static constexpr unsigned int number + //to count the number of the array (or, more accurately, the number of other 4-byte + //arrays before this one), and a static constexpr bool reverse to mark temporaries + //that we being storing from the end of the moments array... + //In practice, for our use cases, we will specialize this + //to be sure there is no overlap... + template <class TempSpecifier> + __host__ __device__ typename TempSpecifier::type * get_temporary_array(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + char * c_ptr = (char *) ((ClusterMomentsArr *) moments_arr); + if (TempSpecifier::reverse) + { + return (typename TempSpecifier::type * ) ( c_ptr + (NMaxClusters * TempSpecifier::number * sizeof(float)) ); + //I know. sizeof(char) == 1. Clearer this way, still... + } + else + { + return (typename TempSpecifier::type * ) ( c_ptr + sizeof(ClusterMomentsArr) - (NMaxClusters * (TempSpecifier::number + 1) * sizeof(float)) ); + //I know. sizeof(char) == 1. Clearer this way, still... + } + } + } + + struct SeedCellPhi + { + using type = float; + }; + + struct EnergyDensityNormalization + { + using type = float; + }; + + struct SumAbsEnergyNonMoments + { + using type = float; + }; + + struct MaxCellEnergyAndCell + { + using type = unsigned long long int; + }; + + struct SecondMaxCellEnergyAndCell + { + using type = unsigned long long int; + }; + + //For later: + + struct MaxCells + { + using type = int; + }; + + struct SecondMaxCells + { + using type = int; + }; + + //----------------- + + struct NumberEmptySamplings + { + using type = int[NMaxClusters]; + }; + + struct NumberNonEmptySamplings + { + using type = int[NMaxClusters]; + }; + + struct MX + { + using type = float; + }; + struct MY + { + using type = float; + }; + struct MZ + { + using type = float; + }; + + struct MaxMomentsEnergyPerSample + { + using type = unsigned int[NMaxClusters]; + //Stored as unsigned ints because there's no atomicMax for floats in CUDA... + }; + + struct MaxSignificanceAndSampling + { + using type = unsigned long long int; + }; + + struct Matrix00 + { + using type = float; + }; + struct Matrix10 + { + using type = float; + }; + struct Matrix20 + { + using type = float; + }; + struct Matrix11 + { + using type = float; + }; + struct Matrix21 + { + using type = float; + }; + struct Matrix22 + { + using type = float; + }; + struct SumSquareEnergies + { + using type = float; + }; + struct TimeNormalization + { + using type = float; + }; + struct AverageLArQNorm + { + using type = float; + }; + struct AverageTileQNorm + { + using type = float; + }; + + struct ShowerAxisX + { + using type = float; + }; + + struct ShowerAxisY + { + using type = float; + }; + + struct ShowerAxisZ + { + using type = float; + }; + + struct AbsoluteEnergyPerSample + { + using type = float[NMaxClusters]; + }; + + struct LateralNormalization + { + using type = float; + }; + struct LongitudinalNormalization + { + using type = float; + }; + struct MaxEnergyAndCellPerSample + { + using type = unsigned long long int[NMaxClusters]; + }; + + struct MaxECellPerSample + { + using type = int[NMaxClusters]; + }; + + + namespace CMCHack +//Special cases, to prevent overlap. + { + template <> + __host__ __device__ typename SeedCellPhi::type * get_temporary_array<SeedCellPhi>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (SeedCellPhi::type *) moments_arr->engCalibFracRest; + } + + template <> + __host__ __device__ typename EnergyDensityNormalization::type * get_temporary_array<EnergyDensityNormalization>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (EnergyDensityNormalization::type *) moments_arr->etaCaloFrame; + } + + template <> + __host__ __device__ typename SumAbsEnergyNonMoments::type * get_temporary_array<SumAbsEnergyNonMoments>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (SumAbsEnergyNonMoments::type *) moments_arr->engCalibFracHad; + } + + template <> + __host__ __device__ typename MaxCellEnergyAndCell::type * get_temporary_array<MaxCellEnergyAndCell>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MaxCellEnergyAndCell::type *) moments_arr->engCalibDeadUnclass; + } + + template <> + __host__ __device__ typename SecondMaxCellEnergyAndCell::type * get_temporary_array<SecondMaxCellEnergyAndCell>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (SecondMaxCellEnergyAndCell::type *) moments_arr->engCalibDeadFCAL; + } + + template <> + __host__ __device__ typename MaxCells::type * get_temporary_array<MaxCells>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MaxCells::type *) moments_arr->engBadHVCells; + } + template <> + __host__ __device__ typename SecondMaxCells::type * get_temporary_array<SecondMaxCells>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (SecondMaxCells::type *) moments_arr->nBadHVCells; + } + + template <> + __host__ __device__ typename NumberEmptySamplings::type * get_temporary_array<NumberEmptySamplings>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (NumberEmptySamplings::type *) moments_arr->maxEPerSample; + } + + template <> + __host__ __device__ typename NumberNonEmptySamplings::type * get_temporary_array<NumberNonEmptySamplings>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (NumberNonEmptySamplings::type *) moments_arr->maxPhiPerSample; + } + + template <> + __host__ __device__ typename MaxMomentsEnergyPerSample::type * get_temporary_array<MaxMomentsEnergyPerSample>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MaxMomentsEnergyPerSample::type *) moments_arr->maxEtaPerSample; + } + + template <> + __host__ __device__ typename MaxSignificanceAndSampling::type * get_temporary_array<MaxSignificanceAndSampling>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MaxSignificanceAndSampling::type *) moments_arr->eta1CaloFrame; + } + + + template <> + __host__ __device__ typename MX::type * get_temporary_array<MX>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MX::type *) moments_arr->engCalibOutL; + } + + template <> + __host__ __device__ typename MY::type * get_temporary_array<MY>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MY::type *) moments_arr->engCalibOutM; + } + + template <> + __host__ __device__ typename MZ::type * get_temporary_array<MZ>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MZ::type *) moments_arr->engCalibOutT; + } + + template <> + __host__ __device__ typename Matrix00::type * get_temporary_array<Matrix00>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (Matrix00::type *) moments_arr->engCalibDeadT; + } + template <> + __host__ __device__ typename Matrix10::type * get_temporary_array<Matrix10>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (Matrix10::type *) moments_arr->engCalibEMB0; + } + template <> + __host__ __device__ typename Matrix20::type * get_temporary_array<Matrix20>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (Matrix20::type *) moments_arr->engCalibEME0; + } + template <> + __host__ __device__ typename Matrix11::type * get_temporary_array<Matrix11>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (Matrix11::type *) moments_arr->engCalibTileG3; + } + template <> + __host__ __device__ typename Matrix21::type * get_temporary_array<Matrix21>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (Matrix21::type *) moments_arr->engCalibDeadTot; + } + template <> + __host__ __device__ typename Matrix22::type * get_temporary_array<Matrix22>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (Matrix22::type *) moments_arr->engCalibDeadEMB0; + } + template <> + __host__ __device__ typename SumSquareEnergies::type * get_temporary_array<SumSquareEnergies>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (SumSquareEnergies::type *) moments_arr->engCalibDeadTile0; + } + template <> + __host__ __device__ typename TimeNormalization::type * get_temporary_array<TimeNormalization>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (TimeNormalization::type *) moments_arr->engCalibDeadTileG3; + } + template <> + __host__ __device__ typename AverageLArQNorm::type * get_temporary_array<AverageLArQNorm>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (AverageLArQNorm::type *) moments_arr->engCalibDeadEME0; + } + template <> + __host__ __device__ typename AverageTileQNorm::type * get_temporary_array<AverageTileQNorm>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (AverageTileQNorm::type *) moments_arr->engCalibDeadHEC0; + } + + + template <> + __host__ __device__ ShowerAxisX::type * get_temporary_array<ShowerAxisX>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (ShowerAxisX::type *) moments_arr->EMProbability; + } + template <> + __host__ __device__ ShowerAxisY::type * get_temporary_array<ShowerAxisY>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (ShowerAxisY::type *) moments_arr->hadWeight; + } + template <> + __host__ __device__ ShowerAxisZ::type * get_temporary_array<ShowerAxisZ>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (ShowerAxisZ::type *) moments_arr->OOCweight; + } + + template <> + __host__ __device__ typename AbsoluteEnergyPerSample::type * get_temporary_array<AbsoluteEnergyPerSample>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (AbsoluteEnergyPerSample::type *) moments_arr->vertexFraction; + } + + + template <> + __host__ __device__ LateralNormalization::type * get_temporary_array<LateralNormalization>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return moments_arr->DMweight; + } + template <> + __host__ __device__ LongitudinalNormalization::type * get_temporary_array<LongitudinalNormalization>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return moments_arr->tileConfidenceLevel; + } + template <> + __host__ __device__ MaxEnergyAndCellPerSample::type * get_temporary_array<MaxEnergyAndCellPerSample>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MaxEnergyAndCellPerSample::type *) moments_arr->maxPhiPerSample; + } + + template <> + __host__ __device__ typename MaxECellPerSample::type * get_temporary_array<MaxECellPerSample>(Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr) + { + return (MaxECellPerSample::type *) moments_arr->vertexFraction; + } + } + +} + +//The per-sample things might very well benefit from being +//struct-of-arrays instead of pure array-of-structs +//since we do the samplings in parallel. +//However, it'd be less clean when it came +//to the temporary array thing... + +constexpr int WarpSize = 32; +//Let's do this per warp... +//In sufficiently new hardware, +//independent thread scheduling +//might very well ensure all the threads +//that are updating the same moments +//get executed together, +//while the warp-wide broadcasting +//will possibly improve memory accesses +//(and, in general, doing the moments +// in parallel will be a net performance gain +// when compared to have all of them being updated in a single thread...)) + +static_assert(NumSamplings <= 28, "We wrote the code under the assumption of 28 samplings at most."); + +/****************************************************************************** + * Clear invalid cells first. (The algorithm doesn't invalidate clusters.) * + ******************************************************************************/ + +__global__ static +void clearInvalidCells(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[index]; + if (tag.is_part_of_cluster()) + { + if (tag.is_shared_between_clusters()) + { + const int first_cluster = tag.cluster_index(); + const int second_cluster = tag.secondary_cluster_index(); + + const int first_seed = clusters_arr->seedCellID[first_cluster]; + const int second_seed = clusters_arr->seedCellID[second_cluster]; + + if (first_seed < 0 && second_seed < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag:: make_invalid_tag(); + } + else if (first_seed < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(second_cluster); + } + else if (second_seed < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(first_cluster); + } + else /*if (first_seed >= 0 && second_seed >= 0)*/ + { + //Do nothing: the tag's already OK. + } + } + else + { + if (clusters_arr->seedCellID[tag.cluster_index()] < 0) + { + cell_state_arr->clusterTag[index] = ClusterTag:: make_invalid_tag(); + } + } + } + } +} + + +/****************************************************************************** + * First Pass * + ******************************************************************************/ + +__global__ static +void zerothClusterPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const int cluster_number) +{ + + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cluster = index / WarpSize; + const int moment = threadIdx.x % WarpSize; + if (cluster < cluster_number) + { + if (moment < NumSamplings) + { + const int sampling = moment; + moments_arr->energyPerSample[sampling][cluster] = 0.f; + moments_arr->nCellSampling[sampling][cluster] = 0; + CMCHack::get_temporary_array< NumberEmptySamplings >(moments_arr)[sampling][cluster] = 0; + CMCHack::get_temporary_array< NumberNonEmptySamplings >(moments_arr)[sampling][cluster] = 0; + CMCHack::get_temporary_array< MaxMomentsEnergyPerSample >(moments_arr)[sampling][cluster] = 0; + } + else + { + switch (moment - NumSamplings) + //NumSamplings == 28 + { + case 0: + moments_arr->centerX[cluster] = 0.f; + moments_arr->centerY[cluster] = 0.f; + moments_arr->centerZ[cluster] = 0.f; + moments_arr->firstEngDens[cluster] = 0.f; + moments_arr->secondEngDens[cluster] = 0.f; + break; + case 1: + moments_arr->engFracEM[cluster] = 0.f; + moments_arr->engPos[cluster] = 0.f; + clusters_arr->clusterEnergy[cluster] = 0.f; + CMCHack::get_temporary_array<SumAbsEnergyNonMoments>(moments_arr)[cluster] = 0.f; + CMCHack::get_temporary_array<EnergyDensityNormalization>(moments_arr)[cluster] = 0.f; + break; + case 2: + CMCHack::get_temporary_array<MX>(moments_arr)[cluster] = 0.f; + CMCHack::get_temporary_array<MY>(moments_arr)[cluster] = 0.f; + CMCHack::get_temporary_array<MaxCellEnergyAndCell>(moments_arr)[cluster] = 0ULL; + CMCHack::get_temporary_array<SecondMaxCellEnergyAndCell>(moments_arr)[cluster] = 0ULL; + clusters_arr->clusterEta[cluster] = 0.f; + break; + case 3: + CMCHack::get_temporary_array<MZ>(moments_arr)[cluster] = 0.f; + clusters_arr->clusterPhi[cluster] = 0.f; + { + const int seed_cell = clusters_arr->seedCellID[cluster]; + if (seed_cell >= 0 && seed_cell < NCaloCells) + { + CMCHack::get_temporary_array<SeedCellPhi>(moments_arr)[cluster] = geometry->phi[seed_cell]; + } + } + break; + default: + break; + } + } + } +} + + +__global__ static +void firstCellPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const bool use_abs_energy) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cell = index / WarpSize; + const int in_warp_index = threadIdx.x % WarpSize; + if (cell < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[cell]; + + const int sampling = geometry->caloSample[cell]; + + if (tag.is_part_of_cluster()) + { + const float energy = cell_info_arr->energy[cell]; + const float abs_energy = fabsf(energy); + const float moments_energy = (use_abs_energy || energy > 0.f ? abs_energy : 0.f); + const float x = geometry->x[cell]; + const float y = geometry->y[cell]; + const float z = geometry->z[cell]; + const float eta = geometry->eta[cell]; + const float phi = geometry->phi[cell]; + const float volume = geometry->volume[cell]; + + auto accumulateForCluster = [&](const int cluster, const float weight, const int this_moment) + { + const float weighted_energy = moments_energy * weight; + switch (this_moment) + { + case 0: + atomicAdd(&(moments_arr->energyPerSample[sampling][cluster]), energy * weight); + break; + case 1: + atomicAdd(&(moments_arr->nCellSampling[sampling][cluster]), 1); + break; + case 2: + atomicMax(&(CMCHack::get_temporary_array<MaxMomentsEnergyPerSample>(moments_arr)[sampling][cluster]), __float_as_uint(weighted_energy)); + break; + case 3: + atomicAdd(&(moments_arr->centerX[cluster]), x * weighted_energy); + break; + case 4: + atomicAdd(&(moments_arr->centerY[cluster]), y * weighted_energy); + break; + case 5: + atomicAdd(&(moments_arr->centerZ[cluster]), z * weighted_energy); + break; + case 6: + if ( sampling == CaloSampling::EMB1 || + sampling == CaloSampling::EMB2 || + sampling == CaloSampling::EMB3 || + sampling == CaloSampling::EME1 || + sampling == CaloSampling::EME2 || + sampling == CaloSampling::EME3 || + sampling == CaloSampling::FCAL0 ) + { + atomicAdd(&(moments_arr->engFracEM[cluster]), weighted_energy); + } + break; + case 7: + if (volume > 0) + { + const float w_E_over_V = weighted_energy / volume; + atomicAdd(&(moments_arr->firstEngDens[cluster]), weighted_energy * w_E_over_V); + atomicAdd(&(moments_arr->secondEngDens[cluster]), weighted_energy * w_E_over_V * w_E_over_V); + atomicAdd(&(CMCHack::get_temporary_array<EnergyDensityNormalization>(moments_arr)[cluster]), weighted_energy); + } + break; + case 8: + { + const float dir = x * x + y * y + z * z; + const float r_dir = (dir > 0.f ? 1.f / sqrtf(dir) : 0.f); + const float w_E_r_dir = weighted_energy * r_dir; + const float mx = w_E_r_dir * x; + atomicAdd(&(CMCHack::get_temporary_array<MX>(moments_arr)[cluster]), mx); + } + break; + case 9: + { + const float dir = x * x + y * y + z * z; + const float r_dir = (dir > 0.f ? 1.f / sqrtf(dir) : 0.f); + const float w_E_r_dir = weighted_energy * r_dir; + const float my = w_E_r_dir * y; + atomicAdd(&(CMCHack::get_temporary_array<MY>(moments_arr)[cluster]), my); + } + break; + case 10: + { + const float dir = x * x + y * y + z * z; + const float r_dir = (dir > 0.f ? 1.f / sqrtf(dir) : 0.f); + const float w_E_r_dir = weighted_energy * r_dir; + const float mz = w_E_r_dir * z; + atomicAdd(&(CMCHack::get_temporary_array<MZ>(moments_arr)[cluster]), mz); + } + break; + case 11: + atomicAdd(&(moments_arr->engPos[cluster]), weighted_energy); + break; + case 12: + { + unsigned long long int energy_and_cell = __float_as_uint(weighted_energy); + //Energy is positive, so no need to switch to total ordering... + energy_and_cell = (energy_and_cell << 32) | (cell + 1); + + const unsigned long long int old_enc = atomicMax(&(CMCHack::get_temporary_array<MaxCellEnergyAndCell>(moments_arr)[cluster]), energy_and_cell); + atomicMax(&(CMCHack::get_temporary_array<SecondMaxCellEnergyAndCell>(moments_arr)[cluster]), min(old_enc, energy_and_cell)); + } + break; + case 13: + atomicAdd(&(clusters_arr->clusterEnergy[cluster]), energy * weight); + atomicAdd(&(CMCHack::get_temporary_array<SumAbsEnergyNonMoments>(moments_arr)[cluster]), abs_energy * weight); + break; + case 14: + atomicAdd(&(clusters_arr->clusterEta[cluster]), abs_energy * weight * eta); + break; + case 15: + { + const float phi_0 = CMCHack::get_temporary_array<SeedCellPhi>(moments_arr)[cluster]; + const float phi_real = Helpers::regularize_angle(phi, phi_0); + atomicAdd(&(clusters_arr->clusterPhi[cluster]), phi_real * abs_energy * weight); + } + break; + default: + break; + } + }; + + if (tag.is_shared_between_clusters()) + { + const float secondary_weight = __uint_as_float(tag.secondary_cluster_weight()); + if (in_warp_index >= WarpSize / 2) + { + accumulateForCluster(tag.secondary_cluster_index(), secondary_weight, in_warp_index - WarpSize / 2); + } + else + { + accumulateForCluster(tag.cluster_index(), 1.0f - secondary_weight, in_warp_index); + } + } + else + { + accumulateForCluster(tag.cluster_index(), 1.0f, in_warp_index); + } + } + + //Optimization for our neighbour handling: + //since we are using all2D, + //which assures max neighbours < 32, + //and which also encompasses + //all of its smaller options, + //we can have each thread knowing where to check + //instead of building an actual neighbour list. + //Also, this is symmetric, + //that is, A being in the list of neighbours of B + //implies B is in the list of neighbours of A. + + constexpr int neighbour_option_num = 4; + + const int num_relevant_neighbours = NeighOffsets(geometry->neighbours.offsets[cell]).get_end_cell(neighbour_option_num); + + int cluster_to_check = 0; + + if (in_warp_index < num_relevant_neighbours) + { + const int neigh = geometry->neighbours.get_neighbour(cell, in_warp_index); + const ClusterTag neigh_tag = cell_state_arr->clusterTag[neigh]; + + if (neigh_tag.is_part_of_cluster()) + { + cluster_to_check = neigh_tag.cluster_index() + 1; + //We add 1 because 0 means no cluster to check here. + //Also, since the cluster indices are 16 bit, + //of course there's no issue here. + } + } + + const unsigned int mask = (1U << num_relevant_neighbours) - 1; + + for (int i = 1; i < num_relevant_neighbours && in_warp_index < num_relevant_neighbours; ++i) + { + const int to_check = in_warp_index + i; + const int warp_to_check = to_check % num_relevant_neighbours; + const int other = __shfl_sync(mask, cluster_to_check, warp_to_check); + if (warp_to_check < to_check && abs(other) == cluster_to_check) + { + cluster_to_check = -cluster_to_check; + //Mark this cluster as already considered. + } + } + + //Maybe there is a solution that uses sorting instead? + //Best choice here would be a sorting network + //(bitonic sorting or Batcher's odd-even), + //but then we'd need to eliminate the equal clusters too... + //All in all, probably something like C ln(n)(ln(n) + 1) + 2 operations + //per thread, with C somewhere around 2 rather than 0.5. + //And, with n = 32, does the added complexity + //really justify this? I would need a good reason + //before considering to implement that sort of thing, + //and I strongly suspect the performance benefits + //not to be that significant. Still... + + if (cluster_to_check > 0) + //Valid and non-repeated. + { + const int neigh_cluster = cluster_to_check - 1; + if (tag.is_part_of_cluster()) + { + + if (tag.cluster_index() != neigh_cluster) + { + atomicAdd(&(CMCHack::get_temporary_array<NumberNonEmptySamplings>(moments_arr)[sampling][neigh_cluster]), 1); + } + } + else + { + atomicAdd(&(CMCHack::get_temporary_array<NumberEmptySamplings>(moments_arr)[sampling][neigh_cluster]), 1); + } + } + } +} + +//Finalize/normalize the first pass moments, +//zero out what is needed for the second pass... + +__global__ static +void firstClusterPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int cluster_number) +{ + + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cluster = index / WarpSize; + const int moment = threadIdx.x % WarpSize; + if (cluster < cluster_number) + { + const float sum_energies = moments_arr->engPos[cluster]; + if (moment < NumSamplings) + { + const int sampling = moment; + const float sampling_energy = moments_arr->energyPerSample[sampling][cluster]; + const unsigned int max_energy_pattern = CMCHack::get_temporary_array<MaxMomentsEnergyPerSample>(moments_arr)[sampling][cluster]; + const float sampling_max_energy = __uint_as_float(max_energy_pattern); + const int sampling_empty = CMCHack::get_temporary_array<NumberEmptySamplings>(moments_arr)[sampling][cluster]; + const int sampling_non_empty = CMCHack::get_temporary_array<NumberNonEmptySamplings>(moments_arr)[sampling][cluster]; + + int total = sampling_empty + sampling_non_empty; + + float isolation = 0.f, isolation_norm = 0.f, eng_frac_core = sampling_max_energy; + + if (total > 0 && sampling_energy > 0) + { + isolation = (sampling_energy * sampling_empty) / total; + isolation_norm = sampling_energy; + } + + const unsigned int mask = 0x0FFFFFFFU; + //28 samplings, so without the last 4 threads. + + for (int i = 1; i < WarpSize; i *= 2) + { + const int origin = sampling ^ i; + const float other_isol = __shfl_xor_sync(mask, isolation, i); + const float other_isol_norm = __shfl_xor_sync(mask, isolation_norm, i); + const float other_efc = __shfl_xor_sync(mask, eng_frac_core, i); + if (origin < NumSamplings) + { + isolation += other_isol; + isolation_norm += other_isol_norm; + eng_frac_core += other_efc; + } + } + + switch (moment) + { + case 0: + moments_arr->isolation[cluster] = (isolation_norm != 0.f ? isolation / isolation_norm : 0.f); + break; + case NumSamplings - 1: + moments_arr->engFracCore[cluster] = (sum_energies > 0.f) * eng_frac_core / sum_energies; + break; + default: + break; + } + } + else + { + switch (moment - NumSamplings) + { + case 0: + { + moments_arr->centerX[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + moments_arr->centerY[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + moments_arr->centerZ[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + const float energy_density_norm = CMCHack::get_temporary_array<EnergyDensityNormalization>(moments_arr)[cluster]; + moments_arr->firstEngDens[cluster] /= (energy_density_norm > 0.f ? energy_density_norm : 1.f); + moments_arr->secondEngDens[cluster] /= (energy_density_norm > 0.f ? energy_density_norm : 1.f); + } + break; + case 1: + { + moments_arr->engFracEM[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + + const float mx = CMCHack::get_temporary_array<MX>(moments_arr)[cluster]; + const float my = CMCHack::get_temporary_array<MY>(moments_arr)[cluster]; + const float mz = CMCHack::get_temporary_array<MZ>(moments_arr)[cluster]; + const float sqrd_mass = sum_energies * sum_energies - mx * mx - my * my - mz * mz; + moments_arr->mass[cluster] = sum_energies <= 0.f ? 0.f : sqrtf(fabsf(sqrd_mass)) * (sqrd_mass < 0.f ? -1.f : 1.f); + } + break; + case 2: + { + unsigned long long int max_E_and_cell = CMCHack::get_temporary_array<MaxCellEnergyAndCell>(moments_arr)[cluster]; + const int max_cell = (max_E_and_cell & 0x7FFFFFFF) - 1; + const float max_E = __uint_as_float(max_E_and_cell >> 32); + moments_arr->engFracMax[cluster] = max_E / (sum_energies > 0.f ? sum_energies : 1.f); + CMCHack::get_temporary_array<MaxCells>(moments_arr)[cluster] = max_cell; + + const unsigned long long int second_max_E_and_cell = CMCHack::get_temporary_array<SecondMaxCellEnergyAndCell>(moments_arr)[cluster]; + const int second_max_cell = (second_max_E_and_cell & 0x7FFFFFFF) - 1; + CMCHack::get_temporary_array<SecondMaxCells>(moments_arr)[cluster] = second_max_cell; + } + break; + case 3: + { + const float abs_energy = CMCHack::get_temporary_array<SumAbsEnergyNonMoments>(moments_arr)[cluster]; + if (abs_energy > 0) + { + const float tempeta = clusters_arr->clusterEta[cluster] / abs_energy; + + clusters_arr->clusterEta[cluster] = tempeta; + + const float temp_ET = clusters_arr->clusterEnergy[cluster] / coshf(abs(tempeta)); + + clusters_arr->clusterEt[cluster] = temp_ET; + clusters_arr->clusterPhi[cluster] = Helpers::regularize_angle(clusters_arr->clusterPhi[cluster] / abs_energy, 0.f); + } + else + { + //clusters_arr->seedCellID[cluster] = -1; + } + } + break; + default: + break; + } + } + + switch (moment) + { + //Avoid 0 and NumSamplings - 1 + //since they set the sampling things... + case 1: + moments_arr->engBadCells[cluster] = 0.f; + break; + case 2: + moments_arr->nBadCells[cluster] = 0; + break; + case 3: + moments_arr->nBadCellsCorr[cluster] = 0; + break; + case 4: + moments_arr->badCellsCorrE[cluster] = 0.f; + break; + case 5: + moments_arr->badLArQFrac[cluster] = 0.f; + break; + case 6: + moments_arr->avgLArQ[cluster] = 0.f; + break; + case 7: + moments_arr->avgTileQ[cluster] = 0.f; + break; + case 8: + moments_arr->PTD[cluster] = 0.f; + break; + case 9: + moments_arr->numCells[cluster] = 0; + break; + case 10: + CMCHack::get_temporary_array<SumSquareEnergies>(moments_arr)[cluster] = 0.f; + break; + case 11: + CMCHack::get_temporary_array<Matrix22>(moments_arr)[cluster] = 0.f; + break; + case 12: + CMCHack::get_temporary_array<Matrix21>(moments_arr)[cluster] = 0.f; + break; + case 13: + CMCHack::get_temporary_array<Matrix11>(moments_arr)[cluster] = 0.f; + break; + case 14: + CMCHack::get_temporary_array<Matrix20>(moments_arr)[cluster] = 0.f; + break; + case 15: + CMCHack::get_temporary_array<Matrix10>(moments_arr)[cluster] = 0.f; + break; + case 16: + CMCHack::get_temporary_array<Matrix00>(moments_arr)[cluster] = 0.f; + break; + case 17: + moments_arr->time[cluster] = 0.f; + break; + case 18: + moments_arr->secondTime[cluster] = 0.f; + break; + case 19: + CMCHack::get_temporary_array<TimeNormalization>(moments_arr)[cluster] = 0.f; + break; + case 20: + CMCHack::get_temporary_array<AverageLArQNorm>(moments_arr)[cluster] = 0.f; + break; + case 21: + CMCHack::get_temporary_array<AverageTileQNorm>(moments_arr)[cluster] = 0.f; + break; + case 22: + CMCHack::get_temporary_array<MaxSignificanceAndSampling>(moments_arr)[cluster] = 0ULL; + break; + case 23: + moments_arr->significance[cluster] = 0.f; + break; + default: + break; + } + } +} + +/****************************************************************************** + * Second pass. * + ******************************************************************************/ + +__global__ static +void secondCellPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<CellNoiseArr> noise_arr, + const bool use_abs_energy, const bool use_two_gaussian_noise, + const float min_LAr_quality) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cell = index / WarpSize; + const int in_warp_index = threadIdx.x % WarpSize; + if (cell < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[cell]; + if (tag.is_part_of_cluster()) + { + const float energy = cell_info_arr->energy[cell]; + const float abs_energy = fabsf(energy); + const float moments_energy = (use_abs_energy || energy > 0.f ? abs_energy : 0.f); + const float time = cell_info_arr->time[cell]; + const float x = geometry->x[cell]; + const float y = geometry->y[cell]; + const float z = geometry->z[cell]; + const bool is_tile = geometry->is_tile(cell); + const int sampling = geometry->caloSample[cell]; + const int gain = cell_info_arr->gain[cell]; + //No need to check for invalid cells as they won't be part of clusters... + const float noise = (is_tile && use_two_gaussian_noise ? + 0.f : //To be fixed in the future... + noise_arr->noise[gain][cell]); + + const QualityProvenance qp = cell_info_arr->qualityProvenance[cell]; + const bool is_bad = cell_info_arr->is_bad(is_tile, qp, false); + auto accumulateForCluster = [&](const int cluster, const float weight, const int this_moment) + { + const float weighted_energy = moments_energy * weight; + const float weighted_energy_or_negative = (use_abs_energy ? fabsf(energy) : energy) * weight; + const float square_w_E = weighted_energy * weighted_energy; + const float center_x = moments_arr->centerX[cluster]; + const float center_y = moments_arr->centerY[cluster]; + const float center_z = moments_arr->centerZ[cluster]; + switch (this_moment) + { + case 0: + if (is_bad) + { + atomicAdd(&(moments_arr->engBadCells[cluster]), weighted_energy_or_negative); + atomicAdd(&(moments_arr->nBadCells[cluster]), 1); + } + break; + case 1: + if (is_bad && energy != 0.f) + { + atomicAdd(&(moments_arr->badCellsCorrE[cluster]), weighted_energy_or_negative); + atomicAdd(&(moments_arr->nBadCellsCorr[cluster]), 1); + } + break; + case 2: + if (!is_bad && !is_tile && ((qp.provenance() & 0x2800U) == 0x2000U) && qp.quality() > min_LAr_quality) + { + atomicAdd(&(moments_arr->badLArQFrac[cluster]), weighted_energy_or_negative); + } + break; + case 3: + if (!is_bad && !is_tile && ((qp.provenance() & 0x2800U) == 0x2000U)) + { + const float square_E_or_neg = weighted_energy_or_negative * weighted_energy_or_negative; + atomicAdd(&(moments_arr->avgLArQ[cluster]), square_E_or_neg * qp.quality()); + atomicAdd(&(CMCHack::get_temporary_array<AverageLArQNorm>(moments_arr)[cluster]), square_E_or_neg); + } + break; + case 4: + if (!is_bad && is_tile && qp.tile_qual1() != 0xFFU && qp.tile_qual2() != 0xFFU) + { + const float square_E_or_neg = weighted_energy_or_negative * weighted_energy_or_negative; + atomicAdd(&(moments_arr->avgTileQ[cluster]), square_E_or_neg * max((unsigned int) qp.tile_qual1(), (unsigned int) qp.tile_qual2())); + atomicAdd(&(CMCHack::get_temporary_array<AverageTileQNorm>(moments_arr)[cluster]), square_E_or_neg); + } + break; + case 5: + atomicAdd(&(moments_arr->PTD[cluster]), square_w_E); + + //Comment on there: + // + // +--------------- begin comment on there ---------------+ + // | | + // | do not convert to pT since clusters are small and | + // | there is virtually no difference and cosh just costs | + // | time ... | + // | | + // +---------------- end comment on there ----------------+ + // + //So maybe we could change this here? + + atomicAdd(&(moments_arr->numCells[cluster]), 1); + break; + case 6: + atomicAdd(&(CMCHack::get_temporary_array<Matrix00>(moments_arr)[cluster]), square_w_E * (x - center_x) * (x - center_x)); + break; + case 7: + atomicAdd(&(CMCHack::get_temporary_array<Matrix10>(moments_arr)[cluster]), square_w_E * (x - center_x) * (y - center_y)); + break; + case 8: + atomicAdd(&(CMCHack::get_temporary_array<Matrix20>(moments_arr)[cluster]), square_w_E * (x - center_x) * (z - center_z)); + break; + case 9: + atomicAdd(&(CMCHack::get_temporary_array<Matrix11>(moments_arr)[cluster]), square_w_E * (y - center_y) * (y - center_y)); + break; + case 10: + atomicAdd(&(CMCHack::get_temporary_array<Matrix21>(moments_arr)[cluster]), square_w_E * (y - center_y) * (z - center_z)); + break; + case 11: + atomicAdd(&(CMCHack::get_temporary_array<Matrix22>(moments_arr)[cluster]), square_w_E * (z - center_z) * (z - center_z)); + break; + case 12: + atomicAdd(&(CMCHack::get_temporary_array<SumSquareEnergies>(moments_arr)[cluster]), square_w_E); + break; + //Note: exclusion of PreSamplerB/E. + case 13: + if ( ((is_tile && (qp.provenance() & 0x8080U)) || (!is_tile && (qp.provenance() & 0x2000U))) && + sampling != CaloSampling::PreSamplerB && sampling != CaloSampling::PreSamplerE ) + { + const float normE = weight * energy; + const float squared_norm = normE * normE; + atomicAdd(&(moments_arr->time[cluster]), time * squared_norm); + atomicAdd(&(moments_arr->secondTime[cluster]), time * time * squared_norm); + atomicAdd(&(CMCHack::get_temporary_array<TimeNormalization>(moments_arr)[cluster]), squared_norm); + } + break; + case 14: + atomicAdd(&(moments_arr->significance[cluster]), noise * noise); + break; + case 15: + { + const float max_sig = noise > 0 ? energy * weight / noise : 0.f; + unsigned long long int max_S_and_S = __float_as_uint(fabsf(max_sig)); + max_S_and_S = max_S_and_S << 32 | (((unsigned long long int) sampling << 1)) | (max_sig > 0); + atomicMax(&(CMCHack::get_temporary_array<MaxSignificanceAndSampling>(moments_arr)[cluster]), max_S_and_S); + } + break; + default: + break; + } + }; + + if (tag.is_shared_between_clusters()) + { + const float secondary_weight = __uint_as_float(tag.secondary_cluster_weight()); + if (in_warp_index >= WarpSize / 2) + { + accumulateForCluster(tag.secondary_cluster_index(), secondary_weight, in_warp_index - WarpSize / 2); + } + else + { + accumulateForCluster(tag.cluster_index(), 1.0f - secondary_weight, in_warp_index); + } + } + else + { + accumulateForCluster(tag.cluster_index(), 1.0f, in_warp_index); + } + } + } +} + +__global__ static +void secondClusterPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int cluster_number, const float max_axis_angle) +{ + + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cluster = index / WarpSize; + const int moment = threadIdx.x % WarpSize; + if (cluster < cluster_number) + { + const float sum_energies = moments_arr->engPos[cluster]; + const float cluster_energy = clusters_arr->clusterEnergy[cluster]; + switch (moment) + { + case WarpSize - 1: + case WarpSize - 2: + case WarpSize - 3: + { + const float center_x = moments_arr->centerX[cluster]; + const float center_y = moments_arr->centerY[cluster]; + const float center_z = moments_arr->centerZ[cluster]; + const float center_mag = sqrtf(center_x * center_x + center_y * center_y + center_z * center_z); + moments_arr->centerMag[cluster] = center_mag; + float axis_x = center_x / center_mag; + float axis_y = center_y / center_mag; + float axis_z = center_z / center_mag; + float delta_phi = 0, delta_theta = 0, delta_alpha = 0; + if (moments_arr->numCells[cluster] > 2) + { + const float norm = CMCHack::get_temporary_array<SumSquareEnergies>(moments_arr)[cluster]; + RealSymmetricMatrixSolver<double> solver { CMCHack::get_temporary_array<Matrix00>(moments_arr)[cluster] / norm, + CMCHack::get_temporary_array<Matrix11>(moments_arr)[cluster] / norm, + CMCHack::get_temporary_array<Matrix22>(moments_arr)[cluster] / norm, + CMCHack::get_temporary_array<Matrix10>(moments_arr)[cluster] / norm, + CMCHack::get_temporary_array<Matrix21>(moments_arr)[cluster] / norm, + CMCHack::get_temporary_array<Matrix20>(moments_arr)[cluster] / norm }; + //If we need more speed at the cost of some precision, + //we could use floats all throughout. + //However, with certain combinations of values, + //the lambdas can be smaller than 1e-6 on the CPU + //but give results larger than that here, + //which leads to differences in delta_phi, + //delta_theta and delta_alpha. + + float lambda = 0, vec[3]; + + switch (moment) + { + case WarpSize - 1: + solver.get_solution_pair_2(lambda, vec, true); + break; + case WarpSize - 2: + solver.get_solution_pair_3(lambda, vec, true); + break; + //2 and 3 are switched compared to the Eigen solution. + case WarpSize - 3: + solver.get_solution_pair_1(lambda, vec, true); + break; + default: + break; + } + + const float min_lambdas = 1.e-6f; + + const unsigned int mask = 0xE0000000U; + //The last three threads. + + const float lambda_1 = __shfl_sync(mask, lambda, WarpSize - 3); + const float lambda_2 = __shfl_sync(mask, lambda, WarpSize - 2); + const float lambda_3 = __shfl_sync(mask, lambda, WarpSize - 1); + + if ( solver.well_defined(lambda_1, lambda_2, lambda_3) && + fabsf(lambda_1) >= min_lambdas && + fabsf(lambda_2) >= min_lambdas && + fabsf(lambda_3) >= min_lambdas ) + { + const float prod = (vec[0] * axis_x + vec[1] * axis_y + vec[2] * axis_z); + const float raw_angle = acosf(prod > 1.f ? 1.f : (prod < -1.f ? -1.f : prod)); + + float this_angle = raw_angle; + + if (raw_angle > Helpers::Constants::pi<float> / 2) + { + this_angle = Helpers::Constants::pi<float> - raw_angle; + vec[0] *= -1; + vec[1] *= -1; + vec[2] *= -1; + } + + const float angle_1 = __shfl_sync(mask, this_angle, WarpSize - 3); + const float angle_2 = __shfl_sync(mask, this_angle, WarpSize - 2); + const float angle_3 = __shfl_sync(mask, this_angle, WarpSize - 1); + + float chosen_angle, chosen_vec[3]; + + if (angle_1 <= angle_2 && angle_1 <= angle_3) + { + chosen_angle = angle_1; + chosen_vec[0] = __shfl_sync(mask, vec[0], WarpSize - 3); + chosen_vec[1] = __shfl_sync(mask, vec[1], WarpSize - 3); + chosen_vec[2] = __shfl_sync(mask, vec[2], WarpSize - 3); + } + else if (angle_2 <= angle_3) + { + chosen_angle = angle_2; + chosen_vec[0] = __shfl_sync(mask, vec[0], WarpSize - 2); + chosen_vec[1] = __shfl_sync(mask, vec[1], WarpSize - 2); + chosen_vec[2] = __shfl_sync(mask, vec[2], WarpSize - 2); + } + else + { + chosen_angle = angle_3; + chosen_vec[0] = __shfl_sync(mask, vec[0], WarpSize - 1); + chosen_vec[1] = __shfl_sync(mask, vec[1], WarpSize - 1); + chosen_vec[2] = __shfl_sync(mask, vec[2], WarpSize - 1); + } + + auto calc_phi = [](const float x, const float y, const float z) + { + return atan2f(y, x); + }; + auto calc_theta = [](const float x, const float y, const float z) + { + return atan2f(sqrtf(x * x + y * y), z); + }; + + switch (moment) + { + case WarpSize - 3: + delta_phi = Helpers::angular_difference(calc_phi(axis_x, axis_y, axis_z), calc_phi(chosen_vec[0], chosen_vec[1], chosen_vec[2])); + if (chosen_angle < max_axis_angle) + { + axis_x = chosen_vec[0]; + } + break; + case WarpSize - 2: + delta_theta = calc_theta(axis_x, axis_y, axis_z) - calc_theta(chosen_vec[0], chosen_vec[1], chosen_vec[2]); + if (chosen_angle < max_axis_angle) + { + axis_y = chosen_vec[1]; + } + break; + case WarpSize - 1: + delta_alpha = chosen_angle; + if (chosen_angle < max_axis_angle) + { + axis_z = chosen_vec[2]; + } + break; + default: + break; + } + } + } + switch (moment) + { + case WarpSize - 3: + CMCHack::get_temporary_array<ShowerAxisX>(moments_arr)[cluster] = axis_x; + moments_arr->deltaPhi[cluster] = delta_phi; + break; + case WarpSize - 2: + CMCHack::get_temporary_array<ShowerAxisY>(moments_arr)[cluster] = axis_y; + moments_arr->deltaTheta[cluster] = delta_theta; + break; + case WarpSize - 1: + CMCHack::get_temporary_array<ShowerAxisZ>(moments_arr)[cluster] = axis_z; + moments_arr->deltaAlpha[cluster] = delta_alpha; + break; + default: + break; + } + } + break; + case 0: + { + moments_arr->badLArQFrac[cluster] /= (cluster_energy != 0.f ? cluster_energy : 1.f); + } + break; + case 1: + { + const float prev_v = moments_arr->significance[cluster]; + moments_arr->significance[cluster] = (prev_v > 0.f ? cluster_energy / sqrtf(prev_v) : 0.f); + } + break; + case 2: + { + const unsigned long long int max_sig_and_samp = CMCHack::get_temporary_array<MaxSignificanceAndSampling>(moments_arr)[cluster]; + const float max_sig = __uint_as_float(max_sig_and_samp >> 32); + const int max_samp = (max_sig_and_samp & 0xFFFFFFFEU) >> 1; + moments_arr->cellSignificance[cluster] = max_sig * (max_sig_and_samp & 1 ? 1.f : -1.f); + moments_arr->cellSigSampling[cluster] = max_samp; + } + break; + case 3: + { + const float norm = CMCHack::get_temporary_array<AverageLArQNorm>(moments_arr)[cluster]; + moments_arr->avgLArQ[cluster] /= (norm > 0.f ? norm : 1.0f); + } + break; + case 4: + { + const float norm = CMCHack::get_temporary_array<AverageTileQNorm>(moments_arr)[cluster]; + moments_arr->avgTileQ[cluster] /= (norm > 0.f ? norm : 1.0f); + } + break; + case 5: + { + const float old = moments_arr->PTD[cluster]; + moments_arr->PTD[cluster] = sqrtf(old) / (sum_energies > 0.f ? sum_energies : 1.f); + //See before: maybe to be revised? + } + break; + case 6: + { + const float norm = CMCHack::get_temporary_array<TimeNormalization>(moments_arr)[cluster]; + if (norm != 0.f) + { + const float time = moments_arr->time[cluster] / norm; + const float second_sum = moments_arr->secondTime[cluster]; + moments_arr->time[cluster] = time; + moments_arr->secondTime[cluster] = (second_sum / norm) - (time * time); + } + else + { + moments_arr->time[cluster] = 0.f; + moments_arr->secondTime[cluster] = 0.f; + } + } + break; + case 7: + if (moments_arr->numCells[cluster] <= 0) + { + //clusters_arr->seedCellID[cluster] = -1; + } + break; + default: + break; + } + + __syncwarp(); + + //Now zero out what we need for the final (!) moments. + //Avoid overburdening WarpSize - 3 to WarpSize - 1. + //Also use 0 to NumSamplings - 1 for the sampling-based ones, + //so try to load-balance with those that did less before. + + switch (moment) + { + case 8: + moments_arr->firstPhi[cluster] = 0.f; + break; + case 9: + moments_arr->firstEta[cluster] = 0.f; + break; + case 10: + moments_arr->secondR[cluster] = 0.f; + break; + case 11: + moments_arr->secondLambda[cluster] = 0.f; + break; + case 12: + moments_arr->lateral[cluster] = 0.f; + break; + case 13: + moments_arr->longitudinal[cluster] = 0.f; + break; + case 14: + moments_arr->nExtraCellSampling[cluster] = 0; + break; + case 15: + CMCHack::get_temporary_array<LateralNormalization>(moments_arr)[cluster] = 0.f; + break; + case 16: + CMCHack::get_temporary_array<LongitudinalNormalization>(moments_arr)[cluster] = 0.f; + break; + default: + break; + } + if (moment < NumSamplings) + { + const int sampling = moment; + CMCHack::get_temporary_array<MaxEnergyAndCellPerSample>(moments_arr)[sampling][cluster] = 0; + moments_arr->etaPerSample[sampling][cluster] = 0.f; + moments_arr->phiPerSample[sampling][cluster] = 0.f; + CMCHack::get_temporary_array<AbsoluteEnergyPerSample>(moments_arr)[sampling][cluster] = 0.f; + } + } +} + +/****************************************************************************** + * Third pass. * + ******************************************************************************/ + +__global__ static +void thirdCellPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const bool use_abs_energy, const float eta_inner_wheel, + const float min_l_longitudinal, const float min_r_lateral) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cell = index / WarpSize; + const int in_warp_index = threadIdx.x % WarpSize; + if (cell < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[cell]; + if (tag.is_part_of_cluster()) + { + const float energy = cell_info_arr->energy[cell]; + const float abs_energy = fabsf(energy); + const float moments_energy = (use_abs_energy || energy > 0.f ? abs_energy : 0.f); + const float x = geometry->x[cell]; + const float y = geometry->y[cell]; + const float z = geometry->z[cell]; + const float eta = geometry->eta[cell]; + const float phi = geometry->phi[cell]; + const int sampling = geometry->caloSample[cell]; + + auto accumulateForCluster = [&](const int cluster, const float weight, const int this_moment) + { + const float weighted_energy = moments_energy * weight; + const float center_x = moments_arr->centerX[cluster]; + const float center_y = moments_arr->centerY[cluster]; + const float center_z = moments_arr->centerZ[cluster]; + const float axis_x = CMCHack::get_temporary_array<ShowerAxisX>(moments_arr)[cluster]; + const float axis_y = CMCHack::get_temporary_array<ShowerAxisY>(moments_arr)[cluster]; + const float axis_z = CMCHack::get_temporary_array<ShowerAxisZ>(moments_arr)[cluster]; + const int max_cell = CMCHack::get_temporary_array<MaxCells>(moments_arr)[cluster]; + const int second_max_cell = CMCHack::get_temporary_array<SecondMaxCells>(moments_arr)[cluster]; + + auto cross_p_mag = [](const float x1, const float x2, const float x3, + const float y1, const float y2, const float y3) + { + const float a = x2 * y3 - x3 * y2; + const float b = x3 * y1 - x1 * y3; + const float c = x1 * y2 - x2 * y1; + return sqrtf(a * a + b * b + c * c); + }; + + auto dot_p = [](const float x1, const float x2, const float x3, + const float y1, const float y2, const float y3) + { + return x1 * y1 + x2 * y2 + x3 * y3; + }; + + const float r = cross_p_mag(x - center_x, y - center_y, z - center_z, axis_x, axis_y, axis_z); + const float lambda = dot_p(x - center_x, y - center_y, z - center_z, axis_x, axis_y, axis_z); + + switch (this_moment) + { + case 0: + { + const float phi_0 = CMCHack::get_temporary_array<SeedCellPhi>(moments_arr)[cluster]; + const float phi_real = Helpers::regularize_angle(phi, phi_0); + atomicAdd(&(moments_arr->firstPhi[cluster]), weighted_energy * phi_real); + } + break; + case 1: + atomicAdd(&(moments_arr->firstEta[cluster]), weighted_energy * eta); + break; + case 2: + atomicAdd(&(moments_arr->secondR[cluster]), weighted_energy * r * r); + break; + case 3: + atomicAdd(&(moments_arr->secondLambda[cluster]), weighted_energy * lambda * lambda); + break; + case 4: + atomicAdd(&(moments_arr->etaPerSample[sampling][cluster]), abs_energy * weight * eta); + break; + case 5: + { + const float phi_0 = CMCHack::get_temporary_array<SeedCellPhi>(moments_arr)[cluster]; + const float phi_real = Helpers::regularize_angle(phi, phi_0); + atomicAdd(&(moments_arr->phiPerSample[sampling][cluster]), abs_energy * weight * phi_real); + } + break; + case 6: + atomicAdd(&(CMCHack::get_temporary_array<AbsoluteEnergyPerSample>(moments_arr)[sampling][cluster]), abs_energy * weight); + break; + case 7: + if (sampling == CaloSampling::EME2 && fabsf(eta) > eta_inner_wheel) + { + atomicAdd(&(moments_arr->nExtraCellSampling[cluster]), 1); + } + break; + case 8: + if (cell != max_cell && cell != second_max_cell) + { + atomicAdd(&(moments_arr->lateral[cluster]), weighted_energy * r * r); + } + break; + case 9: + if (cell != max_cell && cell != second_max_cell) + { + atomicAdd(&(CMCHack::get_temporary_array<LateralNormalization>(moments_arr)[cluster]), weighted_energy * r * r); + } + else + { + const float real_r = max(r, min_r_lateral); + atomicAdd(&(CMCHack::get_temporary_array<LateralNormalization>(moments_arr)[cluster]), weighted_energy * real_r * real_r); + } + break; + case 10: + if (cell != max_cell && cell != second_max_cell) + { + atomicAdd(&(moments_arr->longitudinal[cluster]), weighted_energy * lambda * lambda); + } + break; + case 11: + if (cell != max_cell && cell != second_max_cell) + { + atomicAdd(&(CMCHack::get_temporary_array<LongitudinalNormalization>(moments_arr)[cluster]), weighted_energy * lambda * lambda); + } + else + { + const float real_lambda = max(lambda, min_l_longitudinal); + atomicAdd(&(CMCHack::get_temporary_array<LongitudinalNormalization>(moments_arr)[cluster]), weighted_energy * real_lambda * real_lambda); + } + break; + case 12: + { + const unsigned int energy_pattern = __float_as_uint(energy * weight); + unsigned long long int E_and_cell = FloatingPointHelpers::StandardFloat::to_total_ordering(energy_pattern); + E_and_cell = (E_and_cell << 32) | cell; + atomicMax(&(CMCHack::get_temporary_array<MaxEnergyAndCellPerSample>(moments_arr)[sampling][cluster]), E_and_cell); + } + break; + default: + break; + } + }; + + if (tag.is_shared_between_clusters()) + { + const float secondary_weight = __uint_as_float(tag.secondary_cluster_weight()); + if (in_warp_index >= WarpSize / 2) + { + accumulateForCluster(tag.secondary_cluster_index(), secondary_weight, in_warp_index - WarpSize / 2); + } + else + { + accumulateForCluster(tag.cluster_index(), 1.0f - secondary_weight, in_warp_index); + } + } + else + { + accumulateForCluster(tag.cluster_index(), 1.0f, in_warp_index); + } + } + } +} + +__global__ static +void thirdClusterPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const int cluster_number) +{ + + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cluster = index / WarpSize; + const int moment = threadIdx.x % WarpSize; + if (cluster < cluster_number) + { + const float sum_energies = moments_arr->engPos[cluster]; + if (moment < NumSamplings) + { + const int sampling = moment; + const float sampling_normalization = CMCHack::get_temporary_array<AbsoluteEnergyPerSample>(moments_arr)[sampling][cluster]; + + const unsigned long long int energy_and_cell = CMCHack::get_temporary_array<MaxEnergyAndCellPerSample>(moments_arr)[sampling][cluster]; + + const int cell = sampling_normalization > 0.f ? (int) (energy_and_cell & 0x7FFFFFFF) : -1; + + CMCHack::get_temporary_array<MaxECellPerSample>(moments_arr)[sampling][cluster] = cell; + + moments_arr->etaPerSample[sampling][cluster] /= sampling_normalization; + + const float old_phi = moments_arr->phiPerSample[sampling][cluster]; + + moments_arr->phiPerSample[sampling][cluster] = Helpers::regularize_angle(old_phi / sampling_normalization, 0.f); + } + else + { + const int thread_id = moment - NumSamplings; + + const float center_x = moments_arr->centerX[cluster]; + const float center_y = moments_arr->centerY[cluster]; + const float center_z = moments_arr->centerZ[cluster]; + const float axis_x = CMCHack::get_temporary_array<ShowerAxisX>(moments_arr)[cluster]; + const float axis_y = CMCHack::get_temporary_array<ShowerAxisY>(moments_arr)[cluster]; + const float axis_z = CMCHack::get_temporary_array<ShowerAxisZ>(moments_arr)[cluster]; + + const float center_phi = Helpers::regularize_angle(atan2f(center_y, center_x)); + + const float center_eta = Helpers::eta_from_coordinates(center_x, center_y, center_z); + + const int first_attempt_cell = geometry->get_closest_cell(CaloSampling::EMB1, center_eta, center_phi); + + float lambda_c = 0.f; + + if (first_attempt_cell >= 0) + //Condition on CPU is r_calo == 0, + //but, by definition, I'd expect no cell + //to potentially overlap with the center + //of the detector, right?! + { + if (thread_id == 0) + { + const float r_calo = geometry->r[first_attempt_cell] - geometry->dr[first_attempt_cell] / + (geometry->is_tile(first_attempt_cell) ? 2.f : 1.f); + + const float axis_r = axis_x * axis_x + axis_y * axis_y; + + if (axis_r > 0) + { + const float axis_and_center_r = axis_x * center_x + axis_y * center_y; + const float center_r = center_x * center_x + center_y * center_y - r_calo * r_calo; + const float det = axis_and_center_r * axis_and_center_r / (axis_r * axis_r) - center_r / axis_r; + if (det > 0) + { + const float quot = -axis_and_center_r / axis_r; + const float rootdet = sqrtf(det); + const float branch_1 = quot + rootdet; + const float branch_2 = quot - rootdet; + lambda_c = min(fabsf(branch_1), fabsf(branch_2)); + } + } + + } + } + else + { + int this_sampling = 0; + switch (thread_id) + { + case 0: + this_sampling = CaloSampling::EME1; + break; + case 1: + this_sampling = CaloSampling::EME2; + break; + case 2: + this_sampling = CaloSampling::FCAL0; + break; + case 3: + this_sampling = CaloSampling::HEC0; + break; + default: + break; + } + const int this_cell = geometry->get_closest_cell(this_sampling, center_eta, center_phi); + float this_calc = 0.f; + + if (this_cell >= 0) + { + const float this_z = geometry->z[this_cell]; + this_calc = this_z + (this_z > 0 ? -geometry->dz[this_cell] : geometry->dz[this_cell]) / + (geometry->is_tile(this_cell) ? 2.f : 1.f); + } + + const unsigned int mask = 0xF0000000U; + //The last 4 threads. + + const float new_one = __shfl_down_sync(mask, this_calc, 1); + if (this_calc == 0.f) + { + this_calc = new_one; + } + //(0, 1) and (2, 3) get the wanted between the both of them. + const float new_two = __shfl_down_sync(mask, this_calc, 2); + if (this_calc == 0.f) + { + this_calc = new_two; + } + //0 got the correct one. + + if (this_calc != 0.f && axis_z != 0.f) + { + lambda_c = fabsf( (this_calc - center_z) / axis_z ); + } + + } + + switch (thread_id) + { + case 0: + if (first_attempt_cell < 0) + { + moments_arr->lateral[cluster] /= CMCHack::get_temporary_array<LateralNormalization>(moments_arr)[cluster]; + } + moments_arr->centerLambda[cluster] = lambda_c; + break; + case 1: + if (first_attempt_cell >= 0) + { + moments_arr->lateral[cluster] /= CMCHack::get_temporary_array<LateralNormalization>(moments_arr)[cluster]; + } + moments_arr->longitudinal[cluster] /= CMCHack::get_temporary_array<LongitudinalNormalization>(moments_arr)[cluster]; + break; + case 2: + moments_arr->secondR[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + moments_arr->secondLambda[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + break; + case 3: + { + const float old_first_phi = moments_arr->firstPhi[cluster]; + moments_arr->firstPhi[cluster] = Helpers::regularize_angle(old_first_phi / (sum_energies > 0.f ? sum_energies : 1.f)); + moments_arr->firstEta[cluster] /= (sum_energies > 0.f ? sum_energies : 1.f); + } + break; + default: + break; + } + + } + } +} + +__global__ static +void finalClusterPassKernel( Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const int cluster_number) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + const int cluster = index / NumSamplings; + const int sampling = index % NumSamplings; + if (cluster < cluster_number) + { + const int max_cell = CMCHack::get_temporary_array<MaxECellPerSample>(moments_arr)[sampling][cluster]; + if (max_cell >= 0 && max_cell < NCaloCells) + { + const ClusterTag tag = cell_state_arr->clusterTag[max_cell]; + const float sec_weight = __uint_as_float(tag.secondary_cluster_weight()); + + moments_arr->maxEPerSample[sampling][cluster] = cell_info_arr->energy[max_cell] * (tag.cluster_index() == cluster ? 1.0f - sec_weight : sec_weight); + //The cell can belong to either the first or second cluster. + + moments_arr->maxPhiPerSample[sampling][cluster] = geometry->phi[max_cell]; + moments_arr->maxEtaPerSample[sampling][cluster] = geometry->eta[max_cell]; + } + } +} + +/****************************************************************************** + * Actual kernel calling code * + * (uses dynamic parallelism since we depend on numbers of clusters...) * + ******************************************************************************/ + +__global__ static +void calculateClusterPropertiesAndMomentsDeferKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<ClusterMomentsArr> moments_arr, + Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<CellNoiseArr> noise_arr, + const Helpers::CUDA_kernel_object<ClusterMomentCalculationOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + { + const int cluster_number = clusters_arr->number; + + const int i_dimBlockClusters = ClusterPassBlockSize; + const int i_dimGridClusters = Helpers::int_ceil_div(cluster_number, Helpers::int_floor_div(i_dimBlockClusters, WarpSize)); + const dim3 dimBlockClusters(i_dimBlockClusters, 1, 1); + const dim3 dimGridClusters(i_dimGridClusters, 1, 1); + + const int i_dimBlockCells = CellPassBlockSize; + const int i_dimGridCells = Helpers::int_ceil_div(NCaloCells, Helpers::int_floor_div(i_dimBlockCells, WarpSize)); + const dim3 dimBlockCells(i_dimBlockCells, 1, 1); + const dim3 dimGridCells(i_dimGridCells, 1, 1); + + const int i_dimBlockFinal = FinalClusterPassBlocksize; + const int i_dimGridFinal = Helpers::int_ceil_div(cluster_number * NumSamplings, i_dimBlockFinal); + const dim3 dimBlockFinal(i_dimBlockFinal, 1, 1); + const dim3 dimGridFinal(i_dimGridFinal, 1, 1); + + clearInvalidCells <<< dimGridCells, dimBlockCells>>>(cell_state_arr, clusters_arr); + + zerothClusterPassKernel <<< dimGridClusters, dimBlockClusters>>>(moments_arr, clusters_arr, geometry, cluster_number); + + firstCellPassKernel <<< dimGridCells, dimBlockCells>>>(moments_arr, clusters_arr, cell_state_arr, cell_info_arr, geometry, opts->use_abs_energy); + firstClusterPassKernel <<< dimGridClusters, dimBlockClusters>>>(moments_arr, clusters_arr, cluster_number); + + secondCellPassKernel <<< dimGridCells, dimBlockCells>>>(moments_arr, cell_state_arr, cell_info_arr, geometry, noise_arr, + opts->use_abs_energy, opts->use_two_gaussian_noise, opts->min_LAr_quality); + secondClusterPassKernel <<< dimGridClusters, dimBlockClusters>>>(moments_arr, clusters_arr, cluster_number, opts->max_axis_angle); + + thirdCellPassKernel <<< dimGridCells, dimBlockCells>>>(moments_arr, cell_state_arr, cell_info_arr, geometry, opts->use_abs_energy, + opts->eta_inner_wheel, opts->min_l_longitudinal, opts->min_r_lateral); + thirdClusterPassKernel <<< dimGridClusters, dimBlockClusters>>>(moments_arr, geometry, cluster_number); + + finalClusterPassKernel <<< dimGridFinal, dimBlockFinal>>>(moments_arr, cell_state_arr, cell_info_arr, geometry, cluster_number); + + //We could have split this up and not rely so much on dynamic parallelism. + //However, if not using CUDA 12 (which we probably won't be for a while), + //we'd have to dyn-par our way through the number of clusters at every cluster-related kernel. + //With tail calls, it's a bit simpler, but we'd have a mess of #ifdef and so on + //until we could drop support for CUDA less than 12. + //So I am currently taking the shortcut of just calling everything from here + //and only calculating block sizes once... + } +} + + + + +void calculateClusterPropertiesAndMoments(CaloRecGPU::EventDataHolder & holder, + const ConstantDataHolder & instance_data, + const CMCOptionsHolder & options, + const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + calculateClusterPropertiesAndMomentsDeferKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_clusters_dev, holder.m_moments_dev, holder.m_cell_state_dev, holder.m_cell_info_dev, + instance_data.m_geometry_dev, instance_data.m_cell_noise_dev, options.m_options_dev); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculatorImpl.h b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculatorImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..0406db22777f4e9a3b7bb587cf87dec7f780b49c --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/GPUClusterInfoAndMomentsCalculatorImpl.h @@ -0,0 +1,236 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_GPUCLUSTERINFOANDMOMENTSCALCULATOR_CUDA_H +#define CALORECGPU_GPUCLUSTERINFOANDMOMENTSCALCULATOR_CUDA_H + +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/DataHolders.h" +#include "CaloRecGPU/Helpers.h" + +#include <cmath> + +template <class T> +struct RealSymmetricMatrixSolver +//See https://hal.science/hal-01501221/document +{ + T a, b, c, d, e, f; + // +-- --+ + // | a d f | + // | d b e | + // | f e c | + // +-- --+ + + constexpr static T sqr(const T & x) + { + return x * x; + } + + constexpr static T cub(const T & x) + { + return x * x * x; + } + + constexpr T x_1() const + { + return sqr(a) + sqr(b) + sqr(c) - a * b - a * c - b * c + 3 * (sqr(d) + sqr(e) + sqr(f)); + //sqr(a - b) / 2 + sqr(a - c) / 2 + sqr(b - c) / 2 + 3 * (sqr(d) + sqr(e) + sqr(f)); + //The sum of half-squares can be (re)written as + //sqr(a) + sqr(b) + sqr(c) - a * b - a * c - b*c + //but I think this gives a greater numerical error + //due to potential catastrophic cancellations. + } + + constexpr T x_2() const + { + const T t1 = 2 * a - b - c, + t2 = 2 * b - a - c, + t3 = 2 * c - a - b; + return 9 * (t1 * sqr(e) + t2 * sqr(f) + t3 * sqr(d)) - (t1 * t2 * t3) - 54 * d * e * f; + } + + CUDA_HOS_DEV T phi() const + { + const T temp = x_2(); + using namespace std; + //This allows correct square root + //on CPU and CUDA without casting to double. + return atan2(sqrt(4 * cub(x_1()) - sqr(temp)), temp); + } + + CUDA_HOS_DEV T lambda_1() const + { + using namespace std; + return ( a + b + c - 2 * sqrt(x_1()) * cos( phi() / 3 ) ) / 3; + //Could this be simplified? + } + + CUDA_HOS_DEV T lambda_2() const + { + using namespace std; + return ( a + b + c + 2 * sqrt(x_1()) * cos( (phi() - CaloRecGPU::Helpers::Constants::pi<T>) / 3 ) ) / 3; + //Could this be simplified? + } + + CUDA_HOS_DEV T lambda_3() const + { + using namespace std; + return ( a + b + c + 2 * sqrt(x_1()) * cos( (phi() + CaloRecGPU::Helpers::Constants::pi<T>) / 3 ) ) / 3; + //Could this be simplified? + } + + template <class OtherT> + CUDA_HOS_DEV void get_values(OtherT & l1, OtherT & l2, OtherT & l3) const + { + using namespace std; + + const T sum = a + b + c; + const T troot = 2 * sqrt(x_1()); + const T angl = phi(); + + l1 = ( sum - troot * cos(angl / 3) ) / 3; + l2 = ( sum + troot * cos( (angl - CaloRecGPU::Helpers::Constants::pi<T>) / 3 ) ) / 3; + l3 = ( sum + troot * cos( (angl + CaloRecGPU::Helpers::Constants::pi<T>) / 3 ) ) / 3; + + } + + constexpr T m(const T lambda) const + { + return (d * (c - lambda) - e * f) / (f * (b - lambda) - d * e); + //Probably alternative formulae + //without catastrophic cancellation? + } + + constexpr T m_1() const + { + return m(lambda_1()); + } + constexpr T m_2() const + { + return m(lambda_2()); + } + constexpr T m_3() const + { + return m(lambda_3()); + } + + template <class OtherT> + constexpr void get_v(OtherT (&a)[3], const T v, const bool normalized = false) const + { + const T m_v = m(v); + a[0] = (v - c - e * m_v) / f; + a[1] = m_v; + a[2] = 1; + if (normalized) + { + using namespace std; + T norm = sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); + a[0] /= norm; + a[1] /= norm; + a[2] /= norm; + } + + } + + template <class OtherT> + constexpr void get_v_1(OtherT (&a)[3], const bool normalized = false) const + { + get_v(a, lambda_1(), normalized); + } + template <class OtherT> + constexpr void get_v_2(OtherT (&a)[3], const bool normalized = false) const + { + get_v(a, lambda_2(), normalized); + } + template <class OtherT> + constexpr void get_v_3(OtherT (&a)[3], const bool normalized = false) const + { + get_v(a, lambda_3(), normalized); + } + + template <class OtherT> + constexpr void get_solution_pair_1(OtherT & lambda, OtherT (&v)[3], const bool normalized = false) + { + lambda = lambda_1(); + get_v(v, lambda, normalized); + } + template <class OtherT> + constexpr void get_solution_pair_2(OtherT & lambda, OtherT (&v)[3], const bool normalized = false) + { + lambda = lambda_2(); + get_v(v, lambda, normalized); + } + template <class OtherT> + constexpr void get_solution_pair_3(OtherT & lambda, OtherT (&v)[3], const bool normalized = false) + { + lambda = lambda_3(); + get_v(v, lambda, normalized); + } + + template <class OtherT> + constexpr void get_full_solution( OtherT & lambda_1, OtherT (&v_1)[3], + OtherT & lambda_2, OtherT (&v_2)[3], + OtherT & lambda_3, OtherT (&v_3)[3], + const bool normalized = false ) const + { + get_values(lambda_1, lambda_2, lambda_3); + get_v(v_1, lambda_1, normalized); + get_v(v_2, lambda_2, normalized); + get_v(v_3, lambda_3, normalized); + } + + constexpr bool ill_defined(const T la1, const T la2, const T la3) const + { + return ( f == 0 || + f * (b - la1) == d * e || + f * (b - la2) == d * e || + f * (b - la3) == d * e ); + } + + constexpr bool ill_defined() const + { + T la1, la2, la3; + get_values(la1, la2, la3); + return ill_defined(la1, la2, la3); + } + + constexpr bool well_defined(const T la1, const T la2, const T la3) const + { + return !ill_defined(la1, la3, la3); + } + + constexpr bool well_defined() const + { + return !ill_defined(); + } + +}; + +struct ClusterMomentCalculationOptions +{ + bool use_abs_energy; + bool use_two_gaussian_noise; + float min_LAr_quality; + float max_axis_angle; + float eta_inner_wheel; + float min_l_longitudinal; + float min_r_lateral; +}; + +struct CMCOptionsHolder +{ + CaloRecGPU::Helpers::CPU_object<ClusterMomentCalculationOptions> m_options; + + CaloRecGPU::Helpers::CUDA_object<ClusterMomentCalculationOptions> m_options_dev; + + void allocate(); + void sendToGPU(const bool clear_CPU = true); +}; + +void calculateClusterPropertiesAndMoments(CaloRecGPU::EventDataHolder & holder, const CaloRecGPU::ConstantDataHolder & instance_data, + const CMCOptionsHolder & options, const bool synchronize = false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream = {}); + +#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/GPUToAthenaImporterWithMoments.cxx b/Calorimeter/CaloRecGPU/src/GPUToAthenaImporterWithMoments.cxx new file mode 100644 index 0000000000000000000000000000000000000000..55fff728d671f3e0712a0bebbd3f93bb1d0cb762 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/GPUToAthenaImporterWithMoments.cxx @@ -0,0 +1,795 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "GPUToAthenaImporterWithMoments.h" + +#include "CaloRecGPU/CUDAFriendlyClasses.h" + +#include "AthenaKernel/errorcheck.h" + +#include <vector> +#include <algorithm> +#include <memory> + +#include "xAODCaloEvent/CaloClusterKineHelper.h" +#include "CaloDetDescr/CaloDetDescrManager.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +using namespace CaloRecGPU; + +GPUToAthenaImporterWithMoments::GPUToAthenaImporterWithMoments(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this), + m_doHVMoments(false) +{ + declareInterface<ICaloClusterGPUOutputTransformer> (this); + +} + +#include "MacroHelpers.h" + +StatusCode GPUToAthenaImporterWithMoments::initialize() +{ + ATH_CHECK( m_cellsKey.value().initialize() ); + + ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") ); + + ATH_CHECK(m_caloMgrKey.initialize()); + + ATH_CHECK(m_HVCablingKey.initialize()); + ATH_CHECK(m_HVScaleKey.initialize()); + + auto get_cluster_size_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, xAOD::CaloCluster, + SW_55ele, + SW_35ele, + SW_37ele, + SW_55gam, + SW_35gam, + SW_37gam, + SW_55Econv, + SW_35Econv, + SW_37Econv, + SW_softe, + Topo_420, + Topo_633, + SW_7_11, + SuperCluster, + Tower_01_01, + Tower_005_005, + Tower_fixed_area + ) + ) + //I know Topological Clustering only supports a subset of those, + //but this is supposed to be a general data exporting tool... + else + { + //failed = true; + return xAOD::CaloCluster::CSize_Unknown; + } + }; + + bool size_failed = false; + m_clusterSize = get_cluster_size_from_string(m_clusterSizeString, size_failed); + + if (m_clusterSize == xAOD::CaloCluster::CSize_Unknown) + { + ATH_MSG_ERROR("Invalid Cluster Size: " << m_clusterSizeString); + } + + if (size_failed) + { + return StatusCode::FAILURE; + } + + + auto get_moment_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, xAOD::CaloCluster, + FIRST_PHI, + FIRST_ETA, + SECOND_R, + SECOND_LAMBDA, + DELTA_PHI, + DELTA_THETA, + DELTA_ALPHA, + CENTER_X, + CENTER_Y, + CENTER_Z, + CENTER_MAG, + CENTER_LAMBDA, + LATERAL, + LONGITUDINAL, + ENG_FRAC_EM, + ENG_FRAC_MAX, + ENG_FRAC_CORE, + FIRST_ENG_DENS, + SECOND_ENG_DENS, + ISOLATION, + ENG_BAD_CELLS, + N_BAD_CELLS, + N_BAD_CELLS_CORR, + BAD_CELLS_CORR_E, + BADLARQ_FRAC, + ENG_POS, + SIGNIFICANCE, + CELL_SIGNIFICANCE, + CELL_SIG_SAMPLING, + AVG_LAR_Q, + AVG_TILE_Q, + ENG_BAD_HV_CELLS, + N_BAD_HV_CELLS, + PTD, + MASS, + EM_PROBABILITY, + HAD_WEIGHT, + OOC_WEIGHT, + DM_WEIGHT, + TILE_CONFIDENCE_LEVEL, + SECOND_TIME, + NCELL_SAMPLING, + VERTEX_FRACTION, + NVERTEX_FRACTION, + ETACALOFRAME, + PHICALOFRAME, + ETA1CALOFRAME, + PHI1CALOFRAME, + ETA2CALOFRAME, + PHI2CALOFRAME, + ENG_CALIB_TOT, + ENG_CALIB_OUT_L, + ENG_CALIB_OUT_M, + ENG_CALIB_OUT_T, + ENG_CALIB_DEAD_L, + ENG_CALIB_DEAD_M, + ENG_CALIB_DEAD_T, + ENG_CALIB_EMB0, + ENG_CALIB_EME0, + ENG_CALIB_TILEG3, + ENG_CALIB_DEAD_TOT, + ENG_CALIB_DEAD_EMB0, + ENG_CALIB_DEAD_TILE0, + ENG_CALIB_DEAD_TILEG3, + ENG_CALIB_DEAD_EME0, + ENG_CALIB_DEAD_HEC0, + ENG_CALIB_DEAD_FCAL, + ENG_CALIB_DEAD_LEAKAGE, + ENG_CALIB_DEAD_UNCLASS, + ENG_CALIB_FRAC_EM, + ENG_CALIB_FRAC_HAD, + ENG_CALIB_FRAC_REST) + ) + else + { + failed = true; + return xAOD::CaloCluster::ENERGY_DigiHSTruth; + } + }; + + + auto process_moments = [&](const std::vector<std::string> & moment_names, std::string & invalid_names) + { + for (const std::string & mom_name : moment_names) + { + bool failed = false; + const int linear_num = MomentsOptionsArray::moment_to_linear(get_moment_from_string(mom_name, failed)); + + failed = failed || linear_num >= MomentsOptionsArray::num_moments; + + if (failed) + { + if (invalid_names.size() == 0) + { + invalid_names = "'" + mom_name + "'"; + } + else + { + invalid_names += ", '" + mom_name + "'"; + } + } + else + { + m_momentsToDo.array[linear_num] = true; + } + } + }; + + std::string invalid_names; + + process_moments(m_momentsNames, invalid_names); + + if (invalid_names.size() > 0) + { + ATH_MSG_ERROR( "Moments " << invalid_names + << " are not valid moments and will be ignored!" ); + } + + m_doHVMoments = m_momentsToDo[xAOD::CaloCluster::ENG_BAD_HV_CELLS] || m_momentsToDo[xAOD::CaloCluster::N_BAD_HV_CELLS]; + return StatusCode::SUCCESS; +} + + +StatusCode GPUToAthenaImporterWithMoments::convert (const EventContext & ctx, + const ConstantDataHolder & cdh, + EventDataHolder & ed, + xAOD::CaloClusterContainer * cluster_container) const +{ + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + + const auto start = clock_type::now(); + + SG::ReadHandle<CaloCellContainer> cell_collection(m_cellsKey, ctx); + if ( !cell_collection.isValid() ) + { + ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() ); + return StatusCode::RECOVERABLE; + } + const DataLink<CaloCellContainer> cell_collection_link (cell_collection.name(), ctx); + + //ed.returnToCPU(!m_keepGPUData, true, true, true); + + const auto pre_processing = clock_type::now(); + + ed.returnClusterNumberToCPU(); + CaloRecGPU::CUDA_Helpers::GPU_synchronize(); + + + const auto cluster_number = clock_type::now(); + + ed.returnSomeClustersToCPU(ed.m_clusters->number); + + std::vector<std::unique_ptr<CaloClusterCellLink>> cell_links; + + cell_links.reserve(ed.m_clusters->number); + + size_t valid_clusters = 0; + + CaloRecGPU::CUDA_Helpers::GPU_synchronize(); + + const auto clusters = clock_type::now(); + + ed.returnCellsToCPU(); + + for (int i = 0; i < ed.m_clusters->number; ++i) + { + if (ed.m_clusters->seedCellID[i] >= 0) + { + cell_links.emplace_back(std::make_unique<CaloClusterCellLink>(cell_collection_link)); + cell_links.back()->reserve(256); + //To be adjusted. + ++valid_clusters; + } + else + { + cell_links.emplace_back(nullptr); + //The excluded clusters don't have any cells. + } + } + + std::vector<float> HV_energy(ed.m_clusters->number * m_doHVMoments, 0.f); + std::vector<int> HV_number(ed.m_clusters->number * m_doHVMoments, 0 ); + + SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl(m_HVCablingKey, ctx); + const LArOnOffIdMapping * cabling = *cablingHdl; + SG::ReadCondHandle<ILArHVScaleCorr> hvScaleHdl(m_HVScaleKey, ctx); + const ILArHVScaleCorr * hvcorr = *hvScaleHdl; + + CaloRecGPU::CUDA_Helpers::GPU_synchronize(); + + const auto cells = clock_type::now(); + + ed.returnSomeMomentsToCPU(ed.m_clusters->number); + + if (cell_collection->isOrderedAndComplete()) + //Fast path: cell indices within the collection and identifierHashes match! + { + for (int cell_index = 0; cell_index < NCaloCells; ++cell_index) + { + const ClusterTag this_tag = ed.m_cell_state->clusterTag[cell_index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_index = this_tag.cluster_index(); + const int32_t weight_pattern = this_tag.secondary_cluster_weight(); + + float tempf = 1.0f; + + std::memcpy(&tempf, &weight_pattern, sizeof(float)); + //C++20 would give us bit cast to do this more properly. + //Still, given how the bit pattern is created, + //it should be safe. + + const float reverse_weight = tempf; + + const float this_weight = 1.0f - reverse_weight; + + cell_links[this_index]->addCell(cell_index, this_weight); + + if (cell_index == ed.m_clusters->seedCellID[this_index] && cell_links[this_index]->size() > 1) + //Seed cells aren't shared, + //so no need to check this on the other case. + { + CaloClusterCellLink::iterator begin_it = cell_links[this_index]->begin(); + CaloClusterCellLink::iterator back_it = (--cell_links[this_index]->end()); + + const unsigned int first_idx = begin_it.index(); + const double first_wgt = begin_it.weight(); + + begin_it.reindex(back_it.index()); + begin_it.reweight(back_it.weight()); + + back_it.reindex(first_idx); + back_it.reweight(first_wgt); + + //Of course, this is to ensure the first cell is the seed cell, + //in accordance to the way some cluster properties + //(mostly phi-related) are calculated. + } + + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + cell_links[other_index]->addCell(cell_index, reverse_weight); + } + + if (m_doHVMoments && !cdh.m_geometry->is_tile(cell_index)) + { + HWIdentifier hwid = cabling->createSignalChannelIDFromHash((IdentifierHash) cell_index); + const float corr = hvcorr->HVScaleCorr(hwid); + if (corr > 0.f && corr < 100.f && fabsf(corr - 1.f) > m_HVthreshold) + { + const float abs_energy = fabsf(ed.m_cell_info->energy[cell_index]); + HV_energy[this_index] += abs_energy; + ++HV_number[this_index]; + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + HV_energy[other_index] += abs_energy; + ++HV_number[other_index]; + } + } + } + } + } + } + else if (m_missingCellsToFill.size() > 0) + { + size_t missing_cell_count = 0; + for (int cell_index = 0; cell_index < NCaloCells; ++cell_index) + { + if (missing_cell_count < m_missingCellsToFill.size() && cell_index == m_missingCellsToFill[missing_cell_count]) + { + ++missing_cell_count; + continue; + } + const ClusterTag this_tag = ed.m_cell_state->clusterTag[cell_index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_index = this_tag.cluster_index(); + const int32_t weight_pattern = this_tag.secondary_cluster_weight(); + + float tempf = 1.0f; + + std::memcpy(&tempf, &weight_pattern, sizeof(float)); + //C++20 would give us bit cast to do this more properly. + //Still, given how the bit pattern is created, + //it should be safe. + + const float reverse_weight = tempf; + + const float this_weight = 1.0f - reverse_weight; + + cell_links[this_index]->addCell(cell_index - missing_cell_count, this_weight); + + if (cell_index == ed.m_clusters->seedCellID[this_index] && cell_links[this_index]->size() > 1) + //Seed cells aren't shared, + //so no need to check this on the other case. + { + CaloClusterCellLink::iterator begin_it = cell_links[this_index]->begin(); + CaloClusterCellLink::iterator back_it = (--cell_links[this_index]->end()); + + const unsigned int first_idx = begin_it.index(); + const double first_wgt = begin_it.weight(); + + begin_it.reindex(back_it.index()); + begin_it.reweight(back_it.weight()); + + back_it.reindex(first_idx); + back_it.reweight(first_wgt); + + //Of course, this is to ensure the first cell is the seed cell, + //in accordance to the way some cluster properties + //(mostly phi-related) are calculated. + } + + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + cell_links[other_index]->addCell(cell_index - missing_cell_count, reverse_weight); + } + + if (m_doHVMoments && !cdh.m_geometry->is_tile(cell_index)) + { + HWIdentifier hwid = cabling->createSignalChannelIDFromHash((IdentifierHash) cell_index); + const float corr = hvcorr->HVScaleCorr(hwid); + if (corr > 0.f && corr < 100.f && fabsf(corr - 1.f) > m_HVthreshold) + { + const float abs_energy = fabsf(ed.m_cell_info->energy[cell_index]); + HV_energy[this_index] += abs_energy; + ++HV_number[this_index]; + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + HV_energy[other_index] += abs_energy; + ++HV_number[other_index]; + } + } + } + } + } + } + else + //Slow path: be careful. + { + CaloCellContainer::const_iterator iCells = cell_collection->begin(); + + for (int cell_count = 0; iCells != cell_collection->end(); ++iCells, ++cell_count) + { + const CaloCell * cell = (*iCells); + + //const int cell_index = m_calo_id->calo_cell_hash(cell->ID()); + const int cell_index = cell->caloDDE()->calo_hash(); + + const ClusterTag this_tag = ed.m_cell_state->clusterTag[cell_index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_index = this_tag.cluster_index(); + const int32_t weight_pattern = this_tag.secondary_cluster_weight(); + + float tempf = 1.0f; + + std::memcpy(&tempf, &weight_pattern, sizeof(float)); + //C++20 would give us bit cast to do this more properly. + //Still, given how the bit pattern is created, + //it should be safe. + + const float reverse_weight = tempf; + + const float this_weight = 1.0f - reverse_weight; + + cell_links[this_index]->addCell(cell_count, this_weight); + //So we put this in the right cell link. + + if (cell_index == ed.m_clusters->seedCellID[this_index] && cell_links[this_index]->size() > 1) + //Seed cells aren't shared, + //so no need to check this on the other case. + { + CaloClusterCellLink::iterator begin_it = cell_links[this_index]->begin(); + CaloClusterCellLink::iterator back_it = (--cell_links[this_index]->end()); + + const unsigned int first_idx = begin_it.index(); + const double first_wgt = begin_it.weight(); + + begin_it.reindex(back_it.index()); + begin_it.reweight(back_it.weight()); + + back_it.reindex(first_idx); + back_it.reweight(first_wgt); + + //Of course, this is to ensure the first cell is the seed cell, + //in accordance to the way some cluster properties + //(mostly phi-related) are calculated. + } + + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + cell_links[other_index]->addCell(cell_count, reverse_weight); + } + + if (m_doHVMoments && !cdh.m_geometry->is_tile(cell_index)) + { + HWIdentifier hwid = cabling->createSignalChannelIDFromHash((IdentifierHash) cell_index); + const float corr = hvcorr->HVScaleCorr(hwid); + if (corr > 0.f && corr < 100.f && fabsf(corr - 1.f) > m_HVthreshold) + { + const float abs_energy = fabsf(ed.m_cell_info->energy[cell_index]); + HV_energy[this_index] += abs_energy; + ++HV_number[this_index]; + if (this_tag.is_shared_between_clusters()) + { + const int other_index = this_tag.secondary_cluster_index(); + HV_energy[other_index] += abs_energy; + ++HV_number[other_index]; + } + } + } + } + } + } + + const auto end_cell_cycle = clock_type::now(); + + std::vector<int> cluster_order(ed.m_clusters->number); + + std::iota(cluster_order.begin(), cluster_order.end(), 0); + + std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) -> bool + { + const bool a_valid = ed.m_clusters->seedCellID[a] >= 0; + const bool b_valid = ed.m_clusters->seedCellID[b] >= 0; + if (a_valid && b_valid) + { + return ed.m_clusters->clusterEt[a] + > ed.m_clusters->clusterEt[b]; + } + else if (a_valid) + { + return true; + } + else if (b_valid) + { + return false; + } + else + { + return b > a; + } + } ); + + //Ordered by Et as in the default algorithm... + //The fact that some invalid clusters + //(with possibly trash values for Et) + //can crop up is irrelevant since + //we don't add those anyway: + //the rest is still ordered like we want it to be. + + const auto ordered = clock_type::now(); + + cluster_container->clear(); + cluster_container->reserve(cell_links.size()); + + std::vector<int> real_cluster_order; + real_cluster_order.reserve(cluster_order.size()); + + for (size_t i = 0; i < cluster_order.size(); ++i) + { + const int cluster_index = cluster_order[i]; + + if (cell_links[cluster_index] != nullptr && cell_links[cluster_index]->size() > 0) + { + xAOD::CaloCluster * cluster = new xAOD::CaloCluster(); + cluster_container->push_back(cluster); + + cluster->addCellLink(cell_links[cluster_index].release()); + cluster->setClusterSize(m_clusterSize); + + cluster->setEta(ed.m_clusters->clusterEta[cluster_index]); + cluster->setPhi(ed.m_clusters->clusterPhi[cluster_index]); + + cluster->setE(ed.m_clusters->clusterEnergy[cluster_index]); + cluster->setM(0.0); + + real_cluster_order.push_back(cluster_index); + } + + } + + const auto pre_moments = clock_type::now(); + + CaloRecGPU::CUDA_Helpers::GPU_synchronize(); + + + const auto post_moments = clock_type::now(); + + for (size_t i = 0; i < cluster_container->size(); ++i) + { + xAOD::CaloCluster * cluster = (*cluster_container)[i]; + const int cluster_index = real_cluster_order[i]; + + cluster->setTime(ed.m_moments->time[cluster_index]); + cluster->setSecondTime(ed.m_moments->secondTime[cluster_index]); + cluster->clearSamplingData(); + + uint32_t sampling_pattern = 0; + for (int i = 0; i < NumSamplings; ++i) + { + const int cells_per_sampling = ed.m_moments->nCellSampling[i][cluster_index]; + + if (cells_per_sampling > 0) + { + sampling_pattern |= (0x1U << i); + } + } + cluster->setSamplingPattern(sampling_pattern); + + for (int i = 0; i < NumSamplings; ++i) + { + const int cells_per_sampling = ed.m_moments->nCellSampling[i][cluster_index]; + + if (cells_per_sampling > 0) + { + cluster->setEnergy ((CaloSampling::CaloSample) i, ed.m_moments->energyPerSample [i][cluster_index]); + cluster->setEta ((CaloSampling::CaloSample) i, ed.m_moments->etaPerSample [i][cluster_index]); + cluster->setPhi ((CaloSampling::CaloSample) i, ed.m_moments->phiPerSample [i][cluster_index]); + cluster->setEmax ((CaloSampling::CaloSample) i, ed.m_moments->maxEPerSample [i][cluster_index]); + cluster->setEtamax ((CaloSampling::CaloSample) i, ed.m_moments->maxEtaPerSample [i][cluster_index]); + cluster->setPhimax ((CaloSampling::CaloSample) i, ed.m_moments->maxPhiPerSample [i][cluster_index]); + } + + if (m_momentsToDo[xAOD::CaloCluster::NCELL_SAMPLING]) + { + cluster->setNumberCellsInSampling((CaloSampling::CaloSample) i, cells_per_sampling, false); + } + } + +#define CALORECGPU_MOMENTS_CONVERSION_HELPER(MOMENT_ENUM, MOMENT_ARRAY) \ + if (m_momentsToDo[xAOD::CaloCluster:: MOMENT_ENUM ] ) \ + { \ + cluster->insertMoment(xAOD::CaloCluster:: MOMENT_ENUM , ed.m_moments-> MOMENT_ARRAY [cluster_index]); \ + } + + +#define CALORECGPU_MOMENTS_CONVERSION_INVALID(MOMENT_ENUM) \ + if (m_momentsToDo[xAOD::CaloCluster:: MOMENT_ENUM ] ) \ + { \ + ATH_MSG_WARNING("Moment '" << # MOMENT_ENUM << \ + "' given as a calculated moment, but not yet supported on the GPU side..."); \ + } + + CALORECGPU_MOMENTS_CONVERSION_HELPER(FIRST_PHI, firstPhi ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(FIRST_ETA, firstEta ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(SECOND_R, secondR ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(SECOND_LAMBDA, secondLambda ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(DELTA_PHI, deltaPhi ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(DELTA_THETA, deltaTheta ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(DELTA_ALPHA, deltaAlpha ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CENTER_X, centerX ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CENTER_Y, centerY ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CENTER_Z, centerZ ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CENTER_MAG, centerMag ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CENTER_LAMBDA, centerLambda ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(LATERAL, lateral ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(LONGITUDINAL, longitudinal ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(ENG_FRAC_EM, engFracEM ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(ENG_FRAC_MAX, engFracMax ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(ENG_FRAC_CORE, engFracCore ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(FIRST_ENG_DENS, firstEngDens ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(SECOND_ENG_DENS, secondEngDens ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(ISOLATION, isolation ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(ENG_BAD_CELLS, engBadCells ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(N_BAD_CELLS, nBadCells ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(N_BAD_CELLS_CORR, nBadCellsCorr ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(BAD_CELLS_CORR_E, badCellsCorrE ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(BADLARQ_FRAC, badLArQFrac ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(ENG_POS, engPos ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(SIGNIFICANCE, significance ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CELL_SIGNIFICANCE, cellSignificance ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(CELL_SIG_SAMPLING, cellSigSampling ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(AVG_LAR_Q, avgLArQ ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(AVG_TILE_Q, avgTileQ ); + + if (m_momentsToDo[xAOD::CaloCluster::ENG_BAD_HV_CELLS]) + { + cluster->insertMoment(xAOD::CaloCluster::ENG_BAD_HV_CELLS, HV_energy[cluster_index]); + } + if (m_momentsToDo[xAOD::CaloCluster::N_BAD_HV_CELLS]) + { + cluster->insertMoment(xAOD::CaloCluster::N_BAD_HV_CELLS, HV_number[cluster_index]); + } + + CALORECGPU_MOMENTS_CONVERSION_HELPER(PTD, PTD ); + CALORECGPU_MOMENTS_CONVERSION_HELPER(MASS, mass ); + + CALORECGPU_MOMENTS_CONVERSION_INVALID(EM_PROBABILITY ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(HAD_WEIGHT ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(OOC_WEIGHT ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(DM_WEIGHT ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(TILE_CONFIDENCE_LEVEL ); + + + CALORECGPU_MOMENTS_CONVERSION_HELPER(SECOND_TIME, secondTime); + + if (m_momentsToDo[xAOD::CaloCluster::NCELL_SAMPLING]) + { + const int extra_sampling_count = ed.m_moments->nExtraCellSampling[cluster_index]; + if (extra_sampling_count > 0) + { + cluster->setNumberCellsInSampling(CaloSampling::EME2, extra_sampling_count, true); + } + } + + CALORECGPU_MOMENTS_CONVERSION_INVALID(VERTEX_FRACTION ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(NVERTEX_FRACTION ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ETACALOFRAME ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(PHICALOFRAME ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ETA1CALOFRAME ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(PHI1CALOFRAME ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ETA2CALOFRAME ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(PHI2CALOFRAME ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_TOT ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_OUT_L ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_OUT_M ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_OUT_T ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_L ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_M ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_T ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_EMB0 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_EME0 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_TILEG3 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_TOT ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_EMB0 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_TILE0 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_TILEG3 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_EME0 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_HEC0 ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_FCAL ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_LEAKAGE ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_DEAD_UNCLASS ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_FRAC_EM ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_FRAC_HAD ); + CALORECGPU_MOMENTS_CONVERSION_INVALID(ENG_CALIB_FRAC_REST ); + + //Maybe things to do with DigiHSTruth, if needed? + } + + const auto end = clock_type::now(); + + if (!m_keepGPUData) + { + ed.clear_GPU(); + } + + + if (m_measureTimes) + { + record_times(ctx.evt(), + time_cast(start, pre_processing), + time_cast(pre_processing, cluster_number), + time_cast(cluster_number, clusters), + time_cast(clusters, cells), + time_cast(cells, end_cell_cycle), + time_cast(end_cell_cycle, ordered), + time_cast(ordered, pre_moments), + time_cast(pre_moments, post_moments), + time_cast(post_moments, end) + ); + } + + + return StatusCode::SUCCESS; + +} + + +StatusCode GPUToAthenaImporterWithMoments::finalize() +{ + if (m_measureTimes) + { + print_times("Preprocessing Cluster_Number Clusters Cells Cell_Cycle Ordering Cluster_Creation Moments_Transfer Moments_Fill", 9); + } + return StatusCode::SUCCESS; +} + + +GPUToAthenaImporterWithMoments::~GPUToAthenaImporterWithMoments() +{ + //Nothing! +} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/GPUToAthenaImporterWithMoments.h b/Calorimeter/CaloRecGPU/src/GPUToAthenaImporterWithMoments.h new file mode 100644 index 0000000000000000000000000000000000000000..99a6c6fc84e88e5387181cdb49de352d417444f8 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/GPUToAthenaImporterWithMoments.h @@ -0,0 +1,296 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +//Dear emacs, this is -*-c++-*- + +#ifndef CALORECGPU_GPUTOATHENAIMPORTERWITHMOMENTS_H +#define CALORECGPU_GPUTOATHENAIMPORTERWITHMOMENTS_H + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "CaloRecGPU/CaloClusterGPUTransformers.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" + +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "LArCabling/LArOnOffIdMapping.h" +#include "LArElecCalib/ILArHVScaleCorr.h" + +class CaloCell_ID; + +/** + * @class GPUToAthenaImporterWithMoments + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 30 May 2022 + * @brief Tool to convert the GPU data representation back to CPU, with selected moments too. + * + */ + +class GPUToAthenaImporterWithMoments : + public AthAlgTool, virtual public ICaloClusterGPUOutputTransformer, public CaloGPUTimed +{ + public: + + GPUToAthenaImporterWithMoments(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode convert (const EventContext & ctx, const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, xAOD::CaloClusterContainer * cluster_collection) const override; + + virtual StatusCode finalize() override; + + virtual ~GPUToAthenaImporterWithMoments(); + + private: + + /** @brief If @p true, do not delete the GPU data representation. + * Defaults to @p true. + * + */ + Gaudi::Property<bool> m_keepGPUData {this, "KeepGPUData", true, "Keep GPU allocated data"}; + + /** + * @brief vector of names of the cell containers to use as input. + */ + Gaudi::Property<SG::ReadHandleKey<CaloCellContainer>> m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"}; + + /// Cluster size. Should be set accordingly to the threshold. + Gaudi::Property<std::string> m_clusterSizeString {this, "ClusterSize", "Topo_420", "The size/type of the clusters"}; + + xAOD::CaloCluster::ClusterSize m_clusterSize; + + /** + * @brief Pointer to Calo ID Helper + */ + const CaloCell_ID * m_calo_id {nullptr}; + + /** + * @brief Key for the CaloDetDescrManager in the Condition Store + */ + SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this, "CaloDetDescrManager", "CaloDetDescrManager", + "SG Key for CaloDetDescrManager in the Condition Store"}; + + //Handles for things we can't (yet) do on the GPU. + + ///@brief Cabling for the CPU-based HV moments calculation. + SG::ReadCondHandleKey<LArOnOffIdMapping> m_HVCablingKey{this, "LArCablingKey","LArOnOffIdMap","SG Key of LAr Cabling object"}; + + ///@brief HV corrections for the CPU-based HV moments. + SG::ReadCondHandleKey<ILArHVScaleCorr> m_HVScaleKey{this,"HVScaleCorrKey","LArHVScaleCorr","SG key of HVScaleCorr conditions object"}; + + ///@brief Threshold above which a cell contributes to the HV moments. + Gaudi::Property<float> m_HVthreshold{this,"HVThreshold",0.2,"Threshold to consider a cell 'affected' by HV issues"}; + + /** @brief Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells). + */ + Gaudi::Property<std::vector<int>> m_missingCellsToFill {this, "MissingCellsToFill", {}, "Force fill these cells as disabled on empty containers."}; + + + /** + * @brief vector holding the input list of names of moments to + * calculate. + * + * This is the list of desired names of moments given in the + * jobOptions.*/ + Gaudi::Property<std::vector<std::string>> m_momentsNames{this, "MomentsNames", {}, "List of names of moments to calculate"}; + + + struct MomentsOptionsArray + { + static constexpr int num_moments = 72; + bool array[num_moments]{}; + //Initialize to false. + //(We could consider using + //some form of bitset here, + //but I'm not sure there would be + //a significant performance difference...) + + static constexpr int moment_to_linear(const xAOD::CaloCluster::MomentType moment) + { + switch (moment) + { + default: + return num_moments; + case xAOD::CaloCluster::FIRST_PHI: + return 0; + case xAOD::CaloCluster::FIRST_ETA: + return 1; + case xAOD::CaloCluster::SECOND_R: + return 2; + case xAOD::CaloCluster::SECOND_LAMBDA: + return 3; + case xAOD::CaloCluster::DELTA_PHI: + return 4; + case xAOD::CaloCluster::DELTA_THETA: + return 5; + case xAOD::CaloCluster::DELTA_ALPHA: + return 6; + case xAOD::CaloCluster::CENTER_X: + return 7; + case xAOD::CaloCluster::CENTER_Y: + return 8; + case xAOD::CaloCluster::CENTER_Z: + return 9; + case xAOD::CaloCluster::CENTER_MAG: + return 10; + case xAOD::CaloCluster::CENTER_LAMBDA: + return 11; + case xAOD::CaloCluster::LATERAL: + return 12; + case xAOD::CaloCluster::LONGITUDINAL: + return 13; + case xAOD::CaloCluster::ENG_FRAC_EM: + return 14; + case xAOD::CaloCluster::ENG_FRAC_MAX: + return 15; + case xAOD::CaloCluster::ENG_FRAC_CORE: + return 16; + case xAOD::CaloCluster::FIRST_ENG_DENS: + return 17; + case xAOD::CaloCluster::SECOND_ENG_DENS: + return 18; + case xAOD::CaloCluster::ISOLATION: + return 19; + case xAOD::CaloCluster::ENG_BAD_CELLS: + return 20; + case xAOD::CaloCluster::N_BAD_CELLS: + return 21; + case xAOD::CaloCluster::N_BAD_CELLS_CORR: + return 22; + case xAOD::CaloCluster::BAD_CELLS_CORR_E: + return 23; + case xAOD::CaloCluster::BADLARQ_FRAC: + return 24; + case xAOD::CaloCluster::ENG_POS: + return 25; + case xAOD::CaloCluster::SIGNIFICANCE: + return 26; + case xAOD::CaloCluster::CELL_SIGNIFICANCE: + return 27; + case xAOD::CaloCluster::CELL_SIG_SAMPLING: + return 28; + case xAOD::CaloCluster::AVG_LAR_Q: + return 29; + case xAOD::CaloCluster::AVG_TILE_Q: + return 30; + case xAOD::CaloCluster::ENG_BAD_HV_CELLS: + return 31; + case xAOD::CaloCluster::N_BAD_HV_CELLS: + return 32; + case xAOD::CaloCluster::PTD: + return 33; + case xAOD::CaloCluster::MASS: + return 34; + case xAOD::CaloCluster::EM_PROBABILITY: + return 35; + case xAOD::CaloCluster::HAD_WEIGHT: + return 36; + case xAOD::CaloCluster::OOC_WEIGHT: + return 37; + case xAOD::CaloCluster::DM_WEIGHT: + return 38; + case xAOD::CaloCluster::TILE_CONFIDENCE_LEVEL: + return 39; + case xAOD::CaloCluster::SECOND_TIME: + return 40; + case xAOD::CaloCluster::NCELL_SAMPLING: + return 41; + case xAOD::CaloCluster::VERTEX_FRACTION: + return 42; + case xAOD::CaloCluster::NVERTEX_FRACTION: + return 43; + case xAOD::CaloCluster::ETACALOFRAME: + return 44; + case xAOD::CaloCluster::PHICALOFRAME: + return 45; + case xAOD::CaloCluster::ETA1CALOFRAME: + return 46; + case xAOD::CaloCluster::PHI1CALOFRAME: + return 47; + case xAOD::CaloCluster::ETA2CALOFRAME: + return 48; + case xAOD::CaloCluster::PHI2CALOFRAME: + return 49; + case xAOD::CaloCluster::ENG_CALIB_TOT: + return 50; + case xAOD::CaloCluster::ENG_CALIB_OUT_L: + return 51; + case xAOD::CaloCluster::ENG_CALIB_OUT_M: + return 52; + case xAOD::CaloCluster::ENG_CALIB_OUT_T: + return 53; + case xAOD::CaloCluster::ENG_CALIB_DEAD_L: + return 54; + case xAOD::CaloCluster::ENG_CALIB_DEAD_M: + return 55; + case xAOD::CaloCluster::ENG_CALIB_DEAD_T: + return 56; + case xAOD::CaloCluster::ENG_CALIB_EMB0: + return 57; + case xAOD::CaloCluster::ENG_CALIB_EME0: + return 58; + case xAOD::CaloCluster::ENG_CALIB_TILEG3: + return 59; + case xAOD::CaloCluster::ENG_CALIB_DEAD_TOT: + return 60; + case xAOD::CaloCluster::ENG_CALIB_DEAD_EMB0: + return 61; + case xAOD::CaloCluster::ENG_CALIB_DEAD_TILE0: + return 62; + case xAOD::CaloCluster::ENG_CALIB_DEAD_TILEG3: + return 63; + case xAOD::CaloCluster::ENG_CALIB_DEAD_EME0: + return 64; + case xAOD::CaloCluster::ENG_CALIB_DEAD_HEC0: + return 65; + case xAOD::CaloCluster::ENG_CALIB_DEAD_FCAL: + return 66; + case xAOD::CaloCluster::ENG_CALIB_DEAD_LEAKAGE: + return 67; + case xAOD::CaloCluster::ENG_CALIB_DEAD_UNCLASS: + return 68; + case xAOD::CaloCluster::ENG_CALIB_FRAC_EM: + return 69; + case xAOD::CaloCluster::ENG_CALIB_FRAC_HAD: + return 70; + case xAOD::CaloCluster::ENG_CALIB_FRAC_REST: + return 71; + } + } + + bool & operator[] (const xAOD::CaloCluster::MomentType moment) + { + const int idx=moment_to_linear(moment); //this can return 72 + if (idx == num_moments) { + throw std::out_of_range("index out of range in bool & MomentsOptionsArray[]"); + } + return array[moment_to_linear(moment)]; + } + + bool operator[] (const xAOD::CaloCluster::MomentType moment) const + { + const int idx=moment_to_linear(moment); //this can return 72 + if (idx == num_moments) { + throw std::out_of_range("index out of range in bool MomentsOptionsArray[] const"); + } + return array[moment_to_linear(moment)]; + } + }; + + /** @brief Holds (in a linearized way) the moments and whether to add them to the clusters. + (on the GPU side, they are unconditionally calculated). + */ + MomentsOptionsArray m_momentsToDo; + + + ///@brief To abbreviate checks of @p m_momentsToDo... + bool m_doHVMoments; + +}; + +#endif //CALORECGPU_GPUTOATHENAIMPORTERWITHMOMENTS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/MacroHelpers.h b/Calorimeter/CaloRecGPU/src/MacroHelpers.h index e1fcbe3eb6f5c99227b0f1eef1a5311309ac98d8..ae9b0a06e3c028c398e439dd99cfec2d21365938 100644 --- a/Calorimeter/CaloRecGPU/src/MacroHelpers.h +++ b/Calorimeter/CaloRecGPU/src/MacroHelpers.h @@ -1,134 +1,160 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -//Dear emacs, this is -*-c++-*- - -#ifndef CALORECGPU_MACROHELPERS_H -#define CALORECGPU_MACROHELPERS_H - -/** @file MacroHelpers.h - * Contains some helpful macros to help with repetitive code... - */ - - - -/** @brief Helper macro, expands to nothing. - */ - -#define CRGPU_EMPTY() - -/** @brief Helper macro, defers macro expansion to the next level of evaluation to allow recursive macros. - */ -#define CRGPU_DEFER(...) __VA_ARGS__ CRGPU_EMPTY() - -/** @brief Helper macro, takes the arguments and expands to nothing. - */ - -#define CRGPU_IGNORE(...) - -/** @brief Helper macro, concatenates two arguments - */ -#define CRGPU_CONCAT(X, Y) CRGPU_CONCAT_HELPER(X, Y) - -/** @brief Helper macro for concatenation. - */ -#define CRGPU_CONCAT_HELPER(X,...) X ## __VA_ARGS__ - - - -/** @brief Helper macro, returns the second argument - */ -#define CRGPU_GET_SECOND(X, A, ...) A - -/** @brief Definitions to check for list end - */ -#define CRGPU_TEST_CRGPU_END ,1 -/** @brief Definitions to allow an empty argument to also be used as a terminator - */ -#define CRGPU_TEST_ ,1 - -/** @brief Check for CRGPU_END (or an empty argument) to terminate list - */ -#define CRGPU_CHECK_FOR_END(VAL) CRGPU_CHECK_FOR_END_CHECK(CRGPU_TEST_ ## VAL, 0) - -/** @brief Implementation of checking for CRGPU_END (or an empty argument) to terminate list - */ -#define CRGPU_CHECK_FOR_END_CHECK(...) CRGPU_GET_SECOND(__VA_ARGS__,) - -/** @brief Expands recursive macros. Wrap the recursive macro call in `CRGPU_RECURSIVE_MACRO` to make it work. - */ -#define CRGPU_RECURSIVE_MACRO(...) CR_GPU_MACRO_RECURSE1(CR_GPU_MACRO_RECURSE1(CR_GPU_MACRO_RECURSE1(CR_GPU_MACRO_RECURSE1(__VA_ARGS__)))) - -/** @brief Helper macro to expand recursive macros (recursion level 1). - */ -#define CR_GPU_MACRO_RECURSE1(...) CR_GPU_MACRO_RECURSE2(CR_GPU_MACRO_RECURSE2(CR_GPU_MACRO_RECURSE2(CR_GPU_MACRO_RECURSE2(__VA_ARGS__)))) - -/** @brief Helper macro to expand recursive macros (recursion level 2). - */ -#define CR_GPU_MACRO_RECURSE2(...) CR_GPU_MACRO_RECURSE3(CR_GPU_MACRO_RECURSE3(CR_GPU_MACRO_RECURSE3(CR_GPU_MACRO_RECURSE3(__VA_ARGS__)))) - -/** @brief Helper macro to expand recursive macros (recursion level 3). - */ -#define CR_GPU_MACRO_RECURSE3(...) CR_GPU_MACRO_RECURSE4(CR_GPU_MACRO_RECURSE4(CR_GPU_MACRO_RECURSE4(CR_GPU_MACRO_RECURSE4(__VA_ARGS__)))) - -/** @brief Helper macro to expand recursive macros (recursion level 4). - */ -#define CR_GPU_MACRO_RECURSE4(...) CR_GPU_MACRO_RECURSE_BASE(CR_GPU_MACRO_RECURSE_BASE(CR_GPU_MACRO_RECURSE_BASE(CR_GPU_MACRO_RECURSE_BASE(__VA_ARGS__)))) - -/** @brief Helper macro to expand recursive macros (last recursion level: simply expands the macro). - */ -#define CR_GPU_MACRO_RECURSE_BASE(...) __VA_ARGS__ - -/** @brief Helper macro to apply a macro to all elements of the variadic list, - starting with @p ONE, with @p VAR and @p PREFIX being passed as - arguments to the macro too. - */ -#define CRGPU_MACRO_EXPANSION(MACRO, VAR, PREFIX, ... ) \ -CRGPU_MACRO_EXPANSION_IMPL(MACRO, VAR, PREFIX, __VA_ARGS__, CRGPU_END, CRGPU_END) - -#define CRGPU_MACRO_EXPANSION_IMPL(MACRO, VAR, PREFIX, ONE, NEXT, ... ) \ - CRGPU_DEFER(MACRO) (VAR, PREFIX, ONE) CRGPU_DEFER(CRGPU_CONCAT(CRGPU_MACRO_EXPANSION_IMPL_, CRGPU_CHECK_FOR_END(NEXT))) () (MACRO, VAR, PREFIX, NEXT, __VA_ARGS__ ) - -/** @brief Helper macro to defer macro expansion to enable recursion. - */ -#define CRGPU_MACRO_EXPANSION_IMPL_0 CRGPU_MACRO_EXPANSION_IMPL_DO - -/** @brief Helper macro to defer macro expansion to enable recursion. - */ -#define CRGPU_MACRO_EXPANSION_IMPL_DO() CRGPU_MACRO_EXPANSION_IMPL - -/** @brief Helper macro to defer macro expansion to enable recursion. - */ -#define CRGPU_MACRO_EXPANSION_IMPL_1 CRGPU_MACRO_EXPANSION_IMPL_DONT - -/** @brief Helper macro to defer macro expansion to enable recursion. - */ -#define CRGPU_MACRO_EXPANSION_IMPL_DONT() CRGPU_IGNORE - -/** @brief Base macro to be applied to every element for converting strings to enums. - */ -#define CRGPU_STRING_TO_ENUM_OP(VAR, PREFIX, TYPE) \ - else if (VAR == #TYPE) { return PREFIX::TYPE; } - -/** @brief Checks a string variable, @p VAR, - for matching enum identifiers (@p ONE and the remaining variadic arguments), - for the enum starting with @p PREFIX. - - @warning Should be wrapped in `CRGPU_RECURSIVE_MACRO` to work properly. - */ -#define CRGPU_CHEAP_STRING_TO_ENUM(VAR, PREFIX, ONE, ...) \ -if (false) { return PREFIX::ONE; } CRGPU_MACRO_EXPANSION(CRGPU_STRING_TO_ENUM_OP, VAR, PREFIX, ONE, __VA_ARGS__) - -//Implements this in any C++ compiler that supports variadic macros -//(MSVC had some problems in the past, not sure how it is now...) - - - -//To call this, wrap in CRGPU_RECURSIVE_MACRO( ... ) to ensure correct expansion. -//If there are too many items and the final macros come unexpanded, -//thus leading to "weird" compilation errors, maybe wrap it in two or three... -//Any question, - - -#endif //CALORECGPU_MACROHELPERS_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_MACROHELPERS_H +#define CALORECGPU_MACROHELPERS_H + +/** @file MacroHelpers.h + * Contains some helpful macros to help with repetitive code... + */ + +#define CRGPU_EMPTY() + +/** @brief Helper macro, defers macro expansion to the next level of evaluation to allow recursive macros. + */ +#define CRGPU_DEFER(...) __VA_ARGS__ CRGPU_EMPTY() + +/** @brief Helper macro, takes the arguments and expands to nothing. + */ + +#define CRGPU_IGNORE(...) + +/** @brief Helper macro, concatenates two arguments + */ +#define CRGPU_CONCAT(X, Y) CRGPU_CONCAT_HELPER(X, Y) + +/** @brief Helper macro for concatenation. + */ +#define CRGPU_CONCAT_HELPER(X,...) X ## __VA_ARGS__ + + +/** @brief Helper macro, stringifies the argument + */ +#define CRGPU_STRINGIFY(X) CRGPU_STRINGIFY_HELPER(X) + +/** @brief Helper macro for concatenation. + */ +#define CRGPU_STRINGIFY_HELPER(...) #__VA_ARGS__ + + +/** @brief Helper macro, returns the first argument + */ +#define CRGPU_GET_FIRST(X, ...) X + +/** @brief Helper macro, returns the second argument + */ +#define CRGPU_GET_SECOND(X, ...) CRGPU_GET_FIRST(__VA_ARGS__, X) + +/** @brief Definitions to check for list end + */ +#define CRGPU_TEST_CRGPU_END ,1 +/** @brief Definitions to allow an empty argument to also be used as a terminator + */ +#define CRGPU_TEST_ ,1 + +/** @brief Check for CRGPU_END (or an empty argument) to terminate list + */ +#define CRGPU_CHECK_FOR_END(X) CRGPU_CHECK_FOR_END_CHECK(CRGPU_TEST_ ## X, 0) + +/** @brief Implementation of checking for CRGPU_END (or an empty argument) to terminate list + */ +#define CRGPU_CHECK_FOR_END_CHECK(...) CRGPU_GET_SECOND(__VA_ARGS__,) + +/** @brief Expands recursive macros. Wrap the recursive macro call in `CRGPU_RECURSIVE_MACRO` to make it work. + */ +#define CRGPU_RECURSIVE_MACRO(...) CR_GPU_MACRO_RECURSE1(CR_GPU_MACRO_RECURSE1(CR_GPU_MACRO_RECURSE1(CR_GPU_MACRO_RECURSE1(__VA_ARGS__)))) + +/** @brief Helper macro to expand recursive macros (recursion level 1). + */ +#define CR_GPU_MACRO_RECURSE1(...) CR_GPU_MACRO_RECURSE2(CR_GPU_MACRO_RECURSE2(CR_GPU_MACRO_RECURSE2(CR_GPU_MACRO_RECURSE2(__VA_ARGS__)))) + +/** @brief Helper macro to expand recursive macros (recursion level 2). + */ +#define CR_GPU_MACRO_RECURSE2(...) CR_GPU_MACRO_RECURSE3(CR_GPU_MACRO_RECURSE3(CR_GPU_MACRO_RECURSE3(CR_GPU_MACRO_RECURSE3(__VA_ARGS__)))) + +/** @brief Helper macro to expand recursive macros (recursion level 3). + */ +#define CR_GPU_MACRO_RECURSE3(...) CR_GPU_MACRO_RECURSE4(CR_GPU_MACRO_RECURSE4(CR_GPU_MACRO_RECURSE4(CR_GPU_MACRO_RECURSE4(__VA_ARGS__)))) + +/** @brief Helper macro to expand recursive macros (recursion level 4). + */ +#define CR_GPU_MACRO_RECURSE4(...) CR_GPU_MACRO_RECURSE_BASE(CR_GPU_MACRO_RECURSE_BASE(CR_GPU_MACRO_RECURSE_BASE(CR_GPU_MACRO_RECURSE_BASE(__VA_ARGS__)))) + +/** @brief Helper macro to expand recursive macros (last recursion level: simply expands the macro). + */ +#define CR_GPU_MACRO_RECURSE_BASE(...) __VA_ARGS__ + +/** @brief Helper macro to apply a macro to all elements of the variadic list, + with @p EXTRA_ARG and the parenthesised rest of the arguments + being passed as arguments to the macro too. + */ +#define CRGPU_MACRO_EXPANSION(MACRO, EXTRA_ARG, ... ) \ + CRGPU_MACRO_EXPANSION_IMPL(MACRO, EXTRA_ARG, __VA_ARGS__, CRGPU_END, CRGPU_END) + +#define CRGPU_MACRO_EXPANSION_IMPL(MACRO, EXTRA_ARG, ONE, NEXT, ... ) \ + CRGPU_DEFER(CRGPU_CONCAT(CRGPU_MACRO_INSTANTIATION_IMPL_, CRGPU_CHECK_FOR_END(ONE))) (MACRO) (ONE, EXTRA_ARG, (NEXT, __VA_ARGS__) ) \ + CRGPU_DEFER(CRGPU_CONCAT(CRGPU_MACRO_EXPANSION_IMPL_, CRGPU_CHECK_FOR_END(NEXT))) () (MACRO, EXTRA_ARG, NEXT, __VA_ARGS__ ) + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_EXPANSION_IMPL_0 CRGPU_MACRO_EXPANSION_IMPL_DO + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_EXPANSION_IMPL_DO() CRGPU_MACRO_EXPANSION_IMPL + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_EXPANSION_IMPL_1 CRGPU_MACRO_EXPANSION_IMPL_DONT + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_EXPANSION_IMPL_DONT() CRGPU_IGNORE + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_INSTANTIATION_IMPL_0 CRGPU_MACRO_INSTANTIATION_DO + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_INSTANTIATION_IMPL_1 CRGPU_MACRO_INSTANTIATION_DONT + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_INSTANTIATION_DO(...) __VA_ARGS__ + +/** @brief Helper macro to defer macro expansion to enable recursion. + */ +#define CRGPU_MACRO_INSTANTIATION_DONT(...) CRGPU_IGNORE + +/** @brief Base macro to be applied to every element for converting strings to enums. + */ +#define CRGPU_STRING_TO_ENUM_OP(TYPE, VAR_PREFIX_PAIR, IGNORE) \ + else if (CRGPU_GET_FIRST VAR_PREFIX_PAIR == CRGPU_STRINGIFY(TYPE)) \ + { return CRGPU_GET_SECOND VAR_PREFIX_PAIR::TYPE; } + + +/** @brief Checks a string variable, @p VAR, + for matching enum identifiers (@p ONE and the remaining variadic arguments), + for the enum starting with @p PREFIX. + + @warning Should be wrapped in `CRGPU_RECURSIVE_MACRO` to work properly. + */ +#define CRGPU_CHEAP_STRING_TO_ENUM(VAR, PREFIX, ONE, ...) \ + if (false) { return PREFIX::ONE; } CRGPU_MACRO_EXPANSION(CRGPU_STRING_TO_ENUM_OP, (VAR, PREFIX), ONE, __VA_ARGS__) + + +//Implements this in any C++ compiler that supports variadic macros +//(MSVC had some problems in the past, not sure how it is now...) + + +//To call this, wrap in CRGPU_RECURSIVE_MACRO( ... ) to ensure correct expansion. +//If there are too many items and the final macros come unexpanded, +//thus leading to "weird" compilation errors, maybe wrap it in two or three... +//Any question, reach me at nuno.dos.santos.fernandes@cern.ch + + +#endif //CALORECGPU_MACROHELPERS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.cxx b/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.cxx index d525085b93adcac588797c520f57d003b1745ee8..b980bbba000b8e877c0ff4a7a6c181a837d5b057 100644 --- a/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.cxx +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.cxx @@ -1,214 +1,300 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TopoAutomatonClustering.h" -#include "TopoAutomatonClusteringGPU.h" - - -#include <string> -#include <climits> //For CHAR_BIT... though it's a slightly inefficient way of saying 8. - -#include "CaloIdentifier/CaloCell_ID.h" - -#include "boost/chrono/chrono.hpp" -#include "boost/chrono/thread_clock.hpp" - -#include "MacroHelpers.h" - -using namespace CaloRecGPU; - -TopoAutomatonClustering::TopoAutomatonClustering(const std::string & type, const std::string & name, const IInterface * parent): - AthAlgTool(type, name, parent), - CaloGPUTimed(this) -{ - declareInterface<CaloClusterGPUProcessor> (this); -} - -StatusCode TopoAutomatonClustering::initialize() -{ - - m_options.allocate(); - - - using PackType = decltype(m_options.m_options->validSamplingSeed); - - PackType & seed_samplings = m_options.m_options->validSamplingSeed; - - seed_samplings = 0; - - static_assert(CaloCell_ID::getNumberOfSamplings() <= sizeof(PackType) * CHAR_BIT, "We are assuming that we have fewer samplings that bits per int!"); - - //Possibly more elegant alternative: compile-time packed bool vector (std::bitset?) with CUDA compat. - //Been there, done that, overkill since number of samplings shouldn't change unexpectedly overnight - //and it doesn't seem that likely to me that it'll reach anything that a 64-bit int wouldn't cover - //(at least without implying such a major overhaul that the code will need a deeper redesign anyway...) - - auto get_option_from_string = [](const std::string & str, bool & failed) - { - failed = false; - CRGPU_RECURSIVE_MACRO( - CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID, - PreSamplerB, - EMB1, - EMB2, - EMB3, - PreSamplerE, - EME1, - EME2, - EME3, - HEC0, - HEC1, - HEC2, - HEC3, - TileBar0, - TileBar1, - TileBar2, - TileGap1, - TileGap2, - TileGap3, - TileExt0, - TileExt1, - TileExt2, - FCAL0, - FCAL1, - FCAL2 - ) - ) - else - { - failed = true; - return CaloCell_ID::Unknown; - } - }; - - - for (const std::string & samp_name : m_samplingNames) - { - bool failed = false; - const PackType sampling = (PackType) get_option_from_string(samp_name, failed); - - if (failed) - { - ATH_MSG_ERROR( "Calorimeter sampling" << samp_name - << " is not a valid Calorimeter sampling name and will be ignored! " - << "Valid names are: " - << "PreSamplerB, EMB1, EMB2, EMB3, " - << "PreSamplerE, EME1, EME2, EME3, " - << "HEC0, HEC1, HEC2, HEC3, " - << "TileBar0, TileBar1, TileBar2, " - << "TileGap1, TileGap2, TileGap3, " - << "TileExt0, TileExt1, TileExt2, " - << "FCAL0, FCAL1, FCAL2." ); - } - else - { - seed_samplings |= ((PackType) 1) << sampling; - } - } - - m_options.m_options->seed_threshold = m_seedThresholdOnEorAbsEinSigma; - m_options.m_options->grow_threshold = m_neighborThresholdOnEorAbsEinSigma; - m_options.m_options->terminal_threshold = m_cellThresholdOnEorAbsEinSigma; - m_options.m_options->abs_seed = m_seedCutsInAbsE; - m_options.m_options->abs_grow = m_neighborCutsInAbsE; - m_options.m_options->abs_terminal = m_cellCutsInAbsE; - m_options.m_options->use_two_gaussian = m_twoGaussianNoise; - - m_options.sendToGPU(true); - - - if (m_numPreAllocatedGPUData > 0) - { - ATH_MSG_DEBUG("Pre-allocating temporaries for " << m_numPreAllocatedGPUData << " events."); - - m_temporariesHolder.resize(m_numPreAllocatedGPUData); - //This will allocate the object holders. - - m_temporariesHolder.operate_on_all( [&](TACTemporariesHolder & tth) - { - tth.allocate(); - } - ); - //This will allocate all the memory at this point. - //Also useful to prevent/debug potential allocation issues? - //But the main point is really reducing the execute times... - } - - return StatusCode::SUCCESS; - -} - -StatusCode TopoAutomatonClustering::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const -{ - - using clock_type = boost::chrono::thread_clock; - auto time_cast = [](const auto & before, const auto & after) - { - return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); - }; - - const auto start = clock_type::now(); - - TACTemporariesHolder * temp_data_ptr = nullptr; - - Helpers::separate_thread_accessor<TACTemporariesHolder> sep_th_acc(m_temporariesHolder, temp_data_ptr); - //This is a RAII wrapper to access an object held by Helpers::separate_thread_holder, - //to ensure the event data is appropriately released when we are done processing. - - if (temp_data_ptr == nullptr) - { - ATH_MSG_ERROR("Could not get valid Temporary Data Holder! Event: " << ctx.evt() ); - return StatusCode::FAILURE; - } - - temp_data_ptr->allocate(); - //Does nothing if it is already allocated - //(which it should be unless a new holder had to be created - // due to m_numPreAllocatedGPUData being less than the number of threads.) - - const auto before_snr = clock_type::now(); - - signalToNoise(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto before_pairs = clock_type::now(); - - cellPairs(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto before_growing = clock_type::now(); - - clusterGrowing(event_data, *temp_data_ptr, constant_data, m_options, m_measureTimes); - - const auto end = clock_type::now(); - - - if (m_measureTimes) - { - record_times(ctx.evt(), - time_cast(start, before_snr), - time_cast(before_snr, before_pairs), - time_cast(before_pairs, before_growing), - time_cast(before_growing, end) - ); - } - - return StatusCode::SUCCESS; - - -} - - -StatusCode TopoAutomatonClustering::finalize() -{ - if (m_measureTimes) - { - print_times("Preprocessing Signal-to-Noise_Ratio Cell_Pair_Creation Cluster_Growing", 4); - } - return StatusCode::SUCCESS; -} - - -TopoAutomatonClustering::~TopoAutomatonClustering() -{ - //Nothing! -} \ No newline at end of file +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "TopoAutomatonClustering.h" +#include "TopoAutomatonClusteringImpl.h" + + +#include <string> +#include <climits> //For CHAR_BIT... though it's a slightly inefficient way of saying 8. + +#include "CaloIdentifier/CaloCell_ID.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +#include "MacroHelpers.h" + +using namespace CaloRecGPU; + +TopoAutomatonClustering::TopoAutomatonClustering(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this) +{ + declareInterface<CaloClusterGPUProcessor> (this); +} + +StatusCode TopoAutomatonClustering::initialize() +{ + + m_options.allocate(); + + + using PackType = decltype(m_options.m_options->valid_sampling_seed); + + static_assert(CaloCell_ID::getNumberOfSamplings() <= sizeof(PackType) * CHAR_BIT, "We are assuming that we have fewer samplings that bits per int!"); + + //Possibly more elegant alternative: compile-time packed bool vector (std::bitset?) with CUDA compat. + //Been there, done that, overkill since number of samplings shouldn't change unexpectedly overnight + //and it doesn't seem that likely to me that it'll reach anything that a 64-bit int wouldn't cover + //(at least without implying such a major overhaul that the code will need a deeper redesign anyway...) + + auto get_sampling_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID, + PreSamplerB, + EMB1, + EMB2, + EMB3, + PreSamplerE, + EME1, + EME2, + EME3, + HEC0, + HEC1, + HEC2, + HEC3, + TileBar0, + TileBar1, + TileBar2, + TileGap1, + TileGap2, + TileGap3, + TileExt0, + TileExt1, + TileExt2, + FCAL0, + FCAL1, + FCAL2 + ) + ) + else + { + failed = true; + return CaloCell_ID::Unknown; + } + }; + + + PackType & seed_samplings = m_options.m_options->valid_sampling_seed; + + seed_samplings = 0; + + for (const std::string & samp_name : m_samplingNames) + { + bool failed = false; + const PackType sampling = (PackType) get_sampling_from_string(samp_name, failed); + + if (failed) + { + ATH_MSG_ERROR( "Calorimeter sampling" << samp_name + << " is not a valid Calorimeter sampling name and will be ignored! " + << "Valid names are: " + << "PreSamplerB, EMB1, EMB2, EMB3, " + << "PreSamplerE, EME1, EME2, EME3, " + << "HEC0, HEC1, HEC2, HEC3, " + << "TileBar0, TileBar1, TileBar2, " + << "TileGap1, TileGap2, TileGap3, " + << "TileExt0, TileExt1, TileExt2, " + << "FCAL0, FCAL1, FCAL2." ); + } + else + { + seed_samplings |= ((PackType) 1) << sampling; + } + } + + auto get_calo_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID, + LAREM, LARHEC, + LARFCAL, TILE, + LARMINIFCAL + ) + ) + else + { + failed = true; + return CaloCell_ID::NOT_VALID; + } + }; + + + auto calo_to_sampling_mask = [](const CaloCell_ID::SUBCALO sc) -> PackType + { + switch (sc) + { + case CaloCell_ID::LAREM: + return 0xFFU; + //PreSamplerB=0, EMB1, EMB2, EMB3, + //PreSamplerE, EME1, EME2, EME3=7, + case CaloCell_ID::LARHEC: + return 0xF00U; + //HEC0=8, HEC1, HEC2, HEC3=11, + case CaloCell_ID::TILE: + return 0x1FF000U; + //TileBar0=12, TileBar1, TileBar2, + //TileGap1, TileGap2, TileGap3, + //TileExt0, TileExt1, TileExt2=20, + case CaloCell_ID::LARFCAL: + return 0xE00000U; + //FCAL0=21, FCAL1, FCAL2=23 + case CaloCell_ID::LARMINIFCAL: + return 0xF000000U; + //MINIFCAL0=24, MINIFCAL1, MINIFCAL2, MINIFCAL3=27, + default: + return 0; + } + }; + + PackType & calo_samplings = m_options.m_options->valid_calorimeter_by_sampling; + + calo_samplings = 0; + + for (const std::string & calo_name : m_caloNames) + { + bool failed = false; + const PackType sample_mask = calo_to_sampling_mask(get_calo_from_string(calo_name, failed)); + + if (failed) + { + ATH_MSG_ERROR( "Calorimeter " << calo_name + << " is not a valid Calorimeter name and will be ignored! " + << "Valid names are: LAREM, LARHEC, LARFCAL, and TILE." ); + } + else + { + calo_samplings |= sample_mask; + } + } + + auto get_neighbour_option_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, LArNeighbours, + prevInPhi, + nextInPhi, + prevInEta, + nextInEta, + faces2D, + corners2D, + all2D, + prevInSamp, + nextInSamp, + upAndDown, + prevSubDet, + nextSubDet, + all3D, + corners3D, + all3DwithCorners, + prevSuperCalo, + nextSuperCalo, + super3D + ) + ) + else + { + failed = true; + return LArNeighbours::super3D; + } + }; + + bool neigh_failed = false; + m_options.m_options->neighbour_options = (unsigned int) get_neighbour_option_from_string(m_neighborOptionString, neigh_failed); + + if (neigh_failed) + { + ATH_MSG_ERROR("Invalid Neighbour Option: " << m_neighborOptionString); + } + + m_options.m_options->seed_threshold = m_seedThresholdOnEorAbsEinSigma; + m_options.m_options->grow_threshold = m_neighborThresholdOnEorAbsEinSigma; + m_options.m_options->terminal_threshold = m_cellThresholdOnEorAbsEinSigma; + m_options.m_options->abs_seed = m_seedCutsInAbsE; + m_options.m_options->abs_grow = m_neighborCutsInAbsE; + m_options.m_options->abs_terminal = m_cellCutsInAbsE; + m_options.m_options->use_two_gaussian = m_twoGaussianNoise; + + m_options.m_options->treat_L1_predicted_as_good = m_treatL1PredictedCellsAsGood; + m_options.m_options->use_time_cut = m_cutCellsInTime; + m_options.m_options->keep_significant_cells = m_keepSignificantCells; + m_options.m_options->completely_exclude_cut_seeds = m_excludeCutSeedsFromClustering; + m_options.m_options->time_threshold = m_timeThreshold; + m_options.m_options->snr_threshold_for_keeping_cells = m_thresholdForKeeping; + + m_options.m_options->limit_HECIW_and_FCal_neighs = m_restrictHECIWandFCalNeighbors; + m_options.m_options->limit_PS_neighs = m_restrictPSNeighbors; + + m_options.sendToGPU(true); + + return StatusCode::SUCCESS; + +} + +StatusCode TopoAutomatonClustering::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, + EventDataHolder & event_data, void * temporary_buffer ) const +{ + + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + const auto start = clock_type::now(); + + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries((TopoAutomatonTemporaries *) temporary_buffer); + + const auto before_snr = clock_type::now(); + + signalToNoise(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto before_pairs = clock_type::now(); + + cellPairs(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto before_growing = clock_type::now(); + + clusterGrowing(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto end = clock_type::now(); + + + if (m_measureTimes) + { + record_times(ctx.evt(), + time_cast(start, before_snr), + time_cast(before_snr, before_pairs), + time_cast(before_pairs, before_growing), + time_cast(before_growing, end) + ); + } + + return StatusCode::SUCCESS; + + +} + + +StatusCode TopoAutomatonClustering::finalize() +{ + if (m_measureTimes) + { + print_times("Preprocessing Signal-to-Noise_Ratio Cell_Pair_Creation Cluster_Growing", 4); + } + return StatusCode::SUCCESS; +} + + +TopoAutomatonClustering::~TopoAutomatonClustering() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.h b/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.h index 3c06b57b2e128401a7a43940589d8aaf1a356ad6..07ac9d8816e09b85caa2d09cb85909b741b750ea 100644 --- a/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.h +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonClustering.h @@ -1,153 +1,238 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - - -#ifndef CALORECGPU_TOPOAUTOMATONCLUSTERING_H -#define CALORECGPU_TOPOAUTOMATONCLUSTERING_H - -#include "AthenaBaseComps/AthAlgTool.h" - -#include "CxxUtils/checker_macros.h" - -#include "CaloRecGPU/CaloClusterGPUProcessor.h" -#include "CaloRecGPU/CaloGPUTimed.h" -#include "TopoAutomatonClusteringGPU.h" -#include <string> -#include <mutex> - -/** - * @class TopoAutomatonClustering - * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> - * @date 31 May 2022 - * @brief Topological cluster maker algorithm to be run on GPUs. - */ - - -class TopoAutomatonClustering : - public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed -{ - public: - - TopoAutomatonClustering(const std::string & type, const std::string & name, const IInterface * parent); - - virtual StatusCode initialize() override; - - virtual StatusCode execute (const EventContext & ctx, const ConstantDataHolder & constant_data, EventDataHolder & event_data) const override; - - virtual StatusCode finalize() override; - - virtual ~TopoAutomatonClustering(); - - private: - - - /** - * @brief vector of names of the calorimeter samplings to consider - * for seeds. - * - * The default is to use all calorimeter samplings. Excluding a - * sampling from this vector prevents the definition of a seed cell - * in this sampling. Cells in those samplings are still used and - * incorporated in the topo clusters (both on the neighbor and the - * cell level) they can therefore even expand a cluster but not seed - * one ...*/ - Gaudi::Property<std::vector<std::string>> m_samplingNames {this, "SeedSamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for seeds"}; - - /** - * @brief all cells have to satisfy \f$|E| > N_{\rm cell}\,\sigma\f$ - * - * This cut determines how much the cluster will extend beyond the - * last cell passing the neighbor threshold. The smaller this cut is - * the more cells will be allowed in the tail of the cluster. It - * should be smaller or equal to the neighbor threshold. If a cell - * passing this cut is neighbor of two or more cells passing the - * neighbor cut it will be inserted in the cluster which has the - * neighbor cell that was asked first for its neighbors. Since the - * original list of seed cells is ordered in descending order of - * \f$E/\sigma\f$ (or \f$|E|/\sigma\f$) the distance of the cell (in - * number of cell generations passing the neighbor cut until this - * cell will be reached) usually determines in which cluster the - * cell will end up in. The cell cut should be lower or equal to the - * neighbor cut. */ - Gaudi::Property<float> m_cellThresholdOnEorAbsEinSigma {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; - - /** - * @brief cells with \f$|E| > N_{\rm neighbor}\,\sigma\f$ extend the cluster - * - * This cut determines how many cells are asked for their neighbors - * to expand the cluster. The smaller this cut is the more cells - * will be asked for their neighbors. If a cell passing this cut is - * neighbor of two other cells passing this cut from different - * clusters, the two clusters are merged. The neighbor cut should be - * lower or equal to the seed cut. */ - Gaudi::Property<float> m_neighborThresholdOnEorAbsEinSigma {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; - - /** - * @brief cells with \f$|E| > N_{\rm seed}\,\sigma\f$ start a cluster - * - * This cut determines how many clusters are formed initially. The - * smaller this cut is the more clusters will be created. During - * the accumulation of cells inside the clusters it can happen that - * clusters are merged if a cell passing the neighbor threshold - * would be included in both clusters. */ - Gaudi::Property<float> m_seedThresholdOnEorAbsEinSigma {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; - - - /** - * @brief if set to true seed cuts are on \f$|E|\f$ and \f$|E|_\perp\f$. - * - * The seed cuts and the \f$E_\perp\f$ cut on the final clusters - * before insertion to the CaloClusterContainer will be on absolute - * energy and absolute transverse energy if this is set to true. If - * set to false the cuts will be on energy and transverse energy - * instead. */ - Gaudi::Property<bool> m_seedCutsInAbsE {this, "SeedCutsInAbsE", true, "Seed cuts in Abs E instead of E"}; - - /** - * @brief if set to true neighbor cuts are on \f$|E|\f$ and \f$|E|_\perp\f$. - * - * The neighbor cuts will be on absolute energy and absolute - * transverse energy if this is set to true. If set to false the - * cuts will be on energy and transverse energy instead. */ - Gaudi::Property<bool> m_neighborCutsInAbsE {this, "NeighborCutsInAbsE", true, "Neighbor (grow) cuts in Abs E instead of E"}; - - /** - * @brief if set to true cell cuts are on \f$|E|\f$ and \f$|E|_\perp\f$. - * - * The cell cuts will be on absolute energy and absolute transverse - * energy if this is set to true. If set to false the cuts will be - * on energy and transverse energy instead. */ - Gaudi::Property<bool> m_cellCutsInAbsE {this, "CellCutsInAbsE", true, "Cell (terminal) cuts in Abs E instead of E"}; - - - /** - * @brief if set to true use 2-gaussian noise description for - * TileCal - * - * @warning Currently unsupported on the GPU side! - */ - Gaudi::Property<bool> m_twoGaussianNoise{this, "TwoGaussianNoise", false, "Use 2-gaussian noise description for TileCal"}; - - - /** - * @brief Number of events for which to pre-allocate space on GPU memory - * (should ideally be set to the expected number of threads to be run with). - * - */ - Gaudi::Property<size_t> m_numPreAllocatedGPUData {this, "NumPreAllocatedDataHolders", 0, "Number of temporary data holders to pre-allocate on GPU memory"}; - - /** @brief A way to reduce allocations over multiple threads by keeping a cache - * of previously allocated objects that get assigned to the threads as they need them. - * It's all thread-safe due to an internal mutex ensuring no objects get assigned to different threads. - */ - mutable CaloRecGPU::Helpers::separate_thread_holder<TACTemporariesHolder> m_temporariesHolder ATLAS_THREAD_SAFE; - - - /** @brief Options for the algorithm, held in a GPU-friendly way. - */ - TACOptionsHolder m_options; - -}; - -#endif //CALORECGPU_TOPOAUTOMATONCLUSTERING_H +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + + +#ifndef CALORECGPU_TOPOAUTOMATONCLUSTERING_H +#define CALORECGPU_TOPOAUTOMATONCLUSTERING_H + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "CxxUtils/checker_macros.h" + +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "TopoAutomatonClusteringImpl.h" +#include <string> +#include <mutex> + +#include "CLHEP/Units/SystemOfUnits.h" + +/** + * @class TopoAutomatonClustering + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 31 May 2022 + * @brief Topological cluster maker algorithm to be run on GPUs. + */ + + +class TopoAutomatonClustering : + public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed +{ + public: + + TopoAutomatonClustering(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual StatusCode finalize() override; + + virtual ~TopoAutomatonClustering(); + + virtual size_t size_of_temporaries() const + { + return sizeof(TopoAutomatonTemporaries); + }; + + private: + + /** + * @brief vector of names of the calorimeters to consider. + * + * The default is to use all calorimeters (i.e. LAREM, LARHEC, + * LARFCAL, TILE). Cells which belong to one of the input cell + * containers and to one of the calorimeters in this vector are used + * as input for the cluster maker. This property is used in order + * to ignore a certain subsystem (e.g. for LAREM only clusters + * specify only LAREM in the jobOptions). */ + Gaudi::Property<std::vector<std::string>> m_caloNames {this, "CalorimeterNames", {}, "Name(s) of Calorimeters to use for clustering"}; + + /** + * @brief vector of names of the calorimeter samplings to consider + * for seeds. + * + * The default is to use all calorimeter samplings. Excluding a + * sampling from this vector prevents the definition of a seed cell + * in this sampling. Cells in those samplings are still used and + * incorporated in the topo clusters (both on the neighbor and the + * cell level) they can therefore even expand a cluster but not seed + * one ...*/ + Gaudi::Property<std::vector<std::string>> m_samplingNames {this, "SeedSamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for seeds"}; + + /** + * @brief all cells have to satisfy \f$|E| > N_{\rm cell}\,\sigma\f$ + * + * This cut determines how much the cluster will extend beyond the + * last cell passing the neighbor threshold. The smaller this cut is + * the more cells will be allowed in the tail of the cluster. It + * should be smaller or equal to the neighbor threshold. If a cell + * passing this cut is neighbor of two or more cells passing the + * neighbor cut it will be inserted in the cluster which has the + * neighbor cell that was asked first for its neighbors. Since the + * original list of seed cells is ordered in descending order of + * \f$E/\sigma\f$ (or \f$|E|/\sigma\f$) the distance of the cell (in + * number of cell generations passing the neighbor cut until this + * cell will be reached) usually determines in which cluster the + * cell will end up in. The cell cut should be lower or equal to the + * neighbor cut. */ + Gaudi::Property<float> m_cellThresholdOnEorAbsEinSigma {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"}; + + /** + * @brief cells with \f$|E| > N_{\rm neighbor}\,\sigma\f$ extend the cluster + * + * This cut determines how many cells are asked for their neighbors + * to expand the cluster. The smaller this cut is the more cells + * will be asked for their neighbors. If a cell passing this cut is + * neighbor of two other cells passing this cut from different + * clusters, the two clusters are merged. The neighbor cut should be + * lower or equal to the seed cut. */ + Gaudi::Property<float> m_neighborThresholdOnEorAbsEinSigma {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"}; + + /** + * @brief cells with \f$|E| > N_{\rm seed}\,\sigma\f$ start a cluster + * + * This cut determines how many clusters are formed initially. The + * smaller this cut is the more clusters will be created. During + * the accumulation of cells inside the clusters it can happen that + * clusters are merged if a cell passing the neighbor threshold + * would be included in both clusters. */ + Gaudi::Property<float> m_seedThresholdOnEorAbsEinSigma {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"}; + + + /** + * @brief if set to true seed cuts are on \f$|E|\f$ and \f$|E|_\perp\f$. + * + * The seed cuts and the \f$E_\perp\f$ cut on the final clusters + * before insertion to the CaloClusterContainer will be on absolute + * energy and absolute transverse energy if this is set to true. If + * set to false the cuts will be on energy and transverse energy + * instead. */ + Gaudi::Property<bool> m_seedCutsInAbsE {this, "SeedCutsInAbsE", true, "Seed cuts in Abs E instead of E"}; + + /** + * @brief if set to true neighbor cuts are on \f$|E|\f$ and \f$|E|_\perp\f$. + * + * The neighbor cuts will be on absolute energy and absolute + * transverse energy if this is set to true. If set to false the + * cuts will be on energy and transverse energy instead. */ + Gaudi::Property<bool> m_neighborCutsInAbsE {this, "NeighborCutsInAbsE", true, "Neighbor (grow) cuts in Abs E instead of E"}; + + /** + * @brief if set to true cell cuts are on \f$|E|\f$ and \f$|E|_\perp\f$. + * + * The cell cuts will be on absolute energy and absolute transverse + * energy if this is set to true. If set to false the cuts will be + * on energy and transverse energy instead. */ + Gaudi::Property<bool> m_cellCutsInAbsE {this, "CellCutsInAbsE", true, "Cell (terminal) cuts in Abs E instead of E"}; + + /** + * if set to true, time cut is applied to seed cells, no cut otherwise + */ + Gaudi::Property<bool> m_cutCellsInTime {this, "SeedCutsInT", false, "Do seed cuts in time"}; + + /** + * threshold used for timing cut on seed cells. Implemented as |seed_cell_time|<m_timeThreshold. No such cut on neighbouring cells.*/ + Gaudi::Property<float> m_timeThreshold {this, "SeedThresholdOnTAbs", 12.5 * CLHEP::ns, "Time thresholds (in abs. val.)"}; + + /** + * upper limit on the energy significance, for applying the cell time cut */ + Gaudi::Property<float> m_thresholdForKeeping {this, "TimeCutUpperLimit", 20., "Significance upper limit for applying time cut"}; + + + /** + * @brief if set to true treat cells with a dead OTX which can be + * predicted by L1 trigger info as good instead of bad cells */ + Gaudi::Property<bool> m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}; + + /** + * @brief if set to true, seed cells failing the time cut are also excluded from cluster at all + */ + Gaudi::Property<bool> m_excludeCutSeedsFromClustering {this, "CutOOTseed", true, "Exclude out-of-time seeds from neighbouring and cell stage"}; + + /** + * @brief if set to true, the time cut is not applied on cell of large significance + */ + Gaudi::Property<bool> m_keepSignificantCells {this, "UseTimeCutUpperLimit", false, "Do not apply time cut on cells of large significance"}; + + /** + * @brief if set to true use 2-gaussian noise description for + * TileCal + * + * @warning Currently unsupported on the GPU side! + */ + Gaudi::Property<bool> m_twoGaussianNoise{this, "TwoGaussianNoise", false, "Use 2-gaussian noise description for TileCal"}; + + + /** + * @brief type of neighbor relations to use. + * + * The CaloIdentifier package defines different types of neighbors + * for the calorimeter cells. Currently supported neighbor relations + * for topological clustering are: + * + * @li "all2D" for all cells in the same layer (sampling or module) + * of one calorimeter subsystem. Note that endcap and barrel + * will be unconnected in this case even for the LAREM. + * + * @li "all3D" for all cells in the same calorimeter. This means all + * the "all2D" neighbors for each cell plus the cells in + * adjacent samplings overlapping at least partially in + * \f$\eta\f$ and \f$\phi\f$ with the cell. Note that endcap + * and barrel will be connected in this case for the LAREM. + * + * @li "super3D" for all cells. This means all the "all3D" neighbors + * for each cell plus the cells in adjacent samplings from + * other subsystems overlapping at least partially in + * \f$\eta\f$ and \f$\phi\f$ with the cell. All calorimeters + * are connected in this case. + * + * The default setting is "super3D". */ + Gaudi::Property<std::string> m_neighborOptionString {this, "NeighborOption", "super3D", + "Neighbor option to be used for cell neighborhood relations"}; + + /** + * @brief if set to true limit the neighbors in HEC IW and FCal2&3. + * + * The cells in HEC IW and FCal2&3 get very large in terms of eta + * and phi. Since this might pose problems on certain jet + * algorithms one might need to avoid expansion in eta and phi for + * those cells. If this property is set to true the 2d neighbors of + * these cells are not used - only the next sampling neighbors are + * probed. */ + Gaudi::Property<bool> m_restrictHECIWandFCalNeighbors {this, "RestrictHECIWandFCalNeighbors", + false, "Limit the neighbors in HEC IW and FCal2&3"}; + + /** + * @brief if set to true limit the neighbors in presampler Barrel and Endcap. + * + * The presampler cells add a lot of PileUp in the Hilum + * samples. With this option set to true the presampler cells do not + * expand the cluster in the presampler layer. Only the next + * sampling is used as valid neighbor source. */ + Gaudi::Property<bool> m_restrictPSNeighbors {this, "RestrictPSNeighbors", + false, "Limit the neighbors in presampler Barrel and Endcap"}; + + /** @brief Options for the algorithm, held in a GPU-friendly way. + */ + TACOptionsHolder m_options; + +}; + +#endif //CALORECGPU_TOPOAUTOMATONCLUSTERING_H diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringGPU.cu b/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringGPU.cu deleted file mode 100644 index adee878f58e29e5ebdc82668a64dc258d20adb8b..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringGPU.cu +++ /dev/null @@ -1,426 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "TopoAutomatonClusteringGPU.h" - - -#include <cstring> -#include <cmath> -#include <iostream> -#include <stdio.h> - -using namespace CaloRecGPU; - -void TACTemporariesHolder::allocate() -{ - m_temporaries_dev.allocate(); -} - -void TACOptionsHolder::allocate() -{ - m_options.allocate(); - m_options_dev.allocate(); -} - -void TACOptionsHolder::sendToGPU(const bool clear_CPU) -{ - m_options_dev = m_options; - if (clear_CPU) - { - m_options.clear(); - } -} - -//constexpr static int DefaultBlockSize = 256; - -constexpr static int SignalToNoiseBlockSize = 512; -constexpr static int CellPairsBlockSize = 64; -constexpr static int ClusterGrowingPropagationBlockSize = 64; -constexpr static int ClusterGrowingMergingBlockSize = 512; - -/****************************************************************************** - * Kernel to compute the cells signal (Energy) to noise ratio, used for the - * cells clustering step, to define the seed cells, the growing cells and the - * border cells. - * It also apply the energy thresholds (seed-4, grow-2, border-0) - ******************************************************************************/ - - -__device__ inline static tag_type calculateTag(const float SNR, const int seed_cell_index, const int address) -{ - return Tags::make_seed_tag(__float_as_int(SNR), seed_cell_index, address); -} - - -static __global__ -void signalToNoiseKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, - Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, - const Helpers::CUDA_kernel_object<CellNoiseArr> noise_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry, - const Helpers::CUDA_kernel_object<TopoAutomatonOptions> opts) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - - - if (index < NCaloCells) - { - const float cellEnergy = cell_info_arr->energy[index]; - const int gain = cell_info_arr->gain[index]; - - if (GainConversion::is_invalid_cell(gain)) - { - cell_state_arr->clusterTag[index] = Tags::InvalidTag; - temporaries->secondaryArray[index] = Tags::InvalidTag; - return; - } - - - float sigNoiseRatio = 0.00001f; - //It's what's done in the CPU implementation... - if (GainConversion::is_normal_cell(gain) || GainConversion::is_invalid_seed_cell(gain)) - { - const int corr_gain = GainConversion::recover_invalid_seed_cell_gain(gain); - const float cellNoise = noise_arr->noise[corr_gain][index]; - if (isfinite(cellNoise) && cellNoise > 0.0f) - { - sigNoiseRatio = cellEnergy / cellNoise; - } - } - - const float absRatio = fabsf(sigNoiseRatio); - - if (sigNoiseRatio > opts->seed_threshold || (opts->abs_seed && absRatio > opts->seed_threshold)) // is Seed - { - if (GainConversion::is_invalid_seed_cell(gain)) - //If the cell is just ineligible to be a seed, it can still be a growing cell. - { - cell_state_arr->clusterTag[index] = Tags::GrowTag; - temporaries->secondaryArray[index] = Tags::GrowTag; - } - else if ( !opts->uses_sampling(geometry->caloSample[index]) ) - //If the seed belongs to a sampling that's invalid for seeds... - { - cell_state_arr->clusterTag[index] = Tags::GrowTag; - temporaries->secondaryArray[index] = Tags::GrowTag; - } - else - { - const int n = atomicAdd(&(clusters_arr->number), 1); - - const tag_type tag = calculateTag(absRatio, index, n); - //Since seed_threshold will be positive, - //no problem with using abs here always: - //when actually using the absolute value, - //it's what we want, when not, cells with - //negative SNR will not be acceptable seeds. - cell_state_arr->clusterTag[index] = tag; - temporaries->secondaryArray[index] = tag; - - clusters_arr->seedCellID[n] = index; - /*clusters_arr->clusterEnergy[n] = 0.f; - clusters_arr->clusterEt[n] = 0.f; - clusters_arr->clusterEta[n] = 0.f; - clusters_arr->clusterPhi[n] = 0.f;*/ - //This will be zeroed out later by the property calculation tool. - temporaries->mergeTable[n] = Tags::clear_counter(tag); - } - } - else if (sigNoiseRatio > opts->grow_threshold || (opts->abs_grow && absRatio > opts->grow_threshold)) //is Grow - { - cell_state_arr->clusterTag[index] = Tags::GrowTag; - temporaries->secondaryArray[index] = Tags::GrowTag; - } - else if (sigNoiseRatio > opts->terminal_threshold || (opts->abs_terminal && absRatio > opts->terminal_threshold)) //is Terminal - { - cell_state_arr->clusterTag[index] = Tags::TerminalTag; - temporaries->secondaryArray[index] = Tags::TerminalTag; - } - else //is invalid for propagation - { - cell_state_arr->clusterTag[index] = Tags::InvalidTag; - temporaries->secondaryArray[index] = Tags::InvalidTag; - } - } -} - -//run the kernel -void signalToNoise(EventDataHolder & holder, TACTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize) -{ - - cudaMemsetAsync(&(holder.m_clusters_dev->number), 0, sizeof(holder.m_clusters_dev->number), cudaStreamPerThread); - - const int i_dimBlock = SignalToNoiseBlockSize; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - signalToNoiseKernel <<< dimGrid, dimBlock>>>(holder.m_cell_state_dev, holder.m_clusters_dev, temps.m_temporaries_dev, - holder.m_cell_info_dev, instance_data.m_cell_noise_dev, instance_data.m_geometry_dev, - options.m_options_dev); - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - - -/****************************************************************************** - * Kernel to generate the cell pairs for the growing algorithm. - ******************************************************************************/ - - -static __global__ -void cellPairsKernel( Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, - const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - - - if (index < NCaloCells) - { - - const tag_type this_tag = cell_state_arr->clusterTag[index]; - - if (Tags::is_growing_or_seed(this_tag)) - { - const int num_neighs = geometry->nNeighbours[index]; - - int neighbourList[NMaxNeighbours]; - int num_bad_neighs = 0; - for (int i = 0; i < num_neighs; ++i) - { - const int neigh_ID = geometry->neighbours[index][i]; - const tag_type neigh_tag = cell_state_arr->clusterTag[neigh_ID]; - if (Tags::is_valid(neigh_tag)) - { - neighbourList[i - num_bad_neighs] = neigh_ID; - } - else - { - ++num_bad_neighs; - } - } - - const int real_neighs = num_neighs - num_bad_neighs; - const int n = atomicAdd(&(neighbour_pairs->number), real_neighs); - for (int i = 0; i < real_neighs; ++i) - { - neighbour_pairs->cellID[n + i] = index; - neighbour_pairs->neighbourID[n + i] = neighbourList[i]; - } - } - else if (Tags::is_terminal(this_tag)) - { - const int num_neighs = geometry->nNeighbours[index]; - - int neighbourList[NMaxNeighbours]; - int num_bad_neighs = 0; - for (int i = 0; i < num_neighs; ++i) - { - const int neigh_ID = geometry->neighbours[index][i]; - const tag_type neigh_tag = cell_state_arr->clusterTag[neigh_ID]; - if (Tags::is_growing_or_seed(neigh_tag)) - { - neighbourList[i - num_bad_neighs] = neigh_ID; - } - else - { - ++num_bad_neighs; - } - } - - const int real_neighs = num_neighs - num_bad_neighs; - const int n = atomicAdd(&(neighbour_pairs->reverse_number), real_neighs); - const int real_start = NMaxPairs - n - real_neighs; - for (int i = 0; i < real_neighs; ++i) - { - neighbour_pairs->cellID[real_start + i] = index; - neighbour_pairs->neighbourID[real_start + i] = neighbourList[i]; - } - } - } -} - -//run the kernel -void cellPairs(EventDataHolder & holder, TACTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize) -{ - cudaMemsetAsync(&(holder.m_pairs_dev->number), 0, sizeof(holder.m_pairs_dev->number), cudaStreamPerThread); - cudaMemsetAsync(&(holder.m_pairs_dev->reverse_number), 0, sizeof(holder.m_pairs_dev->reverse_number), cudaStreamPerThread); - - const int i_dimBlock = CellPairsBlockSize; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - cellPairsKernel <<< dimGrid, dimBlock>>>(holder.m_pairs_dev, holder.m_cell_state_dev, instance_data.m_geometry_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - - - -/****************************************************************************** - * Series of kernels for the growing algorithm! - ******************************************************************************/ - -__global__ static -void propagateNeighbours( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, - const int pair_number, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < pair_number) - { - const int this_ID = neighbour_pairs->cellID[index]; - const int neigh_ID = neighbour_pairs->neighbourID[index]; - - const tag_type neigh_raw_tag = cell_state_arr->clusterTag[neigh_ID]; - - const tag_type neigh_prop_tag = Tags::set_for_propagation(neigh_raw_tag); - - const tag_type this_old_raw_tag = atomicMax(&(temporaries->secondaryArray[this_ID]), neigh_prop_tag); - if (Tags::is_part_of_cluster(this_old_raw_tag) && Tags::is_part_of_cluster(neigh_raw_tag)) - { - //If the cell was already part of a cluster, - //we must merge the two of them. - //Else, we keep growing. - const int this_address = Tags::get_index_from_tag(this_old_raw_tag); - const int neigh_address = Tags::get_index_from_tag(neigh_raw_tag); - if (this_address != neigh_address) - { - const tag_type maximum_cluster = max(Tags::clear_counter(this_old_raw_tag), Tags::clear_counter(neigh_raw_tag)); - atomicMax(&(temporaries->mergeTable[this_address]), maximum_cluster); - atomicMax(&(temporaries->mergeTable[neigh_address]), maximum_cluster); - temporaries->continueFlag = 1; - } - } - else if (Tags::is_part_of_cluster(neigh_raw_tag)) - { - temporaries->continueFlag = 1; - } - } -} - -__global__ static -void mergeClusters( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = temporaries->secondaryArray[index]; - if (Tags::is_part_of_cluster(old_tag)) - { - const int address = Tags::get_index_from_tag(old_tag); - const tag_type new_tag = temporaries->mergeTable[address]; - const tag_type final_tag = Tags::update_non_terminal_tag(old_tag, new_tag); - cell_state_arr->clusterTag[index] = final_tag; - temporaries->secondaryArray[index] = final_tag; - } - } -} - -__global__ static -void propagateTerminals( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, - const int reverse_pair_number, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < reverse_pair_number) - { - const int start_index = NMaxPairs - reverse_pair_number; - const int this_ID = neighbour_pairs->cellID[start_index + index]; - const int neigh_ID = neighbour_pairs->neighbourID[start_index + index]; - - const tag_type neigh_raw_tag = cell_state_arr->clusterTag[neigh_ID]; - - atomicMax(&(temporaries->secondaryArray[this_ID]), Tags::set_for_terminal_propagation(neigh_raw_tag)); - } -} - -__global__ static -void finalizeClusterAttribution(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = temporaries->secondaryArray[index]; - cell_state_arr->clusterTag[index] = Tags::clear_counter(old_tag); - } -} - -__global__ static -void clusterGrowingKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) -{ - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - //Will be called with just 1 thread, but... - { - const int pairs_number = neighbour_pairs->number; - const int reverse_pairs_number = neighbour_pairs->reverse_number; - - const int i_dimBlock1 = ClusterGrowingPropagationBlockSize; - const int i_dimGrid1 = Helpers::int_ceil_div(pairs_number, i_dimBlock1); - const dim3 dimBlock1(i_dimBlock1, 1, 1); - const dim3 dimGrid1(i_dimGrid1, 1, 1); - - const int i_dimBlock2 = ClusterGrowingMergingBlockSize; - const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); - const dim3 dimBlock2(i_dimBlock2, 1, 1); - const dim3 dimGrid2(i_dimGrid2, 1, 1); - - const int i_dimBlock3 = ClusterGrowingPropagationBlockSize; - const int i_dimGrid3 = Helpers::int_ceil_div(reverse_pairs_number, i_dimBlock3); - const dim3 dimBlock3(i_dimBlock3, 1, 1); - const dim3 dimGrid3(i_dimGrid3, 1, 1); - - temporaries->continueFlag = 1; - - while (temporaries->continueFlag > 0) - { - temporaries->continueFlag = 0; - propagateNeighbours <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, pairs_number, neighbour_pairs); - mergeClusters <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries); - if (temporaries->continueFlag == 0) - { - cudaDeviceSynchronize(); - } - } - propagateTerminals <<< dimGrid3, dimBlock3>>>(cell_state_arr, temporaries, reverse_pairs_number, neighbour_pairs); - finalizeClusterAttribution <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries); - } -} - -//run the kernel -void clusterGrowing(EventDataHolder & holder, TACTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize) -{ - - clusterGrowingKernel <<< 1, 1>>>(holder.m_cell_state_dev, temps.m_temporaries_dev, holder.m_pairs_dev); - - if (synchronize) - { - CUDA_ERRCHECK(cudaPeekAtLastError()); - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringGPU.h b/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringGPU.h deleted file mode 100644 index 01dd74b678b212af1e3e5fb44ab918c00b422171..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringGPU.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_TOPOAUTOMATONCLUSTERINGGPU_H -#define CALORECGPU_TOPOAUTOMATONCLUSTERINGGPU_H - -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/DataHolders.h" -#include "CaloRecGPU/Helpers.h" - -struct TopoAutomatonTemporaries -{ - CaloRecGPU::tag_type secondaryArray[CaloRecGPU::NCaloCells]; - CaloRecGPU::tag_type mergeTable[CaloRecGPU::NMaxClusters]; - int continueFlag; -}; - -struct TopoAutomatonOptions -{ - float seed_threshold, grow_threshold, terminal_threshold; - bool abs_seed, abs_grow, abs_terminal; - bool use_two_gaussian; - unsigned int validSamplingSeed; - //This is used to pack the bits that tell us whether a sample can be used to have seeds or not. - constexpr bool uses_sampling(const int sampling) const - { - return (validSamplingSeed >> sampling) & 1; - } -}; -//Just a bundled way to pass the options for the Topo-Automaton Clustering. - -struct TACTemporariesHolder -{ - //Helpers::CPU_object<TopoAutomatonTemporaries> m_temporaries; - - CaloRecGPU::Helpers::CUDA_object<TopoAutomatonTemporaries> m_temporaries_dev; - - void allocate(); -}; - -struct TACOptionsHolder -{ - CaloRecGPU::Helpers::CPU_object<TopoAutomatonOptions> m_options; - - CaloRecGPU::Helpers::CUDA_object<TopoAutomatonOptions> m_options_dev; - - void allocate(); - void sendToGPU(const bool clear_CPU = true); -}; - -void signalToNoise(EventDataHolder & holder, TACTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize = false); - -void cellPairs(EventDataHolder & holder, TACTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize = false); - -void clusterGrowing(EventDataHolder & holder, TACTemporariesHolder & temps, - const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize = false); - -#endif //CALORECGPU_TOPOAUTOMATONCLUSTERINGGPU_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringImpl.cu b/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringImpl.cu new file mode 100644 index 0000000000000000000000000000000000000000..ebde83360d11fb2154f0aa85830274fce7a7a7af --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringImpl.cu @@ -0,0 +1,700 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "TopoAutomatonClusteringImpl.h" + + +#include <cstring> +#include <cmath> +#include <iostream> +#include <stdio.h> +#include <cstddef> + +using namespace CaloRecGPU; + +void TACOptionsHolder::allocate() +{ + m_options.allocate(); + m_options_dev.allocate(); +} + +void TACOptionsHolder::sendToGPU(const bool clear_CPU) +{ + m_options_dev = m_options; + if (clear_CPU) + { + m_options.clear(); + } +} + +//constexpr static int DefaultBlockSize = 256; + +constexpr static int SignalToNoiseBlockSize = 512; +constexpr static int CellPairsBlockSize = 256; +constexpr static int ClusterGrowingPropagationBlockSize = 256; +constexpr static int ClusterGrowingCopyAndCheckBlockSize = 512; +constexpr static int ClusterGrowingTerminalPropagationBlockSize = 256; +constexpr static int ClusterGrowingFinalizationBlockSize = 512; +constexpr static int ClusterGrowingSeedCellAssignmentBlockSize = 256; + +#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ > 350 + #if CUDART_VERSION >= 12000 + #define CAN_USE_TAIL_LAUNCH 1 + #else + #define CAN_USE_TAIL_LAUNCH 0 + #endif +#elif defined(__CUDA_ARCH__) + #error "CUDA compute capability at least 3.5 is needed so we can have dynamic parallelism!" +#endif + +namespace TACHacks +//We will (ab)use the cluster info to hold +//the cell-to-cluster map and the continue flag, +//as the cluster properties aren't set here. +//Some pointer trickery, but, given that CUDA allocations +//are, in their essence, casted from void * as in C, +//this should be safe, even more since int and float are both 32-bit. +{ + //We must do this this way because there are more cells than NMaxClusters, + //so we spill over to the next cluster properties (Phi and the first ~third of seedCellID) + static __host__ __device__ int * get_cell_to_cluster_table_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + //void * v_ptr = &(clusters_arr->clusterEt[0]); + void * v_ptr = &(clusters_arr->clusterEta[4]); + //The first 3 elements will possibly be taken over by + //the seed array, and an offset of 4 feels more "natural"... + return ((int *) v_ptr) + index; + } + + static __device__ int get_cell_to_cluster_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + return (*get_cell_to_cluster_table_address(clusters_arr, index)); + } + + static __device__ void set_cell_to_cluster_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index, const int new_value) + { + (*get_cell_to_cluster_table_address(clusters_arr, index)) = new_value; + } + + static __device__ int get_continue_flag(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return clusters_arr->seedCellID[NMaxClusters - 1]; + } + + static __device__ void set_continue_flag(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->seedCellID[NMaxClusters - 1] = value; + } + + + static __host__ __device__ int * get_continue_flag_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return &(clusters_arr->seedCellID[NMaxClusters - 1]); + } + + + static __host__ __device__ unsigned long long int * get_seed_cell_table_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + void * base_ptr = (ClusterInfoArr *) clusters_arr; + return ((unsigned long long int *) base_ptr ) + index + 1; + //We have the numbers first... + //Of course the ClusterInfoArr + //will be 8-byte aligned, + //thus any 8-byte offset from it will also be. + } + + static __device__ unsigned long long int get_seed_cell_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + return (*get_seed_cell_table_address(clusters_arr, index)); + } + + static __device__ void set_seed_cell_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index, const unsigned long long int new_value) + { + (*get_seed_cell_table_address(clusters_arr, index)) = new_value; + } + +#if !CAN_USE_TAIL_LAUNCH + + static __device__ int get_stop_flag(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return clusters_arr->seedCellID[NMaxClusters - 2]; + } + + static __device__ void set_stop_flag(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->seedCellID[NMaxClusters - 2] = value; + } + + static __host__ __device__ int * get_stop_flag_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return &(clusters_arr->seedCellID[NMaxClusters - 2]); + } + +#endif +} + +/****************************************************************************** + * Kernel to compute the cells signal (Energy) to noise ratio, used for the + * cells clustering step, to define the seed cells, the growing cells and the + * border cells. + * It also apply the energy thresholds (seed-4, grow-2, border-0) + ******************************************************************************/ + +static __global__ +void signalToNoiseKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<CellNoiseArr> noise_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + + if (index < NCaloCells) + { + const int cell_sampling = geometry->caloSample[index]; + const float cellEnergy = cell_info_arr->energy[index]; + + if (!cell_info_arr->is_valid(index) || !opts->uses_calorimeter_by_sampling(cell_sampling)) + { + cell_state_arr->clusterTag[index] = TACTag::make_invalid_tag(); + temporaries->secondaryArray[index] = TACTag::make_invalid_tag(); + return; + } + + float sigNoiseRatio = 0.00001f; + //It's what's done in the CPU implementation... + if (!cell_info_arr->is_bad(*geometry, index, opts->treat_L1_predicted_as_good)) + { + const int gain = cell_info_arr->gain[index]; + + float cellNoise = 0.f; + if (opts->use_two_gaussian && geometry->is_tile(index)) + { + //getTileEffSigma + } + else + { + cellNoise = noise_arr->noise[gain][index]; + } + if (isfinite(cellNoise) && cellNoise > 0.0f) + { + sigNoiseRatio = cellEnergy / cellNoise; + } + } + + const float absRatio = fabsf(sigNoiseRatio); + + bool can_be_seed = (opts->abs_seed ? absRatio : sigNoiseRatio) > opts->seed_threshold; + bool can_be_grow = (opts->abs_grow ? absRatio : sigNoiseRatio) > opts->grow_threshold; + bool can_be_term = (opts->abs_terminal ? absRatio : sigNoiseRatio) > opts->terminal_threshold; + + if (can_be_seed && opts->use_time_cut && (!opts->keep_significant_cells || sigNoiseRatio <= opts->snr_threshold_for_keeping_cells)) + { + if (!cell_info_arr->passes_time_cut(*geometry, index, opts->time_threshold)) + { + can_be_seed = false; + if (opts->completely_exclude_cut_seeds) + { + can_be_grow = false; + can_be_term = false; + } + } + } + + + if (can_be_seed && opts->uses_seed_sampling(cell_sampling)) + { + const int n = atomicAdd(&(clusters_arr->number), 1); + + const TACTag tag = TACTag::make_seed_tag(index, __float_as_int(absRatio), can_be_grow); + //Since seed_threshold will be positive, + //no problem with using abs here always: + //when actually using the absolute value, + //it's what we want, when not, cells with + //negative SNR will not be acceptable seeds. + // + //As per the CPU algorithm, + //if a cell does not pass the grow threshold + //(which can happen if seeds are being evaluated + // as absolute value while growing cells are not), + //the clusters cannot be merged. Somehow. + + cell_state_arr->clusterTag[index] = tag; + temporaries->secondaryArray[index] = tag; + + //TACHacks::set_merge_table_entry(clusters_arr, n, n); + TACHacks::set_cell_to_cluster_table_entry(clusters_arr, index, n); + + unsigned long long int snr_and_cell = __float_as_uint(absRatio); + + snr_and_cell = (snr_and_cell << 32) | index; + + TACHacks::set_seed_cell_table_entry(clusters_arr, n, snr_and_cell); + } + else if (can_be_grow) + { + cell_state_arr->clusterTag[index] = TACTag::make_grow_tag(); + temporaries->secondaryArray[index] = TACTag::make_grow_tag(); + } + else if (can_be_term) + { + cell_state_arr->clusterTag[index] = TACTag::make_terminal_tag(); + temporaries->secondaryArray[index] = TACTag::make_terminal_tag(); + } + else //is invalid for propagation + { + cell_state_arr->clusterTag[index] = TACTag::make_invalid_tag(); + temporaries->secondaryArray[index] = TACTag::make_invalid_tag(); + } + } +} + +//run the kernel +void signalToNoise(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temps, + const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + cudaMemsetAsync(&(holder.m_clusters_dev->number), 0, sizeof(holder.m_clusters_dev->number), stream_to_use); + + const int i_dimBlock = SignalToNoiseBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); + + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + signalToNoiseKernel <<< dimGrid, dimBlock, 0, stream_to_use>>>(holder.m_cell_state_dev, holder.m_clusters_dev, temps, + holder.m_cell_info_dev, instance_data.m_cell_noise_dev, instance_data.m_geometry_dev, + options.m_options_dev); + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + + +/****************************************************************************** + * Kernel to generate the cell pairs for the growing algorithm. + ******************************************************************************/ + + +static __global__ +void cellPairsKernel( Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + if (index < NCaloCells) + { + const TACTag this_tag = cell_state_arr->clusterTag[index]; + + if (this_tag.is_grow_or_seed()) + { + int full_neighs[NMaxNeighbours], grow_neighs[NMaxNeighbours], term_neighs[NMaxNeighbours]; + + int num_grow_neighs = 0, num_term_neighs = 0; + + const int num_neighs = geometry->neighbours.get_neighbours_with_option(opts->neighbour_options, index, full_neighs, + opts->limit_HECIW_and_FCal_neighs, opts->limit_PS_neighs); + + for (int i = 0; i < num_neighs; ++i) + { + const int neigh_ID = full_neighs[i]; + const TACTag neigh_tag = cell_state_arr->clusterTag[neigh_ID]; + if (neigh_tag.is_grow_or_seed()) + { + grow_neighs[num_grow_neighs] = neigh_ID; + ++num_grow_neighs; + } + else if (neigh_tag.is_non_assigned_terminal()) + { + term_neighs[num_term_neighs] = neigh_ID; + ++num_term_neighs; + } + } + + if (num_grow_neighs > 0) + { + const int n = atomicAdd(&(neighbour_pairs->number), num_grow_neighs); + for (int i = 0; i < num_grow_neighs; ++i) + { + neighbour_pairs->cellID[n + i] = grow_neighs[i]; + neighbour_pairs->neighbourID[n + i] = index; + } + } + if (num_term_neighs > 0) + { + const int n = atomicAdd(&(neighbour_pairs->reverse_number), num_term_neighs); + const int real_start = NMaxPairs - n - num_term_neighs; + for (int i = 0; i < num_term_neighs; ++i) + { + neighbour_pairs->cellID[real_start + i] = term_neighs[i]; + neighbour_pairs->neighbourID[real_start + i] = index; + } + } + } + } +} + +//run the kernel +void cellPairs(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> /*temps*/, + const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + cudaMemsetAsync(&(holder.m_pairs_dev->number), 0, sizeof(holder.m_pairs_dev->number), stream_to_use); + cudaMemsetAsync(&(holder.m_pairs_dev->reverse_number), 0, sizeof(holder.m_pairs_dev->reverse_number), stream_to_use); + + const int i_dimBlock = CellPairsBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); + + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + cellPairsKernel <<< dimGrid, dimBlock, 0, stream_to_use>>>(holder.m_pairs_dev, holder.m_cell_state_dev, instance_data.m_geometry_dev, options.m_options_dev); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + + + +/****************************************************************************** + * Series of kernels for the growing algorithm! + ******************************************************************************/ +__global__ static +void propagateNeighbours( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int pair_number); + +__global__ static +void propagateTerminals( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int reverse_pair_number); + +__global__ static +void copyTagsAndCheckTermination( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs ); + +__global__ static +void finalizeClusterAttribution(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr); + +__global__ static +void assignSeedCells(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int clusters_number); + +__global__ static +void propagateNeighbours( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int pair_number) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < pair_number) + { + const int this_ID = neighbour_pairs->cellID[index]; + const int neigh_ID = neighbour_pairs->neighbourID[index]; + + const TACTag neigh_tag = cell_state_arr->clusterTag[neigh_ID]; + + const TACTag prop_tag = neigh_tag.propagate(); + + const TACTag this_old_tag = cell_state_arr->clusterTag[this_ID]; + + if (this_old_tag.is_part_of_cluster() && neigh_tag.is_part_of_cluster() && this_old_tag.can_merge()) + { + //If the cell was already part of a cluster, + //we must merge the two of them. + //Else, we keep growing. + const int this_seed_idx = this_old_tag.index(); + const int neigh_seed_idx = neigh_tag.index(); + if (this_seed_idx != neigh_seed_idx) + { + const int this_cluster_index = TACHacks::get_cell_to_cluster_table_entry(clusters_arr, this_seed_idx); + const int neigh_cluster_index = TACHacks::get_cell_to_cluster_table_entry(clusters_arr, neigh_seed_idx); + if (this_cluster_index != neigh_cluster_index) + { + TACHacks::set_continue_flag(clusters_arr, 1); + if (this_cluster_index > neigh_cluster_index) + { + atomicMax(TACHacks::get_cell_to_cluster_table_address(clusters_arr, neigh_seed_idx), this_cluster_index); + atomicMax( TACHacks::get_seed_cell_table_address(clusters_arr, this_cluster_index), + TACHacks::get_seed_cell_table_entry(clusters_arr, neigh_cluster_index) ); + } + else /* if (neigh_cluster_index > this_cluster_index) */ + { + atomicMax(TACHacks::get_cell_to_cluster_table_address(clusters_arr, this_seed_idx), neigh_cluster_index); + atomicMax( TACHacks::get_seed_cell_table_address(clusters_arr, neigh_cluster_index), + TACHacks::get_seed_cell_table_entry(clusters_arr, this_cluster_index) ); + } + } + } + if (prop_tag > this_old_tag) + { + atomicMax(&(temporaries->secondaryArray[this_ID]), prop_tag); + TACHacks::set_continue_flag(clusters_arr, 1); + } + } + else if (!this_old_tag.is_part_of_cluster() && neigh_tag.is_part_of_cluster()) + { + TACHacks::set_continue_flag(clusters_arr, 1); + atomicMax(&(temporaries->secondaryArray[this_ID]), prop_tag); + } + } +#if CAN_USE_TAIL_LAUNCH + else if (index == pair_number) + { + const int i_dimBlock = ClusterGrowingCopyAndCheckBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(NCaloCells + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + copyTagsAndCheckTermination <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs); + + } + +#endif +} + + +__global__ static +void copyTagsAndCheckTermination( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + cell_state_arr->clusterTag[index] = temporaries->secondaryArray[index]; + } + else if (index == NCaloCells) + { +#if CAN_USE_TAIL_LAUNCH + if (TACHacks::get_continue_flag(clusters_arr)) + { + const int pairs_number = neighbour_pairs->number; + + const int i_dimBlock = ClusterGrowingPropagationBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(pairs_number + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + TACHacks::set_continue_flag(clusters_arr, 0); + + propagateNeighbours <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs, pairs_number); + } + else + { + + const int reverse_pairs_number = neighbour_pairs->reverse_number; + const int i_dimBlock = ClusterGrowingTerminalPropagationBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(reverse_pairs_number + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + propagateTerminals <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs, reverse_pairs_number); + + } +#else + if (!TACHacks::get_continue_flag(clusters_arr)) + { + TACHacks::set_stop_flag(clusters_arr, 1); + } + else + { + TACHacks::set_continue_flag(clusters_arr, 0); + } +#endif + } + +} + +__global__ static +void propagateTerminals( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int reverse_pair_number) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < reverse_pair_number) + { + const int start_index = NMaxPairs - reverse_pair_number; + const int this_ID = neighbour_pairs->cellID[start_index + index]; + const int neigh_ID = neighbour_pairs->neighbourID[start_index + index]; + + const TACTag neigh_tag = cell_state_arr->clusterTag[neigh_ID]; + + atomicMax(&(temporaries->secondaryArray[this_ID]), neigh_tag.propagate()); + } +#if CAN_USE_TAIL_LAUNCH + else if (index == reverse_pair_number) + { + const int i_dimBlock = ClusterGrowingFinalizationBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(NCaloCells + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + finalizeClusterAttribution <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr); + } +#endif +} + +__global__ static +void finalizeClusterAttribution(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const TACTag old_tag = temporaries->secondaryArray[index]; + + if (old_tag.is_part_of_cluster()) + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(TACHacks::get_cell_to_cluster_table_entry(clusters_arr, old_tag.index())); + } + else + { + cell_state_arr->clusterTag[index] = ClusterTag::make_invalid_tag(); + } + } +#if CAN_USE_TAIL_LAUNCH + else if (index == NCaloCells) + { + const int num_clusters = clusters_arr->number; + const int i_dimBlock = ClusterGrowingSeedCellAssignmentBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(clusters_arr->number, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + assignSeedCells <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(clusters_arr, num_clusters); + } +#endif +} + +__global__ static +void assignSeedCells(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int clusters_number) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < clusters_number) + { + const unsigned long long int SNR_and_cell = TACHacks::get_seed_cell_table_entry(clusters_arr, index); + const int cell = SNR_and_cell & 0xFFFFFU; + clusters_arr->seedCellID[index] = cell; + //This was built in such a way there's no overlap between the parts we access... + } +} + +__global__ static +void clusterGrowingKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + const int pairs_number = neighbour_pairs->number; + + const int i_dimBlock1 = ClusterGrowingPropagationBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(pairs_number + 1, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + +#if CAN_USE_TAIL_LAUNCH + propagateNeighbours <<< dimGrid1, dimBlock1, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs, pairs_number); +#else + + const int i_dimBlock2 = ClusterGrowingCopyAndCheckBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells + 1, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + const int reverse_pairs_number = neighbour_pairs->reverse_number; + + const int i_dimBlock3 = ClusterGrowingTerminalPropagationBlockSize; + const int i_dimGrid3 = Helpers::int_ceil_div(reverse_pairs_number, i_dimBlock3); + const dim3 dimBlock3(i_dimBlock3, 1, 1); + const dim3 dimGrid3(i_dimGrid3, 1, 1); + + const int i_dimBlock4 = ClusterGrowingFinalizationBlockSize; + const int i_dimGrid4 = Helpers::int_ceil_div(NCaloCells, i_dimBlock4); + const dim3 dimBlock4(i_dimBlock4, 1, 1); + const dim3 dimGrid4(i_dimGrid4, 1, 1); + + const int i_dimBlock5 = ClusterGrowingSeedCellAssignmentBlockSize; + const int i_dimGrid5 = Helpers::int_ceil_div(clusters_arr->number, i_dimBlock5); + const dim3 dimBlock5(i_dimBlock5, 1, 1); + const dim3 dimGrid5(i_dimGrid5, 1, 1); + + //int counter = 0; + + while (!TACHacks::get_stop_flag(clusters_arr)) + { + propagateNeighbours <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs, pairs_number); + copyTagsAndCheckTermination <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs); + + //++counter; + + } + + //printf("COUNTS: %16d\n", counter); + + propagateTerminals <<< dimGrid3, dimBlock3>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs, reverse_pairs_number); + finalizeClusterAttribution <<< dimGrid4, dimBlock4>>>(cell_state_arr, temporaries, clusters_arr); + assignSeedCells <<< dimGrid5, dimBlock5>>>(clusters_arr, clusters_arr->number); +#endif + } +} + +//run the kernel +void clusterGrowing(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temps, + const ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + cudaMemsetAsync(TACHacks::get_continue_flag_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); +#if !CAN_USE_TAIL_LAUNCH + cudaMemsetAsync(TACHacks::get_stop_flag_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); +#endif + clusterGrowingKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_cell_state_dev, temps, holder.m_clusters_dev, holder.m_pairs_dev); + + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringImpl.h b/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..f3e919260d26ee65c66dd17916d92f632ab9c75b --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonClusteringImpl.h @@ -0,0 +1,274 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_TOPOAUTOMATONCLUSTERING_CUDA_H +#define CALORECGPU_TOPOAUTOMATONCLUSTERING_CUDA_H + +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/DataHolders.h" +#include "CaloRecGPU/Helpers.h" +#include "ExtraTagDefinitions.h" + + +struct TACTag : public CaloRecGPU::Tag_1_1_12_32_18 +{ + using CaloRecGPU::Tag_1_1_12_32_18::Tag_1_1_12_32_18; + + protected: + + constexpr static carrier s_grow_tag = 0x7FFFFFFFFFFFFFFFULL; + + constexpr static carrier s_terminal_tag = 0x0000000000000001ULL; + + constexpr static carrier s_minimum_seed_tag = 0x8000000000000000ULL; + + constexpr static uint32_t s_start_counter = 0xFFFU; + + constexpr static carrier s_tag_propagation_delta = carrier(1) << s_12_bit_offset; + + constexpr static carrier s_no_can_merge_flag = s_second_flag_mask; + + public: + + [[nodiscard]] static constexpr carrier make_seed_tag(const uint32_t cell, const uint32_t SNR_pattern, const bool can_merge_with_others = true) + { + return make_generic_tag(cell, SNR_pattern, s_start_counter, !can_merge_with_others, true); + } + + [[nodiscard]] static constexpr carrier make_grow_tag() + { + return s_grow_tag; + } + + [[nodiscard]] static constexpr carrier make_terminal_tag() + { + return s_terminal_tag; + } + + [[nodiscard]] constexpr bool is_part_of_cluster() const + { + return value > s_grow_tag; + } + + [[nodiscard]] static constexpr bool is_part_of_cluster(const TACTag tag) + { + return tag.is_part_of_cluster(); + } + + [[nodiscard]] constexpr bool is_valid() const + { + return value >= s_terminal_tag; + } + + [[nodiscard]] static constexpr bool is_valid(const TACTag tag) + { + return tag.is_valid(); + } + + [[nodiscard]] constexpr bool is_invalid() const + { + return !(this->is_valid()); + } + + [[nodiscard]] static constexpr bool is_invalid(const TACTag tag) + { + return tag.is_invalid(); + } + + [[nodiscard]] constexpr bool is_non_assigned_terminal() const + { + return value >= s_terminal_tag && value < s_grow_tag; + } + + [[nodiscard]] static constexpr bool is_non_assigned_terminal(const TACTag tag) + { + return tag.is_non_assigned_terminal(); + } + + [[nodiscard]] constexpr bool is_non_assigned_grow() const + { + return value >= s_grow_tag && value < s_minimum_seed_tag; + } + + [[nodiscard]] static constexpr bool is_non_assigned_grow(const TACTag tag) + { + return tag.is_non_assigned_grow(); + } + + [[nodiscard]] constexpr bool is_seed() const + { + return value >= s_minimum_seed_tag; + } + + [[nodiscard]] static constexpr bool is_seed(const TACTag tag) + { + return tag.is_seed(); + } + + [[nodiscard]] constexpr bool is_grow_or_seed() const + { + return value >= s_grow_tag; + } + + [[nodiscard]] static constexpr bool is_grow_or_seed(const TACTag tag) + { + return tag.is_grow_or_seed(); + } + + [[nodiscard]] constexpr carrier propagate() const + { + return (value - s_tag_propagation_delta) & (~s_no_can_merge_flag); + } + + [[nodiscard]] static constexpr carrier propagate(const TACTag tag) + { + return tag.propagate(); + } + + [[nodiscard]] constexpr uint32_t index() const + { + return this->get_18_bits(); + } + + [[nodiscard]] static constexpr uint32_t index(const TACTag tag) + { + return tag.index(); + } + + [[nodiscard]] constexpr uint32_t SNR() const + { + return this->get_32_bits(); + } + + [[nodiscard]] static constexpr uint32_t SNR(const TACTag tag) + { + return tag.SNR(); + } + + [[nodiscard]] constexpr uint32_t counter() const + { + return this->get_12_bits(); + } + + [[nodiscard]] static constexpr uint32_t counter(const TACTag tag) + { + return tag.counter(); + } + + [[nodiscard]] constexpr carrier clear_counter_and_no_merge() const + { + return value & ~(s_second_flag_mask | s_12_bit_mask); + } + + [[nodiscard]] static constexpr carrier clear_counter_and_no_merge(const TACTag tag) + { + return tag.clear_counter_and_no_merge(); + } + + [[nodiscard]] constexpr carrier set_index(const uint32_t new_index) const + { + return (value & (~s_18_bit_mask)) | (new_index & 0x3FFFFU); + } + + [[nodiscard]] constexpr bool can_merge() const + { + return this->is_seed() && !this->get_second_flag(); + } + + [[nodiscard]] static constexpr bool can_merge(const TACTag tag) + { + return tag.can_merge(); + } + + [[nodiscard]] constexpr bool cannot_merge() const + { + return !this->can_merge(); + } + + [[nodiscard]] static constexpr bool cannot_merge(const TACTag tag) + { + return tag.cannot_merge(); + } + + [[nodiscard]] constexpr carrier clear_no_merge_flag() const + { + return this->unset_second_flag(); + } + + [[nodiscard]] static constexpr carrier clear_no_merge_flag(const TACTag tag) + { + return tag.clear_no_merge_flag(); + } +}; + +struct TopoAutomatonTemporaries +{ + CaloRecGPU::tag_type secondaryArray[CaloRecGPU::NCaloCells]; +}; + +struct TopoAutomatonOptions +{ + float seed_threshold, grow_threshold, terminal_threshold; + bool abs_seed, abs_grow, abs_terminal; + bool use_two_gaussian; + bool treat_L1_predicted_as_good; + bool use_time_cut; + bool keep_significant_cells; + bool completely_exclude_cut_seeds; + float time_threshold; + float snr_threshold_for_keeping_cells; + + bool limit_HECIW_and_FCal_neighs; + bool limit_PS_neighs; + unsigned int neighbour_options; + + unsigned int valid_sampling_seed; + //This is used to pack the bits that tell us whether a sample can be used to have seeds or not. + unsigned int valid_calorimeter_by_sampling; + //This is a way to express the selection of calorimeters to use for the algorithm + //through the samplings (as the calorimeter <-> sampling relation is fixed...) + + constexpr bool uses_seed_sampling(const int sampling) const + { + return (valid_sampling_seed >> sampling) & 1; + } + + /*! @brief Checks if the calorimeter is used through the sampling to which the cell belongs. + + We use the samplings to identify the calorimeters to be used since that's the information + we have available on the GPU side of things (and the sampling-to-calorimeter map is well-defined). + */ + constexpr bool uses_calorimeter_by_sampling(const int sampling) const + { + return (valid_calorimeter_by_sampling >> sampling) & 1; + } + +}; +//Just a bundled way to pass the options for the Topo-Automaton Clustering. + +struct TACOptionsHolder +{ + CaloRecGPU::Helpers::CPU_object<TopoAutomatonOptions> m_options; + + CaloRecGPU::Helpers::CUDA_object<TopoAutomatonOptions> m_options_dev; + + void allocate(); + void sendToGPU(const bool clear_CPU = true); +}; + +void signalToNoise(CaloRecGPU::EventDataHolder & holder, CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void cellPairs(CaloRecGPU::EventDataHolder & holder, CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void clusterGrowing(CaloRecGPU::EventDataHolder & holder, CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, const TACOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +#endif //CALORECGPU_TOPOAUTOMATONCLUSTERING_CUDA_H diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonSplitting.cxx b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplitting.cxx new file mode 100644 index 0000000000000000000000000000000000000000..547bd1516ffa4e728351930c435cf365ae2c02d9 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplitting.cxx @@ -0,0 +1,272 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "TopoAutomatonSplitting.h" +#include "TopoAutomatonSplittingImpl.h" + + +#include <string> +#include <climits> //For CHAR_BIT... though it's a slightly inefficient way of saying 8. + +#include "CaloIdentifier/CaloCell_ID.h" + +#include "boost/chrono/chrono.hpp" +#include "boost/chrono/thread_clock.hpp" + +#include "MacroHelpers.h" + +using namespace CaloRecGPU; + +TopoAutomatonSplitting::TopoAutomatonSplitting(const std::string & type, const std::string & name, const IInterface * parent): + AthAlgTool(type, name, parent), + CaloGPUTimed(this) +{ + declareInterface<CaloClusterGPUProcessor> (this); + +} + +StatusCode TopoAutomatonSplitting::initialize() +{ + + m_options.allocate(); + + + using PackType = decltype(m_options.m_options->valid_sampling_primary); + + static_assert(CaloCell_ID::getNumberOfSamplings() <= sizeof(PackType) * CHAR_BIT, "We are assuming that we have fewer samplings that bits per int!"); + + auto get_option_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, CaloCell_ID, + PreSamplerB, + EMB1, + EMB2, + EMB3, + PreSamplerE, + EME1, + EME2, + EME3, + HEC0, + HEC1, + HEC2, + HEC3, + TileBar0, + TileBar1, + TileBar2, + TileGap1, + TileGap2, + TileGap3, + TileExt0, + TileExt1, + TileExt2, + FCAL0, + FCAL1, + FCAL2 + ) + ) + else + { + failed = true; + return CaloCell_ID::Unknown; + } + }; + + + auto process_sampling = [&get_option_from_string](const std::vector<std::string> & sampling_names, std::string & invalid_names, PackType & sampling_option) + { + sampling_option = 0; + for (const std::string & samp_name : sampling_names) + { + bool failed = false; + const PackType sampling = (PackType) get_option_from_string(samp_name, failed); + + if (failed) + { + if (invalid_names.size() == 0) + { + invalid_names = "'" + samp_name + "'"; + } + else + { + invalid_names += ", '" + samp_name + "'"; + } + } + else + { + sampling_option |= ((PackType) 1) << sampling; + } + } + }; + + std::string invalid_names; + + process_sampling(m_samplingNames, invalid_names, m_options.m_options->valid_sampling_primary); + + if (invalid_names.size() > 0) + { + ATH_MSG_ERROR( "Calorimeter samplings " << invalid_names + << " are not a valid Calorimeter sampling name and will be ignored! " + << "Valid names are: " + << "PreSamplerB, EMB1, EMB2, EMB3, " + << "PreSamplerE, EME1, EME2, EME3, " + << "HEC0, HEC1, HEC2, HEC3, " + << "TileBar0, TileBar1, TileBar2, " + << "TileGap1, TileGap2, TileGap3, " + << "TileExt0, TileExt1, TileExt2, " + << "FCAL0, FCAL1, FCAL2." ); + } + + invalid_names.clear(); + + process_sampling(m_secondarySamplingNames, invalid_names, m_options.m_options->valid_sampling_secondary); + + if (invalid_names.size() > 0) + { + ATH_MSG_ERROR( "Calorimeter samplings " << invalid_names + << " are not a valid Calorimeter sampling name and will be ignored! " + << "Valid names are: " + << "PreSamplerB, EMB1, EMB2, EMB3, " + << "PreSamplerE, EME1, EME2, EME3, " + << "HEC0, HEC1, HEC2, HEC3, " + << "TileBar0, TileBar1, TileBar2, " + << "TileGap1, TileGap2, TileGap3, " + << "TileExt0, TileExt1, TileExt2, " + << "FCAL0, FCAL1, FCAL2." ); + } + + auto get_neighbour_option_from_string = [](const std::string & str, bool & failed) + { + failed = false; + CRGPU_RECURSIVE_MACRO( + CRGPU_CHEAP_STRING_TO_ENUM( str, LArNeighbours, + prevInPhi, + nextInPhi, + prevInEta, + nextInEta, + faces2D, + corners2D, + all2D, + prevInSamp, + nextInSamp, + upAndDown, + prevSubDet, + nextSubDet, + all3D, + corners3D, + all3DwithCorners, + prevSuperCalo, + nextSuperCalo, + super3D + ) + ) + //I know Topological Clustering only supports a subset of those, + //but this is supposed to be a general data exporting tool... + else + { + failed = true; + return LArNeighbours::super3D; + } + }; + + bool neigh_failed = false; + m_options.m_options->neighbour_options = (unsigned int) get_neighbour_option_from_string(m_neighborOptionString, neigh_failed); + + if (neigh_failed) + { + ATH_MSG_ERROR("Invalid Neighbour Option: " << m_neighborOptionString); + } + + //We must repeat this printing part because ATH_MSG_ERROR + //is a macro that apparently calls a this->msg(...) function. + //Of course it won't work within a lambda... + + m_options.m_options->min_num_cells = m_nCells; + m_options.m_options->min_maximum_energy = m_minEnergy; + m_options.m_options->EM_shower_scale = m_emShowerScale; + m_options.m_options->share_border_cells = m_shareBorderCells; + m_options.m_options->use_absolute_energy = m_absOpt; + m_options.m_options->treat_L1_predicted_as_good = m_treatL1PredictedCellsAsGood; + + m_options.m_options->limit_HECIW_and_FCal_neighs = m_restrictHECIWandFCalNeighbors; + m_options.m_options->limit_PS_neighs = m_restrictPSNeighbors; + + m_options.sendToGPU(false); + + return StatusCode::SUCCESS; + +} + +StatusCode TopoAutomatonSplitting::execute(const EventContext & ctx, const ConstantDataHolder & constant_data, + EventDataHolder & event_data, void * temporary_buffer ) const +{ + + using clock_type = boost::chrono::thread_clock; + auto time_cast = [](const auto & before, const auto & after) + { + return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count(); + }; + + const auto start = clock_type::now(); + + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries((TopoAutomatonSplittingTemporaries *) temporary_buffer); + + const auto preprocessing_end = clock_type::now(); + + fillNeighbours(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto after_neighs = clock_type::now(); + + findLocalMaxima(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto after_maxima = clock_type::now(); + + excludeSecondaryMaxima(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto after_secondary_maxima = clock_type::now(); + + splitClusterGrowing(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto after_growing = clock_type::now(); + + cellWeightingAndFinalization(event_data, temporaries, constant_data, m_options, m_measureTimes); + + const auto end = clock_type::now(); + + + if (m_measureTimes) + { + record_times(ctx.evt(), + time_cast(start, preprocessing_end), + time_cast(preprocessing_end, after_neighs), + time_cast(after_neighs, after_maxima), + time_cast(after_maxima, after_secondary_maxima), + time_cast(after_secondary_maxima, after_growing), + time_cast(after_growing, end) + ); + } + + return StatusCode::SUCCESS; + + +} + + +StatusCode TopoAutomatonSplitting::finalize() +{ + if (m_measureTimes) + { + print_times("Preprocessing Fill_List_of_Intra-Cluster_Neighbours Find_Local_Maxima Find_Secondary_Maxima Splitter_Tag_Propagation Cell_Weighting_And_Finalization", 6); + } + return StatusCode::SUCCESS; +} + + +TopoAutomatonSplitting::~TopoAutomatonSplitting() +{ + //Nothing! +} diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonSplitting.h b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplitting.h new file mode 100644 index 0000000000000000000000000000000000000000..585a27af97ae48082d5629d2757b3c98cdd35daa --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplitting.h @@ -0,0 +1,192 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_TOPOAUTOMATONSPLITTING_H +#define CALORECGPU_TOPOAUTOMATONSPLITTING_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "CaloRecGPU/CaloClusterGPUProcessor.h" +#include "CaloRecGPU/CaloGPUTimed.h" +#include "TopoAutomatonSplittingImpl.h" +#include <string> + +#include "CLHEP/Units/SystemOfUnits.h" + +/** + * @class TopoAutomatonSplitting + * @author Nuno Fernandes <nuno.dos.santos.fernandes@cern.ch> + * @date 25 August 2022 + * @brief Cluster splitter algorithm to be run on GPUs, using the same cellular automaton-based approach as Topo-Automaton Clustering. + */ + + +class TopoAutomatonSplitting : + public AthAlgTool, virtual public CaloClusterGPUProcessor, public CaloGPUTimed +{ + public: + + TopoAutomatonSplitting(const std::string & type, const std::string & name, const IInterface * parent); + + virtual StatusCode initialize() override; + + virtual StatusCode execute (const EventContext & ctx, + const CaloRecGPU::ConstantDataHolder & constant_data, + CaloRecGPU::EventDataHolder & event_data, + void * temporary_buffer) const override; + + virtual StatusCode finalize() override; + + virtual ~TopoAutomatonSplitting(); + + virtual size_t size_of_temporaries() const + { + return sizeof(TopoAutomatonSplittingTemporaries); + }; + + private: + + /** + * @brief vector of names of the calorimeter samplings to consider + * for seeds. + * + * The default is to use all calorimeter samplings. Excluding a + * sampling from this vector prevents the definition of a seed cell + * in this sampling. Cells in those samplings are still used and + * incorporated in the topo clusters (both on the neighbor and the + * cell level) they can therefore even expand a cluster but not seed + * one ...*/ + Gaudi::Property<std::vector<std::string>> m_samplingNames {this, "SamplingNames", {}, "Name(s) of Calorimeter Samplings to consider for local maxima"}; + + /** + * @brief vector of names of the secondary calorimeter samplings to + * consider. + * + * Samplings in this list will be considered for local maxima only + * if no local max in the primary list is overlapping. By default this + * list is empty */ + Gaudi::Property<std::vector<std::string>> m_secondarySamplingNames {this, "SecondarySamplingNames", {}, "Name(s) of secondary Calorimeter Samplings to consider for local maxima"}; + + /** + * @brief local maxima need at least this number of neighbors to + * become seeds + * + * each cell above the energy cut having at least this many + * neighbors in the parent cluster and only neighbors with smaller + * energy seed a split cluster. */ + Gaudi::Property<int> m_nCells {this, "NumberOfCellsCut", 4, "Local maxima need at least this number of neighbors to become seeds. Must be a non-negative number (obviously)."}; + + /** + * @brief local maxima need at least this energy content + * + * potential seed cells have to pass this cut on the energy + * content. */ + Gaudi::Property<float> m_minEnergy {this, "EnergyCut", 500 * CLHEP::MeV, "Minimal energy for a local max"}; + + + /** + * @brief share cells at the border between two local maxima + * + * this property needs to be set to true in order to treat cells + * which would be included in 2 clusters (for more then 2 the 2 with + * the largest E for the current seed cells are used) as shared + * cells. Shared cells are first excluded from the clustering and + * then clustered after all normal cells are clustered. The shared + * clusters are added to the 2 clusters they neighbor with the + * weights \f$w_1 = E_1/(E_1+r E_2)\f$ and \f$w_2 = 1-w_1\f$, where + * \f$E_{1,2}\f$ are the current energies of the 2 neighboring + * clusters without the shared cells and \f$r=\exp(d_1-d_2)\f$ is + * the ratio of the expected dependencies on the distances \f$d_i\f$ + * (in units of a typical em shower scale) of each shared cell to + * the cluster centers. If the property is set to false the border + * cells are included in the normal clustering and the cluster with + * the largest E for the current seed cells gets the current border + * cell. */ + Gaudi::Property<bool> m_shareBorderCells {this, "ShareBorderCells", false, "Whether or not to share cells at the boundary between two clusters"}; + + + /** + * @brief typical EM shower scale to use for distance criteria in + * shared cells + * + * a shared cell is included in both clusters neighboring the cell + * with weights depending on the cluster energies and the distance + * of the shared cell to the cluster centroids. The distance is + * measured in units of this property to roughly describe the + * exponential slope of the energy density distribution for em + * showers. The exact choice of this property is not critical but + * should roughly match the Moliere radius in the LArEM since here + * the sharing of cells has the biggest use case. */ + Gaudi::Property<float> m_emShowerScale {this, "EMShowerScale", 5 * CLHEP::cm, "Typical EM shower distance for which the energy density should drop to 1/e"}; + + /** + * @brief if set to true, splitter only looks at absolute + * value of Energy in order to identify potential seed cells */ + Gaudi::Property<bool> m_absOpt {this, "WeightingOfNegClusters", false, "Should absolute value be used to identify potential seed cells"}; + + /** + * @brief if set to true treat cells with a dead OTX which can be + * predicted by L1 trigger info as good instead of bad cells */ + Gaudi::Property<bool> m_treatL1PredictedCellsAsGood {this, "TreatL1PredictedCellsAsGood", true, "Treat bad cells with dead OTX if predicted from L1 as good"}; + + /** + * @brief type of neighbor relations to use. + * + * The CaloIdentifier package defines different types of neighbors + * for the calorimeter cells. Currently supported neighbor relations + * for topological clustering are: + * + * @li "all2D" for all cells in the same layer (sampling or module) + * of one calorimeter subsystem. Note that endcap and barrel + * will be unconnected in this case even for the LAREM. + * + * @li "all3D" for all cells in the same calorimeter. This means all + * the "all2D" neighbors for each cell plus the cells in + * adjacent samplings overlapping at least partially in + * \f$\eta\f$ and \f$\phi\f$ with the cell. Note that endcap + * and barrel will be connected in this case for the LAREM. + * + * @li "super3D" for all cells. This means all the "all3D" neighbors + * for each cell plus the cells in adjacent samplings from + * other subsystems overlapping at least partially in + * \f$\eta\f$ and \f$\phi\f$ with the cell. All calorimeters + * are connected in this case. + * + * The default setting is "super3D". */ + Gaudi::Property<std::string> m_neighborOptionString {this, "NeighborOption", "super3D", + "Neighbor option to be used for cell neighborhood relations"}; + + /** + * @brief if set to true limit the neighbors in HEC IW and FCal2&3. + * + * The cells in HEC IW and FCal2&3 get very large in terms of eta + * and phi. Since this might pose problems on certain jet + * algorithms one might need to avoid expansion in eta and phi for + * those cells. If this property is set to true the 2d neighbors of + * these cells are not used - only the next sampling neighbors are + * probed. */ + Gaudi::Property<bool> m_restrictHECIWandFCalNeighbors {this, "RestrictHECIWandFCalNeighbors", + false, "Limit the neighbors in HEC IW and FCal2&3"}; + + /** + * @brief if set to true limit the neighbors in presampler Barrel and Endcap. + * + * The presampler cells add a lot of PileUp in the Hilum + * samples. With this option set to true the presampler cells do not + * expand the cluster in the presampler layer. Only the next + * sampling is used as valid neighbor source. */ + Gaudi::Property<bool> m_restrictPSNeighbors {this, "RestrictPSNeighbors", + false, "Limit the neighbors in presampler Barrel and Endcap"}; + + //WARNING: the CPU version of the algorithm does not seem to have this option. Given the description, + // maybe it makes some sense to still allow this here? In our configuration we'll keep it disabled, but... + + /** @brief Options for the algorithm, held in a GPU-friendly way. + */ + TASOptionsHolder m_options; + +}; + +#endif //CALORECGPU_TOPOAUTOMATONSPLITTING_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonSplittingImpl.cu b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplittingImpl.cu new file mode 100644 index 0000000000000000000000000000000000000000..691907f3fcd4d3bc1490df53215332fedda98551 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplittingImpl.cu @@ -0,0 +1,1589 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#include "CaloRecGPU/Helpers.h" +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "TopoAutomatonSplittingImpl.h" + +#include "CaloIdentifier/LArNeighbours.h" +//It's just a struct. + + +#include "CLHEP/Units/SystemOfUnits.h" +//Probably will also work, given that it's just constexpr stuff. + +#include <cstring> +#include <cmath> +#include <iostream> +#include <stdio.h> + + +using namespace CaloRecGPU; + +void TASOptionsHolder::allocate() +{ + m_options.allocate(); + m_options_dev.allocate(); +} + +void TASOptionsHolder::sendToGPU(const bool clear_CPU) +{ + m_options_dev = m_options; + if (clear_CPU) + { + m_options.clear(); + } +} + +constexpr static int FillNeighboursFirstBlockSize = 128; +constexpr static int FillNeighboursSecondBlockSize = 128; + +constexpr static int CountInferiorNeighsBlockSize = 256; +constexpr static int FindLocalMaximaBlockSize = 512; +constexpr static int FixClustersWithoutMaximaBlockSize = 512; + +constexpr static int PrepareArrayForSecondaryMaximaBlockSize = 512; +constexpr static int ExcludeMaximaPropagationBlockSize = 256; +constexpr static int ResetAndCleanSecondariesBlockSize = 512; + +constexpr static int PropagateSplitTagsBlockSize = 256; +constexpr static int HandleSplitIndexChangesBlockSize = 256; +constexpr static int HandleSplitTagChangesBlockSize = 256; + +constexpr static int SumCellsBlockSize = 320; +constexpr static int CalculateCentroidsBlockSize = 512; +constexpr static int FinalizeWeightsBlockSize = 256; + +//These numbers are not at all optimized, +//just going from rough similarity to TAC operations +//(which themselves are not that optimised +// since they were last tested on a previous version...) + +#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ > 350 + #if CUDART_VERSION >= 12000 + #define CAN_USE_TAIL_LAUNCH 1 + #else + #define CAN_USE_TAIL_LAUNCH 0 + #endif +#elif defined(__CUDA_ARCH__) + #error "CUDA compute capability at least 3.5 is needed so we can have dynamic parallelism!" +#endif + +namespace TASHacks +//We will (ab)use the cluster info to hold the original cluster reference, +//shared cluster cells list and continue flag, +//as the cluster indices fit in an int (in fact, they're 16 bits) +//and the cluster properties are only overridden later. +//Some pointer trickery, but, given that CUDA allocations +//are, in their essence, casted from void * as in C, +//this should be safe, even more since int and float are both 32-bit. +{ + static __device__ int get_original_cluster_table_entry(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + return __float_as_int(clusters_arr->clusterEnergy[index]); + } + + static __device__ void set_original_cluster_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index, const int new_value) + { + clusters_arr->clusterEnergy[index] = __int_as_float(new_value); + } + + /* + static __host__ __device__ int * get_original_cluster_table_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + void * v_ptr = &(clusters_arr->clusterEnergy[index]); + return (int *) v_ptr; + } + */ + + + static __device__ int get_continue_flag(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return __float_as_int(clusters_arr->clusterPhi[NMaxClusters - 1]); + } + + static __device__ void set_continue_flag(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->clusterPhi[NMaxClusters - 1] = __int_as_float(value); + } + + static __host__ __device__ int * get_continue_flag_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + void * v_ptr = &(clusters_arr->clusterPhi[NMaxClusters - 1]); + return (int *) v_ptr; + } + + + //Extra pairs of neighbours used in checking for maxima + //but not to actually grow the clusters. + static __device__ int get_num_extra_neighs(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return __float_as_int(clusters_arr->clusterPhi[NMaxClusters - 2]); + } + + /* + static __device__ void set_num_extra_neighs(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->clusterPhi[NMaxClusters - 2] = __int_as_float(value); + } + */ + + static __host__ __device__ int * get_num_extra_neighs_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + void * v_ptr = &(clusters_arr->clusterPhi[NMaxClusters - 2]); + return (int *) v_ptr; + } + + + static __device__ int get_num_extra_reverse_neighs(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return __float_as_int(clusters_arr->clusterPhi[NMaxClusters - 3]); + } + + /* + static __device__ void set_num_extra_reverse_neighs(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->clusterPhi[NMaxClusters - 3] = __int_as_float(value); + } + */ + + static __host__ __device__ int * get_num_extra_reverse_neighs_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + void * v_ptr = &(clusters_arr->clusterPhi[NMaxClusters - 3]); + return (int *) v_ptr; + } + + + + //We must do this this way because there are more cells than NMaxClusters, + //so we spill over to the next cluster properties (Eta and the first ~third of Phi) + static __host__ __device__ int * get_cell_to_cluster_table_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + void * v_ptr = &(clusters_arr->clusterEt[0]); + return ((int *) v_ptr) + index; + } + + static __device__ int get_cell_to_cluster_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + return *(get_cell_to_cluster_table_address(clusters_arr, index)); + } + + static __device__ void set_cell_to_cluster_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index, const int new_value) + { + *(get_cell_to_cluster_table_address(clusters_arr, index)) = new_value; + } + + static __device__ int get_reset_counter(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return __float_as_int(clusters_arr->clusterPhi[NMaxClusters - 4]); + } + + static __device__ void set_reset_counter(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->clusterPhi[NMaxClusters - 4] = __int_as_float(value); + } + + static __host__ __device__ int * get_reset_counter_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + void * v_ptr = &(clusters_arr->clusterPhi[NMaxClusters - 4]); + return (int *) v_ptr; + } + + //This next table is used in the secondary maxima invalidation + //to be able to iterate in both directions simultaneously using + //the main and secondary arrays, while storing the intermediate + //cell assignments here in a reversible form... + + static __host__ __device__ int * get_secondary_restore_table_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + void * v_ptr = &(clusters_arr->clusterEt[0]); + return ((int *) v_ptr) + index; + } + + static __device__ int get_secondary_restore_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index) + { + return *(get_secondary_restore_table_address(clusters_arr, index)); + } + + static __device__ void set_secondary_restore_table_entry(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const int index, const int new_value) + { + *(get_secondary_restore_table_address(clusters_arr, index)) = new_value; + } + +#if !CAN_USE_TAIL_LAUNCH + + static __device__ int get_stop_flag(const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + return __float_as_int(clusters_arr->clusterPhi[NMaxClusters - 5]); + } + + static __device__ void set_stop_flag(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int value) + { + clusters_arr->clusterPhi[NMaxClusters - 5] = __int_as_float(value); + } + + static __host__ __device__ int * get_stop_flag_address(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) + { + void * v_ptr = &(clusters_arr->clusterPhi[NMaxClusters - 5]); + return (int *) v_ptr; + } +#endif + +} + +/****************************************************************************************** + * Determine the same-cluster neighbours of the cells and fill the pairs list accordingly. + ******************************************************************************************/ + + +static __global__ +void fillNeighboursFirstKernel( Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + if (index < NCaloCells) + { + const ClusterTag this_tag = cell_state_arr->clusterTag[index]; + + if (this_tag.is_part_of_cluster()) + { + const bool is_limited = geometry->neighbours.has_limited_neighbours(index, opts->limit_HECIW_and_FCal_neighs, opts->limit_PS_neighs); + //The cells that have limited neighbours, for the split cluster growing part. + //WARNING: the CPU version of the code does not limit PS neighbours ever, but we give additional freedom + // (even if it is disabled by default). + + int neighbours[NMaxNeighbours], good_neighbours[NMaxNeighbours]; + + const unsigned int limited_flags = LArNeighbours::neighbourOption::nextInSamp; + + const unsigned int neighbour_flags = LArNeighbours::neighbourOption::nextSuperCalo; + //We will add the rest of the maxima exclusion neighbours + //in the second fill neighbours kernel, since they must be + //iterated over separately for everything to work properly. + + + const int num_limited = geometry->neighbours.get_neighbours_with_option(limited_flags & opts->neighbour_options, index, neighbours); + + const int num_no_secondary_max = geometry->neighbours.get_neighbours_with_option( neighbour_flags & opts->neighbour_options, + index, &(neighbours[num_limited]) ) + num_limited; + //The limited also belong to the secondary maximum exclusion. + + const int num_others = geometry->neighbours.get_neighbours_with_option( ( ~(neighbour_flags | limited_flags) ) & opts->neighbour_options, + index, &(neighbours[num_no_secondary_max]) ); + + const int num_total_neighs = num_no_secondary_max + num_others; + + int num_good_neighs = 0; + + for (int i = 0; (i < num_limited || !is_limited) && i < num_total_neighs; ++i) + { + const int neigh_ID = neighbours[i]; + const ClusterTag neigh_tag = cell_state_arr->clusterTag[neigh_ID]; + if (neigh_tag.is_part_of_cluster() && this_tag.cluster_index() == neigh_tag.cluster_index()) + { + good_neighbours[num_good_neighs] = neigh_ID; + ++num_good_neighs; + } + } + if (num_good_neighs > 0) + { + const int n = atomicAdd(&(neighbour_pairs->number), num_good_neighs); + for (int i = 0; i < num_good_neighs; ++i) + { + neighbour_pairs->cellID[n + i] = good_neighbours[i]; + neighbour_pairs->neighbourID[n + i] = index; + } + } + + if (num_no_secondary_max > 0) + //Don't forget that secondary maxima invalidation + //occurs regardless of cluster... + { + const int n = atomicAdd(&(neighbour_pairs->reverse_number), num_no_secondary_max); + const int real_start = NMaxPairs - n - num_no_secondary_max; + for (int i = 0; i < num_no_secondary_max; ++i) + { + neighbour_pairs->cellID[real_start + i] = neighbours[i]; + neighbour_pairs->neighbourID[real_start + i] = index; + } + } + temporaries->get_extra_array<int>(index) = num_good_neighs; + } + else + { + int neighbours[NMaxNeighbours]; + + const unsigned int neighbour_flags = LArNeighbours::neighbourOption::nextInSamp | + LArNeighbours::neighbourOption::nextSuperCalo; + + const int num_neighs = geometry->neighbours.get_neighbours_with_option(neighbour_flags & opts->neighbour_options, index, neighbours); + + if (num_neighs > 0) + //Don't forget that secondary maxima invalidation + //occurs regardless of cluster... + { + const int n = atomicAdd(&(neighbour_pairs->reverse_number), num_neighs); + const int real_start = NMaxPairs - n - num_neighs; + for (int i = 0; i < num_neighs; ++i) + { + neighbour_pairs->cellID[real_start + i] = neighbours[i]; + neighbour_pairs->neighbourID[real_start + i] = index; + } + } + + temporaries->get_extra_array<int>(index) = -NMaxNeighbours; + } + } +} + + +static __global__ +void fillNeighboursSecondKernel( Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts ) +//Local maxima are checked even with the neighbourhood relations +//that end up otherwise being excluded in the cells that are limited +//to `nextInSample`. We add the relevant pairs here after the end of the normal pairs +//and store their numbers on the appropriate temporary. +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + if (index < NCaloCells) + { + const ClusterTag this_tag = cell_state_arr->clusterTag[index]; + + int neighbours[NMaxNeighbours]; + + if (this_tag.is_part_of_cluster()) + { + if ( geometry->neighbours.has_limited_neighbours(index, opts->limit_HECIW_and_FCal_neighs, opts->limit_PS_neighs) ) + //WARNING: the CPU version of the code does not limit PS neighbours ever, but we give additional freedom + // (even if it is disabled by default). + { + int good_neighbours[NMaxNeighbours]; + const unsigned int limited_flags = LArNeighbours::neighbourOption::nextInSamp; + + const int num_total_neighs = geometry->neighbours.get_neighbours_with_option((~limited_flags) & opts->neighbour_options, index, neighbours); + int num_good_neighs = 0; + + for (int i = 0; i < num_total_neighs; ++i) + { + const int neigh_ID = neighbours[i]; + const ClusterTag neigh_tag = cell_state_arr->clusterTag[neigh_ID]; + if (neigh_tag.is_part_of_cluster() && this_tag.cluster_index() == neigh_tag.cluster_index()) + { + good_neighbours[num_good_neighs] = neigh_ID; + ++num_good_neighs; + } + } + + if (num_good_neighs > 0) + { + const int n = atomicAdd(TASHacks::get_num_extra_neighs_address(clusters_arr), num_good_neighs); + const int start = neighbour_pairs->number + n; + for (int i = 0; i < num_good_neighs; ++i) + { + neighbour_pairs->cellID[start + i] = good_neighbours[i]; + neighbour_pairs->neighbourID[start + i] = index; + } + } + temporaries->get_extra_array<int>(index) += num_good_neighs; + } + + } + + const unsigned int no_max_flags = LArNeighbours::neighbourOption::prevInSamp | + LArNeighbours::neighbourOption::prevSuperCalo; + const int num_neighs = geometry->neighbours.get_neighbours_with_option(no_max_flags & opts->neighbour_options, index, neighbours); + + if (num_neighs > 0) + //Don't forget that secondary maxima invalidation + //occurs regardless of cluster... + { + const int n = atomicAdd(TASHacks::get_num_extra_reverse_neighs_address(clusters_arr), num_neighs); + const int real_start = NMaxPairs - n - num_neighs - neighbour_pairs->reverse_number; + for (int i = 0; i < num_neighs; ++i) + { + neighbour_pairs->cellID[real_start + i] = neighbours[i]; + neighbour_pairs->neighbourID[real_start + i] = index; + } + } + } +} + +void fillNeighbours(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const ConstantDataHolder & instance_data, const TASOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + cudaMemsetAsync(&(holder.m_pairs_dev->number), 0, sizeof(holder.m_pairs_dev->number), stream_to_use); + cudaMemsetAsync(&(holder.m_pairs_dev->reverse_number), 0, sizeof(holder.m_pairs_dev->reverse_number), stream_to_use); + cudaMemsetAsync(TASHacks::get_num_extra_neighs_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); + cudaMemsetAsync(TASHacks::get_num_extra_reverse_neighs_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); + + const int i_dimBlock1 = FillNeighboursFirstBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(NCaloCells, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + + const int i_dimBlock2 = FillNeighboursSecondBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + fillNeighboursFirstKernel <<< dimGrid1, dimBlock1, 0, stream_to_use>>>(holder.m_pairs_dev, temps, holder.m_cell_state_dev, + instance_data.m_geometry_dev, options.m_options_dev); + + fillNeighboursSecondKernel <<< dimGrid2, dimBlock2, 0, stream_to_use>>>(holder.m_pairs_dev, temps, holder.m_clusters_dev, + holder.m_cell_state_dev, instance_data.m_geometry_dev, options.m_options_dev); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + + +/****************************************************************************************** + * Determine the local maxima and initialize the cell arrays appropriately. + ******************************************************************************************/ + +static __global__ +void countInferiorNeighsKernel( Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int num_normal_pairs, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + if (index < num_normal_pairs) + { + const int this_ID = neighbour_pairs->cellID[index]; + const int neigh_ID = neighbour_pairs->neighbourID[index]; + + const int this_sampling = geometry->caloSample[this_ID]; + const int neigh_sampling = geometry->caloSample[neigh_ID]; + + float this_energy = 0.f, neigh_energy = 0.f; + + if (!cell_info_arr->is_bad(*geometry, this_ID, opts->treat_L1_predicted_as_good) && opts->uses_sampling(this_sampling)) + { + this_energy = cell_info_arr->energy[this_ID]; + if (opts->use_absolute_energy) + { + this_energy = fabsf(this_energy); + } + else if (this_energy <= 0.f) + { + this_energy = 0.f; + } + } + + if (!cell_info_arr->is_bad(*geometry, neigh_ID, opts->treat_L1_predicted_as_good) && opts->uses_sampling(neigh_sampling)) + { + neigh_energy = cell_info_arr->energy[neigh_ID]; + if (opts->use_absolute_energy) + { + neigh_energy = fabsf(neigh_energy); + } + else if (neigh_energy <= 0.f) + { + neigh_energy = 0.f; + } + } + + bool is_max_neig = neigh_energy > this_energy; + + if (opts->uses_primary_sampling(neigh_sampling)) + { + if (!opts->uses_primary_sampling(this_sampling) && opts->uses_secondary_sampling(this_sampling)) + { + is_max_neig = true; + } + } + + if (!is_max_neig) + { + temporaries->get_extra_array<int>(neigh_ID) = -NCaloCells; + //No need to count, just to invalidate! + } + } +} + +static __global__ +void countNeighsDeferrerKernel(Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + const int full_pairs_number = neighbour_pairs->number + TASHacks::get_num_extra_neighs(clusters_arr); + + const int i_dimBlock1 = CountInferiorNeighsBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(full_pairs_number, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); +#if CAN_USE_TAIL_LAUNCH + countInferiorNeighsKernel <<< dimGrid1, dimBlock1, 0, cudaStreamTailLaunch>>>(temporaries, cell_info_arr, neighbour_pairs, full_pairs_number, geometry, opts); +#else + countInferiorNeighsKernel <<< dimGrid1, dimBlock1>>>(temporaries, cell_info_arr, neighbour_pairs, full_pairs_number, geometry, opts); +#endif + } +} + +static __global__ +void findLocalMaximaKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + if (index < NCaloCells) + { + const ClusterTag this_tag = cell_state_arr->clusterTag[index]; + + if (this_tag.is_part_of_cluster()) + { + const int this_sampling = geometry->caloSample[index]; + + float cell_energy = 0.f; + const float raw_cell_energy = cell_info_arr->energy[index]; + + if (!cell_info_arr->is_bad(*geometry, index, opts->treat_L1_predicted_as_good) && opts->uses_sampling(this_sampling)) + { + cell_energy = raw_cell_energy; + if (opts->use_absolute_energy) + { + cell_energy = fabsf(cell_energy); + } + else if (cell_energy <= 0.f) + { + cell_energy = 0.f; + } + } + + const int num_neighs = temporaries->get_extra_array<int>(index); + + bool is_primary = false, is_maximum = false; + + if (num_neighs >= 0 && num_neighs >= opts->min_num_cells && cell_energy >= opts->min_maximum_energy) + { + if (opts->uses_primary_sampling(this_sampling)) + { + is_maximum = true; + is_primary = true; + } + else if (opts->uses_secondary_sampling(this_sampling)) + { + is_maximum = true; + is_primary = false; + } + } + + if (is_maximum) + { + const int original_cluster = this_tag.cluster_index(); + const int new_cluster = atomicAdd(&(clusters_arr->number), 1); + + + const TASTag new_tag = TASTag::make_maximum_tag(new_cluster, __float_as_uint(raw_cell_energy), is_primary); + + cell_state_arr->clusterTag[index] = new_tag; + + clusters_arr->seedCellID[new_cluster] = index; + + clusters_arr->seedCellID[original_cluster] = -1; + + TASHacks::set_original_cluster_table_entry(clusters_arr, new_cluster, original_cluster); + + } + else + { + const int this_cluster = this_tag.cluster_index(); + + cell_state_arr->clusterTag[index] = TASTag::make_cluster_cell_tag(this_cluster); + } + } + else + { + cell_state_arr->clusterTag[index] = TASTag::make_invalid_tag(); + } + } +} + +static __global__ +void fixClustersWithoutMaximaKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + + if (index < NCaloCells) + { + TASTag this_tag = cell_state_arr->clusterTag[index]; + + if (this_tag.is_part_of_splitter_cluster()) + { + temporaries->secondaryArray[index] = this_tag; + } + else if (this_tag.is_valid()) + //It'll be part of an original cluster, given how we've assigned the tags. + { + const int cluster_index = this_tag.index(); + + if (clusters_arr->seedCellID[cluster_index] >= 0) + //This means the cluster is not split. + { + TASTag new_tag = TASTag::make_original_cluster_tag(cluster_index); + cell_state_arr->clusterTag[index] = new_tag; + temporaries->secondaryArray[index] = new_tag; + TASHacks::set_original_cluster_table_entry(clusters_arr, cluster_index, cluster_index); + } + else + //This means the tag belongs to a cluster to be split + { + temporaries->secondaryArray[index] = this_tag; + } + } + else + { + temporaries->secondaryArray[index] = TASTag::make_invalid_tag(); + } + } + +} + +void findLocalMaxima(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const ConstantDataHolder & instance_data, const TASOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + const int i_dimBlock1 = FindLocalMaximaBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(NCaloCells, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + + const int i_dimBlock2 = FixClustersWithoutMaximaBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + countNeighsDeferrerKernel <<< 1, 1, 0, stream_to_use>>>(temps, holder.m_cell_info_dev, holder.m_clusters_dev, + holder.m_pairs_dev, instance_data.m_geometry_dev, options.m_options_dev); + + + findLocalMaximaKernel <<< dimGrid1, dimBlock1, 0, stream_to_use>>>(holder.m_cell_state_dev, holder.m_clusters_dev, + temps, holder.m_cell_info_dev, + instance_data.m_geometry_dev, options.m_options_dev); + + fixClustersWithoutMaximaKernel <<< dimGrid2, dimBlock2, 0, stream_to_use>>>(holder.m_cell_state_dev, temps, holder.m_clusters_dev); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + +/***************************************************************************** + * Delete secondary maxima according to the criteria on the CPU version. + ******************************************************************************/ + +namespace +{ + constexpr int primary_cluster_mark = 0x40000000; + constexpr int original_cluster_mark = 0x20000000; + constexpr int part_of_cluster_mark = 0x10000000; + constexpr int invalid_cell_value = ~( primary_cluster_mark | + original_cluster_mark | + part_of_cluster_mark ); +} + +__global__ static +void prepareArraysForSecondaryMaxima(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + TASTag this_tag = cell_state_arr->clusterTag[index]; + + if (this_tag.is_part_of_original_cluster()) + { + TASHacks::set_secondary_restore_table_entry(clusters_arr, index, this_tag.index() | original_cluster_mark); + this_tag = TASTag::make_invalid_tag(); + //We can propagate freely through original clusters! + } + else if (this_tag.is_part_of_splitter_cluster()) + { + if (this_tag.is_secondary()) + { + TASHacks::set_secondary_restore_table_entry(clusters_arr, index, this_tag.index()); + this_tag = this_tag.update_index(index); + //To get the correct ordering. + } + else + { + TASHacks::set_secondary_restore_table_entry(clusters_arr, index, this_tag.index() | primary_cluster_mark); + this_tag = TASTag::secondary_maxima_eliminator(); + } + } + else if (this_tag.is_non_assigned_part_of_split_cluster()) + { + TASHacks::set_secondary_restore_table_entry(clusters_arr, index, this_tag.index() | part_of_cluster_mark); + this_tag = TASTag::make_invalid_tag(); + } + else + { + TASHacks::set_secondary_restore_table_entry(clusters_arr, index, invalid_cell_value); + this_tag = TASTag::make_invalid_tag(); + } + + cell_state_arr->clusterTag[index] = this_tag; + temporaries->secondaryArray[index] = this_tag; + } +} + +__global__ static +void checkForMaximaExclusionTermination( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs); + +__global__ static +void propagateForMaximaExclusion( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int pair_start, + const int pair_switch, + const int pair_number) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < pair_number) + { + const int this_ID = neighbour_pairs->cellID[pair_start + index]; + const int neigh_ID = neighbour_pairs->neighbourID[pair_start + index]; + + tag_type * array = ( index < pair_switch ? + cell_state_arr->clusterTag : + temporaries->secondaryArray ); + + const TASTag this_tag = array[this_ID]; + + if (this_tag.is_secondary_maxima_eliminator() || this_tag.is_secondary_maximum_seed()) + { + if (atomicMax(&(array[neigh_ID]), this_tag) < this_tag) + { + TASHacks::set_continue_flag(clusters_arr, 1); + } + } + } +#if CAN_USE_TAIL_LAUNCH + else if (index == pair_number) + { + checkForMaximaExclusionTermination <<< 1, 1, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, neighbour_pairs); + } +#endif +} + +__global__ static +void checkForMaximaExclusionTermination( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + if (TASHacks::get_continue_flag(clusters_arr)) + { + TASHacks::set_continue_flag(clusters_arr, 0); +#if CAN_USE_TAIL_LAUNCH + const int reverse_pairs_number = neighbour_pairs->reverse_number; + const int reverse_pairs_start = NMaxPairs - reverse_pairs_number; + + const int extra_reverse_pairs_number = TASHacks::get_num_extra_reverse_neighs(clusters_arr); + + const int total_pairs_start = reverse_pairs_start - extra_reverse_pairs_number; + + const int total_pairs_number = reverse_pairs_number + extra_reverse_pairs_number; + + const int i_dimBlock1 = ExcludeMaximaPropagationBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(total_pairs_number + 1, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + propagateForMaximaExclusion <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, + clusters_arr, neighbour_pairs, + total_pairs_start, extra_reverse_pairs_number, + total_pairs_number); + +#endif + } +#if !CAN_USE_TAIL_LAUNCH + else /*if (!TASHacks::get_continue_flag(clusters_arr))*/ + { + TASHacks::set_stop_flag(clusters_arr, 1); + } +#endif + } +} + +__global__ static +void excludeSecondaryMaximaKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + const int reverse_pairs_number = neighbour_pairs->reverse_number; + const int reverse_pairs_start = NMaxPairs - reverse_pairs_number; + + const int extra_reverse_pairs_number = TASHacks::get_num_extra_reverse_neighs(clusters_arr); + + const int total_pairs_start = reverse_pairs_start - extra_reverse_pairs_number; + + const int total_pairs_number = reverse_pairs_number + extra_reverse_pairs_number; + + const int i_dimBlock1 = ExcludeMaximaPropagationBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(total_pairs_number + 1, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + +#if CAN_USE_TAIL_LAUNCH + propagateForMaximaExclusion <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, + clusters_arr, neighbour_pairs, + total_pairs_start, extra_reverse_pairs_number, + total_pairs_number); +#else + while (!TASHacks::get_stop_flag(clusters_arr)) + { + propagateForMaximaExclusion <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, + clusters_arr, neighbour_pairs, + total_pairs_start, extra_reverse_pairs_number, + total_pairs_number); + checkForMaximaExclusionTermination <<< 1, 1>>> (cell_state_arr, temporaries, + clusters_arr, neighbour_pairs); + //++counter; + } + + //printf("COUNTS: %16d\n", counter); +#endif + } +} + + + +__global__ static +void resetAndCleanUpSecondaries(Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const TASTag tag_one = cell_state_arr->clusterTag[index]; + const TASTag tag_two = temporaries->secondaryArray[index]; + const int prev_state = TASHacks::get_secondary_restore_table_entry(clusters_arr, index); + const int prev_index = prev_state & 0xFFFF; + const float energy = cell_info_arr->energy[index]; + + TASTag new_tag = 0; + + if (prev_state == invalid_cell_value) + { + new_tag = TASTag::make_invalid_tag(); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, -1); + } + else if (prev_state == prev_index) + //is a secondary cluster. + { + if (tag_one.index() != index || tag_two.index() != index) + //The tag got replaced with that of a more energetic secondary maximum + //or a primary maximum (being a secondary maxima eliminator, + //which also has an index larger than any cell index...) + { + clusters_arr->seedCellID[prev_index] = -1; + const int old_index = TASHacks::get_original_cluster_table_entry(clusters_arr, prev_index); + new_tag = TASTag::make_cluster_cell_tag(old_index); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, old_index | (old_index << 16)); + //This actually is the same as the restore table, + //just different functions for semantic clarity... + } + else + { + //clusters_arr->seedCellID[prev_index] = index; + new_tag = TASTag::make_maximum_tag(index, __float_as_uint(energy), true); + //No further distinction between primaries and secondaries. + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, prev_index); + } + } + else if (prev_state & original_cluster_mark) + { + new_tag = TASTag::make_original_cluster_tag(prev_index); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, prev_index | (prev_index << 16)); + } + else if (prev_state & part_of_cluster_mark) + { + new_tag = TASTag::make_cluster_cell_tag(prev_index); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, prev_index | (prev_index << 16)); + } + else if (prev_state & primary_cluster_mark) + { + new_tag = TASTag::make_maximum_tag(index, __float_as_uint(energy), true); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, prev_index); + } + else + { + new_tag = TASTag::make_invalid_tag(); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, -1); + } + + cell_state_arr->clusterTag[index] = new_tag; + temporaries->secondaryArray[index] = new_tag; + } +} + +void excludeSecondaryMaxima(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const ConstantDataHolder & instance_data, const TASOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + const int i_dimBlock1 = PrepareArrayForSecondaryMaximaBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(NCaloCells, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + + const int i_dimBlock2 = ResetAndCleanSecondariesBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + prepareArraysForSecondaryMaxima <<< dimGrid1, dimBlock1>>>(holder.m_cell_state_dev, temps, holder.m_clusters_dev); + if (options.m_options->valid_sampling_secondary != 0) + { + cudaMemsetAsync(TASHacks::get_continue_flag_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); +#if !CAN_USE_TAIL_LAUNCH + cudaMemsetAsync(TASHacks::get_stop_flag_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); +#endif + excludeSecondaryMaximaKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_cell_state_dev, holder.m_clusters_dev, temps, holder.m_pairs_dev, holder.m_cell_info_dev); + } + resetAndCleanUpSecondaries <<< dimGrid2, dimBlock2, 0, stream_to_use>>>(holder.m_cell_state_dev, temps, holder.m_clusters_dev, holder.m_cell_info_dev); + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + + +/****************************************************************************************** + * Propagate the new tags and create the final clusters. + ******************************************************************************************/ +__global__ static +void handleSplitterIndexChangesKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const bool share_cells ); + +__global__ static +void handleSplitterTagChangesKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const bool share_cells ); + +__global__ static +void checkForTagPropagationTermination( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const bool share_cells ); + +__global__ static +void propagateSplitterTagsKernel( const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const int pair_number, const bool share_cells ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < pair_number) + { + const int this_ID = neighbour_pairs->cellID[index]; + const int neigh_ID = neighbour_pairs->neighbourID[index]; + + const TASTag neigh_tag = cell_state_arr->clusterTag[neigh_ID]; + + if (!neigh_tag.is_part_of_splitter_cluster()) + { + return; + } + + TASTag prop_tag = neigh_tag.propagate(); + + if (neigh_tag.is_shared() && !neigh_tag.is_primary() && neigh_tag.counter() > 0x7FF) + { + prop_tag = prop_tag.update_counter(0x7FF); + //Shared cells after the original ones + //are not ordered by the propagation step + //of the original shared cell. + //Assuming less than 2^11 = 2048 propagation steps + //before making a shared cell seems safe-ish? + } + + const TASTag old_tag = cell_state_arr->clusterTag[this_ID]; + if (share_cells && !neigh_tag.is_shared() && old_tag.is_part_of_splitter_cluster() && !old_tag.is_shared() && !old_tag.is_primary()) + { + const int old_count = old_tag.counter(); + const int new_count = prop_tag.counter(); + const int old_cell = old_tag.index(); + const int new_cell = prop_tag.index(); + if (old_count == new_count && old_cell != new_cell) + //Note that, in the CPU implementation, + //cells are only shared if they are in the to-grow list. + { + const int old_index = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, old_cell); + const int new_index = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, new_cell); + if (old_index != new_index) + { + prop_tag = old_tag.prepare_for_sharing(prop_tag); + atomicMax(TASHacks::get_reset_counter_address(clusters_arr), old_count); + } + } + } + + atomicMax(&(temporaries->secondaryArray[this_ID]), prop_tag); + } +#if CAN_USE_TAIL_LAUNCH + else if (index == pair_number) + { + const int i_dimBlock = HandleSplitIndexChangesBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(NCaloCells + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + handleSplitterIndexChangesKernel <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, neighbour_pairs, share_cells); + } +#endif +} + +__global__ static +void handleSplitterIndexChangesKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const bool share_cells ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + TASTag old_tag = cell_state_arr->clusterTag[index]; + TASTag new_tag = temporaries->secondaryArray[index]; + + if (!new_tag.is_part_of_splitter_cluster() || new_tag.counter() == TASTag::max_counter()) + { + return; + } + + const uint32_t new_cluster_index = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, new_tag.index()); + const int desired_counter = TASHacks::get_reset_counter(clusters_arr); + + if ( new_tag.counter() < desired_counter || (old_tag.is_part_of_splitter_cluster() && old_tag.counter() < desired_counter) ) + { + const int original_cluster_index = TASHacks::get_original_cluster_table_entry(clusters_arr, new_cluster_index & 0xFFFFU); + new_tag = TASTag::make_cluster_cell_tag(original_cluster_index); + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, original_cluster_index | (original_cluster_index << 16)); + TASHacks::set_continue_flag(clusters_arr, 1); + cell_state_arr->clusterTag[index] = new_tag; + temporaries->secondaryArray[index] = new_tag; + } + else if (!new_tag.is_primary()) + { + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, new_cluster_index); + } + } +#if CAN_USE_TAIL_LAUNCH + else if (index == NCaloCells) + { + const int i_dimBlock = HandleSplitTagChangesBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(NCaloCells + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + handleSplitterTagChangesKernel <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, neighbour_pairs, share_cells); + } +#endif +} + +__global__ static +void handleSplitterTagChangesKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const bool share_cells ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + TASTag old_tag = cell_state_arr->clusterTag[index]; + TASTag new_tag = temporaries->secondaryArray[index]; + + if (!new_tag.is_part_of_splitter_cluster() || old_tag == new_tag) + { + return; + } + + const uint32_t old_cluster_index = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, old_tag.index()); + const uint32_t new_cluster_index = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, new_tag.index()); + + if (old_cluster_index == new_cluster_index) + { + const float cell_energy = cell_info_arr->energy[index]; + new_tag = new_tag.update_cell(index, __float_as_uint(cell_energy)); + if (new_tag != old_tag) + { + TASHacks::set_continue_flag(clusters_arr, 1); + } + cell_state_arr->clusterTag[index] = new_tag; + temporaries->secondaryArray[index] = new_tag; + return; + } + + if ( old_tag.is_part_of_splitter_cluster() && !old_tag.is_shared() && + new_tag.is_shared() && new_tag.is_primary() ) + { + new_tag = new_tag.update_counter(old_tag.counter() + 1); + const int min_index = min(new_cluster_index, old_cluster_index) & 0xFFFF; + const int max_index = max(new_cluster_index, old_cluster_index) & 0xFFFF; + TASHacks::set_cell_to_cluster_table_entry(clusters_arr, index, (max_index << 16) | min_index); + const float cell_energy = cell_info_arr->energy[index]; + new_tag = new_tag.update_cell(index, __float_as_uint(cell_energy)); + } + else + { + const float cell_energy = cell_info_arr->energy[index]; + new_tag = new_tag.update_cell(index, __float_as_uint(cell_energy)); + } + + TASHacks::set_continue_flag(clusters_arr, 1); + cell_state_arr->clusterTag[index] = new_tag; + temporaries->secondaryArray[index] = new_tag; + } +#if CAN_USE_TAIL_LAUNCH + else if (index == NCaloCells) + { + checkForTagPropagationTermination <<< 1, 1, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, neighbour_pairs, share_cells); + } +#endif +} + + +__global__ static +void checkForTagPropagationTermination( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const bool share_cells ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + TASHacks::set_reset_counter(clusters_arr, 0); + if (TASHacks::get_continue_flag(clusters_arr)) + { + TASHacks::set_continue_flag(clusters_arr, 0); +#if CAN_USE_TAIL_LAUNCH + const int pairs_number = neighbour_pairs->number; + + const int i_dimBlock = PropagateSplitTagsBlockSize; + const int i_dimGrid = Helpers::int_ceil_div(pairs_number + 1, i_dimBlock); + const dim3 dimBlock(i_dimBlock, 1, 1); + const dim3 dimGrid(i_dimGrid, 1, 1); + + propagateSplitterTagsKernel <<< dimGrid, dimBlock, 0, cudaStreamTailLaunch>>>(cell_state_arr, temporaries, clusters_arr, + cell_info_arr, neighbour_pairs, pairs_number, share_cells); +#endif + } +#if !CAN_USE_TAIL_LAUNCH + else /*if (!TASHacks::get_continue_flag(clusters_arr))*/ + { + TASHacks::set_stop_flag(clusters_arr, 1); + } +#endif + } +} + + +__global__ static +void splitClusterTagPropagationKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + const int pairs_number = neighbour_pairs->number; + + const int i_dimBlock1 = PropagateSplitTagsBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(pairs_number + 1, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); +#if CAN_USE_TAIL_LAUNCH + +#else + const int i_dimBlock2 = HandleSplitIndexChangesBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + const int i_dimBlock3 = HandleSplitTagChangesBlockSize; + const int i_dimGrid3 = Helpers::int_ceil_div(NCaloCells, i_dimBlock3); + const dim3 dimBlock3(i_dimBlock3, 1, 1); + const dim3 dimGrid3(i_dimGrid3, 1, 1); + + //int counter = 0; + + const bool share_cells = opts->share_border_cells; + + while (!TASHacks::get_stop_flag(clusters_arr)) + { + propagateSplitterTagsKernel <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, + neighbour_pairs, pairs_number, share_cells); + handleSplitterIndexChangesKernel <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, neighbour_pairs, share_cells); + handleSplitterTagChangesKernel <<< dimGrid3, dimBlock3>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, neighbour_pairs, share_cells); + checkForTagPropagationTermination <<< 1, 1>>>(cell_state_arr, temporaries, clusters_arr, cell_info_arr, neighbour_pairs, share_cells); + //++counter; + } + //printf("COUNTS: %16d\n", counter); +#endif + } +} + +//run the kernel +void splitClusterGrowing(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const ConstantDataHolder & instance_data, const TASOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + cudaMemsetAsync(TASHacks::get_continue_flag_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); + cudaMemsetAsync(TASHacks::get_reset_counter_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); +#if !CAN_USE_TAIL_LAUNCH + cudaMemsetAsync(TASHacks::get_stop_flag_address(holder.m_clusters_dev), 0, sizeof(int), stream_to_use); +#endif + splitClusterTagPropagationKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_cell_state_dev, temps, holder.m_clusters_dev, + holder.m_cell_info_dev, holder.m_pairs_dev, options.m_options_dev); + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} + +/****************************************************************************************** + * Calculate the cell weights (only if indeed using shared_cells). + ******************************************************************************************/ + +namespace +{ + constexpr int clusterprop_abs_E = 0; + constexpr int clusterprop_E = 1; + constexpr int clusterprop_x = 2; + constexpr int clusterprop_y = 3; + constexpr int clusterprop_z = 4; +} + + +__global__ static +void sumCellsForCentroid( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + const Helpers::CUDA_kernel_object<CellInfoArr> cell_info_arr, + const Helpers::CUDA_kernel_object<GeometryArr> geometry) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const TASTag tag = cell_state_arr->clusterTag[index]; + if (tag.is_part_of_splitter_cluster() && !tag.is_shared()) + { + const int cluster = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, tag.index()) & 0xFFFF; + + const float energy = cell_info_arr->energy[index]; + const float abs_energy = fabsf(energy); + const float x = geometry->x[index]; + const float y = geometry->y[index]; + const float z = geometry->z[index]; + + atomicAdd( &( temporaries->get_cluster_property_aux_array<clusterprop_abs_E>(cluster) ), abs_energy ); + atomicAdd( &( temporaries->get_cluster_property_aux_array<clusterprop_E>(cluster) ), energy ); + + atomicAdd( &( temporaries->get_cluster_property_aux_array<clusterprop_x>(cluster) ), x * abs_energy ); + atomicAdd( &( temporaries->get_cluster_property_aux_array<clusterprop_y>(cluster) ), y * abs_energy ); + atomicAdd( &( temporaries->get_cluster_property_aux_array<clusterprop_z>(cluster) ), z * abs_energy ); + + } + } +} + +__global__ static +void calculateCentroids(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const int cluster_number) +{ + const int i = blockIdx.x * blockDim.x + threadIdx.x; + if (i < cluster_number) + { + + const float abs_energy = temporaries->get_cluster_property_aux_array<clusterprop_abs_E>(i); + + if (abs_energy > 0) + { + temporaries->get_cluster_property_aux_array<clusterprop_x>(i) /= abs_energy; // x + + temporaries->get_cluster_property_aux_array<clusterprop_y>(i) /= abs_energy; // y + + temporaries->get_cluster_property_aux_array<clusterprop_z>(i) /= abs_energy; // z + } + } +} + +__global__ static +void calculateCentroidsDeferKernel(Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index == 0) + //Will be called with just 1 thread, but... + { + const int i_dimBlock1 = CalculateCentroidsBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(NCaloCells, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); +#if CAN_USE_TAIL_LAUNCH + calculateCentroids <<< dimGrid1, dimBlock1, 0, cudaStreamTailLaunch>>>(clusters_arr, temporaries, clusters_arr->number); +#else + calculateCentroids <<< dimGrid1, dimBlock1>>>(clusters_arr, temporaries, clusters_arr->number); +#endif + } +} + + +__global__ static +void assignFinalCells( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, + Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temporaries, + const Helpers::CUDA_kernel_object<GeometryArr> geometry, + const Helpers::CUDA_kernel_object<TopoAutomatonSplittingOptions> opts ) +{ + const int index = blockIdx.x * blockDim.x + threadIdx.x; + if (index < NCaloCells) + { + const TASTag tag = cell_state_arr->clusterTag[index]; + if (tag.is_part_of_splitter_cluster()) + { + if (opts->share_border_cells && tag.is_shared()) + { + const uint32_t shared_clusters_packed = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, tag.index()); + const int cluster_1 = shared_clusters_packed & 0xFFFFU; + const int cluster_2 = (shared_clusters_packed >> 16) & 0xFFFFU; + + const float cell_x = geometry->x[index]; + const float cell_y = geometry->y[index]; + const float cell_z = geometry->z[index]; + + + const float delta_x_1 = cell_x - temporaries->get_cluster_property_aux_array<clusterprop_x>(cluster_1); + const float delta_x_2 = cell_x - temporaries->get_cluster_property_aux_array<clusterprop_x>(cluster_2); + + const float delta_y_1 = cell_y - temporaries->get_cluster_property_aux_array<clusterprop_y>(cluster_1); + const float delta_y_2 = cell_y - temporaries->get_cluster_property_aux_array<clusterprop_y>(cluster_2); + + const float delta_z_1 = cell_z - temporaries->get_cluster_property_aux_array<clusterprop_z>(cluster_1); + const float delta_z_2 = cell_z - temporaries->get_cluster_property_aux_array<clusterprop_z>(cluster_2); + + + const float d_1 = sqrtf(delta_x_1 * delta_x_1 + delta_y_1 * delta_y_1 + delta_z_1 * delta_z_1); + + const float d_2 = sqrtf(delta_x_2 * delta_x_2 + delta_y_2 * delta_y_2 + delta_z_2 * delta_z_2); + + float r_exp = (d_1 - d_2) / opts->EM_shower_scale; + + if (r_exp > 10) + { + r_exp = 10; + } + else if (r_exp < -10) + { + r_exp = -10; + } + + const float r = expf(r_exp); + const float r_reverse = expf(-r_exp); + + float E_1 = temporaries->get_cluster_property_aux_array<clusterprop_E>(cluster_1); + + float E_2 = temporaries->get_cluster_property_aux_array<clusterprop_E>(cluster_2); + + if (opts->use_absolute_energy) + { + E_1 = fabsf(E_1); + E_2 = fabsf(E_2); + } + + if (E_1 <= 0) + { + E_1 = 1.0f * CLHEP::MeV; + } + if (E_2 <= 0) + { + E_2 = 1.0f * CLHEP::MeV; + } + + float weight = E_1 / (E_1 + E_2 * r); + float rev_weight = E_2 / (E_2 + E_1 * r_reverse); + + if (__float_as_uint(weight) == 0) + { + weight == __uint_as_float(1); + } + + if (__float_as_uint(rev_weight) == 0) + { + rev_weight == __uint_as_float(1); + } + + //This is just so that shared clusters + //always show up as shared clusters. + //A denormal weight is... negligible for physics. + + if (weight > 0.5f) + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(cluster_1, __float_as_uint(rev_weight), cluster_2); + } + else if (weight == 0.5f) + { + const int max_cluster = cluster_1 > cluster_2 ? cluster_1 : cluster_2; + const int min_cluster = cluster_1 > cluster_2 ? cluster_2 : cluster_1; + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(max_cluster, __float_as_uint(weight), min_cluster); + } + else /*if (weight < 0.5f)*/ + { + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(cluster_2, __float_as_uint(weight), cluster_1); + } + } + else + { + const int this_cluster = TASHacks::get_cell_to_cluster_table_entry(clusters_arr, tag.index()) & 0xFFFF; + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(this_cluster); + } + } + else if (tag.is_non_assigned_part_of_split_cluster()) + { + const int this_cluster = tag.index(); + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(this_cluster); + //Cells that are part of a pre-splitter cluster get added to the "same"? + + atomicMax(&(clusters_arr->seedCellID[this_cluster]), index); + //Not the seed cell, but just a consistent way of marking this cluster as still valid... + } + else if (tag.is_part_of_original_cluster()) + { + const int this_cluster = tag.index(); + cell_state_arr->clusterTag[index] = ClusterTag::make_tag(this_cluster); + } + else + { + cell_state_arr->clusterTag[index] = ClusterTag::make_invalid_tag(); + } + } +} + +//run the kernel +void cellWeightingAndFinalization(EventDataHolder & holder, Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const ConstantDataHolder & instance_data, const TASOptionsHolder & options, const bool synchronize, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream) +{ + const cudaStream_t & stream_to_use = (stream != nullptr ? * ((cudaStream_t *) stream) : cudaStreamPerThread); + + if (options.m_options->share_border_cells) + { + cudaMemsetAsync(temps->secondaryArray, 0, sizeof(tag_type) * NCaloCells, cudaStreamPerThread); + const int i_dimBlock1 = SumCellsBlockSize; + const int i_dimGrid1 = Helpers::int_ceil_div(NCaloCells, i_dimBlock1); + const dim3 dimBlock1(i_dimBlock1, 1, 1); + const dim3 dimGrid1(i_dimGrid1, 1, 1); + + sumCellsForCentroid <<< dimGrid1, dimBlock1, 0, stream_to_use>>>( holder.m_clusters_dev, temps, + holder.m_cell_state_dev, holder.m_cell_info_dev, + instance_data.m_geometry_dev ); + + calculateCentroidsDeferKernel <<< 1, 1, 0, stream_to_use>>>(holder.m_clusters_dev, temps); + + } + + const int i_dimBlock2 = FinalizeWeightsBlockSize; + const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); + const dim3 dimBlock2(i_dimBlock2, 1, 1); + const dim3 dimGrid2(i_dimGrid2, 1, 1); + + assignFinalCells <<< dimGrid2, dimBlock2, 0, stream_to_use>>>( holder.m_cell_state_dev, holder.m_clusters_dev, temps, + instance_data.m_geometry_dev, options.m_options_dev ); + + if (synchronize) + { + CUDA_ERRCHECK(cudaPeekAtLastError()); + CUDA_ERRCHECK(cudaStreamSynchronize(stream_to_use)); + } +} diff --git a/Calorimeter/CaloRecGPU/src/TopoAutomatonSplittingImpl.h b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplittingImpl.h new file mode 100644 index 0000000000000000000000000000000000000000..00dc29b1e711109b4d22d47abcd612889cced359 --- /dev/null +++ b/Calorimeter/CaloRecGPU/src/TopoAutomatonSplittingImpl.h @@ -0,0 +1,498 @@ +// +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// + +#ifndef CALORECGPU_TOPOAUTOMATONSPLITTING_CUDA_H +#define CALORECGPU_TOPOAUTOMATONSPLITTING_CUDA_H + +#include "CaloRecGPU/CUDAFriendlyClasses.h" +#include "CaloRecGPU/DataHolders.h" +#include "CaloRecGPU/Helpers.h" +#include "ExtraTagDefinitions.h" + +#include "FPHelpers.h" + +struct TASTag : public CaloRecGPU::Tag_1_1_12_32_18 +//Any %? +{ + using CaloRecGPU::Tag_1_1_12_32_18::Tag_1_1_12_32_18; + + protected: + + static constexpr uint32_t s_start_counter = 0xFFFU; + //12 bits. + + static constexpr carrier s_tag_propagation_delta = carrier(1) << s_12_bit_offset; + + using EnergyFPFormat = FloatingPointHelpers::StandardFloat; + + [[nodiscard]] constexpr static uint32_t energy_to_storage(const uint32_t energy_pattern) + { + return EnergyFPFormat::template to_total_ordering<uint32_t>(energy_pattern); + } + + [[nodiscard]] constexpr static uint32_t storage_to_energy(const uint32_t storage_pattern) + { + return EnergyFPFormat::template from_total_ordering<uint32_t>(storage_pattern); + } + + public: + + [[nodiscard]] constexpr static carrier counter_delta() + { + return s_tag_propagation_delta; + } + + [[nodiscard]] constexpr int32_t index() const + { + return this->get_18_bits(); + } + + [[nodiscard]] constexpr static int32_t index(const TASTag tag) + { + return tag.index(); + } + + [[nodiscard]] constexpr uint32_t energy_bits() const + { + return this->get_32_bits(); + } + + [[nodiscard]] constexpr static uint32_t energy_bits(const TASTag tag) + { + return tag.energy_bits(); + } + + [[nodiscard]] constexpr int32_t counter() const + { + return this->get_12_bits(); + } + + [[nodiscard]] static constexpr int32_t counter(const TASTag tag) + { + return tag.counter(); + } + + [[nodiscard]] static constexpr int32_t max_counter() + { + return s_start_counter; + } + + [[nodiscard]] constexpr bool is_primary() const + { + return this->get_first_flag(); + } + + [[nodiscard]] constexpr static bool is_primary(const TASTag tag) + { + return tag.is_primary(); + } + + [[nodiscard]] constexpr bool is_secondary() const + { + return !this->is_primary(); + } + + [[nodiscard]] constexpr static bool is_secondary(const TASTag tag) + { + return tag.is_secondary(); + } + + /*! Expects @p maximum_energy_pattern to be the bit pattern of the float that represents the energy. + */ + [[nodiscard]] static constexpr carrier make_maximum_tag(const int32_t index, const uint32_t maximum_energy_pattern, const bool is_primary) + { + return make_generic_tag(index, energy_to_storage(maximum_energy_pattern), s_start_counter, true, is_primary); + } + + [[nodiscard]] static constexpr carrier make_original_cluster_tag(const uint16_t original_cluster_index) + { + return make_generic_tag(original_cluster_index, 0xFFFFFFFFU, s_start_counter, true, true); + } + + /*! Expects @p energy_pattern to be the bit pattern of the float that represents the energy. + */ + [[nodiscard]] static constexpr carrier make_shared_tag(const int32_t index, const uint32_t energy_pattern, const int32_t counter) + { + return make_generic_tag(index, energy_to_storage(energy_pattern), counter, false, true); + } + + [[nodiscard]] static constexpr carrier make_cluster_cell_tag(const uint16_t original_cluster_index) + { + return make_generic_tag(original_cluster_index, 1, 0, 0, 0); + } + + protected: + + static constexpr carrier s_last_non_assigned_tag = (s_18_bit_mask << 1) | s_18_bit_mask; + + public: + + [[nodiscard]] constexpr carrier set_primary() const + { + return this->set_first_flag(); + } + + [[nodiscard]] static constexpr carrier set_primary(const TASTag tag) + { + return tag.set_primary(); + } + + [[nodiscard]] constexpr carrier clear_primary() const + { + return this->unset_first_flag(); + } + + [[nodiscard]] static constexpr carrier clear_primary(const TASTag tag) + { + return tag.clear_primary(); + } + + [[nodiscard]] constexpr carrier set_shared() const + { + return this->unset_second_flag(); + } + + [[nodiscard]] static constexpr carrier set_shared(const TASTag tag) + { + return tag.set_shared(); + } + + [[nodiscard]] constexpr carrier clear_shared() const + { + return this->set_second_flag(); + } + + [[nodiscard]] static constexpr carrier clear_shared(const TASTag tag) + { + return tag.clear_shared(); + } + + [[nodiscard]] constexpr bool is_valid() const + { + return value > 0ULL; + } + + [[nodiscard]] static constexpr bool is_valid(const TASTag tag) + { + return tag.is_valid(); + } + + [[nodiscard]] constexpr bool is_invalid() const + { + return !this->is_valid(); + } + + [[nodiscard]] static constexpr bool is_invalid(const TASTag tag) + { + return tag.is_invalid(); + } + + [[nodiscard]] constexpr bool is_part_of_original_cluster() const + { + return (value & s_32_bit_mask) == s_32_bit_mask; + //As original cluster cells have all bits of the energy set to 1 + //(which would be a NaN for normal energy) + } + + [[nodiscard]] static constexpr bool is_part_of_original_cluster(const TASTag tag) + { + return tag.is_part_of_original_cluster(); + } + + [[nodiscard]] constexpr bool is_part_of_splitter_cluster() const + { + return value > s_last_non_assigned_tag && !this->is_part_of_original_cluster(); + } + + [[nodiscard]] static constexpr bool is_part_of_splitter_cluster(const TASTag tag) + { + return tag.is_part_of_splitter_cluster(); + } + + [[nodiscard]] constexpr bool is_shared() const + { + return !(this->get_second_flag()); + } + + [[nodiscard]] constexpr static bool is_shared(const TASTag tag) + { + return tag.is_shared(); + } + + [[nodiscard]] constexpr bool is_non_assigned_part_of_split_cluster() const + { + return value > 0 && value <= s_last_non_assigned_tag; + } + + [[nodiscard]] static constexpr bool is_non_assigned_part_of_split_cluster(const TASTag tag) + { + return tag.is_non_assigned_part_of_split_cluster(); + } + + [[nodiscard]] constexpr carrier propagate() const + { + return (value - s_tag_propagation_delta) & (~s_first_flag_mask); + } + + [[nodiscard]] static constexpr carrier propagate(const TASTag tag) + { + return tag.propagate(); + } + + [[nodiscard]] constexpr carrier update_cell(const uint32_t new_index, const uint32_t new_energy) + { + return make_generic_tag(new_index, energy_to_storage(new_energy), 0, 0, 0) | (value & ~(s_18_bit_mask | s_32_bit_mask)); + } + + [[nodiscard]] constexpr carrier update_index(const uint32_t new_index) const + { + return (value & (~s_18_bit_mask)) | ( (carrier(new_index) << s_18_bit_offset) & s_18_bit_mask); + } + + [[nodiscard]] constexpr carrier update_counter(const uint32_t new_counter) const + { + return (value & (~s_12_bit_mask)) | (carrier(new_counter) << s_12_bit_offset); + } + + [[nodiscard]] constexpr carrier ordering_bits() const + { + return value & (s_32_bit_mask | s_18_bit_mask); + } + + [[nodiscard]] static constexpr carrier ordering_bits(const TASTag tag) + { + return tag.ordering_bits(); + } + + [[nodiscard]] constexpr carrier prepare_for_sharing(const TASTag other_tag) const + { + return (other_tag & (~s_second_flag_mask)) | s_first_flag_mask | s_12_bit_mask; + } + + protected: + + static constexpr carrier s_eliminated_secondary_tag = 0xFFFFFFFFFFFFFFFFULL; + + public: + + /*! Just to be semantically clearer for the maxima exclusion. + */ + [[nodiscard]] constexpr bool is_secondary_maximum_seed() const + { + return this->is_part_of_splitter_cluster() && this->is_secondary(); + } + + [[nodiscard]] constexpr static bool is_secondary_maximum_seed(const TASTag tag) + { + return tag.is_secondary_maximum_seed(); + } + + [[nodiscard]] static constexpr carrier secondary_maxima_eliminator() + { + return s_eliminated_secondary_tag; + } + + [[nodiscard]] constexpr bool is_secondary_maxima_eliminator() const + { + return value == s_eliminated_secondary_tag; + } + + [[nodiscard]] static constexpr bool is_secondary_maxima_eliminator(const TASTag tag) + { + return tag.is_secondary_maxima_eliminator(); + } + +}; + +struct TopoAutomatonSplittingTemporaries +{ + CaloRecGPU::tag_type secondaryArray[CaloRecGPU::NCaloCells]; + //Temporarily used as an int array + //to find local maxima + //and as a float array to hold + //cluster (absolute) energies + //for the shared cell weighting. + + template <class T> + constexpr T * get_extra_array() + { + static_assert(sizeof(T) <= sizeof(CaloRecGPU::tag_type), "Can only get extra arrays of sufficiently small types..."); + + void * vptr = (void *) secondaryArray; + return ((T *) vptr); + //I know, I know. + //Should be safe given the lack of padding, though, + //and given that the malloc'd memory + //is cast from void * anyway... + //We avoid using reinterpret_cast + //and employ direct C-style casting instead + //to prevent compilers from complaining about + //it not being constexpr-safe. + //And we need to declare as constexpr + //to automatically get it on the GPU + //without the usual shenanigans + //while keeping compatibility with non-CUDA code. + } + + template <class T> + constexpr const T * get_extra_array() const + { + static_assert(sizeof(T) <= sizeof(CaloRecGPU::tag_type), "Can only get extra arrays of sufficiently small types..."); + + void * vptr = (void *) secondaryArray; + return ((const T *) vptr); + } + + template <class T> + constexpr T & get_extra_array(const int i) + { + return this->get_extra_array<T>()[i]; + } + + template <class T> + constexpr const T & get_extra_array(const int i) const + { + return this->get_extra_array<T>()[i]; + } + + template <class T> + constexpr T * get_second_extra_array() + { + static_assert(sizeof(T) * 2 <= sizeof(CaloRecGPU::tag_type), "Can only get extra arrays of sufficiently small types..."); + + void * vptr = (void *) secondaryArray; + return ((T *) vptr) + CaloRecGPU::NCaloCells; + } + + template <class T> + constexpr const T * get_second_extra_array() const + { + static_assert(sizeof(T) * 2 <= sizeof(CaloRecGPU::tag_type), "Can only get extra arrays of sufficiently small types..."); + + void * vptr = (void *) secondaryArray; + return ((const T *) vptr) + CaloRecGPU::NCaloCells; + } + + template <class T> + constexpr T & get_second_extra_array(const int i) + { + return this->get_second_extra_array<T>()[i]; + } + + template <class T> + constexpr const T & get_second_extra_array(const int i) const + { + return this->get_second_extra_array<T>()[i]; + } + + template <size_t i = 0> + constexpr const float * get_cluster_property_aux_array() const + { + static_assert((i + 1) * sizeof(float) * CaloRecGPU::NMaxClusters <= sizeof(TopoAutomatonSplittingTemporaries), + "Cannot access outside of secondaryArray bounds..."); + + return this->get_extra_array<float>() + i * CaloRecGPU::NMaxClusters; + } + + template <size_t i = 0> + constexpr float * get_cluster_property_aux_array() + { + static_assert((i + 1) * sizeof(float) * CaloRecGPU::NMaxClusters <= sizeof(TopoAutomatonSplittingTemporaries), + "Cannot access outside of secondaryArray bounds..."); + + return this->get_extra_array<float>() + i * CaloRecGPU::NMaxClusters; + } + + template <size_t i = 0> + constexpr const float & get_cluster_property_aux_array(const int j) const + { + return this->get_cluster_property_aux_array<i>()[j]; + } + + template <size_t i = 0> + constexpr float & get_cluster_property_aux_array(const int j) + { + return this->get_cluster_property_aux_array<i>()[j]; + } + +}; + +struct TopoAutomatonSplittingOptions +{ + unsigned int valid_sampling_primary; + unsigned int valid_sampling_secondary; + + int min_num_cells; + float min_maximum_energy; + + float EM_shower_scale; + + bool share_border_cells; + bool use_absolute_energy; + bool treat_L1_predicted_as_good; + + bool limit_HECIW_and_FCal_neighs; + bool limit_PS_neighs; + //WARNING: the CPU version of the algorithm does not seem to have this option. Given the description, + // maybe it makes some sense to still allow this here? In our configuration we'll keep it disabled, but... + + unsigned int neighbour_options; + + constexpr bool uses_primary_sampling(const unsigned int sampling) const + { + return (valid_sampling_primary >> sampling) & 1U; + } + constexpr bool uses_secondary_sampling(const unsigned int sampling) const + { + return (valid_sampling_secondary >> sampling) & 1U; + } + constexpr bool uses_sampling(const unsigned int sampling) const + { + return uses_primary_sampling(sampling) || uses_secondary_sampling(sampling); + } +}; + +struct TASOptionsHolder +{ + CaloRecGPU::Helpers::CPU_object<TopoAutomatonSplittingOptions> m_options; + + CaloRecGPU::Helpers::CUDA_object<TopoAutomatonSplittingOptions> m_options_dev; + + void allocate(); + void sendToGPU(const bool clear_CPU = false); +}; + +void fillNeighbours(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, + const TASOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void findLocalMaxima(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, + const TASOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void excludeSecondaryMaxima(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, + const TASOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void splitClusterGrowing(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, + const TASOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +void cellWeightingAndFinalization(CaloRecGPU::EventDataHolder & holder, + CaloRecGPU::Helpers::CUDA_kernel_object<TopoAutomatonSplittingTemporaries> temps, + const CaloRecGPU::ConstantDataHolder & instance_data, + const TASOptionsHolder & options, const bool synchronize = false, + CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use = {}); + +#endif //CALORECGPU_TOPOAUTOMATONSPLITTING_CUDA_H diff --git a/Calorimeter/CaloRecGPU/src/components/CaloRecGPU_entries.cxx b/Calorimeter/CaloRecGPU/src/components/CaloRecGPU_entries.cxx index f94568222f81e0c789b352b9d96733a9e190f69f..5497c6fb8fea07bf1e40322f37a0ef29e8ff83fe 100644 --- a/Calorimeter/CaloRecGPU/src/components/CaloRecGPU_entries.cxx +++ b/Calorimeter/CaloRecGPU/src/components/CaloRecGPU_entries.cxx @@ -1,5 +1,9 @@ // -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +// +// Dear emacs, this is -*- c++ -*- +// +// Dear emacs, this is -*- c++ -*- // // Local include(s). @@ -14,7 +18,12 @@ #include "../CaloCellsCounterGPU.h" #include "../CaloTopoClusterSplitterGPU.h" #include "../BasicGPUClusterInfoCalculator.h" +#include "../TopoAutomatonSplitting.h" #include "../CaloClusterDeleter.h" +#include "../CaloGPUClusterAndCellDataMonitor.h" +#include "../GPUClusterInfoAndMomentsCalculator.h" +#include "../GPUToAthenaImporterWithMoments.h" +#include "../CaloMomentsDumper.h" // Declare the "components". DECLARE_COMPONENT( CaloGPUHybridClusterProcessor ) @@ -29,5 +38,9 @@ DECLARE_COMPONENT( CaloCellsCounterGPU ) DECLARE_COMPONENT( CaloTopoClusterSplitterGPU ) DECLARE_COMPONENT( BasicGPUClusterInfoCalculator ) DECLARE_COMPONENT( CaloClusterDeleter ) - +DECLARE_COMPONENT( TopoAutomatonSplitting ) +DECLARE_COMPONENT( CaloGPUClusterAndCellDataMonitor ) +DECLARE_COMPONENT( GPUClusterInfoAndMomentsCalculator ) +DECLARE_COMPONENT( GPUToAthenaImporterWithMoments ) +DECLARE_COMPONENT( CaloMomentsDumper ) diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPUTesting.py b/Calorimeter/CaloRecGPU/test/CaloRecGPUTesting.py new file mode 100644 index 0000000000000000000000000000000000000000..1c1671c06736903586830b5acc42cbe1c749fd0e --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPUTesting.py @@ -0,0 +1,806 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +#import CaloRecGPU.CaloRecGPUConfigurator + +from CaloRecGPU.CaloRecGPUConfigurator import SingleToolToPlot, ComparedToolsToPlot + +from AthenaConfiguration.Enums import Format +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +def PrevAlgorithmsConfiguration(Configurator, clustersname = None): + doLCCalib = Configurator.ConfigFlags.Calo.TopoCluster.doTopoClusterLocalCalib + + if clustersname is None: + clustersname = "CaloCalTopoClusters" if doLCCalib else "CaloTopoClusters" + + if clustersname=="CaloTopoClusters" and doLCCalib is True: + raise RuntimeError("Inconsistent arguments: Name must not be 'CaloTopoClusters' if doLCCalib is True") + + Configurator.ClustersOutputName = clustersname + + result=ComponentAccumulator() + + if Configurator.ConfigFlags.Input.Format is Format.BS: + #Data-case: Schedule ByteStream reading for LAr & Tile + from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg + result.merge(LArRawDataReadingCfg(Configurator.ConfigFlags)) + + from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg + + result.merge(ByteStreamReadCfg(Configurator.ConfigFlags,type_names=['TileDigitsContainer/TileDigitsCnt', + 'TileRawChannelContainer/TileRawChannelCnt', + 'TileMuonReceiverContainer/TileMuRcvCnt'])) + result.getService("ByteStreamCnvSvc").ROD2ROBmap=["-1"] + if Configurator.ConfigFlags.Output.doWriteESD: + from TileRecAlgs.TileDigitsFilterConfig import TileDigitsFilterOutputCfg + result.merge(TileDigitsFilterOutputCfg(Configurator.ConfigFlags)) + else: #Mostly for wrapping in RecExCommon + from TileRecAlgs.TileDigitsFilterConfig import TileDigitsFilterCfg + result.merge(TileDigitsFilterCfg(Configurator.ConfigFlags)) + + from LArROD.LArRawChannelBuilderAlgConfig import LArRawChannelBuilderAlgCfg + result.merge(LArRawChannelBuilderAlgCfg(Configurator.ConfigFlags)) + + from TileRecUtils.TileRawChannelMakerConfig import TileRawChannelMakerCfg + result.merge(TileRawChannelMakerCfg(Configurator.ConfigFlags)) + + if not Configurator.ConfigFlags.Input.isMC and not Configurator.ConfigFlags.Common.isOnline: + from LArCellRec.LArTimeVetoAlgConfig import LArTimeVetoAlgCfg + result.merge(LArTimeVetoAlgCfg(Configurator.ConfigFlags)) + + if not Configurator.ConfigFlags.Input.isMC and not Configurator.ConfigFlags.Overlay.DataOverlay: + from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg + result.merge(LArFebErrorSummaryMakerCfg(Configurator.ConfigFlags)) + + if Configurator.ConfigFlags.Input.Format is Format.BS or 'StreamRDO' in Configurator.ConfigFlags.Input.ProcessingTags: + result.merge(Configurator.DefaultCaloCellMakerConf()) + elif Configurator.FillMissingCells: + from AthenaCommon.Logging import log + log.warning("Asked to fill missing cells but will not run cell maker! Slow path might be taken!") + + from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg + + # Schedule total noise cond alg + result.merge(CaloNoiseCondAlgCfg(Configurator.ConfigFlags,"totalNoise")) + # Schedule electronic noise cond alg (needed for LC weights) + result.merge(CaloNoiseCondAlgCfg(Configurator.ConfigFlags,"electronicNoise")) + + if not Configurator.ConfigFlags.Common.isOnline: + from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg + result.merge(LArElecCalibDBCfg(Configurator.ConfigFlags,["HVScaleCorr"])) + + return result + + + +#TestGrow, TestSplit, TestMoments are self-explanatory. +#If `DoCrossTests` is True, outputs and/or plots +#are done considering all possible combinations +#of (GPU, CPU) x (Growing, Splitting) +#PlotterConfigurator takes the CaloGPUClusterAndCellDataMonitor +#and adds the appropriate plots to it. +def FullTestConfiguration(Configurator, TestGrow=False, TestSplit=False, TestMoments=False, DoCrossTests=False, + PlotterConfigurator=None, clustersname=None, OutputCellInfo=False, SkipSyncs=True): + doLCCalib = Configurator.ConfigFlags.Calo.TopoCluster.doTopoClusterLocalCalib + + if clustersname is None: + clustersname = "CaloCalTopoClusters" if doLCCalib else "CaloTopoClusters" + + if clustersname=="CaloTopoClusters" and doLCCalib is True: + raise RuntimeError("Inconsistent arguments: Name must not be 'CaloTopoClusters' if doLCCalib is True") + + Configurator.ClustersOutputName = clustersname + + if not (TestGrow and TestSplit): + DoCrossTests = False + + result= PrevAlgorithmsConfiguration(Configurator, clustersname) + + HybridClusterProcessor = CompFactory.CaloGPUHybridClusterProcessor("HybridClusterProcessor") + HybridClusterProcessor.ClustersOutputName = Configurator.ClustersOutputName + HybridClusterProcessor.MeasureTimes = Configurator.MeasureTimes + HybridClusterProcessor.TimeFileOutput = "GlobalTimes.txt" + HybridClusterProcessor.DeferConstantDataPreparationToFirstEvent = True + + if PlotterConfigurator is None: + HybridClusterProcessor.DoPlots = False + else: + HybridClusterProcessor.DoPlots = True + Plotter = PlotterConfigurator(result.popToolsAndMerge(Configurator.PlotterMonitoringToolConf())) + HybridClusterProcessor.PlotterTool = Plotter + if TestGrow and not DoCrossTests: + Plotter.ToolsToPlot += [ SingleToolToPlot("DefaultGrowing", "CPU_growing") ] + Plotter.ToolsToPlot += [ SingleToolToPlot("PropCalcPostGrowing", "GPU_growing") ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("DefaultGrowing", "PropCalcPostGrowing", "growing") ] + if TestSplit and not DoCrossTests: + Plotter.ToolsToPlot += [ SingleToolToPlot("DefaultSplitting", "CPU_splitting") ] + Plotter.ToolsToPlot += [ SingleToolToPlot("PropCalcPostSplitting", "GPU_splitting") ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("DefaultSplitting", "PropCalcPostSplitting", "splitting", True) ] + if TestMoments: + Plotter.ToolsToPlot += [ SingleToolToPlot("CPUMoments", "CPU_moments") ] + Plotter.ToolsToPlot += [ SingleToolToPlot("AthenaClusterImporter", "GPU_moments") ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("CPUMoments", "AthenaClusterImporter", "moments", True) ] + if DoCrossTests: + Plotter.ToolsToPlot += [ SingleToolToPlot("DefaultGrowing", "CPU_growing") ] + Plotter.ToolsToPlot += [ SingleToolToPlot("PropCalcPostGrowing", "GPU_growing") ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("DefaultGrowing", "PropCalcPostGrowing", "growing") ] + + Plotter.ToolsToPlot += [ SingleToolToPlot("DefaultSplitting", "CPUCPU_splitting") ] + Plotter.ToolsToPlot += [ SingleToolToPlot("PropCalcPostSplitting", "GPUGPU_splitting") ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("DefaultSplitting", "PropCalcPostSplitting", "CPU_to_GPUGPU_splitting", True) ] + + Plotter.ToolsToPlot += [ SingleToolToPlot("PropCalcDefaultGrowGPUSplit", "CPUGPU_splitting") ] + Plotter.ToolsToPlot += [ SingleToolToPlot("DefaultPostGPUSplitting", "GPUCPU_splitting") ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("DefaultSplitting", "PropCalcDefaultGrowGPUSplit", "CPU_to_CPUGPU_splitting", True) ] + Plotter.PairsToPlot += [ ComparedToolsToPlot("DefaultSplitting", "DefaultPostGPUSplitting", "CPU_to_GPUCPU_splitting", True) ] + + + HybridClusterProcessor.DoMonitoring = Configurator.DoMonitoring + + if Configurator.DoMonitoring or PlotterConfigurator is not None: + histSvc = CompFactory.THistSvc(Output = ["EXPERT DATAFILE='expert-monitoring.root', OPT='RECREATE'"]) + result.addService(histSvc) + + if Configurator.DoMonitoring: + HybridClusterProcessor.MonitoringTool = Configurator.MonitorizationToolConf() + + HybridClusterProcessor.NumPreAllocatedDataHolders = Configurator.NumPreAllocatedDataHolders + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(Configurator.ConfigFlags)) + result.merge(TileGMCfg(Configurator.ConfigFlags)) + + ConstantDataExporter = result.popToolsAndMerge( Configurator.BasicConstantDataExporterToolConf() ) + EventDataExporter = result.popToolsAndMerge( Configurator.BasicEventDataExporterToolConf() ) + + AthenaClusterImporter = None + + if TestMoments: + AthenaClusterImporter = result.popToolsAndMerge( Configurator.AthenaClusterAndMomentsImporterToolConf("AthenaClusterImporter") ) + else: + AthenaClusterImporter = result.popToolsAndMerge( Configurator.BasicAthenaClusterImporterToolConf("AthenaClusterImporter") ) + + HybridClusterProcessor.ConstantDataToGPUTool = ConstantDataExporter + HybridClusterProcessor.EventDataToGPUTool = EventDataExporter + HybridClusterProcessor.GPUToEventDataTool = AthenaClusterImporter + + HybridClusterProcessor.BeforeGPUTools = [] + + if TestGrow or TestSplit or TestMoments: + DefaultClustering = result.popToolsAndMerge( Configurator.DefaultTopologicalClusteringToolConf("DefaultGrowing") ) + + HybridClusterProcessor.BeforeGPUTools += [DefaultClustering] + + if TestGrow and (not TestSplit or DoCrossTests): + if Configurator.OutputCountsToFile: + CPUCount1 = result.popToolsAndMerge( Configurator.CellsCounterCPUToolConf("./counts", "DefaultGrowCounter", "default_grow") ) + HybridClusterProcessor.BeforeGPUTools += [CPUCount1] + if Configurator.OutputClustersToFile: + CPUOut1 = result.popToolsAndMerge( Configurator.CPUOutputToolConf("./out_default_grow", "DefaultGrowOutput") ) + HybridClusterProcessor.BeforeGPUTools += [CPUOut1] + + + if TestSplit or TestMoments: + FirstSplitter = result.popToolsAndMerge( Configurator.DefaultClusterSplittingToolConf("DefaultSplitting") ) + HybridClusterProcessor.BeforeGPUTools += [FirstSplitter] + + if Configurator.OutputCountsToFile: + CPUCount2 = result.popToolsAndMerge( Configurator.CellsCounterCPUToolConf("./counts", "DefaultGrowAndSplitCounter", "default_grow_split") ) + HybridClusterProcessor.BeforeGPUTools += [CPUCount2] + if Configurator.OutputClustersToFile: + CPUOut2 = result.popToolsAndMerge( Configurator.CPUOutputToolConf("./out_default_grow_split", "DefaultSplitOutput") ) + HybridClusterProcessor.BeforeGPUTools += [CPUOut2] + + if TestMoments: + CPUMoments = result.popToolsAndMerge( Configurator.DefaultClusterMomentsCalculatorToolConf("CPUMoments") ) + HybridClusterProcessor.BeforeGPUTools += [CPUMoments] + if Configurator.OutputCountsToFile: + CPUDumper = result.popToolsAndMerge( Configurator.MomentsDumperToolConf("./moments", "CPUMomentsDumper", "CPU") ) + HybridClusterProcessor.BeforeGPUTools += [CPUDumper] + + Deleter = result.popToolsAndMerge( Configurator.CaloClusterDeleterToolConf()) + HybridClusterProcessor.BeforeGPUTools += [Deleter] + + if TestSplit and (not TestGrow or DoCrossTests): + SecondDefaultClustering = result.popToolsAndMerge( Configurator.DefaultTopologicalClusteringToolConf("SecondDefaultGrowing") ) + HybridClusterProcessor.BeforeGPUTools += [SecondDefaultClustering] + + HybridClusterProcessor.GPUTools = [] + + if OutputCellInfo: + CellOut = result.popToolsAndMerge( Configurator.GPUOutputToolConf("./out_cell", "CellInfoOutput", OnlyOutputCells = True) ) + HybridClusterProcessor.GPUTools += [CellOut] + + if TestSplit: + if not TestGrow: + GPUClusterSplitting1 = result.popToolsAndMerge( Configurator.TopoAutomatonSplitterToolConf("GPUSplitter") ) + if SkipSyncs: + GPUClusterSplitting1.MeasureTimes = False + HybridClusterProcessor.GPUTools += [GPUClusterSplitting1] + PropCalc1 = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalcPostSplitting", False) ) + if SkipSyncs: + PropCalc1.MeasureTimes = False + HybridClusterProcessor.GPUTools += [PropCalc1] + elif DoCrossTests: + GPUClusterSplitting1 = result.popToolsAndMerge( Configurator.TopoAutomatonSplitterToolConf("FirstGPUSplitter") ) + GPUClusterSplitting1.TimeFileOutput = "" #This means there's no output. + GPUClusterSplitting1.MeasureTimes = False + HybridClusterProcessor.GPUTools += [GPUClusterSplitting1] + PropCalc1 = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalcDefaultGrowGPUSplit", False) ) + PropCalc1.TimeFileOutput = "" #This means there's no output. + PropCalc1.MeasureTimes = False + HybridClusterProcessor.GPUTools += [PropCalc1] + + if ((not TestGrow) or DoCrossTests): + if Configurator.OutputCountsToFile: + GPUCount1 = result.popToolsAndMerge( Configurator.CellsCounterGPUToolConf("./counts", "DefaultGrowModifiedSplitCounter", "default_grow_modified_split") ) + HybridClusterProcessor.GPUTools += [GPUCount1] + if Configurator.OutputClustersToFile: + GPUOut1 = result.popToolsAndMerge( Configurator.GPUOutputToolConf("./out_default_grow_modified_split", "DefaultGrowModifiedSplitOutput") ) + HybridClusterProcessor.GPUTools += [GPUOut1] + + if TestGrow: + TopoAutomatonClustering1 = result.popToolsAndMerge( Configurator.TopoAutomatonClusteringToolConf("GPUGrowing") ) + if SkipSyncs: + TopoAutomatonClustering1.MeasureTimes = False + HybridClusterProcessor.GPUTools += [TopoAutomatonClustering1] + + PropCalc2 = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalcPostGrowing", True)) + if SkipSyncs: + PropCalc2.MeasureTimes = False + HybridClusterProcessor.GPUTools += [PropCalc2] + if ((not TestSplit) or DoCrossTests): + if Configurator.OutputCountsToFile: + GPUCount2 = result.popToolsAndMerge( Configurator.CellsCounterGPUToolConf("./counts", "ModifiedGrowCounter", "modified_grow") ) + HybridClusterProcessor.GPUTools += [GPUCount2] + if Configurator.OutputClustersToFile: + GPUOut2 = result.popToolsAndMerge( Configurator.GPUOutputToolConf("./out_modified_grow", "ModifiedGrowOutput") ) + HybridClusterProcessor.GPUTools += [GPUOut2] + + if TestGrow and TestSplit: + GPUClusterSplitting2 = result.popToolsAndMerge( Configurator.TopoAutomatonSplitterToolConf("GPUSplitter") ) + if SkipSyncs: + GPUClusterSplitting2.MeasureTimes = False + HybridClusterProcessor.GPUTools += [GPUClusterSplitting2] + + if HybridClusterProcessor.DoPlots or not TestMoments: + PropCalc3 = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalcPostSplitting", False) ) + if SkipSyncs: + PropCalc3.MeasureTimes = False + HybridClusterProcessor.GPUTools += [PropCalc3] + + if Configurator.OutputCountsToFile: + GPUCount3 = result.popToolsAndMerge( Configurator.CellsCounterGPUToolConf("./counts", "ModifiedGrowSplitCounter", "modified_grow_split") ) + HybridClusterProcessor.GPUTools += [GPUCount3] + if Configurator.OutputClustersToFile: + GPUOut3 = result.popToolsAndMerge( Configurator.GPUOutputToolConf("./out_modified_grow_split", "ModifiedGrowSplitOutput") ) + HybridClusterProcessor.GPUTools += [GPUOut3] + + if DoCrossTests: + TopoAutomatonClustering2 = result.popToolsAndMerge( Configurator.TopoAutomatonClusteringToolConf("SecondGPUGrowing") ) + TopoAutomatonClustering2.MeasureTimes = False + TopoAutomatonClustering2.TimeFileOutput = "" #This means there's no output. + HybridClusterProcessor.GPUTools += [TopoAutomatonClustering2] + + PropCalc4 = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalc4", True) ) + PropCalc4.TimeFileOutput = "" #This means there's no output. + PropCalc4.MeasureTimes = False + HybridClusterProcessor.GPUTools += [PropCalc4] + + if not (TestGrow or TestSplit): + TopoAutomatonClusteringDef = result.popToolsAndMerge( Configurator.TopoAutomatonClusteringToolConf("TopoAutomatonClustering") ) + if SkipSyncs: + TopoAutomatonClusteringDef.MeasureTimes = False + HybridClusterProcessor.GPUTools += [TopoAutomatonClusteringDef] + + FirstPropCalcDef = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalcPostGrowing", True) ) + if SkipSyncs: + FirstPropCalcDef.MeasureTimes = False + HybridClusterProcessor.GPUTools += [FirstPropCalcDef] + + GPUClusterSplittingDef = result.popToolsAndMerge( Configurator.TopoAutomatonSplitterToolConf("GPUTopoSplitter") ) + if SkipSyncs: + GPUClusterSplittingDef.MeasureTimes = False + HybridClusterProcessor.GPUTools += [GPUClusterSplittingDef] + + if not TestMoments: + SecondPropCalcDef = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PropCalcPostSplitting", False) ) + if SkipSyncs: + SecondPropCalcDef.MeasureTimes = False + HybridClusterProcessor.GPUTools += [SecondPropCalcDef] + + if TestMoments and not DoCrossTests: + if TestGrow and not TestSplit: + GPUClusterSplittingDef = result.popToolsAndMerge( Configurator.TopoAutomatonSplitterToolConf("GPUTopoSplitter") ) + if SkipSyncs: + GPUClusterSplittingDef.MeasureTimes = False + HybridClusterProcessor.GPUTools += [GPUClusterSplittingDef] + + GPUMomentsDef = result.popToolsAndMerge( Configurator.GPUClusterMomentsCalculatorToolConf("GPUTopoMoments") ) + if SkipSyncs: + GPUMomentsDef.MeasureTimes = False + HybridClusterProcessor.GPUTools += [GPUMomentsDef] + + HybridClusterProcessor.AfterGPUTools = [] + + if TestMoments and Configurator.OutputCountsToFile: + GPUDumper = result.popToolsAndMerge( Configurator.MomentsDumperToolConf("./moments", "GPUMomentsDumper", "GPU") ) + HybridClusterProcessor.AfterGPUTools += [GPUDumper] + + if TestGrow and (not TestSplit or DoCrossTests): + + TopoSplitter = result.popToolsAndMerge( Configurator.DefaultClusterSplittingToolConf("DefaultPostGPUSplitting") ) + HybridClusterProcessor.AfterGPUTools += [TopoSplitter] + + if DoCrossTests: + if Configurator.OutputCountsToFile: + CPUCount3 = result.popToolsAndMerge( Configurator.CellsCounterCPUToolConf("./counts", "ModifiedGrowDefaultSplitCounter", "modified_grow_default_split") ) + HybridClusterProcessor.AfterGPUTools += [CPUCount3] + if Configurator.OutputClustersToFile: + CPUOut3 = result.popToolsAndMerge( Configurator.CPUOutputToolConf("./out_modified_grow_default_split", "ModifiedGrowDefaultSplitOutput") ) + HybridClusterProcessor.AfterGPUTools += [CPUOut3] + + result.addEventAlgo(HybridClusterProcessor,primary=True) + + return result + + +def PrepareTest(Configurator, + default_files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root"], + parse_command_arguments = True, + allocate_as_many_as_threads = True): + + import argparse + + args = None + rest = None + + if parse_command_arguments: + parser = argparse.ArgumentParser() + + parser.add_argument('-events','--numevents', type=int, default = 10) + parser.add_argument('-threads','--numthreads', type=int, default = 1) + parser.add_argument('-f','--files', action = 'extend', nargs = '*') + parser.add_argument('-t','--measuretimes', action = 'store_true') + parser.add_argument('-o','--outputclusters', action = 'store_true') + parser.add_argument('-c','--outputcounts', action = 'store_true') + parser.add_argument('-nfc','--notfillcells', action = 'store_true') + + parser.add_argument('-uoc','--useoriginalcriteria', action = 'store_true') + + parser.add_argument('-m','--perfmon', action = 'store_true') + parser.add_argument('-fm','--fullmon', action = 'store_true') + + + (args, pre_rest) = parser.parse_known_args() + + if pre_rest is None or len(pre_rest) == 0: + rest = ['--threads', '1'] + #Crude workaround for a condition within ConfigFlags.fillFromArgs + #that would make it inspect the whole command-line when provided + #with an empty list of arguments. + #(I'd personally suggest changing the "listOfArgs or sys.argv[1:]" + # used there since empty arrays are falsy while being non-null, + # to a "sys.argv[1:] if listofArgs is None else listofArgs", + # but I'm not about to suggest potentially code-breaking behaviour changes + # when I can work around them easily, even if rather inelegantly...) + else: + rest = pre_rest + + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + + from AthenaConfiguration.AllConfigFlags import initConfigFlags + #from AthenaConfiguration.TestDefaults import defaultTestFiles + + Configurator.ConfigFlags = initConfigFlags() #ConfigFlags.clone() + + if parse_command_arguments: + Configurator.ConfigFlags.fillFromArgs(listOfArgs=rest) + #We could instead use our parser to overload here and so on, but... + + if args is None or args.files is None: + Configurator.ConfigFlags.Input.Files = default_files + elif len(args.files) == 0: + Configurator.ConfigFlags.Input.Files = default_files + elif len(args.files) == 1: + if args.files[0] == 'default': + Configurator.ConfigFlags.Input.Files = default_files + elif args.files[0] == 'ttbar': + Configurator.ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000001.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000002.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000003.pool.root.1" ] + + elif args.files[0] == 'jets': + Configurator.ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigEgammaValidation/valid3.147917.Pythia8_AU2CT10_jetjet_JZ7W.recon.RDO.e3099_s2578_r6596_tid05293007_00/RDO.05293007._000001.pool.root.1"] + else: + Configurator.ConfigFlags.Input.Files = args.files + else: + Configurator.ConfigFlags.Input.Files = args.files + + #Configurator.ConfigFlags.Input.Files = defaultTestFiles.RDO_RUN2 + + if parse_command_arguments: + Configurator.ConfigFlags.Concurrency.NumThreads = int(args.numthreads) + Configurator.ConfigFlags.Concurrency.NumConcurrentEvents = int(args.numthreads) + #This is to ensure the measurments are multi-threaded in the way we expect, I guess? + Configurator.ConfigFlags.PerfMon.doFastMonMT = args.perfmon + Configurator.ConfigFlags.PerfMon.doFullMonMT = args.fullmon + + + Configurator.ConfigFlags.lock() + + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + + cfg=MainServicesCfg(Configurator.ConfigFlags) + cfg.merge(PoolReadCfg(Configurator.ConfigFlags)) + + if parse_command_arguments: + if args.perfmon or args.fullmon: + from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg + cfg.merge(PerfMonMTSvcCfg(Configurator.ConfigFlags)) + + if parse_command_arguments: + Configurator.MeasureTimes = args.measuretimes + Configurator.OutputClustersToFile = args.outputclusters + Configurator.OutputCountsToFile = args.outputcounts + Configurator.FillMissingCells = not args.notfillcells + Configurator.UseOriginalCriteria = args.useoriginalcriteria + if allocate_as_many_as_threads: + Configurator.NumPreAllocatedDataHolders = int(args.numthreads) + + if 'StreamRDO' in Configurator.ConfigFlags.Input.ProcessingTags: + cfg.addEventAlgo(CompFactory.xAODMaker.EventInfoCnvAlg(),sequenceName="AthAlgSeq") + + Configurator.MissingCellsToFill = [186986, 187352] + + if parse_command_arguments: + return (cfg, int(args.numevents)) + else: + return (cfg, 10) + +#For pretty printing things in axes when it comes to moments: +#<MOMENT_NAME>: <PLOT TITLE> <AXIS TITLE> <UNITS> +name_to_moment_map = { + "time" : ("time", "time", "[#mu s]"), + "FIRST_PHI" : ("firstPhi", "firstPhi", ""), + "FIRST_ETA" : ("firstEta", "firstEta", ""), + "SECOND_R" : ("secondR", "secondR", ""), + "SECOND_LAMBDA" : ("secondLambda", "secondLambda", ""), + "DELTA_PHI" : ("deltaPhi", "deltaPhi", ""), + "DELTA_THETA" : ("deltaTheta", "deltaTheta", ""), + "DELTA_ALPHA" : ("deltaAlpha", "deltaAlpha", ""), + "CENTER_X" : ("centerX", "centerX", ""), + "CENTER_Y" : ("centerY", "centerY", ""), + "CENTER_Z" : ("centerZ", "centerZ", ""), + "CENTER_MAG" : ("centerMag", "centerMag", ""), + "CENTER_LAMBDA" : ("centerLambda", "centerLambda", ""), + "LATERAL" : ("lateral", "lateral", ""), + "LONGITUDINAL" : ("longitudinal", "longitudinal", ""), + "ENG_FRAC_EM" : ("engFracEM", "engFracEM", ""), + "ENG_FRAC_MAX" : ("engFracMax", "engFracMax", ""), + "ENG_FRAC_CORE" : ("engFracCore", "engFracCore", ""), + "FIRST_ENG_DENS" : ("firstEngDens", "firstEngDens", ""), + "SECOND_ENG_DENS" : ("secondEngDens", "secondEngDens", ""), + "ISOLATION" : ("isolation", "isolation", ""), + "ENG_BAD_CELLS" : ("engBadCells", "engBadCells", ""), + "N_BAD_CELLS" : ("nBadCells", "nBadCells", ""), + "N_BAD_CELLS_CORR" : ("nBadCellsCorr", "nBadCellsCorr", ""), + "BAD_CELLS_CORR_E" : ("badCellsCorrE", "badCellsCorrE", ""), + "BADLARQ_FRAC" : ("badLArQFrac", "badLArQFrac", ""), + "ENG_POS" : ("engPos", "engPos", ""), + "SIGNIFICANCE" : ("significance", "significance", ""), + "CELL_SIGNIFICANCE" : ("cellSignificance", "cellSignificance", ""), + "CELL_SIG_SAMPLING" : ("cellSigSampling", "cellSigSampling", ""), + "AVG_LAR_Q" : ("avgLArQ", "avgLArQ", ""), + "AVG_TILE_Q" : ("avgTileQ", "avgTileQ", ""), + "ENG_BAD_HV_CELLS" : ("engBadHVCells", "engBadHVCells", ""), + "N_BAD_HV_CELLS" : ("nBadHVCells", "nBadHVCells", ""), + "PTD" : ("PTD", "PTD", ""), + "MASS" : ("mass", "mass", ""), + "EM_PROBABILITY" : ("EMProbability", "EMProbability", ""), + "HAD_WEIGHT" : ("hadWeight", "hadWeight", ""), + "OOC_WEIGHT" : ("OOCweight", "OOCweight", ""), + "DM_WEIGHT" : ("DMweight", "DMweight", ""), + "TILE_CONFIDENCE_LEVEL" : ("tileConfidenceLevel", "tileConfidenceLevel", ""), + "SECOND_TIME" : ("secondTime", "secondTime", ""), + "number_of_cells" : ("numCells", "numCells", ""), + "VERTEX_FRACTION" : ("vertexFraction", "vertexFraction", ""), + "NVERTEX_FRACTION" : ("nVertexFraction", "nVertexFraction", ""), + "ETACALOFRAME" : ("etaCaloFrame", "etaCaloFrame", ""), + "PHICALOFRAME" : ("phiCaloFrame", "phiCaloFrame", ""), + "ETA1CALOFRAME" : ("eta1CaloFrame", "eta1CaloFrame", ""), + "PHI1CALOFRAME" : ("phi1CaloFrame", "phi1CaloFrame", ""), + "ETA2CALOFRAME" : ("eta2CaloFrame", "eta2CaloFrame", ""), + "PHI2CALOFRAME" : ("phi2CaloFrame", "phi2CaloFrame", ""), + "ENG_CALIB_TOT" : ("engCalibTot", "engCalibTot", ""), + "ENG_CALIB_OUT_L" : ("engCalibOutL", "engCalibOutL", ""), + "ENG_CALIB_OUT_M" : ("engCalibOutM", "engCalibOutM", ""), + "ENG_CALIB_OUT_T" : ("engCalibOutT", "engCalibOutT", ""), + "ENG_CALIB_DEAD_L" : ("engCalibDeadL", "engCalibDeadL", ""), + "ENG_CALIB_DEAD_M" : ("engCalibDeadM", "engCalibDeadM", ""), + "ENG_CALIB_DEAD_T" : ("engCalibDeadT", "engCalibDeadT", ""), + "ENG_CALIB_EMB0" : ("engCalibEMB0", "engCalibEMB0", ""), + "ENG_CALIB_EME0" : ("engCalibEME0", "engCalibEME0", ""), + "ENG_CALIB_TILEG3" : ("engCalibTileG3", "engCalibTileG3", ""), + "ENG_CALIB_DEAD_TOT" : ("engCalibDeadTot", "engCalibDeadTot", ""), + "ENG_CALIB_DEAD_EMB0" : ("engCalibDeadEMB0", "engCalibDeadEMB0", ""), + "ENG_CALIB_DEAD_TILE0" : ("engCalibDeadTile0", "engCalibDeadTile0", ""), + "ENG_CALIB_DEAD_TILEG3" : ("engCalibDeadTileG3", "engCalibDeadTileG3", ""), + "ENG_CALIB_DEAD_EME0" : ("engCalibDeadEME0", "engCalibDeadEME0", ""), + "ENG_CALIB_DEAD_HEC0" : ("engCalibDeadHEC0", "engCalibDeadHEC0", ""), + "ENG_CALIB_DEAD_FCAL" : ("engCalibDeadFCAL", "engCalibDeadFCAL", ""), + "ENG_CALIB_DEAD_LEAKAGE" : ("engCalibDeadLeakage", "engCalibDeadLeakage", ""), + "ENG_CALIB_DEAD_UNCLASS" : ("engCalibDeadUnclass", "engCalibDeadUnclass", ""), + "ENG_CALIB_FRAC_EM" : ("engCalibFracEM", "engCalibFracEM", ""), + "ENG_CALIB_FRAC_HAD" : ("engCalibFracHad", "engCalibFracHad", ""), + "ENG_CALIB_FRAC_REST" : ("engCalibFracRest" "engCalibFracRest" "") +} + +class PlotterConfigurator: + #DoCells currently changes nothing + #(originally was intended to show + #that we had cells with the same energy), + #keeping it here to remain part of the interface + #if/when we port the cell maker as well. + def __init__ (self, StepsToPlot = [], PairsToPlot = [], DoStandard = True, DoMoments = False, DoCells = False): + self.PlotsToDo = [] + if DoStandard: + for step in StepsToPlot: + self.PlotsToDo += [ + ( (step + "_cluster_E",), + {'type': 'TH1F', + 'title': "Cluster Energy; E [MeV]; Number of Events", + 'xbins': 63, + 'xmin': -5020, + 'xmax': 5020, + 'path': "EXPERT"} + ), + ( (step + "_cluster_Et",), + {'type': 'TH1F', + 'title': "Cluster Transverse Energy; E_T [MeV]; Number of Events", + 'xbins': 63, + 'xmin': -5020, + 'xmax': 5020, + 'path': "EXPERT"} + ), + ( (step + "_cluster_eta",), + {'type': 'TH1F', + 'title': "Cluster #eta; #eta; Number of Events", + 'xbins': 84, + 'xmin': -10.5, + 'xmax': 10.5, + 'path': "EXPERT"} + ), + ( (step + "_cluster_phi",), + {'type': 'TH1F', + 'title': "Cluster #phi; #phi; Number of Events", + 'xbins': 61, + 'xmin': -3.25, + 'xmax': 3.25, + 'path': "EXPERT"} + ), + ( (step + "_cluster_eta," + step + "_cluster_phi",), + {'type': 'TH2F', + 'title': "Cluster #eta versus #phi; #eta; #phi", + 'xbins': 84, + 'xmin': -10.5, + 'xmax': 10.5, + 'ybins': 61, + 'ymin': -3.25, + 'ymax': 3.25, + 'path': "EXPERT"} + ) + ] + for pair in PairsToPlot: + self.PlotsToDo += [ + ( (pair + "_num_unmatched_clusters",), + {'type': 'TH1F', + 'title': "Number of Unmatched Clusters; # of Unmatched Clusters; Number of Events", + 'xbins': 21, + 'xmin': -0.5, + 'xmax': 20.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_diff_cells;" + pair + "_cluster_diff_cells_zoom_0",), + {'type': 'TH1F', + 'title': "Different Cell Assignments; # of Differently Assigned Cells; Number of Clusters", + 'xbins': 21, + 'xmin': -25, + 'xmax': 1025, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_diff_cells;" + pair + "_cluster_diff_cells_zoom_1",), + {'type': 'TH1F', + 'title': "Different Cell Assignments; # of Differently Assigned Cells; Number of Clusters", + 'xbins': 21, + 'xmin': -12.5, + 'xmax': 512.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_diff_cells;" + pair + "_cluster_diff_cells_zoom_2",), + {'type': 'TH1F', + 'title': "Different Cell Assignments; # of Differently Assigned Cells; Number of Clusters", + 'xbins': 21, + 'xmin': -2.5, + 'xmax': 102.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_diff_cells;" + pair + "_cluster_diff_cells_zoom_3",), + {'type': 'TH1F', + 'title': "Different Cell Assignments; # of Differently Assigned Cells; Number of Clusters", + 'xbins': 21, + 'xmin': -0.5, + 'xmax': 20.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_E_ref," + pair + "_cluster_E_test",), + {'type': 'TH2F', + 'title': "Cluster Energy Comparison; E^{(CPU)} [MeV]; E^{(GPU)} [MeV]", + 'xbins': 63, + 'xmin': -50.5, + 'xmax': 50.5, + 'ybins': 63, + 'ymin': -50.5, + 'ymax': 50.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_E_ref," + pair + "_cluster_delta_E_rel_ref",), + {'type': 'TH2F', + 'title': "Cluster Energy Resolution; E^{(CPU)} [MeV]; #Delta E / #(){E^{(CPU)}}", + 'xbins': 63, + 'xmin': -50.5, + 'xmax': 50.5, + 'ybins': 63, + 'ymin': -0.025, + 'ymax': 0.025, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_Et_ref," + pair + "_cluster_Et_test",), + {'type': 'TH2F', + 'title': "Cluster Transverse Energy Comparison; E_T^{(CPU)} [MeV]; E_T^{(GPU)} [MeV]", + 'xbins': 63, + 'xmin': -50.5, + 'xmax': 50.5, + 'ybins': 63, + 'ymin': -50.5, + 'ymax': 50.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_Et_ref," + pair + "_cluster_delta_Et_rel_ref",), + {'type': 'TH2F', + 'title': "Cluster Transverse Energy Resolution; E_T^{(CPU)} [MeV]; #Delta E_T / #(){E_T^{(CPU)}}", + 'xbins': 63, + 'xmin': -50.5, + 'xmax': 50.5, + 'ybins': 63, + 'ymin': -0.025, + 'ymax': 0.025, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_eta_ref," + pair + "_cluster_eta_test",), + {'type': 'TH2F', + 'title': "Cluster #eta Comparison; #eta^{(CPU)}; #eta^{(GPU)}", + 'xbins': 63, + 'xmin': -10.5, + 'xmax': 10.5, + 'ybins': 63, + 'ymin': -10.5, + 'ymax': 10.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_eta_ref," + pair + "_cluster_delta_eta_rel_ref",), + {'type': 'TH2F', + 'title': "Cluster #eta Resolution; #eta^{(CPU)}; #Delta #eta / #(){#eta^{(CPU)}}", + 'xbins': 63, + 'xmin': -10.5, + 'xmax': 10.5, + 'ybins': 63, + 'ymin': -0.025, + 'ymax': 0.025, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_phi_ref," + pair + "_cluster_phi_test",), + {'type': 'TH2F', + 'title': "Cluster #phi Comparison; #phi^{(CPU)}; #phi^{(GPU)}", + 'xbins': 63, + 'xmin': -3.3, + 'xmax': 3.3, + 'ybins': 63, + 'ymin': -3.3, + 'ymax': 3.3, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_phi_ref," + pair + "_cluster_delta_phi_in_range",), + {'type': 'TH2F', + 'title': "Cluster #phi Resolution; #phi^{(CPU)}; #Delta #phi", + 'xbins': 63, + 'xmin': -10.5, + 'xmax': 10.5, + 'ybins': 63, + 'ymin': -0.025, + 'ymax': 0.025, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_delta_phi_in_range",), + {'type': 'TH1F', + 'title': "Cluster #phi; #phi; Number of Clusters", + 'xbins': 61, + 'xmin': -3.25, + 'xmax': 3.25, + 'path': "EXPERT"} + ), + ( (pair + "_cell_secondary_weight_ref," + pair + "_cell_secondary_weight_test",), + {'type': 'TH2F', + 'title': "Shared Cell Secondary Weight Comparison; w_2^{(CPU)}; w_2^{(GPU)}", + 'xbins': 51, + 'xmin': -0.05, + 'xmax': 0.505, + 'ybins': 51, + 'ymin': -0.05, + 'ymax': 0.505, + 'path': "EXPERT"} + ) + ] + if DoMoments: + for pair in PairsToPlot: + for mom, prettynames in name_to_moment_map.items(): + self.PlotsToDo += [ + ( (pair + "_cluster_delta_moments_" + mom + "_rel_ref;" + pair + "_cluster_delta_moments_" + mom + "_rel_ref_zoom_0",), + {'type': 'TH1F', + 'title': prettynames[0] + "; #Delta " + prettynames[1] + "; Number of Clusters", + 'xbins': 51, + 'xmin': -1, + 'xmax': 1, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_delta_moments_" + mom + "_rel_ref;" + pair + "_cluster_delta_moments_" + mom + "_rel_ref_zoom_1",), + {'type': 'TH1F', + 'title': prettynames[0] + "; #Delta " + prettynames[1] + "; Number of Clusters", + 'xbins': 51, + 'xmin': -0.5, + 'xmax': 0.5, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_delta_moments_" + mom + "_rel_ref;" + pair + "_cluster_delta_moments_" + mom + "_rel_ref_zoom_2",), + {'type': 'TH1F', + 'title': prettynames[0] + "; #Delta " + prettynames[1] + "; Number of Clusters", + 'xbins': 51, + 'xmin': -0.1, + 'xmax': 0.1, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_delta_moments_" + mom + "_rel_ref;" + pair + "_cluster_delta_moments_" + mom + "_rel_ref_zoom_3",), + {'type': 'TH1F', + 'title': prettynames[0] + "; #Delta " + prettynames[1] + "; Number of Clusters", + 'xbins': 51, + 'xmin': -0.01, + 'xmax': 0.01, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_delta_moments_" + mom + "_rel_ref;" + pair + "_cluster_delta_moments_" + mom + "_rel_ref_zoom_4",), + {'type': 'TH1F', + 'title': prettynames[0] + "; #Delta " + prettynames[1] + "; Number of Clusters", + 'xbins': 51, + 'xmin': -0.001, + 'xmax': 0.001, + 'path': "EXPERT"} + ), + ( (pair + "_cluster_delta_moments_" + mom + "_rel_ref;" + pair + "_cluster_delta_moments_" + mom + "_rel_ref_zoom_5",), + {'type': 'TH1F', + 'title': prettynames[0] + "; #Delta " + prettynames[1] + "; Number of Clusters", + 'xbins': 51, + 'xmin': -0.0001, + 'xmax': 0.0001, + 'path': "EXPERT"} + ) + ] + + def __call__(self, Plotter): + for plotdef in self.PlotsToDo: + Plotter.MonitoringTool.defineHistogram(*plotdef[0], **plotdef[1]) + return Plotter + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_count_cells_to_file.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_count_cells_to_file.py new file mode 100644 index 0000000000000000000000000000000000000000..00e081fa2c3611529d3c5114689a69b4770541a8 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_count_cells_to_file.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Outputs cell information (and cell assignment, thus also some cluster information) +#to a textual format, for both CPU and GPU growing and splitting, +#and also for the cross-check versions (CPU growing with GPU splitting +#and GPU growing with CPU splitting). + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + Configurator.OutputCountsToFile = True + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, DoCrossTests = True) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_measure_times.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_measure_times.py new file mode 100644 index 0000000000000000000000000000000000000000..c40d65fac7ee3a93bb1fe85e7b13df31a31020c2 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_measure_times.py @@ -0,0 +1,28 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Measures per-thread times for CPU and GPU implementations, +#without synchronization on the GPU side +#(thus only the total GPU time is accurate). + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + Configurator.MeasureTimes = True + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow=True, TestSplit=True, SkipSyncs=True) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_measure_times_sync.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_measure_times_sync.py new file mode 100644 index 0000000000000000000000000000000000000000..08f4c1f283582e84646f82e833b555c676f62a42 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_measure_times_sync.py @@ -0,0 +1,30 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Measures per-thread times for CPU and GPU implementations, +#with synchronization on the GPU side +#(which means that kernel launch overheads aren't hidden, +# but the fraction of time spent in the various steps +# of the GPU implementation can be measured). + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + Configurator.MeasureTimes = True + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow=True, TestSplit=True, SkipSyncs = False) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_grow_test.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_grow_test.py new file mode 100644 index 0000000000000000000000000000000000000000..b9a87a30aba5acf1929d15d99cf4c30fa8a2cc6d --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_grow_test.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Outputs plots for comparing CPU and GPU growing. + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing"], ["growing"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_growsplit_cross_test.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_growsplit_cross_test.py new file mode 100644 index 0000000000000000000000000000000000000000..2cfa0eaf3ad25129e42fc9e5519d0e1a648ab52a --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_growsplit_cross_test.py @@ -0,0 +1,35 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Outputs plots for comparing +#CPU growing with GPU growing +#and all possible combinations for the splitter: +#CPU growing with CPU splitting, +#GPU growing with GPU splitting, +#CPU growing with GPU splitting +#and GPU growing with CPU splitting. + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing", "CPUCPU_splitting", "GPUGPU_splitting", "CPUGPU_splitting", "GPUCPU_splitting"], + ["growing", "CPU_to_GPUGPU_splitting", "CPU_to_CPUGPU_splitting", "CPU_to_GPUCPU_splitting"]) + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, DoCrossTests = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_growsplit_test.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_growsplit_test.py new file mode 100644 index 0000000000000000000000000000000000000000..f9d6dbad8f729410d4919a9873ac114f49ac3dc0 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_growsplit_test.py @@ -0,0 +1,31 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Outputs plots for comparing +#CPU growing with GPU growing +#and CPU growing + splitting with GPU growing + splitting + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing", "CPU_splitting", "GPU_splitting"], ["growing", "splitting"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_moments_test.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_moments_test.py new file mode 100644 index 0000000000000000000000000000000000000000..92f1f714286cfcee0d182c3403427c9ccb7e3fd9 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_moments_test.py @@ -0,0 +1,30 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Outputs plots and textual information +#to compare CPU with GPU moments calculation. + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_moments", "GPU_moments"], ["moments"], DoMoments = True) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestMoments = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_run.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_run.py new file mode 100644 index 0000000000000000000000000000000000000000..3d2a9a63a544d2b36b73b1ef4577a4dd7a457e77 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_run.py @@ -0,0 +1,24 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Just runs the GPU algorithms. + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/python/TACandGPUSplitterConfig.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_run_monitoring.py similarity index 51% rename from Calorimeter/CaloRecGPU/python/TACandGPUSplitterConfig.py rename to Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_run_monitoring.py index 97c09e4edf662a3ec30fb46f08104a5298b307aa..4ce7ea6e39ea3cc53904c4555707324fcce9a88b 100644 --- a/Calorimeter/CaloRecGPU/python/TACandGPUSplitterConfig.py +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_run_monitoring.py @@ -1,15 +1,17 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Just runs the GPU algorithms, with basic monitoring enabled. from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting if __name__=="__main__": Configurator = CaloRecGPUConfigurator() - Configurator.TestGPUGrowing = True - Configurator.TestGPUSplitting = True + Configurator.DoMonitoring = True - cfg, numevents = Configurator.PrepareTest(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root"]) + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) theKey="CaloCalTopoClustersNew" diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_split_test.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_split_test.py new file mode 100644 index 0000000000000000000000000000000000000000..784fc715d470690c1718cdba7c61935181b16a20 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_simple_split_test.py @@ -0,0 +1,28 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#Outputs plots for comparing CPU and GPU splitting. + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_splitting", "GPU_splitting"], ["splitting"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest() + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.HybridClusterProcessorTestConf(TestSplit = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_CPU_and_overheads.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_CPU_and_overheads.py new file mode 100644 index 0000000000000000000000000000000000000000..6bbe450f9bff27d0a43c670a9ddc8c64cf5115e7 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_CPU_and_overheads.py @@ -0,0 +1,73 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +#Run the CPU implementation plus any overheads, +#for multithreading studies. + +def Configure(Configurator, clustersname = None): + from AthenaConfiguration.ComponentFactory import CompFactory + + result = CaloRecGPUTesting.PrevAlgorithmsConfiguration(Configurator, clustersname) + + HybridClusterProcessor = CompFactory.CaloGPUHybridClusterProcessor("HybridClusterProcessor") + HybridClusterProcessor.ClustersOutputName = Configurator.ClustersOutputName + HybridClusterProcessor.MeasureTimes = Configurator.MeasureTimes + HybridClusterProcessor.TimeFileOutput = "GlobalTimes.txt" + HybridClusterProcessor.DeferConstantDataPreparationToFirstEvent = True + HybridClusterProcessor.DoPlots = False + HybridClusterProcessor.PlotterTool = None + HybridClusterProcessor.DoMonitoring = False + HybridClusterProcessor.NumPreAllocatedDataHolders = Configurator.NumPreAllocatedDataHolders + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(Configurator.ConfigFlags)) + result.merge(TileGMCfg(Configurator.ConfigFlags)) + + ConstantDataExporter = result.popToolsAndMerge( Configurator.BasicConstantDataExporterToolConf() ) + + HybridClusterProcessor.ConstantDataToGPUTool = ConstantDataExporter + + HybridClusterProcessor.EventDataToGPUTool = None + HybridClusterProcessor.GPUToEventDataTool = None + + HybridClusterProcessor.BeforeGPUTools = [] + + DefaultClustering = result.popToolsAndMerge( Configurator.DefaultTopologicalClusteringToolConf("DefaultGrowing") ) + HybridClusterProcessor.BeforeGPUTools += [DefaultClustering] + + DefaultSplitting = result.popToolsAndMerge( Configurator.DefaultClusterSplittingToolConf("DefaultSplitting") ) + HybridClusterProcessor.BeforeGPUTools += [DefaultSplitting] + + CPUMoments = result.popToolsAndMerge( Configurator.DefaultClusterMomentsCalculatorToolConf("CPUMoments") ) + HybridClusterProcessor.BeforeGPUTools += [CPUMoments] + + HybridClusterProcessor.GPUTools = [] + + HybridClusterProcessor.AfterGPUTools = [] + + result.addEventAlgo(HybridClusterProcessor,primary=True) + + return result + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = Configure(Configurator) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_GPU_and_overheads.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_GPU_and_overheads.py new file mode 100644 index 0000000000000000000000000000000000000000..0541969528cb7a31fb4470d46b40bf42d9c7598b --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_GPU_and_overheads.py @@ -0,0 +1,77 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +#Run the GPU implementation plus any overheads, +#for multithreading studies. + +def Configure(Configurator, clustersname = None): + from AthenaConfiguration.ComponentFactory import CompFactory + + result = CaloRecGPUTesting.PrevAlgorithmsConfiguration(Configurator, clustersname) + + HybridClusterProcessor = CompFactory.CaloGPUHybridClusterProcessor("HybridClusterProcessor") + HybridClusterProcessor.ClustersOutputName = Configurator.ClustersOutputName + HybridClusterProcessor.MeasureTimes = Configurator.MeasureTimes + HybridClusterProcessor.TimeFileOutput = "GlobalTimes.txt" + HybridClusterProcessor.DeferConstantDataPreparationToFirstEvent = True + HybridClusterProcessor.DoPlots = False + HybridClusterProcessor.PlotterTool = None + HybridClusterProcessor.DoMonitoring = False + HybridClusterProcessor.NumPreAllocatedDataHolders = Configurator.NumPreAllocatedDataHolders + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(Configurator.ConfigFlags)) + result.merge(TileGMCfg(Configurator.ConfigFlags)) + + ConstantDataExporter = result.popToolsAndMerge( Configurator.BasicConstantDataExporterToolConf() ) + EventDataExporter = result.popToolsAndMerge( Configurator.BasicEventDataExporterToolConf() ) + AthenaClusterImporter = result.popToolsAndMerge( Configurator.AthenaClusterAndMomentsImporterToolConf() ) + + HybridClusterProcessor.ConstantDataToGPUTool = ConstantDataExporter + HybridClusterProcessor.EventDataToGPUTool = EventDataExporter + HybridClusterProcessor.GPUToEventDataTool = AthenaClusterImporter + + HybridClusterProcessor.BeforeGPUTools = [] + + HybridClusterProcessor.GPUTools = [] + + TopoAutomatonClusteringDef = result.popToolsAndMerge( Configurator.TopoAutomatonClusteringToolConf("TopoAutomatonClustering")) + HybridClusterProcessor.GPUTools += [TopoAutomatonClusteringDef] + + FirstPropCalcDef = result.popToolsAndMerge( Configurator.ClusterInfoCalcToolConf("PostGrowGPUClusterPropertiesCalculator", True)) + HybridClusterProcessor.GPUTools += [FirstPropCalcDef] + + GPUClusterSplittingDef = result.popToolsAndMerge( Configurator.TopoAutomatonSplitterToolConf("GPUSplitter") ) + HybridClusterProcessor.GPUTools += [GPUClusterSplittingDef] + + GPUMomentsDef = result.popToolsAndMerge( Configurator.GPUClusterMomentsCalculatorToolConf("GPUTopoMoments") ) + HybridClusterProcessor.GPUTools += [GPUMomentsDef] + + HybridClusterProcessor.AfterGPUTools = [] + + result.addEventAlgo(HybridClusterProcessor,primary=True) + + return result + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = Configure(Configurator) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_overheads.py b/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_overheads.py new file mode 100644 index 0000000000000000000000000000000000000000..b3a0ef488fc9f5676bb695726ae81d31ae4622c3 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/CaloRecGPU_time_overheads.py @@ -0,0 +1,64 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + +#Run with just the potential overheads and no clustering, +#for multithreading studies. + +def Configure(Configurator, clustersname = None): + from AthenaConfiguration.ComponentFactory import CompFactory + + result = CaloRecGPUTesting.PrevAlgorithmsConfiguration(Configurator, clustersname) + + HybridClusterProcessor = CompFactory.CaloGPUHybridClusterProcessor("HybridClusterProcessor") + HybridClusterProcessor.ClustersOutputName = Configurator.ClustersOutputName + HybridClusterProcessor.MeasureTimes = Configurator.MeasureTimes + HybridClusterProcessor.TimeFileOutput = "GlobalTimes.txt" + HybridClusterProcessor.DeferConstantDataPreparationToFirstEvent = True + HybridClusterProcessor.DoPlots = False + HybridClusterProcessor.PlotterTool = None + HybridClusterProcessor.DoMonitoring = False + HybridClusterProcessor.NumPreAllocatedDataHolders = Configurator.NumPreAllocatedDataHolders + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + + result.merge(LArGMCfg(Configurator.ConfigFlags)) + result.merge(TileGMCfg(Configurator.ConfigFlags)) + + ConstantDataExporter = result.popToolsAndMerge( Configurator.BasicConstantDataExporterToolConf() ) + + HybridClusterProcessor.ConstantDataToGPUTool = ConstantDataExporter + + HybridClusterProcessor.EventDataToGPUTool = None + HybridClusterProcessor.GPUToEventDataTool = None + + HybridClusterProcessor.BeforeGPUTools = [] + + HybridClusterProcessor.GPUTools = [] + + HybridClusterProcessor.AfterGPUTools = [] + + result.addEventAlgo(HybridClusterProcessor,primary=True) + + return result + + +if __name__=="__main__": + + Configurator = CaloRecGPUConfigurator() + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator) + + theKey="CaloCalTopoClustersNew" + + topoAcc = Configure(Configurator) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + diff --git a/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_0.py b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_0.py new file mode 100755 index 0000000000000000000000000000000000000000..a5751931d9f75f008516ec0998c85928e79c6f34 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_0.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# art-description: GPU Topological (Topo-Automaton) Clustering test: 4 2 0 thresholds. +# art-type: local +# art-include: master/Athena +# art-architecture: '#&nvidia' +# art-output: expert-monitoring.root + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +def do_test(files): + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing", "CPU_splitting", "GPU_splitting"], ["growing", "splitting"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator, files, parse_command_arguments = False) + + Configurator.TopoClusterSeedCutsInAbsE = False + Configurator.TopoClusterCellCutsInAbsE = False + Configurator.TopoClusterNeighborCutsInAbsE = False + Configurator.SplitterUseNegativeClusters = False + + + Configurator.TopoClusterSNRSeedThreshold = 4.0 + Configurator.TopoClusterSNRGrowThreshold = 2.0 + Configurator.TopoClusterSNRCellThreshold = 0.0 + + Configurator.ClusterSize = "Topo_420" + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + + +if __name__=="__main__": + do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000001.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000002.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000003.pool.root.1" ]) +# do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigEgammaValidation/valid3.147917.Pythia8_AU2CT10_jetjet_JZ7W.recon.RDO.e3099_s2578_r6596_tid05293007_00/RDO.05293007._000001.pool.root.1"], +# "jets") + diff --git a/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_0_abs.py b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_0_abs.py new file mode 100755 index 0000000000000000000000000000000000000000..b232b87336d6fe94ad39f54f09a6cf3d459699d2 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_0_abs.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# art-description: GPU Topological (Topo-Automaton) Clustering test: 4 2 0 thresholds (in absolute value). +# art-type: local +# art-include: master/Athena +# art-architecture: '#&nvidia' +# art-output: expert-monitoring.root + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +def do_test(files): + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing", "CPU_splitting", "GPU_splitting"], ["growing", "splitting"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator, files, parse_command_arguments = False) + + Configurator.TopoClusterSeedCutsInAbsE = True + Configurator.TopoClusterCellCutsInAbsE = True + Configurator.TopoClusterNeighborCutsInAbsE = True + Configurator.SplitterUseNegativeClusters = True + + + Configurator.TopoClusterSNRSeedThreshold = 4.0 + Configurator.TopoClusterSNRGrowThreshold = 2.0 + Configurator.TopoClusterSNRCellThreshold = 0.0 + + Configurator.ClusterSize = "Topo_420" + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + + +if __name__=="__main__": + do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000001.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000002.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000003.pool.root.1" ]) +# do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigEgammaValidation/valid3.147917.Pythia8_AU2CT10_jetjet_JZ7W.recon.RDO.e3099_s2578_r6596_tid05293007_00/RDO.05293007._000001.pool.root.1"], +# "jets") + diff --git a/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_2.py b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_2.py new file mode 100755 index 0000000000000000000000000000000000000000..4aec1e05321dc2d0bf43da3d224d465dd96ad964 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_4_2_2.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# art-description: GPU Topological (Topo-Automaton) Clustering test: 4 2 2 thresholds. +# art-type: local +# art-include: master/Athena +# art-architecture: '#&nvidia' +# art-output: expert-monitoring.root + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +def do_test(files): + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing", "CPU_splitting", "GPU_splitting"], ["growing", "splitting"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator, files, parse_command_arguments = False) + + Configurator.TopoClusterSeedCutsInAbsE = False + Configurator.TopoClusterCellCutsInAbsE = False + Configurator.TopoClusterNeighborCutsInAbsE = False + Configurator.SplitterUseNegativeClusters = False + + + Configurator.TopoClusterSNRSeedThreshold = 4.0 + Configurator.TopoClusterSNRGrowThreshold = 2.0 + Configurator.TopoClusterSNRCellThreshold = 2.0 + + Configurator.ClusterSize = "Topo_420" #no 4 2 2 yet? + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + + +if __name__=="__main__": + do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000001.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000002.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000003.pool.root.1" ]) +# do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigEgammaValidation/valid3.147917.Pythia8_AU2CT10_jetjet_JZ7W.recon.RDO.e3099_s2578_r6596_tid05293007_00/RDO.05293007._000001.pool.root.1"], +# "jets") + diff --git a/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_6_3_3.py b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_6_3_3.py new file mode 100755 index 0000000000000000000000000000000000000000..9f61a987073bfc19adb509fb8336903af6bcaab2 --- /dev/null +++ b/Calorimeter/CaloRecGPU/test/test_CaloRecGPU_6_3_3.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# art-description: GPU Topological (Topo-Automaton) Clustering test: 6 3 3 thresholds. +# art-type: local +# art-include: master/Athena +# art-architecture: '#&nvidia' +# art-output: expert-monitoring.root + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from CaloRecGPU.CaloRecGPUConfigurator import CaloRecGPUConfigurator +import CaloRecGPUTesting + + +def do_test(files): + Configurator = CaloRecGPUConfigurator() + + PlotterConfig = CaloRecGPUTesting.PlotterConfigurator(["CPU_growing", "GPU_growing", "CPU_splitting", "GPU_splitting"], ["growing", "splitting"]) + + Configurator.DoMonitoring = True + + cfg, numevents = CaloRecGPUTesting.PrepareTest(Configurator, files, parse_command_arguments = False) + + Configurator.TopoClusterSeedCutsInAbsE = False + Configurator.TopoClusterCellCutsInAbsE = False + Configurator.TopoClusterNeighborCutsInAbsE = False + Configurator.SplitterUseNegativeClusters = False + + + Configurator.TopoClusterSNRSeedThreshold = 6.0 + Configurator.TopoClusterSNRGrowThreshold = 3.0 + Configurator.TopoClusterSNRCellThreshold = 3.0 + + Configurator.ClusterSize = "Topo_633" + + theKey="CaloCalTopoClustersNew" + + topoAcc = CaloRecGPUTesting.FullTestConfiguration(Configurator, TestGrow = True, TestSplit = True, PlotterConfigurator = PlotterConfig) + + topoAlg = topoAcc.getPrimary() + topoAlg.ClustersOutputName=theKey + + cfg.merge(topoAcc) + + cfg.run(numevents) + + +if __name__=="__main__": + do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000001.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000002.pool.root.1", + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.RDO.e3698_s2608_s2183_r7195/RDO.06752780._000003.pool.root.1" ]) +# do_test(["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigEgammaValidation/valid3.147917.Pythia8_AU2CT10_jetjet_JZ7W.recon.RDO.e3099_s2578_r6596_tid05293007_00/RDO.05293007._000001.pool.root.1"], +# "jets") + diff --git a/Calorimeter/CaloRecGPU/tools/methodchecker/NewMethodCheck.cu b/Calorimeter/CaloRecGPU/tools/methodchecker/NewMethodCheck.cu deleted file mode 100644 index cb927fab2818bbcebdfb9fea3d227cdc3b0c66cb..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/methodchecker/NewMethodCheck.cu +++ /dev/null @@ -1,1181 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -#define TTAC_CALCULATE_PHI_BY_SIMPLE_AVERAGE 1 - -#include <iostream> -#include <iomanip> -#include <cstdlib> -#include <unordered_map> -#include <map> -#include <set> -#include <algorithm> -#include <numeric> - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/StandaloneDataIO.h" - -#include "../../src/TopoAutomatonClusteringGPU.cu" -#include "../../src/BasicGPUClusterInfoCalculatorImpl.cu" - -#include <chrono> - -using namespace CaloRecGPU; - -void generic_comparison_print(const std::vector<size_t> & vect, const std::string & title, const size_t break_after) -{ - std::cout << "\n\n " << title << ":"; - - size_t accum = 0, local_accum = 0; - - for (size_t i = 0; i < vect.size(); ++i) - { - if (i % break_after == 0) - { - if (i > 0) - { - std::cout << "(" << local_accum / double(break_after) << ")"; - } - local_accum = 0; - std::cout << "\n "; - } - const size_t res = vect[i]; - printf("%5zu ", res); - accum += res; - local_accum += res; - } - std::cout << "(" << local_accum / double(break_after) << ")"; - std::cout << "\n (" << accum / double(vect.size()) << ")"; -} - -struct Results -{ - Helpers::CPU_object<CellStateArr> m_state; - - std::vector<size_t> total, assignment, terminal, inclusion; - - bool has_total = false, has_assignment = false, has_terminal = false, has_inclusion = false; - - void set_reference(const EventDataHolder & event_data) - { - m_state = event_data.m_cell_state_dev; - } - - void add_comparison(const EventDataHolder & event_data) - { - Helpers::CPU_object<CellStateArr> temp_state = event_data.m_cell_state_dev; - size_t total_diffs = 0, just_assignment = 0, terminal_weird = 0, inclusion_or_not = 0; - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type test_tag = temp_state->clusterTag[i]; - const tag_type ref_tag = m_state->clusterTag[i]; - if (test_tag != ref_tag) - { - ++total_diffs; - has_total = true; - if (Tags::is_part_of_cluster(test_tag) && Tags::is_part_of_cluster(ref_tag)) - { - ++just_assignment; - has_assignment = true; - } - else if (Tags::is_non_assigned_terminal(test_tag) && Tags::is_non_assigned_terminal(ref_tag)) - { - ++terminal_weird; - has_terminal = true; - } - else - { - ++inclusion_or_not; - has_inclusion = true; - } - } - } - total.push_back(total_diffs); - assignment.push_back(just_assignment); - terminal.push_back(terminal_weird); - inclusion.push_back(inclusion_or_not); - } - - void print_comparison(const size_t break_after, const bool force_print) - { - std::cout << " --------- CONSISTENCY --------- \n\n"; - - if (has_total || force_print) - { - generic_comparison_print(total, "Total", break_after); - } - - if (has_assignment || force_print) - { - generic_comparison_print(assignment, "Assignment", break_after); - } - - - if (has_terminal || force_print) - { - generic_comparison_print(terminal, "Terminal", break_after); - } - - if (has_inclusion || force_print) - { - generic_comparison_print(inclusion, "Inclusion", break_after); - } - - if (!has_total) - { - std::cout << "\nAll good, you can go rest now.\n"; - } - std::cout << std::endl; - - } - -}; - - -struct CPUComparison -{ - - struct SNRArray - { - float snr[NCaloCells]; - }; - - Helpers::CPU_object<CellStateArr> m_state; - Helpers::CPU_object<SNRArray> m_snr_arr; - - int m_ref_clusters = 0; - - std::vector<size_t> total, seed, grow, term; - - bool has_total = false, has_seed = false, has_grow = false, has_term = false; - - struct phi_errors - { - double mu = 0, sigma_sqr = 0; - double differences = 0; - double max = std::numeric_limits<double>::lowest(); - void add (const double val) - { - mu += val; - sigma_sqr += val * val; - max = std::max(max, val); - } - void add_difference() - { - differences += 1; - } - void finalize(const size_t count, const size_t num_events = 1) - { - mu /= count; - sigma_sqr /= count; - sigma_sqr -= mu * mu; - differences /= num_events; - } - void combine(const phi_errors & dp, const size_t count) - { - mu += dp.mu * count; - sigma_sqr += (dp.sigma_sqr + dp.mu * dp.mu) * count; - differences += dp.differences; - max = std::max(max, dp.max); - } - - template <class stream> - friend stream & operator<< (stream & s, const phi_errors & pe) - { - s << "|" << pe.differences << " " << pe.max << " " << pe.mu + (pe.mu < 1e-3) * 1e-3 << " " << std::sqrt(pe.sigma_sqr) << "|"; - return s; - } - - }; - - std::vector<std::string> phi_comparison_labels { "Reference to CPU-Calculated", - "Reference to GPU-Calculated", - "CPU-Calculated to GPU-Calculated", - "CPU to CPU No Reg.", - "CPU to CPU KBN", - "CPU to CPU KBN No Reg.", - "CPU to CPU Sin/Cos", - "CPU to CPU Sin/Cos KBN", - "CPU KBN No Reg. to GPU", - "Reference No Reg. to GPU", - "Reference Sin/Cos to GPU"}; - - std::vector<std::vector<phi_errors>> phi_comparisons = std::vector<std::vector<phi_errors>>(phi_comparison_labels.size()); - - std::vector<size_t> valid_phis_counts; - - template <class T> - static inline T regularize(T b, T a) - //a. k. a. proxim in Athena code. - { - const T aplus = a + Helpers::Constants::pi<T>; - const T aminus = a - Helpers::Constants::pi<T>; - if (b > aplus) - { - do - { - b -= 2 * Helpers::Constants::pi<T>; - } - while (b > aplus); - } - else if (b < aminus) - { - do - { - b += 2 * Helpers::Constants::pi<T>; - } - while (b < aminus); - } - return b; - } - static double angle_fix(const double angle) - { - return regularize(angle, 0.); - //fmod, no? - } - - struct base_phi_calc - { - virtual void resize(const size_t) = 0; - virtual void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) = 0; - virtual void finalize(std::vector<double> & array) = 0; - }; - - - inline static - void calculate_phis(base_phi_calc & phi_calculator, std::vector<double> & cluster_phi_array, const CellStateArr & state, - const int n_clusters, const float * phi, const float * snr, const float * energy) - { - - std::vector<int> seed_cell_id(n_clusters, -1); - std::vector<float> seed_snr(n_clusters, 0); - - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type tag = state.clusterTag[i]; - if (Tags::is_part_of_cluster(tag)) - { - const int index = Tags::get_index_from_tag(tag); - const float this_snr = std::abs(snr[i]); - if (this_snr > seed_snr[index]) - { - seed_cell_id[index] = i; - seed_snr[index] = this_snr; - } - } - } - - std::vector<float> seed_phi(n_clusters, 0); - - for (int i = 0; i < n_clusters; ++i) - { - const int id = seed_cell_id[i]; - if (id < 0) - { - std::cout << "ERRRR! " << i << " " << id << std::endl; - } - else - { - seed_phi[i] = phi[id]; - } - } - - phi_calculator.resize(n_clusters); - - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type tag = state.clusterTag[i]; - if (Tags::is_part_of_cluster(tag)) - { - const int index = Tags::get_index_from_tag(tag); - phi_calculator.update_cluster(index, energy[i], phi[i], seed_phi[index]); - } - } - - cluster_phi_array.clear(); - cluster_phi_array.resize(n_clusters, -1000.); - - phi_calculator.finalize(cluster_phi_array); - - } - - struct standard_phi_calc : public base_phi_calc - { - std::vector<double> phis, weights; - void resize(const size_t n_clusters) - { - phis.clear(); - phis.resize(n_clusters, 0); - weights.clear(); - weights.resize(n_clusters, 0); - } - void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) - { - const double abs_e = std::abs(energy); - weights[cluster] += abs_e; - phis[cluster] += abs_e * regularize(phi, seed_phi); - } - void finalize(std::vector<double> & array) - { - for (size_t i = 0; i < phis.size(); ++i) - { - array[i] = angle_fix(phis[i] / weights[i]); - } - } - }; - - struct standard_phi_calc_no_reg : public standard_phi_calc - { - void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) - { - const double abs_e = std::abs(energy); - weights[cluster] += abs_e; - phis[cluster] += abs_e * phi; - } - }; - - struct KBN_base_class : public base_phi_calc - { - template <class T> inline static - void KahanBabushkaNeumaier_summate(const T res, T & Sum, T & Correct) - { - const T t = Sum + res; - if (std::abs(Sum) >= std::abs(res)) - { - Correct += (Sum - t) + res; - } - else - { - Correct += (res - t) + Sum; - } - Sum = t; - } - }; - - struct KBN_phi_calc : public KBN_base_class -//Kahan-Babushka-Neumaier Summation - { - std::vector<double> phis, weights, corrections; - void resize(const size_t n_clusters) - { - phis.clear(); - phis.resize(n_clusters, 0); - weights.clear(); - weights.resize(n_clusters, 0); - corrections.clear(); - corrections.resize(n_clusters, 0); - } - void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) - { - const double abs_e = std::abs(energy); - weights[cluster] += abs_e; - KahanBabushkaNeumaier_summate(abs_e * regularize(phi, seed_phi), phis[cluster], corrections[cluster]); - } - void finalize(std::vector<double> & array) - { - for (size_t i = 0; i < phis.size(); ++i) - { - array[i] = angle_fix((phis[i] + corrections[i]) / weights[i]); - } - } - }; - - struct KBN_phi_calc_no_reg : public KBN_phi_calc - { - void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) - { - const double abs_e = std::abs(energy); - weights[cluster] += abs_e; - KahanBabushkaNeumaier_summate(abs_e * phi, phis[cluster], corrections[cluster]); - } - }; - - struct sincos_phi_calc : public base_phi_calc - { - std::vector<double> sins, coss; - void resize(const size_t n_clusters) - { - sins.clear(); - sins.resize(n_clusters, 0); - coss.clear(); - coss.resize(n_clusters, 0); - } - void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) - { - const double abs_e = std::abs(energy); - sins[cluster] += abs_e * sin(phi); - coss[cluster] += abs_e * cos(phi); - } - void finalize(std::vector<double> & array) - { - for (size_t i = 0; i < sins.size(); ++i) - { - const double raw_phi = atan2(sins[i], coss[i]); - if (isnan(raw_phi) || isinf(raw_phi)) - { - array[i] = -1000.; - } - else - { - array[i] = angle_fix(raw_phi); - } - } - } - }; - - struct sincos_KBN_phi_calc : public KBN_base_class - { - std::vector<double> sins, coss, sincorr, coscorr; - void resize(const size_t n_clusters) - { - sins.clear(); - sins.resize(n_clusters, 0); - coss.clear(); - coss.resize(n_clusters, 0); - sincorr.clear(); - sincorr.resize(n_clusters, 0); - coscorr.clear(); - coscorr.resize(n_clusters, 0); - } - void update_cluster(const int cluster, const double energy, const double phi, const double seed_phi) - { - const double abs_e = std::abs(energy); - KahanBabushkaNeumaier_summate(abs_e * sin(phi), sins[cluster], sincorr[cluster]); - KahanBabushkaNeumaier_summate(abs_e * cos(phi), coss[cluster], coscorr[cluster]); - } - void finalize(std::vector<double> & array) - { - for (size_t i = 0; i < sins.size(); ++i) - { - const double raw_phi = atan2(sins[i] + sincorr[i], coss[i] + coscorr[i]); - if (isnan(raw_phi) || isinf(raw_phi)) - { - array[i] = -1000.; - } - else - { - array[i] = angle_fix(raw_phi); - } - } - } - }; - - - void set_reference(const CellStateArr & state, const CellInfoArr & cell_info, const ConstantDataHolder & instance_data, const int num_clusters) - { - m_ref_clusters = num_clusters; - - m_state.allocate(); - *(m_state) = state; - - m_snr_arr.allocate(); - - for (int i = 0; i < NCaloCells; ++i) - { - float snr = 0.00001f; - - const int local_gain = cell_info.gain[i]; - - if (GainConversion::is_invalid_cell(local_gain)) - { - snr = 0; - //I mean... These won't be used anyway, so... any value goes. - } - else if (GainConversion::is_normal_cell(local_gain) || GainConversion::is_invalid_seed_cell(local_gain)) - { - const float local_noise = instance_data.m_cell_noise->noise[GainConversion::recover_invalid_seed_cell_gain(local_gain)][i]; - if (finite(local_noise) && local_noise > 0.0f) - { - snr = std::abs(cell_info.energy[i] / local_noise); - } - } - m_snr_arr->snr[i] = snr; - } - - std::vector<double> phi_calcs; - standard_phi_calc spc{}; - calculate_phis(spc, phi_calcs, *m_state, m_ref_clusters, - instance_data.m_geometry->phi, m_snr_arr->snr, cell_info.energy); - - } - - static constexpr double default_min_similarity = 0.75; - static constexpr double default_term_weight = 0.0; - static constexpr double default_grow_weight = 250; - static constexpr double default_seed_weight = 10000; - - - static constexpr float SNR_thresholds[3] = {0., 2., 4.}; - - void find_matches(std::vector<int> & r2t_matches, - std::vector<int> & t2r_matches, - const float * SNR_array, - const tag_type * ref_tag_array, - const tag_type * test_tag_array, - const size_t num_ref_clusters, - const size_t num_test_clusters, - const double min_similarity = default_min_similarity, - const double term_weight = default_term_weight, - const double grow_weight = default_grow_weight, - const double seed_weight = default_seed_weight) - //Expects clusters numbered from 0 to N-1... - { - std::vector<int> similarity_map(num_ref_clusters * num_test_clusters, 0.f); - - std::vector<double> ref_normalization(num_ref_clusters, 0.f); - std::vector<double> test_normalization(num_test_clusters, 0.f); - - - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type ref_tag = ref_tag_array[i]; - const tag_type test_tag = test_tag_array[i]; - const double SNR = std::abs(SNR_array[i]); - const double weight = SNR * ( SNR > SNR_thresholds[2] ? seed_weight : - ( - SNR > SNR_thresholds[1] ? grow_weight : - ( - SNR > SNR_thresholds[0] ? term_weight : - 0 - ) - ) - ); - const int ref_idx = Tags::get_index_from_tag(ref_tag); - const int test_idx = Tags::get_index_from_tag(test_tag); - if (Tags::is_part_of_cluster(ref_tag) && Tags::is_part_of_cluster(test_tag)) - { - similarity_map[test_idx * num_ref_clusters + ref_idx] += weight; - } - if (Tags::is_part_of_cluster(ref_tag)) - { - ref_normalization[ref_idx] += weight; - } - if (Tags::is_part_of_cluster(test_tag)) - { - test_normalization[test_idx] += weight; - } - } - - //In essence, the Gale-Shapley Algorithm - - std::vector<std::vector<int>> sorted_GPU_matches; - - sorted_GPU_matches.reserve(num_test_clusters); - - for (int testc = 0; testc < num_test_clusters; ++testc) - { - std::vector<int> sorter(num_ref_clusters); - std::iota(sorter.begin(), sorter.end(), 0); - - std::sort(sorter.begin(), sorter.end(), - [&](const int a, const int b) - { - const double a_weight = similarity_map[testc * num_ref_clusters + a]; - const double b_weight = similarity_map[testc * num_ref_clusters + b]; - return a_weight > b_weight; - } - ); - - int wanted_size = 0; - - for (; wanted_size < sorter.size(); ++wanted_size) - { - const double match_weight = similarity_map[testc * num_ref_clusters + sorter[wanted_size]] / test_normalization [testc]; - if (match_weight < min_similarity) - { - break; - } - } - - //Yeah, we could do a binary search for best worst-case complexity, - //but we are expecting 1~2 similar clusters and the rest garbage, - //so we're expecting only 1~2 iterations. - //This actually means all that sorting is way way overkill, - //but we must make sure in the most general case that this works... - - sorter.resize(wanted_size); - - sorted_GPU_matches.push_back(sorter); - } - - int num_iter = 0; - - constexpr int max_iter = 32; - - - r2t_matches.clear(); - t2r_matches.clear(); - - r2t_matches.resize(num_ref_clusters, -1); - t2r_matches.resize(num_test_clusters, -1); - - - std::vector<double> matched_weights(num_ref_clusters, -1.); - - std::vector<int> skipped_matching(num_test_clusters, 0); - - for (int stop_counter = 0; stop_counter < num_test_clusters && num_iter < max_iter; ++num_iter) - { - stop_counter = 0; - for (int testc = 0; testc < sorted_GPU_matches.size(); ++testc) - { - if (skipped_matching[testc] < sorted_GPU_matches[testc].size()) - { - const int match_c = sorted_GPU_matches[testc][skipped_matching[testc]]; - const double match_weight = similarity_map[testc * num_ref_clusters + match_c] / ref_normalization[match_c]; - if (match_weight >= min_similarity && match_weight > matched_weights[match_c]) - { - const int prev_match = r2t_matches[match_c]; - if (prev_match >= 0) - { - ++skipped_matching[prev_match]; - --stop_counter; - } - r2t_matches[match_c] = testc; - matched_weights[match_c] = match_weight; - ++stop_counter; - } - else - { - ++skipped_matching[testc]; - } - } - else - { - ++stop_counter; - } - } - } - - for (int i = 0; i < r2t_matches.size(); ++i) - { - const int match = r2t_matches[i]; - if (match >= 0) - { - t2r_matches[match] = i; - } - } - - } - - - void add_comparison(const EventDataHolder & event_data, const ConstantDataHolder & instance_data) - { - - cudaDeviceSynchronize(); - - Helpers::CPU_object<CellStateArr> cell_state = event_data.m_cell_state_dev; - - Helpers::CPU_object<ClusterInfoArr> cluster_info = event_data.m_clusters_dev; - - std::unordered_map<int, int> tag_map; - - { - - std::vector<int> cluster_order(cluster_info->number); - - std::iota(cluster_order.begin(), cluster_order.end(), 0); - - std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) - { - if (cluster_info->seedCellID[a] < 0) - { - return false; - //This means that clusters with no cells - //(marked as invalid) always compare lower, - //so they appear in the end. - } - else if (cluster_info->seedCellID[b] < 0) - { - return true; - } - return cluster_info->clusterEt[a] > cluster_info->clusterEt[b]; - } ); - - int real_cluster_numbers = cluster_info->number; - - for (size_t i = 0; i < cluster_order.size(); ++i) - { - const int this_id = cluster_order[i]; - if (cluster_info->seedCellID[this_id] < 0) - { - tag_map[this_id] = -1; - --real_cluster_numbers; - } - else - { - tag_map[this_id] = i; - } - } - - const Helpers::CPU_object<ClusterInfoArr> temp_clusters(cluster_info); - - cluster_info->number = real_cluster_numbers; - - for (int i = 0; i < temp_clusters->number; ++i) - { - cluster_info->clusterEnergy[i] = temp_clusters->clusterEnergy[cluster_order[i]]; - cluster_info->clusterEt[i] = temp_clusters->clusterEt[cluster_order[i]]; - cluster_info->clusterEta[i] = temp_clusters->clusterEta[cluster_order[i]]; - cluster_info->clusterPhi[i] = temp_clusters->clusterPhi[cluster_order[i]]; - cluster_info->seedCellID[i] = temp_clusters->seedCellID[cluster_order[i]]; - } - - } - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type this_tag = cell_state->clusterTag[i]; - if (!Tags::is_part_of_cluster(this_tag)) - { - cell_state->clusterTag[i] = Tags::InvalidTag; - } - else - { - const int old_idx = Tags::get_index_from_tag(this_tag); - const int new_idx = tag_map[old_idx]; - if (new_idx < 0) - { - cell_state->clusterTag[i] = Tags::InvalidTag; - } - else - { - cell_state->clusterTag[i] = Tags::make_seed_tag(0x7f7fffff, cluster_info->seedCellID[new_idx], new_idx); - //To match what we do on the CPU side... - } - } - } - - std::vector<int> r2t_matches, t2r_matches; - - find_matches(r2t_matches, t2r_matches, m_snr_arr->snr, m_state->clusterTag, cell_state->clusterTag, m_ref_clusters, cluster_info->number); - /* - for (int i = 0; i < r2t_matches.size(); ++i) - { - std::cout << i << " " << r2t_matches[i] << "\n"; - } - for (int i = 0; i < t2r_matches.size(); ++i) - { - std::cout << i << " " << t2r_matches[i] << "\n"; - } - std::cout << std::endl; - */ - - std::vector<bool> equal_cells(t2r_matches.size(), true); - - size_t diffs = 0, seed_count = 0, grow_count = 0, term_count = 0; - - for (int i = 0; i < NCaloCells; ++i) - { - const tag_type test_real_tag = cell_state->clusterTag[i]; - const tag_type ref_real_tag = m_state->clusterTag[i]; - - const int test_tag = ( Tags::is_part_of_cluster(test_real_tag) ? - Tags::get_index_from_tag(test_real_tag) : -1 ); - const int ref_tag = ( Tags::is_part_of_cluster(ref_real_tag) ? - Tags::get_index_from_tag(ref_real_tag) : -1 ); - - if ((test_tag >= 0 && t2r_matches[test_tag] != ref_tag) || (test_tag < 0 && ref_tag >= 0)) - { - equal_cells[ref_tag] = false; - ++diffs; - has_total = true; - const float snr = m_snr_arr->snr[i]; - if (snr > 4) - { - has_seed = true; - ++seed_count; - //std::cout << i << ": " << test_tag << " " << ref_tag << " (" << snr << ")" << std::endl; - } - else if (snr > 2) - { - has_grow = true; - //std::cout << i << ": " << test_tag << " " << ref_tag << " (" << snr << ")" << std::endl; - ++grow_count; - } - else if (snr > 0) - { - has_term = true; - ++term_count; - } - else - { - std::cout << "Hmmm " << i << std::endl; - } - } - } - - total.push_back(diffs); - seed.push_back(seed_count); - grow.push_back(grow_count); - term.push_back(term_count); - - std::vector< std::vector< std::vector<double> > > phi_calcs; - - { - - standard_phi_calc pc_s{}; - standard_phi_calc_no_reg pc_snr{}; - KBN_phi_calc pc_kbn{}; - KBN_phi_calc_no_reg pc_kbnnr{}; - sincos_phi_calc pc_sc{}; - sincos_KBN_phi_calc pc_sckbn{}; - - std::vector<base_phi_calc *> calcs{& pc_s, & pc_snr, & pc_kbn, & pc_kbnnr, & pc_sc, & pc_sckbn}; - - std::vector<const CellStateArr *> tag_arrays{m_state, cell_state}; - std::vector<int> num_state_clusters{m_ref_clusters, cluster_info->number}; - - for (size_t i = 0; i < tag_arrays.size(); ++i) - { - phi_calcs.emplace_back(); - for (auto & calc_method : calcs) - { - phi_calcs.back().emplace_back(); - calculate_phis(*calc_method, phi_calcs.back().back(), *tag_arrays[i], num_state_clusters[i], - instance_data.m_geometry->phi, m_snr_arr->snr, event_data.m_cell_info->energy); - } - } - - } - - std::vector<phi_errors> phi_errs(phi_comparison_labels.size()); - - constexpr double max_diff = 0.25; - - int count = 0; - for (int test_id = 0; test_id < cluster_info->number; ++test_id) - { - if (t2r_matches[test_id] < 0) - { - continue; - } - const double GPU_phi = cluster_info->clusterPhi[test_id]; - - std::vector<int> indices{t2r_matches[test_id], test_id}; - - auto check = [&](const double val, const int id1, const int id2) - { - if (val < -Helpers::Constants::pi<double> || val > Helpers::Constants::pi<double>) - { - std::cout << id1 << " " << id2 << ": " << val << std::endl; - return true; - } - return false; - }; - - bool stop = false; - - if (check(GPU_phi, -1, -1)) - { - stop = true; - } - - - for (int i = 0; i < phi_calcs.size(); ++i) - { - for (int j = 0; j < phi_calcs[i].size(); ++j) - { - if (check(phi_calcs[i][j][indices[i]], i, j)) - { - stop = true; - } - } - } - - if (stop) - { - continue; - } - - struct calc_spec - { - int origin; - int calc; - }; - - struct diff_spec - { - calc_spec a, b; - }; - - std::vector<diff_spec> diffs{ {{0, 0}, {1, 0}}, //Reference to CPU-Calculated - {{0, 0}, {-1, -1}}, //Reference to GPU-Calculated - {{1, 0}, {-1, -1}}, //CPU-Calculated to GPU-Calculated - {{1, 0}, {1, 1}}, //CPU to CPU No Reg. - {{1, 0}, {1, 2}}, //CPU to CPU KBN - {{1, 0}, {1, 3}}, //CPU to CPU KBN No Reg. - {{1, 0}, {1, 4}}, //CPU to CPU Sin/Cos - {{1, 0}, {1, 5}}, //CPU to CPU Sin/Cos KBN - {{1, 3}, {-1, -1}}, //CPU KBN No Reg. to GPU - {{0, 1}, {-1, -1}}, //Reference No Reg. to GPU - {{0, 4}, {-1, -1}} //Reference Sin/Cos to GPU - }; - - auto getty = [&](const calc_spec & cs) - { - if (cs.origin < 0 || cs.calc < 0) - { - return GPU_phi; - } - else - { - return phi_calcs[cs.origin][cs.calc][indices[cs.origin]]; - } - }; - - auto setty = [&](phi_errors & pe, const double delta) - { - pe.add(delta); - if (delta > max_diff) - { - pe.add_difference(); - } - }; - - for (int i = 0; i < diffs.size(); ++i) - { - const double one = getty(diffs[i].a); - const double two = getty(diffs[i].b); - - const double dif = Helpers::Constants::pi<double> - std::abs(std::fmod(std::abs(one - two), 2 * Helpers::Constants::pi<double>) - Helpers::Constants::pi<double>); - - setty(phi_errs[i], dif); - } - ++count; - } - - valid_phis_counts.push_back(count); - - for (int i = 0; i < phi_errs.size(); ++i) - { - phi_errs[i].finalize(count); - phi_comparisons[i].push_back(phi_errs[i]); - } - - - } - - - void print_phi(const std::vector<phi_errors> & vect, const std::vector<size_t> & counts, const std::string & title, const size_t break_after) - { - std::cout << "\n\n " << title << ":"; - - phi_errors accum{0, 0, 0}, local_accum{0, 0, 0}; - size_t counter = 0, local_counter = 0; - - for (size_t i = 0; i < vect.size(); ++i) - { - if (i % break_after == 0) - { - if (i > 0) - { - local_accum.finalize(local_counter, break_after); - std::cout << "(" << local_accum << ")"; - } - local_accum = phi_errors {0, 0, 0}; - local_counter = 0; - std::cout << "\n "; - } - const phi_errors res = vect[i]; - const size_t num = counts[i]; - printf("|%7.3f %7.3f %7.3f %7.3f| ", res.differences, res.max, res.mu + (res.mu < 1e-3) * 1e-3, std::sqrt(res.sigma_sqr)); - local_accum.combine(res, num); - local_counter += num; - accum.combine(res, num); - counter += num; - } - local_accum.finalize(local_counter, break_after); - std::cout << "(" << local_accum << ")"; - accum.finalize(counter, vect.size()); - std::cout << "\n (" << accum << ")"; - } - - - void print_comparison(const size_t break_after, const bool force_print) - { - std::cout << " --------- CPU COMPARISON --------- \n\n"; - - if (has_total || force_print) - { - generic_comparison_print(total, "Total", break_after); - } - - if (has_seed || force_print) - { - generic_comparison_print(seed, "Seed", break_after); - } - - - if (has_grow || force_print) - { - generic_comparison_print(grow, "Grow", break_after); - } - - if (has_term || force_print) - { - generic_comparison_print(term, "Terminal", break_after); - } - - if (!has_total) - { - std::cout << "\nAll good, you can go rest now.\n"; - } - - std::cout << "\n\n --------- PHI COMPARISON --------- \n\n"; - - for (size_t i = 0; i < phi_comparison_labels.size(); ++i) - { - print_phi(phi_comparisons[i], valid_phis_counts, phi_comparison_labels[i], break_after); - } - - std::cout << std::endl; - - } - -}; - -void setup_cuda_device() -{ - int devID = 0; - cudaDeviceProp props; - - /* maybe we want something else here */ - cudaSetDevice(0); - - cudaGetDeviceProperties(&props, devID); - std::cout << "[CUDA] Device " << devID << " " << props.name << " with compute capability " << props.major << "." << props.minor << std::endl; -} - -int main(int argc, char ** argv) -{ - if (argc < 3) - { - std::cout << "Expected arguments: <program> <num reps> <max events> <geometry and noise folder> <events folder>" << std::endl; - return 0; - } - - setup_cuda_device(); - - const size_t num_reps = std::strtoull(argv[1], nullptr, 10); - - const int max_events = std::atoi(argv[2]); - - const auto constants_folder = StandaloneDataIO::load_folder(argv[3], 0, false, false, true, true); - - const auto loaded_folder = StandaloneDataIO::load_folder(argv[4], max_events, true, true, false, false); - - ConstantDataHolder fixed_data; - - fixed_data.m_geometry = constants_folder.geometry.begin()->second; - fixed_data.m_cell_noise = constants_folder.noise.begin()->second; - - fixed_data.sendToGPU(false); - - TACTemporariesHolder temporary_holder; - - temporary_holder.allocate(); - - TACOptionsHolder options_holder; - - options_holder.allocate(); - - *(options_holder.m_options) = TopoAutomatonOptions { 4.0f, 2.0f, 0.0f, true, true, true, false, 0x7FFFFFFF}; - - options_holder.sendToGPU(); - - BasicGPUClusterInfoCalculatorTemporariesHolder other_temporary_holder; - - other_temporary_holder.allocate(); - - - Helpers::CPU_object<CellStateArr> temp_cells; - Helpers::CPU_object<TopoAutomatonTemporaries> temp_temp; - - temp_cells.allocate(); - temp_temp.allocate(); - - EventDataHolder event_data; - event_data.allocate(); - - std::vector<size_t> times; - - Results results; - CPUComparison comparison; - - - for (const auto & it : loaded_folder.cell_info) - { - event_data.m_cell_info = (*it.second); - - event_data.sendToGPU(); - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - - //std::cout << "Sent data." << std::endl; - - signalToNoise(event_data, temporary_holder, fixed_data, options_holder, true); - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - - cellPairs(event_data, temporary_holder, fixed_data, options_holder, true); - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - - temp_cells = event_data.m_cell_state_dev; - temp_temp = temporary_holder.m_temporaries_dev; - - - for (size_t rep = 0; rep <= num_reps; ++rep) - { - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - - if (rep != 0) - { - event_data.m_cell_state_dev = temp_cells; - temporary_holder.m_temporaries_dev = temp_temp; - } - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - - - //std::cout << "So far, so good... " << rep << std::endl; - - auto start = std::chrono::steady_clock::now(); - - clusterGrowing(event_data, temporary_holder, fixed_data, options_holder, true); - - auto end = std::chrono::steady_clock::now(); - - times.push_back(std::chrono::duration_cast<std::chrono::microseconds>(end - start).count()); - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - if (rep == 0) - { - updateSeedCellProperties(event_data, other_temporary_holder, fixed_data, true); - calculateClusterProperties(event_data, other_temporary_holder, fixed_data, true); - - results.set_reference(event_data); - comparison.set_reference( - *(loaded_folder.cell_state.at(it.first)), - (*it.second), - fixed_data, - loaded_folder.clusters.at(it.first)->number - ); - comparison.add_comparison(event_data, fixed_data); - } - else - { - results.add_comparison(event_data); - } - } - } - - generic_comparison_print(times, "Execution Times", num_reps); - std::cout << "\n"; - results.print_comparison(num_reps, false); - comparison.print_comparison(loaded_folder.cell_info.size(), true); - - //CUDA_ERRCHECK(cudaDeviceSynchronize()); - - return 0; -} \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/DefaultImplementation.h b/Calorimeter/CaloRecGPU/tools/optimizer/DefaultImplementation.h deleted file mode 100644 index e30b298bf3d702aef3cf087b08159f631f33b98b..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/DefaultImplementation.h +++ /dev/null @@ -1,476 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef TOPOAUTOMATONCLUSTEROPTIMIZER_DEFAULT_IMPLEMENTATION_H -#define TOPOAUTOMATONCLUSTEROPTIMIZER_DEFAULT_IMPLEMENTATION_H - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "OptimizerDataHolders.h" - - -#include <cstring> -#include <cmath> -#include <iostream> -#include <stdio.h> - -using namespace CaloRecGPU; - -namespace DefaultImplementation -{ - - constexpr int DefaultBlockSize = 256; - - __device__ inline static tag_type calculateTag(const float SNR, const int seed_cell_index, const int address) - { - return Tags::make_seed_tag(__float_as_int(SNR), seed_cell_index, address); - } - - - static __global__ - void signalToNoiseKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - Helpers::CUDA_kernel_object<CellInfoArr> info_arr, - const Helpers::CUDA_kernel_object<CellNoiseArr> noise_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry, - const Helpers::CUDA_kernel_object<TopoAutomatonOptions> opts) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - - - if (index < NCaloCells) - { - const float cellEnergy = info_arr->energy[index]; - const int gain = info_arr->gain[index]; - - if (GainConversion::is_invalid_cell(gain)) - { - cell_state_arr->clusterTag[index] = Tags::InvalidTag; - return; - } - - float sigNoiseRatio = 0.00001f; - //It's what's done in the CPU implementation... - if (!GainConversion::is_bad_cell(gain)) - { - const int corr_gain = GainConversion::recover_invalid_seed_cell_gain(gain); - const float cellNoise = noise_arr->noise[corr_gain][index]; - if (isfinite(cellNoise) && cellNoise > 0.0f) - { - sigNoiseRatio = cellEnergy / cellNoise; - } - } - - const float absRatio = fabsf(sigNoiseRatio); - - if (sigNoiseRatio > opts->seed_threshold || (opts->abs_seed && absRatio > opts->seed_threshold)) // is Seed - { - if (GainConversion::is_invalid_seed_cell(gain)) - //If the cell is just ineligible to be a seed, it can still be a growing cell. - { - cell_state_arr->clusterTag[index] = Tags::GrowTag; - } - else if ( !( opts->validSamplingSeed & (1 << geometry->caloSample[index]) ) ) - //If the seed belongs to a sampling that's invalid for seeds... - { - cell_state_arr->clusterTag[index] = Tags::GrowTag; - } - else - { - const int n = atomicAdd(&(clusters_arr->number), 1); - - const tag_type tag = calculateTag(absRatio, index, n); - //Since seed_threshold will be positive, - //no problem with using abs here always: - //when actually using the absolute value, - //it's what we want, when not, cells with - //negative SNR will not be acceptable seeds. - cell_state_arr->clusterTag[index] = tag; - - clusters_arr->seedCellID[n] = index; - temporaries->seedCellPhi[n] = geometry->phi[index]; - clusters_arr->clusterEnergy[n] = 0.f; - clusters_arr->clusterEt[n] = 0.f; - clusters_arr->clusterEta[n] = 0.f; -#if !TTAC_CALCULATE_PHI_BY_SIMPLE_AVERAGE - clusters_arr->clusterSumSinPhi[n] = 0.f; - clusters_arr->clusterSumCosPhi[n] = 0.f; -#else - clusters_arr->clusterPhi[n] = 0.f; -#endif - temporaries->mergeTable[n] = Tags::clear_counter(tag); - } - } - else if (sigNoiseRatio > opts->grow_threshold || (opts->abs_grow && absRatio > opts->grow_threshold)) //is Grow - { - cell_state_arr->clusterTag[index] = Tags::GrowTag; - } - else if (sigNoiseRatio > opts->terminal_threshold || (opts->abs_terminal && absRatio > opts->terminal_threshold)) //is Terminal - { - cell_state_arr->clusterTag[index] = Tags::TerminalTag; - } - else //is invalid for propagation - { - cell_state_arr->clusterTag[index] = Tags::InvalidTag; - } - } - } - - //run the kernel - void signal_to_noise(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, const int blocksize = DefaultBlockSize) - { - - const int i_dimBlock = blocksize; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - signalToNoiseKernel <<< dimGrid, dimBlock>>>(holder.m_cell_state_dev, holder.m_clusters_dev, holder.m_temporaries_dev, - holder.m_cell_info_dev, instance_data.m_cell_noise_fixed_dev, instance_data.m_geometry_dev, - instance_data.m_options_dev); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - - } - - - /****************************************************************************** - * Kernel to generate the cell pairs for the growing algorithm. - ******************************************************************************/ - - - static __global__ - void cellPairsKernel( Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, - const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - - - if (index < NCaloCells) - { - - const tag_type this_tag = cell_state_arr->clusterTag[index]; - - if (Tags::is_growing_or_seed(this_tag)) - { - const int num_neighs = geometry->nNeighbours[index]; - - int neighbourList[NMaxNeighbours]; - int num_bad_neighs = 0; - for (int i = 0; i < num_neighs; ++i) - { - const int neigh_ID = geometry->neighbours[index][i]; - const tag_type neigh_tag = cell_state_arr->clusterTag[neigh_ID]; - if (Tags::is_valid(neigh_tag)) - { - neighbourList[i - num_bad_neighs] = neigh_ID; - } - else - { - ++num_bad_neighs; - } - } - - const int real_neighs = num_neighs - num_bad_neighs; - const int n = atomicAdd(&(neighbour_pairs->number), real_neighs); - for (int i = 0; i < real_neighs; ++i) - { - neighbour_pairs->cellID[n + i] = index; - neighbour_pairs->neighbourID[n + i] = neighbourList[i]; - } - } - } - } - - - //run the kernel - void cell_pairs(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, const int blocksize = DefaultBlockSize) - { - - const int i_dimBlock = blocksize; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - cellPairsKernel <<< dimGrid, dimBlock>>>(holder.m_pairs_dev, holder.m_cell_state_dev, instance_data.m_geometry_dev); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - - } - - - - /****************************************************************************** - * Series of kernels for the growing algorithm! - ******************************************************************************/ - - __global__ static - void propagateNeighbours( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - const int pair_number, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < pair_number) - { - const int this_ID = neighbour_pairs->cellID[index]; - const int neigh_ID = neighbour_pairs->neighbourID[index]; - - const tag_type neigh_raw_tag = cell_state_arr->clusterTag[neigh_ID]; - - const tag_type neigh_prop_tag = Tags::set_for_propagation(neigh_raw_tag); - - const tag_type this_old_raw_tag = atomicMax(&(cell_state_arr->clusterTag[this_ID]), neigh_prop_tag); - - if (Tags::is_part_of_cluster(this_old_raw_tag) && Tags::is_part_of_cluster(neigh_raw_tag)) - { - //If the cell was already part of a cluster, - //we must merge the two of them. - //Else, we keep growing. - const int this_address = Tags::get_index_from_tag(this_old_raw_tag); - const int neigh_address = Tags::get_index_from_tag(neigh_raw_tag); - const tag_type maximum_cluster = max(Tags::clear_counter(this_old_raw_tag), Tags::clear_counter(neigh_raw_tag)); - atomicMax(&(temporaries->mergeTable[this_address]), maximum_cluster); - atomicMax(&(temporaries->mergeTable[this_address]), maximum_cluster); - } - else if (Tags::is_part_of_cluster(neigh_raw_tag)) - { - temporaries->continueFlag = 1; - } - } - } - - __global__ static - void mergeClusters( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = cell_state_arr->clusterTag[index]; - if (Tags::is_part_of_cluster(old_tag)) - { - const int address = Tags::get_index_from_tag(old_tag); - const tag_type new_tag = temporaries->mergeTable[address]; - cell_state_arr->clusterTag[index] = Tags::update_non_terminal_tag(old_tag, new_tag); - } - } - } - - __global__ static - void propagateTerminals( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const int pair_number, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < pair_number) - { - const int this_ID = neighbour_pairs->cellID[index]; - const int neigh_ID = neighbour_pairs->neighbourID[index]; - - const tag_type this_tag = cell_state_arr->clusterTag[this_ID]; - - atomicMax(&(cell_state_arr->clusterTag[neigh_ID]), Tags::set_for_terminal_propagation(this_tag)); - } - } - - - __global__ static - void finalizeClusterAttribution( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = cell_state_arr->clusterTag[index]; - cell_state_arr->clusterTag[index] = Tags::clear_counter(old_tag); - } - } - - - __global__ static - void clusterGrowingKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, - const int blocksize1, const int blocksize2, const int blocksize3, const int blocksize4) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - //Will be called with just 1 thread, but... - { - const int pairs_number = neighbour_pairs->number; - - const int i_dimBlock1 = blocksize1; - const int i_dimGrid1 = Helpers::int_ceil_div(pairs_number, i_dimBlock1); - const dim3 dimBlock1(i_dimBlock1, 1, 1); - const dim3 dimGrid1(i_dimGrid1, 1, 1); - - const int i_dimBlock2 = blocksize2; - const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); - const dim3 dimBlock2(i_dimBlock2, 1, 1); - const dim3 dimGrid2(i_dimGrid2, 1, 1); - - const int i_dimBlock3 = blocksize3; - const int i_dimGrid3 = Helpers::int_ceil_div(pairs_number, i_dimBlock3); - const dim3 dimBlock3(i_dimBlock3, 1, 1); - const dim3 dimGrid3(i_dimGrid3, 1, 1); - - const int i_dimBlock4 = blocksize4; - const int i_dimGrid4 = Helpers::int_ceil_div(NCaloCells, i_dimBlock4); - const dim3 dimBlock4(i_dimBlock4, 1, 1); - const dim3 dimGrid4(i_dimGrid4, 1, 1); - - - temporaries->continueFlag = 1; - - while (temporaries->continueFlag > 0) - { - temporaries->continueFlag = 0; - propagateNeighbours <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, pairs_number, neighbour_pairs); - mergeClusters <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries); - if (temporaries->continueFlag == 0) - { - cudaDeviceSynchronize(); - } - } - propagateTerminals <<< dimGrid3, dimBlock3>>>(cell_state_arr, pairs_number, neighbour_pairs); - finalizeClusterAttribution <<< dimGrid4, dimBlock4>>>(cell_state_arr, temporaries); - } - } - - //run the kernel - void cluster_growing(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, - const int blocksize1 = DefaultBlockSize, const int blocksize2 = DefaultBlockSize, const int blocksize3 = -1, const int blocksize4 = -1) - { - - clusterGrowingKernel <<< 1, 1>>>(holder.m_cell_state_dev, holder.m_temporaries_dev, holder.m_pairs_dev, - blocksize1, blocksize2, ( blocksize3 < 0 ? blocksize1 : blocksize3 ), ( blocksize4 < 0 ? blocksize2 : blocksize4)); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - - } - - - /****************************************************************************** - * Finalize cluster information. - ******************************************************************************/ - - __global__ static - void calculateClusterInfoKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, - const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<CellInfoArr> info_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type tag = cell_state_arr->clusterTag[index]; - if (Tags::is_part_of_cluster(tag)) - //By this point they all have the terminals anyway, so... - { - const int cluster_index = Tags::get_index_from_tag(tag); - const float energy = info_arr->energy[index]; - const float abs_energy = fabsf(energy); - const float phi_raw = geometry->phi[index]; - - atomicAdd(&(clusters_arr->clusterEnergy[cluster_index]), energy); - atomicAdd(&(clusters_arr->clusterEt[cluster_index]), abs_energy); - atomicAdd(&(clusters_arr->clusterEta[cluster_index]), abs_energy * geometry->eta[index]); - - -#if !TTAC_CALCULATE_PHI_BY_SIMPLE_AVERAGE - float sin_phi; - float cos_phi; - sincosf(phi_raw, &sin_phi, &cos_phi); - //Calculates the sine and co-sine of phi - atomicAdd(&(clusters_arr->clusterSumSinPhi[cluster_index]), sin_phi * abs_energy); - atomicAdd(&(clusters_arr->clusterSumCosPhi[cluster_index]), cos_phi * abs_energy); -#else - const float phi_0 = temporaries->seedCellPhi[cluster_index]; - const float phi_real = phi_raw + - (phi_raw > phi_0 + Helpers::Constants::pi<float> ? -2 : - phi_raw < phi_0 - Helpers::Constants::pi<float> ? 2 : 0) * Helpers::Constants::pi<float>; - atomicAdd(&(clusters_arr->clusterPhi[cluster_index]), phi_real * abs_energy); -#endif - - } - } - } - - - __global__ static - void finalizeClusterInfoKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int cluster_number) - { - const int i = blockIdx.x * blockDim.x + threadIdx.x; - if (i < cluster_number) - { - - const float abs_energy = clusters_arr->clusterEt[i]; - - if (abs_energy > 0) - { - const float tempeta = clusters_arr->clusterEta[i] / abs_energy; - - clusters_arr->clusterEta[i] = tempeta; - - clusters_arr->clusterEt[i] = abs_energy / coshf(tempeta); - -#if !TTAC_CALCULATE_PHI_BY_SIMPLE_AVERAGE - const float raw_phi = atan2f(clusters_arr->clusterSumSinPhi[i], clusters_arr->clusterSumCosPhi[i]); - const float corr_phi = ( (isnan(raw_phi) || isinf(raw_phi)) ? -10 : - raw_phi + (raw_phi < 0 ? 2 * Helpers::Constants::pi<float> : 0) ); - - clusters_arr->clusterPhi[i] = corr_phi; -#else - clusters_arr->clusterPhi[i] /= abs_energy; -#endif - } - else - { - clusters_arr->seedCellID[i] = -1; - //This is just a way to signal that this is an invalid cluster. - } - } - } - - __global__ static - void finalizeClustersDeferKernel( Helpers::CUDA_kernel_object<ClusterInfoArr> clusters_arr, const int blocksize2 ) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - { - const int cluster_number = clusters_arr->number; - - const int i_dimBlock = blocksize2; - const int i_dimGrid = Helpers::int_ceil_div(cluster_number, i_dimBlock); - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - finalizeClusterInfoKernel <<< dimGrid, dimBlock >>>(clusters_arr, cluster_number); - - } - } - - void finalize_clusters(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, const int blocksize1 = DefaultBlockSize, const int blocksize2 = DefaultBlockSize) - { - - const int i_dimBlock = blocksize1; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - calculateClusterInfoKernel <<< dimGrid, dimBlock>>>(holder.m_clusters_dev, holder.m_cell_state_dev, holder.m_cell_info_dev, instance_data.m_geometry_dev, holder.m_temporaries_dev); - - finalizeClustersDeferKernel <<< 1, 1>>>(holder.m_clusters_dev, blocksize2); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - } -} - -#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/ExtraDefs.h b/Calorimeter/CaloRecGPU/tools/optimizer/ExtraDefs.h deleted file mode 100644 index c4121506a1d93fe833bad4072d70fed53b348cdb..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/ExtraDefs.h +++ /dev/null @@ -1,110 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef TOPOAUTOMATONCLUSTEROPTIMIZER_EXTRA_DEFS_H -#define TOPOAUTOMATONCLUSTEROPTIMIZER_EXTRA_DEFS_H - -using namespace CaloRecGPU; - -class ExtraTags : public Tags -{ - public: - inline constexpr static tag_type set_for_terminal_propagation2(const tag_type tag) - { - return (tag - tag_propagation_delta) & (~ValidPropagationMark); - } - inline constexpr static tag_type update_non_terminal_tag(const tag_type old_tag, const tag_type new_tag) - { - return clear_everything_but_counter(old_tag) | new_tag; - } - - inline constexpr static tag_type update_terminal_tag(const tag_type old_tag, const tag_type new_tag) - { - return clear_everything_but_counter(old_tag) | new_tag; - } - - inline constexpr static tag_type update_terminal_tag2(const tag_type old_tag, const tag_type new_tag) - { - return clear_everything_but_counter(old_tag) | (new_tag & (~ValidPropagationMark)); - } - - inline constexpr static tag_type terminal_to_seed_tag(const tag_type old_tag) - { - return old_tag | ValidPropagationMark; - } - - /* - inline constexpr static tag_type set_for_neighbour_propagation(const tag_type tag) - { - const uint32_t count = get_counter_from_tag(tag) - 1; - const uint32_t index = get_index_from_tag(tag); - const uint32_t snr = get_snr_from_tag(tag); - tag_type ret = count; - ret = (ret << 31) | snr; //MSB of snr is 0 - ret = (ret << 16) | index; - - //So: 0 ... 16 bit counter ... 31 bit SNR ... 16 bit index - - return ret; - } - - - inline constexpr static int32_t get_index_from_terminal_tag(const tag_type tag) - { - return tag & 0x0000FFFFU; - } - - inline constexpr static int32_t get_counter_from_terminal_tag(const tag_type tag) - { - uint32_t ret = (tag & 0x7FFF800000000000ULL) >> 47; - //0x 7FFF 8000 0000 0000 - return ret; - } - - inline constexpr static int32_t clear_everything_but_counter_from_terminal_tag(const tag_type tag) - { - return tag & 0x7FFF800000000000ULL; - } - - inline constexpr static int32_t get_snr_from_terminal_tag(const tag_type tag) - { - uint32_t ret = (tag & 0x00007FFFFFFF0000ULL) >> 16; - //0x 0000 7FFF FFFF 0000 - return ret; - } - - inline constexpr static tag_type update_non_terminal_tag(const tag_type old_tag, const tag_type new_tag) - { - return clear_everything_but_counter(old_tag) | new_tag; - } - - inline constexpr static tag_type update_terminal_tag(const tag_type old_tag, const tag_type new_tag) - { - const uint32_t index = get_index_from_tag(new_tag); - const uint32_t snr = get_snr_from_tag(new_tag); - tag_type ret = snr; - ret = (ret << 16) | index; - return clear_everything_but_counter_from_terminal_tag(old_tag) | ret; - } - - inline constexpr static tag_type terminal_to_seed_tag(const tag_type old_tag) - { - tag_type ret = get_snr_from_terminal_tag(old_tag); - - - const uint32_t index = get_index_from_terminal_tag(old_tag); - - ret = (ret << 16) | index; - - ret = (ret << 16); - - return ret | ValidPropagationMark; - - } - */ - -}; - -#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/FixedPairs.h b/Calorimeter/CaloRecGPU/tools/optimizer/FixedPairs.h deleted file mode 100644 index 5310607907e41fae09fe7dcfa938f9dbcdb766b0..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/FixedPairs.h +++ /dev/null @@ -1,184 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef TOPOAUTOMATONCLUSTEROPTIMIZER_FIXEDPAIR_IMPLEMENTATION_H -#define TOPOAUTOMATONCLUSTEROPTIMIZER_FIXEDPAIR_IMPLEMENTATION_H - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "OptimizerDataHolders.h" -#include "ExtraDefs.h" - - -#include <cstring> -#include <cmath> -#include <iostream> -#include <stdio.h> - -using namespace CaloRecGPU; - -namespace FixedPairs -{ - - constexpr int DefaultBlockSize = 256; - __global__ static - void propagateNeighbours( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - const int pair_number, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < pair_number) - { - const int this_ID = neighbour_pairs->cellID[index]; - const int neigh_ID = neighbour_pairs->neighbourID[index]; - - const tag_type this_raw_tag = cell_state_arr->clusterTag[this_ID]; - const tag_type neigh_raw_tag = cell_state_arr->clusterTag[neigh_ID]; - - if (Tags::is_invalid(this_raw_tag) || Tags::is_invalid(neigh_raw_tag)) - { - return; - } - - if (Tags::is_growing_or_seed(this_raw_tag) && Tags::is_growing_or_seed(neigh_raw_tag)) - { - const tag_type neigh_prop_tag = Tags::set_for_propagation(neigh_raw_tag); - const tag_type this_prop_tag = Tags::set_for_propagation(this_raw_tag); - - atomicMax(&(cell_state_arr->clusterTag[this_ID]), neigh_prop_tag); - atomicMax(&(cell_state_arr->clusterTag[neigh_ID]), this_prop_tag); - if (Tags::is_part_of_cluster(this_raw_tag) && Tags::is_part_of_cluster(neigh_raw_tag)) - { - tag_type maximum_cluster = max(Tags::clear_counter(this_raw_tag), Tags::clear_counter(neigh_raw_tag)); - - const int this_address = Tags::get_index_from_tag(this_raw_tag); - const int neigh_address = Tags::get_index_from_tag(neigh_raw_tag); - - atomicMax(&(temporaries->mergeTable[this_address]), maximum_cluster); - atomicMax(&(temporaries->mergeTable[neigh_address]), maximum_cluster); - } - else if (Tags::is_part_of_cluster(this_raw_tag) || Tags::is_part_of_cluster(neigh_raw_tag)) - { - temporaries->continueFlag = 1; - } - } - else if (Tags::is_part_of_cluster(this_raw_tag) /* && Tags::is_assignable_terminal(neigh_raw_tag)*/) - { - atomicMax(&(cell_state_arr->clusterTag[neigh_ID]), ExtraTags::set_for_terminal_propagation2(this_raw_tag)); - } - else if (Tags::is_part_of_cluster(neigh_raw_tag) /* && Tags::is_assignable_terminal(neigh_raw_tag)*/) - { - atomicMax(&(cell_state_arr->clusterTag[this_ID]), ExtraTags::set_for_terminal_propagation2(neigh_raw_tag)); - } - else - { - //Between terminals, nothing. - } - } - } - - - __global__ static - void mergeClusters( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = cell_state_arr->clusterTag[index]; - if (Tags::is_part_of_cluster(old_tag)) - { - const int address = Tags::get_index_from_tag(old_tag); - const tag_type new_tag = temporaries->mergeTable[address]; - cell_state_arr->clusterTag[index] = Tags::update_non_terminal_tag(old_tag, new_tag); - } - else if (Tags::is_assigned_terminal(old_tag)) - { - const int address = Tags::get_index_from_tag(old_tag); - const tag_type new_tag = temporaries->mergeTable[address]; - cell_state_arr->clusterTag[index] = ExtraTags::update_terminal_tag2(old_tag, new_tag); - } - } - } - - __global__ static - void finalizeClusterAttribution( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = cell_state_arr->clusterTag[index]; - if (Tags::is_assigned_terminal(old_tag)) - { - cell_state_arr->clusterTag[index] = Tags::terminal_to_seed_tag(old_tag); - } - else /*if (Tags::is_part_of_cluster(old_tag))*/ - { - cell_state_arr->clusterTag[index] = Tags::clear_counter(old_tag); - } - } - } - - __global__ static - void clusterGrowingKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, - const int blocksize1, const int blocksize2, const int blocksize3) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - //Will be called with just 1 thread, but... - { - const int pairs_number = neighbour_pairs->number; - - const int i_dimBlock1 = blocksize1; - const int i_dimGrid1 = Helpers::int_ceil_div(pairs_number, i_dimBlock1); - const dim3 dimBlock1(i_dimBlock1, 1, 1); - const dim3 dimGrid1(i_dimGrid1, 1, 1); - - const int i_dimBlock2 = blocksize2; - const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); - const dim3 dimBlock2(i_dimBlock2, 1, 1); - const dim3 dimGrid2(i_dimGrid2, 1, 1); - - const int i_dimBlock3 = blocksize3; - const int i_dimGrid3 = Helpers::int_ceil_div(NCaloCells, i_dimBlock3); - const dim3 dimBlock3(i_dimBlock3, 1, 1); - const dim3 dimGrid3(i_dimGrid3, 1, 1); - - - temporaries->continueFlag = 1; - - while (temporaries->continueFlag > 0) - { - temporaries->continueFlag = 0; - propagateNeighbours <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, pairs_number, neighbour_pairs); - mergeClusters <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries); - if (temporaries->continueFlag == 0) - { - cudaDeviceSynchronize(); - } - } - finalizeClusterAttribution <<< dimGrid3, dimBlock3>>>(cell_state_arr, temporaries); - } - } - - //run the kernel - void cluster_growing(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, - const int blocksize1 = DefaultBlockSize, const int blocksize2 = DefaultBlockSize, const int blocksize3 = -1) - { - - clusterGrowingKernel <<< 1, 1>>>(holder.m_cell_state_dev, holder.m_temporaries_dev, instance_data.m_fixed_pairs_dev, - blocksize1, blocksize2, ( blocksize3 < 0 ? blocksize1 : blocksize3 )); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - - } - -} - -#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/HalvedPairs.h b/Calorimeter/CaloRecGPU/tools/optimizer/HalvedPairs.h deleted file mode 100644 index e2862f3345c6203ebfe96642342e951403337157..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/HalvedPairs.h +++ /dev/null @@ -1,250 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef TOPOAUTOMATONCLUSTEROPTIMIZER_HALFPAIR_IMPLEMENTATION_H -#define TOPOAUTOMATONCLUSTEROPTIMIZER_HALFPAIR_IMPLEMENTATION_H - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "OptimizerDataHolders.h" -#include "ExtraDefs.h" - - -#include <cstring> -#include <cmath> -#include <iostream> -#include <stdio.h> - -using namespace CaloRecGPU; - -namespace HalvedPairs -{ - - constexpr int DefaultBlockSize = 256; - - static __global__ - void cellPairsKernel( Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, - const Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<GeometryArr> geometry) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - - - if (index < NCaloCells) - { - - const tag_type this_tag = cell_state_arr->clusterTag[index]; - - if (Tags::is_growing_or_seed(this_tag)) - { - const int num_neighs = geometry->nNeighbours[index]; - - int neighbourList[NMaxNeighbours]; - int num_bad_neighs = 0; - for (int i = 0; i < num_neighs; ++i) - { - const int neigh_ID = geometry->neighbours[index][i]; - const tag_type neigh_tag = cell_state_arr->clusterTag[neigh_ID]; - if ( (Tags::is_growing_or_seed(neigh_tag) && neigh_ID > index) || Tags::is_non_assigned_terminal(neigh_tag)) - { - neighbourList[i - num_bad_neighs] = neigh_ID; - } - else - { - ++num_bad_neighs; - } - } - - const int real_neighs = num_neighs - num_bad_neighs; - const int n = atomicAdd(&(neighbour_pairs->number), real_neighs); - for (int i = 0; i < real_neighs; ++i) - { - neighbour_pairs->cellID[n + i] = index; - neighbour_pairs->neighbourID[n + i] = neighbourList[i]; - } - } - } - } - - - //run the kernel - void cell_pairs(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, const int blocksize = DefaultBlockSize) - { - - const int i_dimBlock = blocksize; - const int i_dimGrid = Helpers::int_ceil_div(NCaloCells, i_dimBlock); - - const dim3 dimBlock(i_dimBlock, 1, 1); - const dim3 dimGrid(i_dimGrid, 1, 1); - - cellPairsKernel <<< dimGrid, dimBlock>>>(holder.m_half_pairs_dev, holder.m_cell_state_dev, instance_data.m_geometry_dev); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - - } - - - - /****************************************************************************** - * Series of kernels for the growing algorithm! - ******************************************************************************/ - - __global__ static - void propagateNeighbours( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - const int pair_number, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < pair_number) - { - const int this_ID = neighbour_pairs->cellID[index]; - const int neigh_ID = neighbour_pairs->neighbourID[index]; - - const tag_type neigh_raw_tag = cell_state_arr->clusterTag[neigh_ID]; - - const tag_type neigh_prop_tag = Tags::set_for_propagation(neigh_raw_tag); - - const tag_type this_old_raw_tag = atomicMax(&(cell_state_arr->clusterTag[this_ID]), neigh_prop_tag); - - const tag_type this_old_prop_tag = Tags::set_for_propagation(this_old_raw_tag); - - if (this_old_prop_tag > neigh_raw_tag && Tags::is_growing_or_seed(neigh_raw_tag)) - { - atomicMax(&(cell_state_arr->clusterTag[neigh_ID]), this_old_prop_tag); - if (Tags::is_non_assigned_growing(neigh_raw_tag)) - { - temporaries->continueFlag = 1; - } - } - - if (Tags::is_part_of_cluster(this_old_raw_tag) && Tags::is_part_of_cluster(neigh_raw_tag)) - { - //If the cell was already part of a cluster, - //we must merge the two of them. - //Else, we keep growing. - - tag_type maximum_cluster = max(Tags::clear_counter(this_old_raw_tag), Tags::clear_counter(neigh_raw_tag)); - - const int this_address = Tags::get_index_from_tag(this_old_raw_tag); - const int neigh_address = Tags::get_index_from_tag(neigh_raw_tag); - - atomicMax(&(temporaries->mergeTable[this_address]), maximum_cluster); - atomicMax(&(temporaries->mergeTable[neigh_address]), maximum_cluster); - } - else if (Tags::is_part_of_cluster(neigh_raw_tag)) - { - temporaries->continueFlag = 1; - } - else if (Tags::is_part_of_cluster(this_old_raw_tag) && ExtraTags::is_assignable_terminal(neigh_raw_tag)) - { - atomicMax(&(cell_state_arr->clusterTag[neigh_ID]), ExtraTags::set_for_terminal_propagation2(this_old_raw_tag)); - } - } - } - - - __global__ static - void mergeClusters( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = cell_state_arr->clusterTag[index]; - if (Tags::is_part_of_cluster(old_tag)) - { - const int address = Tags::get_index_from_tag(old_tag); - const tag_type new_tag = temporaries->mergeTable[address]; - cell_state_arr->clusterTag[index] = Tags::update_non_terminal_tag(old_tag, new_tag); - } - else if (Tags::is_assigned_terminal(old_tag)) - { - const int address = Tags::get_index_from_tag(old_tag); - const tag_type new_tag = temporaries->mergeTable[address]; - cell_state_arr->clusterTag[index] = ExtraTags::update_terminal_tag2(old_tag, new_tag); - } - } - } - - __global__ static - void finalizeClusterAttribution( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - const Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index < NCaloCells) - { - const tag_type old_tag = cell_state_arr->clusterTag[index]; - if (Tags::is_assigned_terminal(old_tag)) - { - cell_state_arr->clusterTag[index] = Tags::terminal_to_seed_tag(old_tag); - } - else /*if (Tags::is_part_of_cluster(old_tag))*/ - { - cell_state_arr->clusterTag[index] = Tags::clear_counter(old_tag); - } - } - } - - - __global__ static - void clusterGrowingKernel( Helpers::CUDA_kernel_object<CellStateArr> cell_state_arr, - Helpers::CUDA_kernel_object<TopoAutomatonTemporariesOld> temporaries, - const Helpers::CUDA_kernel_object<PairsArr> neighbour_pairs, - const int blocksize1, const int blocksize2, const int blocksize3) - { - const int index = blockIdx.x * blockDim.x + threadIdx.x; - if (index == 0) - //Will be called with just 1 thread, but... - { - const int pairs_number = neighbour_pairs->number; - - const int i_dimBlock1 = blocksize1; - const int i_dimGrid1 = Helpers::int_ceil_div(pairs_number, i_dimBlock1); - const dim3 dimBlock1(i_dimBlock1, 1, 1); - const dim3 dimGrid1(i_dimGrid1, 1, 1); - - const int i_dimBlock2 = blocksize2; - const int i_dimGrid2 = Helpers::int_ceil_div(NCaloCells, i_dimBlock2); - const dim3 dimBlock2(i_dimBlock2, 1, 1); - const dim3 dimGrid2(i_dimGrid2, 1, 1); - - const int i_dimBlock3 = blocksize3; - const int i_dimGrid3 = Helpers::int_ceil_div(NCaloCells, i_dimBlock3); - const dim3 dimBlock3(i_dimBlock3, 1, 1); - const dim3 dimGrid3(i_dimGrid3, 1, 1); - - - temporaries->continueFlag = 1; - - while (temporaries->continueFlag > 0) - { - temporaries->continueFlag = 0; - propagateNeighbours <<< dimGrid1, dimBlock1>>>(cell_state_arr, temporaries, pairs_number, neighbour_pairs); - mergeClusters <<< dimGrid2, dimBlock2>>>(cell_state_arr, temporaries); - if (temporaries->continueFlag == 0) - { - cudaDeviceSynchronize(); - } - } - finalizeClusterAttribution <<< dimGrid3, dimBlock3>>>(cell_state_arr, temporaries); - } - } - - //run the kernel - void cluster_growing(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data, - const int blocksize1 = DefaultBlockSize, const int blocksize2 = DefaultBlockSize, const int blocksize3 = -1) - { - - clusterGrowingKernel <<< 1, 1>>>(holder.m_cell_state_dev, holder.m_temporaries_dev, holder.m_half_pairs_dev, - blocksize1, blocksize2, ( blocksize3 < 0 ? blocksize1 : blocksize3 )); - - CUDA_ERRCHECK(cudaStreamSynchronize(cudaStreamPerThread)); - - } - -} - -#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/Optimize.cu b/Calorimeter/CaloRecGPU/tools/optimizer/Optimize.cu deleted file mode 100644 index b5371c1952d7b0d404ece8ade591c80781946452..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/Optimize.cu +++ /dev/null @@ -1,74 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#define TTAC_CALCULATE_PHI_BY_SIMPLE_AVERAGE 1 - -#include "CaloRecGPU/Helpers.h" -#include "TestDefinitions.h" - -#include "DefaultImplementation.h" -#include "HalvedPairs.h" -#include "FixedPairs.h" - -using namespace CaloRecGPU; - -int main(int argc, char ** argv) -{ - std::string folder = "."; - int max_events = 32, - num_reps = test_function::s_num_reps, - compress_loops_after = test_function::s_compress_loops_after, - keep_best = test_function::s_keep_best; - std::string prefix = test_function::s_prefix; - - if (argc > 1) - { - folder = argv[1]; - } - if (argc > 2) - { - max_events = std::atoi(argv[2]); - } - if (argc > 3) - { - prefix = argv[3]; - } - if (argc > 4) - { - num_reps = std::atoi(argv[4]); - } - if (argc > 5) - { - compress_loops_after = std::atoi(argv[5]); - } - if (argc > 6) - { - keep_best = std::atoi(argv[6]); - } - - TestHolder tests(folder, max_events); - - test_function::s_num_reps = num_reps; - test_function::s_compress_loops_after = compress_loops_after; - test_function::s_keep_best = keep_best; - test_function::s_prefix = prefix; - - loop_range threads{1, 128, 1}; - //loop_range blocks{256, 256, 256}; - loop_range blocks{32, 1024, 32}; - - tests.add_snr_func("default_snr", DefaultImplementation::signal_to_noise, threads, blocks); - tests.add_pair_func("default_pairs", DefaultImplementation::cell_pairs, threads, blocks); - //tests.add_pair_func("half_pairs", HalvedPairs::cell_pairs, threads, blocks); - tests.add_grow_func("default_growing", DefaultImplementation::cluster_growing, threads, blocks, blocks, blocks, blocks); - //tests.add_grow_func("half_pair_growing", HalvedPairs::cluster_growing, threads, blocks, blocks, blocks); - //tests.add_grow_func("fixed_pair_growing", FixedPairs::cluster_growing, threads, blocks, blocks, blocks); - tests.add_finalize_func("default_finalize", DefaultImplementation::finalize_clusters, threads, blocks, blocks); - - tests.do_tests(false); - //Change this to `true` to recover the old, "pretty" file format. - - return 0; -} diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/OptimizerDataHolders.h b/Calorimeter/CaloRecGPU/tools/optimizer/OptimizerDataHolders.h deleted file mode 100644 index 17b35a428e9667aa89e8d34271f1a3c832a5df41..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/OptimizerDataHolders.h +++ /dev/null @@ -1,170 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration -// -#ifndef TOPOAUTOMATONCLUSTEROPTIMIZER_DATAHOLDERS_H -#define TOPOAUTOMATONCLUSTEROPTIMIZER_DATAHOLDERS_H - -#include "CaloRecGPU/Helpers.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "../../src/TopoAutomatonClusteringGPU.h" - - -#include <fstream> - -using namespace CaloRecGPU; - -struct TopoAutomatonTemporariesOld -{ - tag_type secondaryArray[NCaloCells]; - tag_type mergeTable[NMaxClusters]; - float seedCellPhi[NMaxClusters]; - int continueFlag; -}; - - -class InstanceDataHolder -{ - public: - - - Helpers::CPU_object<GeometryArr> m_geometry; - - Helpers::CPU_object<CellNoiseArr> m_cell_noise_fixed; - - Helpers::CPU_object<TopoAutomatonOptions> m_options; - - Helpers::CPU_object<PairsArr> m_fixed_pairs; - - Helpers::CUDA_object<GeometryArr> m_geometry_dev; - - Helpers::CUDA_object<CellNoiseArr> m_cell_noise_fixed_dev; - - Helpers::CUDA_object<TopoAutomatonOptions> m_options_dev; - - Helpers::CUDA_object<PairsArr> m_fixed_pairs_dev; - - bool m_GPU_info_ready = false; - - - void send(const bool clear_CPU = false) - { - m_options_dev = m_options; - m_geometry_dev = m_geometry; - m_cell_noise_fixed_dev = m_cell_noise_fixed; - m_fixed_pairs_dev = m_fixed_pairs; - m_GPU_info_ready = true; - if (clear_CPU) - { - m_options.clear(); - m_geometry.clear(); - m_cell_noise_fixed.clear(); - } - } - - bool prepare(Helpers::CPU_object<GeometryArr> && geom, Helpers::CPU_object<CellNoiseArr> && noise) - { - m_geometry = geom; - m_cell_noise_fixed = noise; - - for (int cell = 0; cell < NCaloCells; ++cell) - { - const int n_neighs = m_geometry->nNeighbours[cell]; - - for (int i = 0; i < n_neighs; ++i) - { - const int neigh = m_geometry->neighbours[cell][i]; - - const int neigh_neighs = m_geometry->nNeighbours[neigh]; - - bool symmetry = false; - - for (int j = 0; j < neigh_neighs; ++j) - { - if (m_geometry->neighbours[neigh][j] == cell) - { - symmetry = true; - break; - } - } - if (symmetry == false) - { - m_geometry->neighbours[neigh][neigh_neighs] = cell; - m_geometry->nNeighbours[neigh] += 1; - } - } - } - m_options.allocate(); - (*m_options) = TopoAutomatonOptions { 4.0f, 2.0f, 0.0f, true, true, true, false, 0x7FFFFFFF}; - - m_fixed_pairs.allocate(); - - for (int i = 0; i < NCaloCells; ++i) - { - int neighs[NMaxNeighbours]; - int num_valid_neighs = 0; - for (int j = 0; j < m_geometry->nNeighbours[i]; ++j) - { - const int this_neigh_idx = m_geometry->neighbours[i][j]; - if (this_neigh_idx >= i) - { - neighs[num_valid_neighs] = this_neigh_idx; - ++num_valid_neighs; - } - } - const int old_number = m_fixed_pairs->number; - - m_fixed_pairs->number += num_valid_neighs; - for (int j = 0; j < num_valid_neighs; ++j) - { - m_fixed_pairs->cellID[old_number + j] = i; - m_fixed_pairs->neighbourID[old_number + j] = neighs[j]; - } - - } - - return false; - } - -}; - -class ProcessingDataHolder -{ - public: - - Helpers::CPU_object<CellInfoArr> m_cell_info; - Helpers::CPU_object<CellStateArr> m_cell_state; - Helpers::CPU_object<PairsArr> m_pairs, m_half_pairs; - Helpers::CPU_object<ClusterInfoArr> m_clusters; - - Helpers::CUDA_object<CellInfoArr> m_cell_info_dev; - Helpers::CUDA_object<CellStateArr> m_cell_state_dev; - Helpers::CUDA_object<PairsArr> m_pairs_dev, m_half_pairs_dev; - Helpers::CUDA_object<ClusterInfoArr> m_clusters_dev; - - - //Temporaries for the method. - Helpers::CPU_object<TopoAutomatonTemporariesOld> m_temporaries; - - Helpers::CUDA_object<TopoAutomatonTemporariesOld> m_temporaries_dev; - - bool prepare(Helpers::CPU_object<CellInfoArr> && cell_info) - { - m_cell_info = cell_info; - - m_cell_state.allocate(); - m_clusters.allocate(); - m_clusters->number = 0; - m_pairs.allocate(); - m_pairs->number = 0; - m_temporaries.allocate(); - m_temporaries_dev.allocate(); - //Yes, unneeded for processing from scratch, - //but we'll save intermediate results. - - return false; - } - -}; - -#endif //TOPOAUTOMATONCLUSTEROPTIMIZER_DATAHOLDERS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/optimizer/TestDefinitions.h b/Calorimeter/CaloRecGPU/tools/optimizer/TestDefinitions.h deleted file mode 100644 index 006f899ba42df08c0af4a62895b51c94c00699c8..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/optimizer/TestDefinitions.h +++ /dev/null @@ -1,874 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef TOPOAUTOMATONCLUSTEROPTIMIZER_TEST_DEFINES_H -#define TOPOAUTOMATONCLUSTEROPTIMIZER_TEST_DEFINES_H - -#include <vector> -#include <string> -#include <fstream> -#include <thread> -#include <algorithm> -#include "CaloRecGPU/StandaloneDataIO.h" -#include "CaloRecGPU/CUDAFriendlyClasses.h" - -#include "OptimizerDataHolders.h" -#include "DefaultImplementation.h" - -#include <time.h> - - -void setup_cuda_device() -{ - int devID = 0; - cudaDeviceProp props; - - /* maybe we want something else here */ - cudaSetDevice(0); - - cudaGetDeviceProperties(&props, devID); - std::cout << "[CUDA] Device " << devID << " " << props.name << " with compute capability " << props.major << "." << props.minor << std::endl; -} - - -template <class T> -struct top_n_holder -//Simple, no-frills sorted vector. -//(We assume T provides a strong ordering.) -{ - private: - size_t m_nmax; - std::vector<T> m_buff; - public: - top_n_holder(const size_t sz): m_nmax(sz) - { - m_buff.reserve(m_nmax); - } - void try_add(const T & val) - { - auto greater_it = std::lower_bound(m_buff.begin(), m_buff.end(), val); - if (m_buff.size() < m_nmax) - { - m_buff.insert(greater_it, val); - } - else - { - if (greater_it == m_buff.begin()) - { - return; - } - else - { - for (auto it = m_buff.begin(); (it + 1) != greater_it; ++it) - { - *it = *(it + 1); - } - *(greater_it - 1) = val; - } - } - } - const T & operator[] (const size_t i) const - { - return m_buff[i]; - } - size_t size() const - { - return m_buff.size(); - } -}; - -struct loop_range -{ - using type = int; - //It's enough for our purposes, - //but might need to be bumped up to a int64_t to be sure... - - type start, stop, step; - - loop_range(const type begin = 0, const type end = 0, const type iter = 1): - start(begin), stop(end), step(iter) - { - } - - type get_iteration(const type num) const - //Returns the iteration number corresponding to the nearest - //element of the iteration not greater than `num` - //(that is, if `num` is not part of the numbers - // that can be reached given `start` and `step`, - // it's rounded down.) - { - return (num - start) / step ; - } - - type get_number_of_iterations() const - { - return (stop - start) / step + 1; - } - - type get_number_from_iteration(const type num) const - { - return start + num * step; - } - - type get_number_in_the_middle() const - //Rounded down in case there's an even number of iterations... - { - return get_number_from_iteration(get_number_of_iterations() / 2 - (get_number_of_iterations() % 2 == 0)); - } - - type last() const - { - return get_number_from_iteration(get_number_of_iterations() - 1); - //Not necessarily stop... - } - - type first() const - { - return start; - } - - template <class F, class ... Args> - void loop (F && f, Args && ... args) const - { - for (type i = start, count = 0; i <= stop; ++count, i += step ) - { - f(count, i, std::forward<Args>(args)...); - } - } - - -}; - - -namespace Timer -{ - using time_type = timespec; - time_type mark_time() - { - time_type ret; - clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ret); - return ret; - } - double time_diff(const time_type & begin, const time_type & end) - //In miliseconds... - { - return ((double) (end.tv_sec - begin.tv_sec)) * 1e3 + ((double) (end.tv_nsec - begin.tv_nsec)) * 1e-6; - } -}; - -union f_pointers -{ - void (*zero_loop) (ProcessingDataHolder &, const InstanceDataHolder &); - void (*one_loop) (ProcessingDataHolder &, const InstanceDataHolder &, const int); - void (*two_loop) (ProcessingDataHolder &, const InstanceDataHolder &, const int, const int); - void (*three_loop) (ProcessingDataHolder &, const InstanceDataHolder &, const int, const int, const int); - void (*four_loop) (ProcessingDataHolder &, const InstanceDataHolder &, const int, const int, const int, const int); -}; - -void prepare_data_for_event(ProcessingDataHolder & event_data, const ProcessingDataHolder & stored_data) -{ - event_data.m_cell_info_dev = stored_data.m_cell_info; - event_data.m_cell_state_dev = stored_data.m_cell_state; - event_data.m_pairs_dev = stored_data.m_pairs; - event_data.m_half_pairs_dev = stored_data.m_half_pairs; - event_data.m_clusters_dev = stored_data.m_clusters; - event_data.m_temporaries_dev = stored_data.m_temporaries; -} - -void get_data_from_event(const ProcessingDataHolder & event_data, ProcessingDataHolder & stored_data) -{ - stored_data.m_cell_info = event_data.m_cell_info_dev; - stored_data.m_cell_state = event_data.m_cell_state_dev; - stored_data.m_pairs = event_data.m_pairs_dev; - stored_data.m_half_pairs = event_data.m_half_pairs_dev; - stored_data.m_clusters = event_data.m_clusters_dev; - stored_data.m_temporaries = event_data.m_temporaries_dev; -} - -struct test_function -{ - constexpr static size_t s_max_num_loops = 4; - - loop_range::type num_loops; - f_pointers pointers; - loop_range block_sizes[s_max_num_loops]; - loop_range thread_numbers; - std::string label; - - static loop_range::type s_num_reps; - - static loop_range::type s_compress_loops_after; - - static loop_range::type s_keep_best; - - static std::string s_prefix; - - private: - - void unpack_loops(loop_range * const block_sizes) - { - } - - - void unpack_loops(loop_range * const block_sizes, const loop_range & lr) - { - *block_sizes = lr; - } - - template <class ... Loops> - void unpack_loops(loop_range * const block_sizes, const loop_range & lr, Loops && ... loops) - { - *block_sizes = lr; - unpack_loops(block_sizes + 1, std::forward<Loops>(loops)...); - } - - public: - - template <class Func, class ... Loops> - test_function(const std::string & lbl, Func && f, const loop_range & threads, Loops && ... loops) - { - label = lbl; - thread_numbers = threads; - num_loops = sizeof...(loops); - //We expect this to match. - //Please don't break it. - //Function pointers will barf and so on. - //Stack corruption, world exploding, - //computer on fire, - //ANYTHING CAN HAPPEN WILL HAPPEN - - if (num_loops > s_max_num_loops) - { - num_loops = 0; - std::cout << "ERROR: " << num_loops << " is too many loops for testing!" << std::endl; - pointers.zero_loop = nullptr; - } - else - { - unpack_loops(block_sizes, std::forward<Loops>(loops)...); - switch (num_loops) - { - case 0: - pointers.zero_loop = (decltype(pointers.zero_loop)) f; - break; - case 1: - pointers.one_loop = (decltype(pointers.one_loop)) f; - break; - case 2: - pointers.two_loop = (decltype(pointers.two_loop)) f; - break; - case 3: - pointers.three_loop = (decltype(pointers.three_loop)) f; - break; - case 4: - pointers.four_loop = (decltype(pointers.four_loop)) f; - break; - default: - break; - } - //I know, I know. - //std::variant is just around the corner... - //In C++17, that is. - } - - - } - - private: - - struct test_parameters - { - loop_range::type block_size[s_max_num_loops]; - loop_range::type n_threads; - template <class stream> - void print(stream & s, const loop_range::type num_loops, bool print_pretty = false) const - { - if (print_pretty) - { - s << n_threads << " |"; - for (loop_range::type i = 0; i < num_loops; ++i) - { - s << " " << block_size[i]; - } - } - else - { - s << n_threads; - for (loop_range::type i = 0; i < num_loops; ++i) - { - s << "," << block_size[i]; - } - } - } - }; - - double test_one_event(const test_parameters & params, ProcessingDataHolder & event_data, const InstanceDataHolder & instance_data) const - { - switch (num_loops) - { - case 0: - { - auto start = Timer::mark_time(); - pointers.zero_loop(event_data, instance_data); - auto finish = Timer::mark_time(); - return Timer::time_diff(start, finish); - } - case 1: - { - auto start = Timer::mark_time(); - pointers.one_loop(event_data, instance_data, params.block_size[0]); - auto finish = Timer::mark_time(); - return Timer::time_diff(start, finish); - } - case 2: - { - auto start = Timer::mark_time(); - pointers.two_loop(event_data, instance_data, params.block_size[0], params.block_size[1]); - auto finish = Timer::mark_time(); - return Timer::time_diff(start, finish); - } - case 3: - { - auto start = Timer::mark_time(); - pointers.three_loop(event_data, instance_data, params.block_size[0], params.block_size[1], params.block_size[2]); - auto finish = Timer::mark_time(); - return Timer::time_diff(start, finish); - } - case 4: - { - auto start = Timer::mark_time(); - pointers.four_loop(event_data, instance_data, params.block_size[0], params.block_size[1], params.block_size[2], params.block_size[3]); - auto finish = Timer::mark_time(); - return Timer::time_diff(start, finish); - } - default: - return 9e99; - } - } - - void test_one_thread(const loop_range::type thread_idx, - const test_parameters & params, - std::vector<double> & times, - ProcessingDataHolder & event_data, - const InstanceDataHolder & instance_data, - const std::vector<ProcessingDataHolder> & event_states) const - { - for (loop_range::type reps = 0; reps < s_num_reps; ++reps) - { - for (loop_range::type i = thread_idx; i < event_states.size(); i += params.n_threads) - { - prepare_data_for_event(event_data, event_states[i]); - times[i] += test_one_event(params, event_data, instance_data) / s_num_reps; - } - } - } - - struct test_result - { - double average; - double corrected_average; - template <class stream> - friend stream & operator << (stream & s, const test_result & tr) - { - return s << tr.corrected_average << " (" << tr.average << ")"; - } - }; - - test_result execute_test(std::ofstream & out, - const test_parameters & params, - std::vector<double> & times, - std::vector<ProcessingDataHolder> & thread_data, - const InstanceDataHolder & instance_data, - const std::vector<ProcessingDataHolder> & event_states, - const bool pretty_print = false) const - { - if (pretty_print) - { - out << "\n"; - } - params.print(out, num_loops, pretty_print); - if (pretty_print) - { - out << "\n"; - } - - times.clear(); - times.resize(event_states.size(), 0.); - - std::vector<std::thread> threads; - threads.reserve(params.n_threads); - - for (loop_range::type i = 0; i < params.n_threads; ++i) - { - threads.emplace_back( [ &, i]() - { - this->test_one_thread(i, params, times, thread_data[i], instance_data, event_states); - } ); - } - for (auto & thread : threads) - { - thread.join(); - } - - test_result ret {0., 0.}; - - if (pretty_print) - { - out << "\nTimes (ms): "; - for (const auto & t : times) - { - out << t << " "; - } - } - - std::sort(times.begin(), times.end()); - - const size_t ignore_last = std::min(size_t(30), size_t(times.size() / 8)); - - for (size_t i = 0; i < times.size(); ++i) - { - ret.average += times[i]; - if (i < times.size() - ignore_last) - { - ret.corrected_average += times[i]; - } - } - - const double corr_mu = ret.corrected_average / (times.size() - ignore_last); - const double exclude_factor = 20.0; - //We exclude times that are greater than 20 times the distance from the approximate average to the first value, - //assuming measurements are approximately symmetric to the average (e. g. normal distribution) - //and thus those way outside the curve must be wrong. - const double max_valid = corr_mu + (corr_mu - times[0]) * exclude_factor; - if (times[times.size() - ignore_last - 1] > exclude_factor) - { - for (int i = times.size() - ignore_last; i > 0; --i) - { - const double this_time = times[i - 1]; - if (this_time <= exclude_factor) - { - ret.corrected_average /= i; - break; - } - ret.corrected_average -= this_time; - } - } - else if (times[times.size() - ignore_last - 1] < exclude_factor) - { - bool broke = false; - for (int i = times.size() - ignore_last - 1; i < times.size(); ++i) - { - const double this_time = times[i]; - if (this_time > exclude_factor) - { - ret.corrected_average /= (i - 1); - broke = true; - break; - } - ret.corrected_average += this_time; - } - if (!broke) - { - ret.corrected_average /= times.size(); - } - } - else /*if (times[times.size() - ignore_last - 1] == exclude_factor)*/ - { - ret.corrected_average /= (times.size() - ignore_last); - } - - ret.average /= times.size(); - - if (pretty_print) - { - out << "\nAverage (ms): " << ret << std::endl; - } - - return ret; - } - - - - struct best_result - { - test_parameters parameters; - double throughput; - - friend bool operator > (const best_result & r1, const best_result & r2) - { - return r1.throughput > r2.throughput; - } - friend bool operator < (const best_result & r1, const best_result & r2) - { - return r1.throughput < r2.throughput; - } - template <class stream> - void print(stream & s, const loop_range::type num_loops, const bool pretty_print = false) const - { - if (pretty_print) - { - s << throughput << " ("; - parameters.print(s, num_loops, pretty_print); - s << ")"; - } - } - }; - - - best_result recurse_test(loop_range::type it_num, - std::ofstream & out, - test_parameters & params, - std::vector<double> & times, - std::vector<ProcessingDataHolder> & thread_data, - const InstanceDataHolder & instance_data, - const std::vector<ProcessingDataHolder> & event_states, - const bool pretty_print = false) const - { - best_result res {{}, 0.}; - if (it_num >= num_loops) - { - test_result tr = execute_test(out, params, times, thread_data, instance_data, event_states, pretty_print); - res.parameters = params; - res.throughput = 1e3 * params.n_threads / tr.corrected_average; //So we get events/second - if (!pretty_print) - { - out << "," << res.throughput << "\n"; - } - return res; - } - if ((it_num + 1) >= s_compress_loops_after) - { - top_n_holder<best_result> best_parameters(s_keep_best); - - block_sizes[it_num].loop([&](loop_range::type count, loop_range::type block_size) - { - params.block_size[it_num] = block_size; - - const best_result temp = this->recurse_test(num_loops, out, params, times, thread_data, instance_data, event_states, pretty_print); - - best_parameters.try_add(temp); - } - ); - - if (it_num + 1 >= num_loops) - { - if (best_parameters.size() > 0) - { - res = best_parameters[best_parameters.size() - 1]; - } - } - else - { - for (loop_range::type i = 0; i < best_parameters.size(); ++i) - { - params.block_size[it_num] = best_parameters[i].parameters.block_size[it_num]; - const best_result temp = recurse_test(it_num + 1, out, params, times, thread_data, instance_data, event_states, pretty_print); - res = std::max(res, temp); - } - } - } - else - { - block_sizes[it_num].loop([&](loop_range::type count, loop_range::type block_size) - { - params.block_size[it_num] = block_size; - - const best_result temp = this->recurse_test(it_num + 1, out, params, times, thread_data, instance_data, event_states, pretty_print); - - res = std::max(res, temp); - } - ); - } - return res; - } - - best_result thread_test(std::ofstream & out, - std::vector<double> & times, - std::vector<ProcessingDataHolder> & thread_data, - const InstanceDataHolder & instance_data, - const std::vector<ProcessingDataHolder> & event_states, - const bool pretty_print = false) - { - best_result res {{}, 0.}; - test_parameters params; - for (loop_range::type i = 0; i < num_loops; ++i) - { - params.block_size[i] = block_sizes[i].get_number_in_the_middle(); - } - thread_numbers.loop([&](loop_range::type count, loop_range::type num_threads) - { - params.n_threads = num_threads; - best_result temp = this->recurse_test(0, out, params, times, thread_data, instance_data, event_states, pretty_print); - - res = std::max(res, temp); - - if (pretty_print) - { - out << "\nBest: " << temp.throughput << " events / s | "; - } - - temp.throughput = 1.0 / (temp.throughput * num_threads); - //For pretty printing - - temp.print(out, num_loops, pretty_print); - - if (pretty_print) - { - out << "\n"; - } - } - ); - return res; - } - - - public: - - void test(std::vector<ProcessingDataHolder> & thread_data, - const InstanceDataHolder & instance_data, - const std::vector<ProcessingDataHolder> & event_states, - const bool pretty_print) - { - std::cout << "Testing " << label << " (" << thread_numbers.start << " " << thread_numbers.stop << " " << thread_numbers.step; - - for (loop_range::type i = 0; i < num_loops; ++i) - { - std::cout << " | " << block_sizes[i].start << " " << block_sizes[i].stop << " " << block_sizes[i].step; - } - - std::cout << ")" << std::endl; - - std::ofstream out(s_prefix + (s_prefix.size() > 0 ? "_" : "") + label + ".txt", std::ios_base::app); - - out << label << "\n"; - - std::vector<double> times; - - const best_result best = thread_test(out, times, thread_data, instance_data, event_states, pretty_print); - - if (pretty_print) - { - out << "\n\nOut of all: " << best.throughput << " events / s | " - << 1.0 / (best.throughput * best.parameters.n_threads) << " ms ("; - best.parameters.print(out, num_loops, pretty_print); - out << ")" << std::endl; - } - } - -}; - - -loop_range::type test_function::s_num_reps = 2; -loop_range::type test_function::s_compress_loops_after = 1; -loop_range::type test_function::s_keep_best = 5; -std::string test_function::s_prefix = ""; - - -#include "DefaultImplementation.h" - -#include "HalvedPairs.h" - - -namespace DefaultImplementation -{ - //The following are just for us to work with default parameters and function pointers. - //(Which won't work otherwise.) - - void signal_to_noise_def(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data) - { - signal_to_noise(holder, instance_data); - } - void cell_pairs_def(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data) - { - cell_pairs(holder, instance_data); - HalvedPairs::cell_pairs(holder, instance_data); - } - void cluster_growing_def(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data) - { - cluster_growing(holder, instance_data); - } - void finalize_clusters_def(ProcessingDataHolder & holder, const InstanceDataHolder & instance_data) - { - finalize_clusters(holder, instance_data); - } -} - -struct TestHolder -{ - private: - - std::vector<test_function> snr_funcs; - std::vector<test_function> pair_funcs; - std::vector<test_function> grow_funcs; - std::vector<test_function> finalize_funcs; - - std::vector<ProcessingDataHolder> event_states; - - - mutable std::vector<ProcessingDataHolder> thread_data; - - InstanceDataHolder instance_data; - - loop_range::type max_threads; - loop_range::type events_to_use; - - template <class Str> - bool ends_with(const Str & str1, const Str & str2) - { - if (str1.size() < str2.size()) - { - return false; - } - else - { - return (str1.substr(str1.size() - str2.size()) == str2); - } - } - - void setup_thread_data() - { - thread_data.resize(max_threads); - for (auto & thd : thread_data) - { - thd.m_cell_info_dev.allocate(); - thd.m_cell_state_dev.allocate(); - thd.m_pairs_dev.allocate(); - thd.m_half_pairs_dev.allocate(); - thd.m_clusters_dev.allocate(); - thd.m_temporaries_dev.allocate(); - } - } - - template <class F> - void process_one_thread(const loop_range::type thread_idx, F && f) - { - for (loop_range::type i = thread_idx; i < event_states.size(); i += max_threads) - { - prepare_data_for_event(thread_data[thread_idx], event_states[i]); - f(thread_data[thread_idx], instance_data); - get_data_from_event(thread_data[thread_idx], event_states[i]); - } - } - - template <class F> - void process_events(F && f) - { - std::vector<std::thread> threads; - threads.reserve(max_threads); - - for (loop_range::type i = 0; i < max_threads; ++i) - { - threads.emplace_back([ &, i]() - { - this->process_one_thread(i, std::forward<F>(f)); - }); - } - for (auto & thread : threads) - { - thread.join(); - } - std::cout << "\nDone." << std::endl; - } - - public: - - void load(const std::string & folder, const size_t max_events) - { - events_to_use = max_events; - auto fold_info = StandaloneDataIO::load_folder(folder, max_events, false); //Can skip loading clusters. - - instance_data.prepare(std::move(fold_info.geometry.begin()->second), std::move(fold_info.noise.begin()->second)); - instance_data.send(true); - //No need to keep this data on CPU. - - for (auto & kv : fold_info.cell_info) - { - event_states.emplace_back(); - event_states.back().prepare(std::move(kv.second)); - } - } - - void load(const std::string & folder) - { - load(folder, events_to_use); - } - - TestHolder(const loop_range::type evs = std::numeric_limits<loop_range::type>::max()): - max_threads(0), events_to_use(evs) - { - } - - TestHolder(const std::string & folder, const loop_range::type evs = std::numeric_limits<loop_range::type>::max()): - max_threads(0), events_to_use(evs) - { - load(folder); - } - - template <class ... T> - void add_snr_func(T && ... args) - //Template for perfect forwarding... - { - snr_funcs.emplace_back(std::forward<T>(args)...); - max_threads = std::max(max_threads, snr_funcs.back().thread_numbers.last()); - } - - template <class ... T> - void add_pair_func(T && ... args) - //Template for perfect forwarding... - { - pair_funcs.emplace_back(std::forward<T>(args)...); - max_threads = std::max(max_threads, pair_funcs.back().thread_numbers.last()); - } - - template <class ... T> - void add_grow_func(T && ... args) - //Template for perfect forwarding... - { - grow_funcs.emplace_back(std::forward<T>(args)...); - max_threads = std::max(max_threads, grow_funcs.back().thread_numbers.last()); - } - - template <class ... T> - void add_finalize_func(T && ... args) - //Template for perfect forwarding... - { - finalize_funcs.emplace_back(std::forward<T>(args)...); - max_threads = std::max(max_threads, finalize_funcs.back().thread_numbers.last()); - } - - void do_tests(const bool pretty_print = false) - { - setup_thread_data(); - for (auto & tf : snr_funcs) - { - tf.test(thread_data, instance_data, event_states, pretty_print); - } - - process_events(DefaultImplementation::signal_to_noise_def); - - for (auto & tf : pair_funcs) - { - tf.test(thread_data, instance_data, event_states, pretty_print); - } - - process_events(&DefaultImplementation::cell_pairs_def); - - for (auto & tf : grow_funcs) - { - tf.test(thread_data, instance_data, event_states, pretty_print); - } - - process_events(&DefaultImplementation::cluster_growing_def); - - for (auto & tf : finalize_funcs) - { - tf.test(thread_data, instance_data, event_states, pretty_print); - } - - } - -}; - -#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/plotter/ClusterPlotter.h b/Calorimeter/CaloRecGPU/tools/plotter/ClusterPlotter.h deleted file mode 100644 index e5e9bfbbdf041bc27e107c02617f32ed243c9bad..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/plotter/ClusterPlotter.h +++ /dev/null @@ -1,1043 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_TOOLS_CLUSTERPLOTTER_H -#define CALORECGPU_TOOLS_CLUSTERPLOTTER_H - -#include <vector> -#include <string> -#include <set> -#include <limits> -#include <utility> - -#include <functional> - -#include <sstream> -#include <numeric> -#include <iomanip> - -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/StandaloneDataIO.h" -#include "PlotterAuxDefines.h" - -#include "CxxUtils/checker_macros.h" - - -#ifdef ATLAS_CHECK_THREAD_SAFETY - - ATLAS_NO_CHECK_FILE_THREAD_SAFETY; - -#endif - -namespace CaloRecGPU{ - constexpr double default_min_similarity = 0.9; - constexpr double default_term_weight = 1.0; - constexpr double default_grow_weight = 250; - constexpr double default_seed_weight = 5000; -} - -struct EventData -{ - // for initialisers - static constexpr double maxDbl=std::numeric_limits<double>::max(); - static constexpr double lowestDbl = std::numeric_limits<double>::lowest(); - // - std::vector<ClusterData> ref_clusters, test_clusters; - std::vector<float> SNR_array; - std::vector<float> energy_array; - std::vector<int> ref_tag_array, test_tag_array; - std::vector<int> r2t_matches, t2r_matches; - std::vector<int> ref_unmatched, test_unmatched; - - std::vector<double> delta_R_array; - std::vector<double> delta_Et_rel_array; - //Indexed by reference cluster! - //(We seem to get less reference clusters, on average.) - - ClusterData min_vals[4], max_vals[4], unmatched_min_vals[4], unmatched_max_vals[4]; - - float min_reg_energy[4], max_reg_energy[4], min_reg_SNR[4], max_reg_SNR[4]; - //By region (all, central, end-cap or forward) - - float min_type_energy[4], max_type_energy[4], min_type_SNR[4], max_type_SNR[4]; - //By type (all, seed, grow, terminal) - - double min_delta_R[4] = {maxDbl, maxDbl,maxDbl, maxDbl}; - double max_delta_R[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_E[4]={maxDbl, maxDbl,maxDbl, maxDbl}; - double max_delta_E[4]= {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_Et[4] = {maxDbl, maxDbl,maxDbl, maxDbl}; - double max_delta_Et[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_E_rel[4] = {maxDbl, maxDbl,maxDbl, maxDbl}; - double max_delta_E_rel[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_Et_rel[4] = {maxDbl, maxDbl,maxDbl, maxDbl}; - double max_delta_Et_rel[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_eta[4], max_delta_eta[4]; - - double min_delta_phi[4], max_delta_phi[4]; - - int max_cluster_number[4], min_cluster_number[4]; - int max_unmatched_number[4], min_unmatched_number[4]; - - bool test_has_more[4]; - - int cluster_diff[4]; - - double cell_diff_frac_reg[4], cell_diff_frac_type[4]; - - std::vector<bool> cluster_same_cells[4]; - - void find_matches(const double min_similarity = CaloRecGPU::default_min_similarity, - const double term_weight = CaloRecGPU::default_term_weight, - const double grow_weight = CaloRecGPU::default_grow_weight, - const double seed_weight = CaloRecGPU::default_seed_weight) - { - std::vector<int> similarity_map(test_clusters.size() * ref_clusters.size(), 0.f); - - std::vector<double> ref_normalization(ref_clusters.size(), 0.f); - std::vector<double> test_normalization(test_clusters.size(), 0.f); - - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_tag = ref_tag_array[i]; - const int test_tag = test_tag_array[i]; - const double SNR = std::abs(SNR_array[i]); - const double weight = SNR * ( SNR > SNR_thresholds[2] ? seed_weight : - ( - SNR > SNR_thresholds[1] ? grow_weight : - ( - SNR > SNR_thresholds[0] ? term_weight : - 0 - ) - ) - ); - if (ref_tag >= 0 && test_tag >= 0) - { - similarity_map[test_tag * ref_clusters.size() + ref_tag] += weight; - } - if (ref_tag >= 0) - { - ref_normalization[ref_tag] += weight; - } - if (test_tag >= 0) - { - test_normalization[test_tag] += weight; - } - } - - /* - for (int tc = 0; tc < test_clusters.size(); ++tc) - { - for (int rc = 0; rc < ref_clusters.size(); ++rc) - { - const double simil = similarity_map[tc * ref_clusters.size() + rc]; - if (simil > 0) - { - std::cout << tc << " " << rc << " " << simil << " " << simil/ref_normalization[rc] << " " << simil/test_normalization[tc] << std::endl; - } - } - } - - std::cout << " --- " << std::endl; - */ - - - //In essence, the Gale-Shapley Algorithm - - std::vector<std::vector<int>> sorted_GPU_matches; - - sorted_GPU_matches.reserve(test_clusters.size()); - - for (size_t testc = 0; testc < test_clusters.size(); ++testc) - { - std::vector<int> sorter(ref_clusters.size()); - std::iota(sorter.begin(), sorter.end(), 0); - - std::sort(sorter.begin(), sorter.end(), - [&](const int a, const int b) - { - const double a_weight = similarity_map[testc * ref_clusters.size() + a]; - const double b_weight = similarity_map[testc * ref_clusters.size() + b]; - return a_weight > b_weight; - } - ); - - size_t wanted_size = 0; - - for (; wanted_size < sorter.size(); ++wanted_size) - { - const double match_weight = similarity_map[testc * ref_clusters.size() + sorter[wanted_size]] / test_normalization [testc]; - if (match_weight < min_similarity) - { - break; - } - } - - //Yeah, we could do a binary search for best worst-case complexity, - //but we are expecting 1~2 similar clusters and the rest garbage, - //so we're expecting only 1~2 iterations. - //This actually means all that sorting is way way overkill, - //but we must make sure in the most general case that this works... - - sorter.resize(wanted_size); - - sorted_GPU_matches.push_back(sorter); - } - - int num_iter = 0; - - constexpr int max_iter = 32; - - std::vector<double> matched_weights(ref_clusters.size(), -1.); - - std::vector<size_t> skipped_matching(test_clusters.size(), 0); - - for (size_t stop_counter = 0; stop_counter < test_clusters.size() && num_iter < max_iter; ++num_iter) - { - stop_counter = 0; - for (size_t testc = 0; testc < sorted_GPU_matches.size(); ++testc) - { - if (skipped_matching[testc] < sorted_GPU_matches[testc].size()) - { - const int match_c = sorted_GPU_matches[testc][skipped_matching[testc]]; - const double match_weight = similarity_map[testc * ref_clusters.size() + match_c] / ref_normalization[match_c]; - if (match_weight >= min_similarity && match_weight > matched_weights[match_c]) - { - const int prev_match = r2t_matches[match_c]; - if (prev_match >= 0) - { - ++skipped_matching[prev_match]; - --stop_counter; - } - r2t_matches[match_c] = testc; - matched_weights[match_c] = match_weight; - ++stop_counter; - } - else - { - ++skipped_matching[testc]; - } - } - else - { - ++stop_counter; - } - } - } - - ref_unmatched.clear(); - test_unmatched.clear(); - - for (size_t i = 0; i < r2t_matches.size(); ++i) - { - const int match = r2t_matches[i]; - if (r2t_matches[i] < 0) - { - ref_unmatched.push_back(i); - } - else - { - t2r_matches[match] = i; - } - } - - for (size_t i = 0; i < t2r_matches.size(); ++i) - { - if (t2r_matches[i] < 0) - { - test_unmatched.push_back(i); - } - } - - std::cout << "Matched in " << num_iter << " iterations: " - << r2t_matches.size() - ref_unmatched.size() << " / " << r2t_matches.size() << " || " - << t2r_matches.size() - test_unmatched.size() << " / " << t2r_matches.size() << " || " << ref_unmatched.size() << " | " << test_unmatched.size() << std::endl; - /* - { - std::vector<int> testc(t2r_matches.size(), 0); - - for (int i = 0; i < r2t_matches.size(); ++i) - { - const int res = r2t_matches[i]; - if (res >= 0) - { - testc[res] += 1; - } - } - - for (int i = 0; i < testc.size(); ++i) - { - if (testc[i] != 1) - { - std::cout << i << ": " << testc[i] << "\n"; - } - } - - std::cout << "\n\n----------" << std::endl; - } - */ - - } - - - EventData(const CaloRecGPU::GeometryArr & geometry, - const CaloRecGPU::CellNoiseArr & noise_arr, - const CaloRecGPU::CellInfoArr & cell_info, - const CaloRecGPU::CellStateArr & ref_cells, - const CaloRecGPU::CellStateArr & test_cells, - const CaloRecGPU::ClusterInfoArr & reference, - const CaloRecGPU::ClusterInfoArr & test, - const double min_similarity = CaloRecGPU::default_min_similarity, - const double term_weight = CaloRecGPU::default_term_weight, - const double grow_weight = CaloRecGPU::default_grow_weight, - const double seed_weight = CaloRecGPU::default_seed_weight): - ref_clusters(reference.number), - test_clusters(test.number), - SNR_array(CaloRecGPU::NCaloCells), - energy_array(CaloRecGPU::NCaloCells), - ref_tag_array(CaloRecGPU::NCaloCells), - test_tag_array(CaloRecGPU::NCaloCells), - r2t_matches(reference.number, -1), - t2r_matches(test.number, -1), - delta_R_array(reference.number, -1), - delta_Et_rel_array(reference.number, -2) - //delta_Et_rel >= -1 by definition - { - std::vector<int> ref_seed_cells(ref_clusters.size(), -1); - std::vector<int> test_seed_cells(test_clusters.size(), -1); - std::vector<float> ref_sc_snr(ref_clusters.size(), 0); - std::vector<float> test_sc_snr(test_clusters.size(), 0); - - for (int i = 0; i < 4; ++i) - { - set_to_highest(min_reg_energy[i]); - set_to_highest(min_reg_SNR[i]); - - set_to_lowest(max_reg_energy[i]); - set_to_lowest(max_reg_SNR[i]); - - - set_to_highest(min_type_energy[i]); - set_to_highest(min_type_SNR[i]); - - set_to_lowest(max_type_energy[i]); - set_to_lowest(max_type_SNR[i]); - - } - - - for (size_t i = 0; i < ref_clusters.size(); ++i) - { - ref_clusters[i].num_cells = 0; - } - - for (size_t i = 0; i < test_clusters.size(); ++i) - { - test_clusters[i].num_cells = 0; - } - - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const float this_energy = cell_info.energy[i]; - - const int this_gain = cell_info.gain[i]; - - - float this_SNR = 0.00001; - - if (!CaloRecGPU::GainConversion::is_bad_cell(this_gain)) - { - const int corrected_gain = CaloRecGPU::GainConversion::recover_invalid_seed_cell_gain(this_gain); - const float this_noise = noise_arr.noise[corrected_gain][i]; - - if (finite(this_noise) && this_noise > 0.0f) - { - this_SNR = std::abs(this_energy / this_noise); - } - if (this_SNR > SNR_thresholds[2] && CaloRecGPU::GainConversion::is_invalid_seed_cell(this_gain)) - { - this_SNR = (SNR_thresholds[2] + SNR_thresholds[1]) / 2; - //Hack to turn invalid seeds to growing. - //Does slightly skew the SNR metric, but... - } - } - - SNR_array[i] = this_SNR; - - const float this_scale_energy = this_energy * 1e-3; - - energy_array[i] = this_scale_energy; - - operate_on_regions(min_reg_energy, geometry.eta[i], [&](float * en) - { - *en = std::min(*en, this_scale_energy); - }); - operate_on_regions(max_reg_energy, geometry.eta[i], [&](float * en) - { - *en = std::max(*en, this_scale_energy); - }); - - operate_on_regions(min_reg_SNR, geometry.eta[i], [&](float * snr) - { - *snr = std::min(*snr, this_SNR); - }); - operate_on_regions(max_reg_SNR, geometry.eta[i], [&](float * snr) - { - *snr = std::max(*snr, this_SNR); - }); - - - operate_on_types(min_type_energy, this_SNR, [&](float * en) - { - *en = std::min(*en, this_scale_energy); - }); - operate_on_types(max_type_energy, this_SNR, [&](float * en) - { - *en = std::max(*en, this_scale_energy); - }); - - operate_on_types(min_type_SNR, geometry.eta[i], [&](float * snr) - { - *snr = std::min(*snr, this_SNR); - }); - operate_on_types(max_type_SNR, geometry.eta[i], [&](float * snr) - { - *snr = std::max(*snr, this_SNR); - }); - - int ref_tag = get_legacy_tag(ref_cells.clusterTag[i]); - int test_tag = get_legacy_tag(test_cells.clusterTag[i]); - - if (ref_tag >= 0 && ref_tag > int(ref_clusters.size())) - { - std::cout << "ERROR! Invalid tag: " << ref_tag << " " << std::hex << ref_cells.clusterTag[i] << std::dec << " (" << ref_clusters.size() << ")" << std::endl; - ref_tag = -1; - } - - if (test_tag >= 0 && test_tag > int(test_clusters.size())) - { - std::cout << "ERROR! Invalid tag: " << test_tag << " " << std::hex << test_cells.clusterTag[i] << std::dec << " (" << test_clusters.size() << ")" << std::endl; - test_tag = -1; - } - - ref_tag_array[i] = ref_tag; - test_tag_array[i] = test_tag; - - if (ref_tag >= 0) - { - if (this_SNR > ref_sc_snr[ref_tag]) - { - ref_sc_snr[ref_tag] = this_SNR; - ref_seed_cells[ref_tag] = i; - ++ref_clusters[ref_tag].num_cells; - } - } - if (test_tag >= 0) - { - if (this_SNR > test_sc_snr[test_tag]) - { - test_sc_snr[test_tag] = this_SNR; - test_seed_cells[test_tag] = i; - ++test_clusters[test_tag].num_cells; - } - } - - } - - - for (size_t i = 0; i < ref_clusters.size(); ++i) - { - ref_clusters[i].abs_energy = 0; - } - - for (size_t i = 0; i < test_clusters.size(); ++i) - { - test_clusters[i].abs_energy = 0; - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - - const int ref_tag = ref_tag_array[i]; - const int test_tag = test_tag_array[i]; - - const float this_energy = energy_array[i]; - - const float this_abs_energy = std::abs(this_energy); - - if (ref_tag >= 0 && ref_seed_cells[ref_tag] >= 0) - { - ref_clusters[ref_tag].abs_energy += this_abs_energy; - ref_clusters[ref_tag].eta_post += geometry.eta[i] * this_abs_energy; - ref_clusters[ref_tag].phi_post += proxim_ath(geometry.phi[i], geometry.phi[ref_seed_cells[ref_tag]]) * this_abs_energy; - ref_clusters[ref_tag].energy_post += this_energy; - } - if (test_tag >= 0 && test_seed_cells[test_tag] >= 0) - { - test_clusters[test_tag].abs_energy += this_abs_energy; - test_clusters[test_tag].eta_post += geometry.eta[i] * this_abs_energy; - test_clusters[test_tag].phi_post += proxim_ath(geometry.phi[i], geometry.phi[test_seed_cells[test_tag]]) * this_abs_energy; - test_clusters[test_tag].energy_post += this_energy; - } - } - - int ref_cluster_counter[4], test_cluster_counter[4]; - - for (int i = 0; i < 4; ++i) - { - set_to_lowest(max_vals[i]); - - set_to_highest(min_vals[i]); - - ref_cluster_counter[i] = 0; - test_cluster_counter[i] = 0; - } - - for (int i = 0; i < reference.number; ++i) - { - - const float energy = reference.clusterEnergy[i] * 1e-3; - const float transverse_energy = reference.clusterEt[i] * 1e-3; - //So the energies are in GeV! - const float eta = reference.clusterEta[i]; - const float phi = reference.clusterPhi[i]; - - ref_clusters[i].set(ref_clusters[i].num_cells, energy, transverse_energy, eta, phi); - - operate_on_regions(max_vals, eta, [&](ClusterData * clu) - { - clu->set_to_max(ref_clusters[i]); - }); - operate_on_regions(min_vals, eta, [&](ClusterData * clu) - { - clu->set_to_min(ref_clusters[i]); - }); - - operate_on_regions(ref_cluster_counter, eta, [](int * val) - { - *val = *val + 1; - } ); - - ref_clusters[i].eta_post /= ref_clusters[i].abs_energy; - ref_clusters[i].phi_post /= ref_clusters[i].abs_energy; - ref_clusters[i].phi_post = wrapPhi(ref_clusters[i].phi_post); - - ref_clusters[i].abs_energy *= 1e-3; - ref_clusters[i].energy_post *= 1e-3; - } - - for (int i = 0; i < test.number; ++i) - { - const float energy = test.clusterEnergy[i] * 1e-3; - const float transverse_energy = test.clusterEt[i] * 1e-3; - //So the energies are in GeV! - const float eta = test.clusterEta[i]; - const float phi = test.clusterPhi[i]; - - test_clusters[i].set(test_clusters[i].num_cells, energy, transverse_energy, eta, phi); - - operate_on_regions(max_vals, eta, [&](ClusterData * clu) - { - clu->set_to_max(test_clusters[i]); - }); - operate_on_regions(min_vals, eta, [&](ClusterData * clu) - { - clu->set_to_min(test_clusters[i]); - }); - - operate_on_regions(test_cluster_counter, eta, [](int * val) - { - *val = *val + 1; - } ); - - test_clusters[i].eta_post /= test_clusters[i].abs_energy; - test_clusters[i].phi_post /= test_clusters[i].abs_energy; - test_clusters[i].phi_post = wrapPhi(test_clusters[i].phi_post); - - test_clusters[i].abs_energy *= 1e-3; - test_clusters[i].energy_post *= 1e-3; - } - - for (int i = 0; i < 4; ++i) - { - max_cluster_number[i] = std::max(ref_cluster_counter[i], test_cluster_counter[i]); - min_cluster_number[i] = std::min(ref_cluster_counter[i], test_cluster_counter[i]); - test_has_more[i] = test_cluster_counter[i] > ref_cluster_counter[i]; - cluster_diff[i] = int(test_cluster_counter[i]) - int(ref_cluster_counter[i]); - } - - find_matches(min_similarity, term_weight, grow_weight, seed_weight); - - for (int i = 0; i < 4; ++i) - { - set_to_lowest(max_delta_R[i]); - set_to_highest(min_delta_R[i]); - - set_to_lowest(max_delta_E[i]); - set_to_highest(min_delta_E[i]); - - set_to_lowest(max_delta_E_rel[i]); - set_to_highest(min_delta_E_rel[i]); - - set_to_lowest(max_delta_Et[i]); - set_to_highest(min_delta_Et[i]); - - set_to_lowest(max_delta_Et_rel[i]); - set_to_highest(min_delta_Et_rel[i]); - - set_to_lowest(max_delta_eta[i]); - set_to_highest(min_delta_eta[i]); - - set_to_lowest(max_delta_phi[i]); - set_to_highest(min_delta_phi[i]); - - ref_cluster_counter[i] = 0; - test_cluster_counter[i] = 0; - - set_to_lowest(unmatched_max_vals[i]); - - set_to_highest(unmatched_min_vals[i]); - } - - for (size_t refc = 0; refc < r2t_matches.size(); ++refc) - { - const int this_match = r2t_matches[refc]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ref_clusters[refc]); - const ClusterData * match_cluster = &(test_clusters[this_match]); - - const double delta_R = match_cluster->delta_R(*this_cluster); - - const double delta_E = match_cluster->energy - this_cluster->energy; - - const double delta_E_rel = std::abs(delta_E / this_cluster->energy); - - const double delta_Et = match_cluster->transverse_energy - this_cluster->transverse_energy; - - const double delta_Et_rel = delta_Et / this_cluster->transverse_energy; - - - const double delta_eta = (match_cluster->eta - this_cluster->eta); - const double delta_phi = minDiffPhi(match_cluster->phi, this_cluster->phi); - - delta_R_array[refc] = delta_R; - - delta_Et_rel_array[refc] = delta_Et_rel; - - operate_on_regions(max_delta_R, ref_clusters[refc].eta, [&](double * dr) - { - *dr = std::max(*dr, delta_R); - }); - operate_on_regions(min_delta_R, ref_clusters[refc].eta, [&](double * dr) - { - *dr = std::min(*dr, delta_R); - }); - - operate_on_regions(max_delta_E, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::max(*dE, delta_E); - }); - operate_on_regions(min_delta_E, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::min(*dE, delta_E); - }); - - operate_on_regions(max_delta_Et, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::max(*dE, delta_Et); - }); - operate_on_regions(min_delta_Et, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::min(*dE, delta_Et); - }); - - operate_on_regions(max_delta_E_rel, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::max(*dE, delta_E_rel); - }); - operate_on_regions(min_delta_E_rel, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::min(*dE, delta_E_rel); - }); - - operate_on_regions(max_delta_Et_rel, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::max(*dE, delta_Et_rel); - }); - operate_on_regions(min_delta_Et_rel, ref_clusters[refc].eta, [&](double * dE) - { - *dE = std::min(*dE, delta_Et_rel); - }); - - operate_on_regions(max_delta_phi, ref_clusters[refc].eta, [&](double * dphi) - { - *dphi = std::max(*dphi, delta_phi); - }); - operate_on_regions(min_delta_phi, ref_clusters[refc].eta, [&](double * dphi) - { - *dphi = std::min(*dphi, delta_phi); - }); - - operate_on_regions(max_delta_eta, ref_clusters[refc].eta, [&](double * deta) - { - *deta = std::max(*deta, delta_eta); - }); - operate_on_regions(min_delta_eta, ref_clusters[refc].eta, [&](double * deta) - { - *deta = std::min(*deta, delta_eta); - }); - } - else - { - operate_on_regions(ref_cluster_counter, ref_clusters[refc].eta, [](int * val) - { - *val = *val + 1; - } ); - - operate_on_regions(unmatched_max_vals, ref_clusters[refc].eta, [&](ClusterData * clu) - { - clu->set_to_max(test_clusters[refc]); - }); - operate_on_regions(unmatched_min_vals, ref_clusters[refc].eta, [&](ClusterData * clu) - { - clu->set_to_min(test_clusters[refc]); - }); - } - //Unmatched clusters get DeltaR == -1 - } - - for (const auto test_nomatch : test_unmatched) - { - operate_on_regions(test_cluster_counter, test_clusters[test_nomatch].eta, [](int * val) - { - *val = *val + 1; - } ); - operate_on_regions(unmatched_max_vals, test_clusters[test_nomatch].eta, - [&](ClusterData * clu) - { - clu->set_to_max(test_clusters[test_nomatch]); - }); - operate_on_regions(unmatched_min_vals, test_clusters[test_nomatch].eta, - [&](ClusterData * clu) - { - clu->set_to_min(test_clusters[test_nomatch]); - }); - } - - for (int i = 0; i < 4; ++i) - { - max_unmatched_number[i] = std::max(ref_cluster_counter[i], test_cluster_counter[i]); - min_unmatched_number[i] = std::min(ref_cluster_counter[i], test_cluster_counter[i]); - } - - - int cell_diff_type[4]={}; - int cell_diff_reg[4]={}; - int cell_count_type[4]={}; - int cell_count_reg[4]={}; - - for (int i = 0; i < 4; ++i) - { - cluster_same_cells[i].resize(ref_clusters.size(), true); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_tag = get_legacy_tag(ref_cells.clusterTag[i]); - const int test_tag = get_legacy_tag(test_cells.clusterTag[i]); - if (ref_tag < 0 && test_tag < 0) - { - //Do nothing in this case: they are both off. - } - else if ( (ref_tag < 0 && test_tag >= 0) || (ref_tag >= 0 && test_tag < 0) || - r2t_matches[ref_tag] != test_tag || t2r_matches[test_tag] != ref_tag ) - { - operate_on_types(cell_diff_type, SNR_array[i], [](int * count) - { - (*count) = *count + 1; - }); - operate_on_regions(cell_diff_reg, geometry.eta[i], [](int * count) - { - (*count) = *count + 1; - }); - } - - if (ref_tag >= 0 && r2t_matches[ref_tag] != test_tag) - { - operate_on_types(cluster_same_cells, SNR_array[i], [&](std::vector<bool> * v) - { - (*v)[ref_tag] = false; - }); - } - if (test_tag >= 0 && t2r_matches[test_tag] != ref_tag && t2r_matches[test_tag] >= 0) - { - operate_on_types(cluster_same_cells, SNR_array[i], [&](std::vector<bool> * v) - { - (*v)[t2r_matches[test_tag]] = false; - }); - } - - operate_on_types(cell_count_type, SNR_array[i], [](int * count) - { - (*count) = *count + 1; - }); - operate_on_regions(cell_count_reg, geometry.eta[i], [](int * count) - { - (*count) = *count + 1; - }); - } - - for (int i = 0; i < 4; ++i) - { - cell_diff_frac_type[i] = double(cell_diff_type[i]) / double(cell_count_type[i]); - cell_diff_frac_reg[i] = double(cell_diff_reg[i]) / double(cell_count_reg[i]); - } - } - - -}; - -struct ClusterPlotter : public BasePlotter -{ - // - static constexpr double maxDbl=std::numeric_limits<double>::max(); - static constexpr double lowestDbl = std::numeric_limits<double>::lowest(); - // - std::vector<EventData> events; - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::GeometryArr> geometry; - CaloRecGPU::Helpers::CPU_object<CaloRecGPU::CellNoiseArr> noise; - - - double min_energy_cut = 1e-3; - - int min_size_cut = 128; - - - ClusterData min_vals[4], max_vals[4], unmatched_min_vals[4], unmatched_max_vals[4]; - - double min_delta_R[4], max_delta_R[4]; - - - double min_delta_E[4] = {maxDbl, maxDbl, maxDbl, maxDbl}; - double max_delta_E[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_Et[4] = {maxDbl, maxDbl, maxDbl, maxDbl}; - double max_delta_Et[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_E_rel[4] = {maxDbl, maxDbl, maxDbl, maxDbl}; - double max_delta_E_rel[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_Et_rel[4] = {maxDbl, maxDbl, maxDbl, maxDbl}; - double max_delta_Et_rel[4] = {lowestDbl, lowestDbl, lowestDbl, lowestDbl}; - - double min_delta_eta[4], max_delta_eta[4]; - - double min_delta_phi[4], max_delta_phi[4]; - - - float min_reg_energy[4], max_reg_energy[4], min_reg_SNR[4], max_reg_SNR[4]; - //By region (all, central, end-cap or forward) - - float min_type_energy[4], max_type_energy[4], min_type_SNR[4], max_type_SNR[4]; - //By type (all, seed, grow, terminal) - - int max_cluster_number[4], min_cluster_number[4]; - - int max_unmatched_number[4], min_unmatched_number[4]; - - int max_cluster_diff[4], min_cluster_diff[4]; - - ClusterPlotter(const ClusterPlotter &) = delete; - ClusterPlotter(ClusterPlotter &&) = default; - - ClusterPlotter & operator= (const ClusterPlotter &) = delete; - ClusterPlotter & operator= (ClusterPlotter &&) = default; - - virtual ~ClusterPlotter() - { - } - - - virtual size_t num() const - { - return events.size(); - } - - ClusterPlotter(const boost::filesystem::path & constants_folder_path, - const boost::filesystem::path & reference_folder_path, - const boost::filesystem::path & test_folder_path, - const int max_events = -1, - const std::string & filter = "", - const double min_similarity = CaloRecGPU::default_min_similarity, - const double term_weight = CaloRecGPU::default_term_weight, - const double grow_weight = CaloRecGPU::default_grow_weight, - const double seed_weight = CaloRecGPU::default_seed_weight) - { - - auto filename_filter = [&](const std::string & str) - { - return str.find(filter) == std::string::npos; - }; - - auto const_folder = StandaloneDataIO::load_folder_filter(filename_filter, constants_folder_path, - max_events, false, false, true, true); - //Don't load clusters; need geometry and noise, obviously, but also cells - //so we get a standard value for energies and gains - //(which, in the current version, should be outputted by the GPU output, - // so it should in principle be the same as the test_folder...) - - geometry = const_folder.geometry.begin()->second; - noise = const_folder.noise.begin()->second; - - auto ref_folder = StandaloneDataIO::load_folder_filter(filename_filter, reference_folder_path, - max_events, true, true, false, false); - auto test_folder = StandaloneDataIO::load_folder_filter(filename_filter, test_folder_path, - max_events, true, true, false, false); - - auto map_title_fixer = [](auto & map) - { - for (auto & it : map) - { - auto nodeHandler = map.extract(it.first); - std::string new_title = it.first; - auto endstring_it = std::remove_if(new_title.begin(), new_title.end(), [](const char & c) - { - return !std::isdigit(c); - }); - new_title.erase(endstring_it, new_title.end()); - - nodeHandler.key() = new_title; - map.insert(std::move(nodeHandler)); - } - }; - - map_title_fixer(ref_folder.cell_state); - map_title_fixer(ref_folder.clusters); - map_title_fixer(test_folder.cell_info); - map_title_fixer(test_folder.cell_state); - map_title_fixer(test_folder.clusters); - - for (const auto & it : test_folder.clusters) - { - events.emplace_back(*geometry, *noise, *(test_folder.cell_info.at(it.first)), - *(ref_folder.cell_state.at(it.first)), *(test_folder.cell_state.at(it.first)), - *(ref_folder.clusters.at(it.first)), *(test_folder.clusters.at(it.first)), - min_similarity, term_weight, grow_weight, seed_weight ); - } - - for (int i = 0; i < 4; ++i) - { - set_to_lowest(max_vals[i]); - - set_to_highest(min_vals[i]); - - set_to_highest(min_reg_energy[i]); - set_to_highest(min_reg_SNR[i]); - - set_to_lowest(max_reg_energy[i]); - set_to_lowest(max_reg_SNR[i]); - - set_to_highest(min_type_energy[i]); - set_to_highest(min_type_SNR[i]); - - set_to_lowest(max_type_energy[i]); - set_to_lowest(max_type_SNR[i]); - - set_to_lowest(max_delta_R[i]); - set_to_highest(min_delta_R[i]); - - set_to_lowest(max_cluster_number[i]); - set_to_highest(min_cluster_number[i]); - - set_to_lowest(max_unmatched_number[i]); - set_to_highest(min_unmatched_number[i]); - - set_to_lowest(max_cluster_diff[i]); - set_to_highest(min_cluster_diff[i]); - - - set_to_lowest(max_delta_eta[i]); - set_to_highest(min_delta_eta[i]); - - set_to_lowest(max_delta_phi[i]); - set_to_highest(min_delta_phi[i]); - - set_to_lowest(unmatched_max_vals[i]); - - set_to_highest(unmatched_min_vals[i]); - } - - for (const auto & ev : events) - { - for (int i = 0; i < 4; ++i) - { - min_vals[i].set_to_min(ev.min_vals[i]); - max_vals[i].set_to_max(ev.max_vals[i]); - - min_type_energy[i] = std::min(min_type_energy[i], ev.min_type_energy[i]); - min_type_SNR[i] = std::min(min_type_SNR[i], ev.min_type_SNR[i]); - min_reg_energy[i] = std::min(min_reg_energy[i], ev.min_reg_energy[i]); - min_reg_SNR[i] = std::min(min_reg_SNR[i], ev.min_reg_SNR[i]); - - max_type_energy[i] = std::max(max_type_energy[i], ev.max_type_energy[i]); - max_type_SNR[i] = std::max(max_type_SNR[i], ev.max_type_SNR[i]); - max_reg_energy[i] = std::max(max_reg_energy[i], ev.max_reg_energy[i]); - max_reg_SNR[i] = std::max(max_reg_SNR[i], ev.max_reg_SNR[i]); - - min_delta_R[i] = std::min(min_delta_R[i], ev.min_delta_R[i]); - max_delta_R[i] = std::max(max_delta_R[i], ev.max_delta_R[i]); - - min_delta_E[i] = std::min(min_delta_E[i], ev.min_delta_E[i]); - max_delta_E[i] = std::max(max_delta_E[i], ev.max_delta_E[i]); - - min_delta_Et[i] = std::min(min_delta_Et[i], ev.min_delta_Et[i]); - max_delta_Et[i] = std::max(max_delta_Et[i], ev.max_delta_Et[i]); - - min_delta_E_rel[i] = std::min(min_delta_E_rel[i], ev.min_delta_E_rel[i]); - max_delta_E_rel[i] = std::max(max_delta_E_rel[i], ev.max_delta_E_rel[i]); - - min_delta_Et_rel[i] = std::min(min_delta_Et_rel[i], ev.min_delta_Et_rel[i]); - max_delta_Et_rel[i] = std::max(max_delta_Et_rel[i], ev.max_delta_Et_rel[i]); - - min_cluster_number[i] = std::min( min_cluster_number[i], ev.max_cluster_number[i] ); - max_cluster_number[i] = std::max( max_cluster_number[i], ev.min_cluster_number[i] ); - - min_unmatched_number[i] = std::min( min_unmatched_number[i], ev.max_unmatched_number[i] ); - max_unmatched_number[i] = std::max( max_unmatched_number[i], ev.min_unmatched_number[i] ); - - min_cluster_diff[i] = std::min( min_cluster_diff[i], ev.cluster_diff[i] ); - max_cluster_diff[i] = std::max( max_cluster_diff[i], ev.cluster_diff[i] ); - - min_delta_eta[i] = std::min(min_delta_eta[i], ev.min_delta_eta[i]); - max_delta_eta[i] = std::max(max_delta_eta[i], ev.max_delta_eta[i]); - - min_delta_phi[i] = std::min(min_delta_phi[i], ev.min_delta_phi[i]); - max_delta_phi[i] = std::max(max_delta_phi[i], ev.max_delta_phi[i]); - - unmatched_min_vals[i].set_to_min(ev.unmatched_min_vals[i]); - unmatched_max_vals[i].set_to_max(ev.unmatched_max_vals[i]); - } - } - - populate_plots(); - - } - - private: - void populate_plots(); - -}; - -#include "ClusterPlotterPlots.h" - -#endif \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/plotter/ClusterPlotterPlots.h b/Calorimeter/CaloRecGPU/tools/plotter/ClusterPlotterPlots.h deleted file mode 100644 index 07b7344070a4ba072c41c065ab001db8f4a33e2e..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/plotter/ClusterPlotterPlots.h +++ /dev/null @@ -1,2876 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_TOOLS_CLUSTERPLOTTERPLOTS_H -#define CALORECGPU_TOOLS_CLUSTERPLOTTERPLOTS_H - -#include "CxxUtils/checker_macros.h" - -#ifdef ATLAS_CHECK_THREAD_SAFETY - - ATLAS_NO_CHECK_FILE_THREAD_SAFETY; - -#endif - -void ClusterPlotter::populate_plots() -{ - - std::cout << "Started populating plots." << std::endl; - -#ifndef RETFUNC -#define RETFUNC(...) [&]([[maybe_unused]] const int i){ return double(__VA_ARGS__); } -#endif - - add_plot<H1D_plotter_region>( - "diff_num_hist", - RETFUNC(min_cluster_diff[i]), - RETFUNC(max_cluster_diff[i]), - true, 0, "Difference in Number of Clusters Per Event", test_name + " Clusters - " + ref_name + " Clusters", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - group->global->Fill( ev.cluster_diff[0] ); - group->t1->Fill( ev.cluster_diff[1] ); - group->t2->Fill( ev.cluster_diff[2] ); - group->t3->Fill( ev.cluster_diff[3] ); - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "diff_num_rel_hist", - RETFUNC(double(min_cluster_diff[i]) / double(max_cluster_number[i])), - RETFUNC(double(max_cluster_diff[i]) / double(min_cluster_number[i])), - true, 0, "Relative Difference in Number of Clusters Per Event", "#(){" + test_name + " Clusters - " + ref_name + " Clusters}/" + ref_name + " Clusters", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - group->global->Fill( double(ev.cluster_diff[0]) / - double(ev.test_has_more[0] ? ev.min_cluster_number[0] : ev.max_cluster_number[0] ) ); - group->t1->Fill( double(ev.cluster_diff[1]) / - double(ev.test_has_more[1] ? ev.min_cluster_number[1] : ev.max_cluster_number[1] ) ); - group->t2->Fill( double(ev.cluster_diff[2]) / - double(ev.test_has_more[2] ? ev.min_cluster_number[2] : ev.max_cluster_number[2] ) ); - group->t3->Fill( double(ev.cluster_diff[3]) / - double(ev.test_has_more[3] ? ev.min_cluster_number[3] : ev.max_cluster_number[3] ) ); - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "frac_cell_diff_reg_hist", - RETFUNC(0), - RETFUNC(1), - false, 0, "Fraction of Cells With Different Clusters Per Region", "Fraction", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - group->global->Fill( ev.cell_diff_frac_reg[0] ); - group->t1->Fill( ev.cell_diff_frac_reg[1] ); - group->t2->Fill( ev.cell_diff_frac_reg[2] ); - group->t3->Fill( ev.cell_diff_frac_reg[3] ); - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_type>( - "frac_cell_diff_type_hist", - RETFUNC(0), - RETFUNC(1), - false, 0, "Fraction of Cells With Different Clusters Per Type", "Fraction", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - group->global->Fill( ev.cell_diff_frac_type[0] ); - - group->t1->Fill( ev.cell_diff_frac_type[1] ); - - group->t2->Fill( ev.cell_diff_frac_type[2] ); - - group->t3->Fill( ev.cell_diff_frac_type[3] ); - } - - }, - StyleKinds::joined); - - - add_plot<joined_plotter_type>("diff_cell_per_cluster", "Differently Assigned Cells Per Cluster", "Number of Differently Assigned Cells", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - add_plot<H1D_plotter_type>("diff_cell_per_cluster_ref", - RETFUNC(0), - RETFUNC(10000), - false, 0, std::string("Differently Assigned Cells Per Cluster") + " (" + ref_name + ")", "Number of Differently Assigned Cells", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.ref_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (ref_idx >= 0 && ev.r2t_matches[ref_idx] != test_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[ref_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - group->global->Fill(count[0][i]); - group->t1->Fill(count[1][i]); - group->t2->Fill(count[2][i]); - group->t3->Fill(count[3][i]); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>("diff_cell_per_cluster_test", - RETFUNC(0), - RETFUNC(10000), - false, 0, std::string("Differently Assigned Cells Per Cluster") + " (" + test_name + ")", "Number of Differently Assigned Cells", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.test_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (test_idx >= 0 && ev.t2r_matches[test_idx] != ref_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[test_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - group->global->Fill(count[0][i]); - group->t1->Fill(count[1][i]); - group->t2->Fill(count[2][i]); - group->t3->Fill(count[3][i]); - } - } - - }, - StyleKinds::test), - test_name); - - - - add_plot<joined_plotter_type>("rel_diff_cell_per_cluster", "Fraction of Differently Assigned Cells Per Cluster", "Differently Assigned Cells/Cluster Size", "Counts", - add_plot<H1D_plotter_type>("rel_diff_cell_per_cluster_ref", - RETFUNC(0), - RETFUNC(1), - false, 0, std::string("Fraction of Differently Assigned Cells Per Cluster") + " (" + ref_name + ")", "Differently Assigned Cells/Cluster Size", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.ref_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (ref_idx >= 0 && ev.r2t_matches[ref_idx] != test_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[ref_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - if (ev.ref_clusters[i].num_cells > min_size_cut) - { - group->global->Fill(double(count[0][i]) / ev.ref_clusters[i].num_cells); - group->t1->Fill(double(count[1][i]) / ev.ref_clusters[i].num_cells); - group->t2->Fill(double(count[2][i]) / ev.ref_clusters[i].num_cells); - group->t3->Fill(double(count[3][i]) / ev.ref_clusters[i].num_cells); - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>("rel_diff_cell_per_cluster_test", - RETFUNC(0), - RETFUNC(1), - false, 0, std::string("Fraction of Differently Assigned Cells Per Cluster") + " (" + test_name + ")", "Differently Assigned Cells/Cluster Size", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.test_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (test_idx >= 0 && ev.t2r_matches[test_idx] != ref_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[test_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - if (ev.test_clusters[i].num_cells > min_size_cut) - { - group->global->Fill(double(count[0][i]) / ev.test_clusters[i].num_cells); - group->t1->Fill(double(count[1][i]) / ev.test_clusters[i].num_cells); - group->t2->Fill(double(count[2][i]) / ev.test_clusters[i].num_cells); - group->t3->Fill(double(count[3][i]) / ev.test_clusters[i].num_cells); - } - } - } - - }, - StyleKinds::test), - test_name); - - - - add_plot<joined_plotter_type>("diff_cell_per_cluster_cumul", "Fraction of Clusters With More Differently Assigned Cells", "Differently Assigned Cells", "Fraction of Clusters With More Differences", - add_plot<H1D_plotter_type>("diff_cell_per_cluster_ref_cumul", - RETFUNC(0), - RETFUNC(10000), - false, -1, std::string("Differently Assigned Cells Per Cluster") + " (" + ref_name + ")", "Differently Assigned Cells", "Fraction of Clusters With More Differences", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.ref_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (ref_idx >= 0 && ev.r2t_matches[ref_idx] != test_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[ref_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - group->global->Fill(count[0][i]); - group->t1->Fill(count[1][i]); - group->t2->Fill(count[2][i]); - group->t3->Fill(count[3][i]); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>("diff_cell_per_cluster_test_cumul", - RETFUNC(0), - RETFUNC(10000), - false, -1, std::string("Differently Assigned Cells Per Cluster") + " (" + test_name + ")", "Differently Assigned Cells", "Fraction of Clusters With More Differences", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.test_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (test_idx >= 0 && ev.t2r_matches[test_idx] != ref_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[test_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - group->global->Fill(count[0][i]); - group->t1->Fill(count[1][i]); - group->t2->Fill(count[2][i]); - group->t3->Fill(count[3][i]); - } - } - - }, - StyleKinds::test), - test_name); - - - - add_plot<joined_plotter_type>("rel_diff_cell_per_cluster_cumul", "Fraction of Differently Assigned Cells Per Cluster", "Differently Assigned Cells/Cluster Size", "Fraction of Clusters With Greater Relative Differences", - add_plot<H1D_plotter_type>("rel_diff_cell_per_cluster_ref_cumul", - RETFUNC(0), - RETFUNC(1), - false, -1, std::string("Fraction of Differently Assigned Cells Per Cluster") + " (" + ref_name + ")", "Differently Assigned Cells/Cluster Size", "Fraction of Clusters With Greater Relative Differences", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.ref_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (ref_idx >= 0 && ev.r2t_matches[ref_idx] != test_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[ref_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - if (ev.ref_clusters[i].num_cells > min_size_cut) - { - group->global->Fill(double(count[0][i]) / ev.ref_clusters[i].num_cells); - group->t1->Fill(double(count[1][i]) / ev.ref_clusters[i].num_cells); - group->t2->Fill(double(count[2][i]) / ev.ref_clusters[i].num_cells); - group->t3->Fill(double(count[3][i]) / ev.ref_clusters[i].num_cells); - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>("rel_diff_cell_per_cluster_test_cumul", - RETFUNC(0), - RETFUNC(1), - false, -1, std::string("Fraction of Differently Assigned Cells Per Cluster") + " (" + test_name + ")", "Differently Assigned Cells/Cluster Size", "Fraction of Clusters With Greater Relative Differences", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.test_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (test_idx >= 0 && ev.t2r_matches[test_idx] != ref_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[test_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - if (ev.test_clusters[i].num_cells > min_size_cut) - { - group->global->Fill(double(count[0][i]) / ev.test_clusters[i].num_cells); - group->t1->Fill(double(count[1][i]) / ev.test_clusters[i].num_cells); - group->t2->Fill(double(count[2][i]) / ev.test_clusters[i].num_cells); - group->t3->Fill(double(count[3][i]) / ev.test_clusters[i].num_cells); - } - } - } - - }, - StyleKinds::test), - test_name); - - - - add_plot<H2D_plotter_type>( - "diff_cell_vs_delta_phi", - RETFUNC(0), - RETFUNC(10000), - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, "Number of Differently Assigned Cells versus #Delta #phi", "Differently Assigned Cells", "#Delta #phi", - [&](hist_group_2D * group) - { - - for (const auto & ev : events) - { - std::vector<int> count[4]; - - for (int i = 0; i < 4; ++i) - { - count[i].resize(ev.test_clusters.size(), 0); - } - - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (test_idx >= 0 && ev.t2r_matches[test_idx] != ref_idx) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[test_idx] += 1; - }); - } - else if (ref_idx >= 0 && ev.r2t_matches[ref_idx] >= 0 && test_idx != ev.r2t_matches[ref_idx]) - { - operate_on_types(count, this_SNR, - [&](std::vector<int> * vec) - { - (*vec)[ev.r2t_matches[ref_idx]] += 1; - }); - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - const int this_match = ev.t2r_matches[i]; - if (this_match >= 0) - { - const double dp = minDiffPhi(ev.test_clusters[i].phi, ev.ref_clusters[this_match].phi); - group->global->Fill(count[0][i], dp); - group->t1->Fill(count[1][i], dp); - group->t2->Fill(count[2][i], dp); - group->t3->Fill(count[3][i], dp); - } - } - } - }, - StyleKinds::joined); - - /* - add_plot<H1D_plotter_type>( - "diff_cell_per_cluster_alt", - RETFUNC(25000), - RETFUNC(-25000), - true, 0, "Clusters Cell Differences", test_name + " Cells - " + ref_name + " Cells", "Counts", - [&](hist_group_1D *group) - { - for (const auto & ev : events) - { - - std::vector<int> num_cells[2][4]; - for (int j = 0; j < 4; ++j) - { - num_cells[0][j].resize(ev.ref_clusters.size()); - } - for (int j = 0; j < 4; ++j) - { - num_cells[1][j].resize(ev.test_clusters.size()); - } - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (ref_idx >= 0) - { - operate_on_types(num_cells[0], this_SNR, [&](std::vector<int> * vec){ (*vec)[ref_idx] += 1; }); - } - if (test_idx >= 0) - { - operate_on_types(num_cells[1], this_SNR, [&](std::vector<int> * vec){ (*vec)[test_idx] += 1; }); - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const int this_cluster = i; - const int match_cluster = this_match; - group->global->Fill(num_cells[1][0][match_cluster] - num_cells[0][0][this_cluster]); - group->t1->Fill(num_cells[1][1][match_cluster] - num_cells[0][1][this_cluster]); - group->t2->Fill(num_cells[1][2][match_cluster] - num_cells[0][2][this_cluster]); - group->t3->Fill(num_cells[1][3][match_cluster] - num_cells[0][3][this_cluster]); - - } - } - } - - }, - StyleKinds::joined); - */ - add_plot<H1D_plotter_region>( - "delta_eta_hist", - RETFUNC(min_delta_eta[i]), - RETFUNC(max_delta_eta[i]), - true, 0, "Matched Clusters #Delta #eta", "#eta_{Cluster}^{(" + test_name + ")} - #eta_{Cluster}^{(" + ref_name + ")}", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ev.ref_clusters[i]); - const ClusterData * match_cluster = &(ev.test_clusters[this_match]); - const double delta_eta = (match_cluster->eta - this_cluster->eta); - fill_regions(group, match_cluster->eta, delta_eta); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "delta_phi_hist", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, 0, "Matched Clusters #Delta #phi", "#Delta #phi", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ev.ref_clusters[i]); - const ClusterData * match_cluster = &(ev.test_clusters[this_match]); - const double delta_phi = minDiffPhi(match_cluster->phi, this_cluster->phi); - fill_regions(group, match_cluster->eta, delta_phi); - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_region>( - "delta_phi_vs_cpu_size_hist", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, 0, "Matched Clusters #Delta #phi/CPU Size", "#Delta #phi/CPU Cluster Size", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ev.ref_clusters[i]); - const ClusterData * match_cluster = &(ev.test_clusters[this_match]); - const double delta_phi = minDiffPhi(match_cluster->phi, this_cluster->phi) / this_cluster->num_cells; - fill_regions(group, match_cluster->eta, delta_phi); - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H2D_plotter_region>( - "delta_phi_vs_cpu_size_hist2d", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - RETFUNC(0), - RETFUNC(max_vals[i].num_cells), - true, "Matched Clusters #Delta #phi versus CPU Size", "#Delta #phi", "CPU Cluster Size", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ev.ref_clusters[i]); - const ClusterData * match_cluster = &(ev.test_clusters[this_match]); - const double delta_phi = minDiffPhi(match_cluster->phi, this_cluster->phi); - fill_regions(group, match_cluster->eta, delta_phi, this_cluster->num_cells); - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_region>( - "delta_phi_vs_gpu_size_hist", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, 0, "Matched Clusters #Delta #phi/GPU Size", "#Delta #phi/GPU Cluster Size", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ev.ref_clusters[i]); - const ClusterData * match_cluster = &(ev.test_clusters[this_match]); - const double delta_phi = minDiffPhi(match_cluster->phi, this_cluster->phi) / match_cluster->num_cells; - fill_regions(group, match_cluster->eta, delta_phi); - } - } - } - - }, - StyleKinds::joined); - - - - add_plot<H2D_plotter_region>( - "delta_phi_vs_gpu_size_hist2d", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - RETFUNC(0), - RETFUNC(max_vals[i].num_cells), - true, "Matched Clusters #Delta #phi versus GPU Size", "#Delta #phi", "GPU Cluster Size", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const ClusterData * this_cluster = &(ev.ref_clusters[i]); - const ClusterData * match_cluster = &(ev.test_clusters[this_match]); - const double delta_phi = minDiffPhi(match_cluster->phi, this_cluster->phi); - fill_regions(group, match_cluster->eta, delta_phi, match_cluster->num_cells); - } - } - } - - }, - StyleKinds::joined); - - /************************************* - * DELTA R PLOTS * - *************************************/ - add_plot<H1D_plotter_region>( - "delta_R_hist", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, 0, "Matched Clusters Distance", "#Delta R", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, dr); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "delta_R_hist_cumul", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, -1, "Fraction of Matched Clusters at Distance", "#Delta R", "Fraction of More Distant Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, dr); - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H2D_plotter_region>( - "delta_R_vs_E", - RETFUNC(min_vals[i].energy), - RETFUNC(max_vals[i].energy), - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - true, "Matched Clusters Distance versus Energy", "E^{(" + ref_name + ")} [GeV]", "#Delta R", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].energy, dr); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H2D_plotter_region>( - "delta_R_vs_Et", - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - true, "Matched Clusters Distance versus Transverse Energy", "E_{T}^{(" + ref_name + ")} [GeV]", "#Delta R", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].transverse_energy, dr); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H2D_plotter_region>( - "delta_R_vs_Eta", - RETFUNC(min_vals[i].eta), - RETFUNC(max_vals[i].eta), - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - true, "Matched Clusters Distance versus #eta", "#eta^{(" + ref_name + ")}", "#Delta R", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].eta, dr); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H2D_plotter_region>( - "delta_R_vs_Phi", - RETFUNC(min_vals[i].phi), - RETFUNC(max_vals[i].phi), - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - true, "Matched Clusters Distance versus #phi", "#phi^{(" + ref_name + ")}", "#Delta R", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].phi, dr); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H2D_plotter_region>( - "delta_R_vs_size", - RETFUNC(min_vals[i].num_cells), - RETFUNC(max_vals[i].num_cells), - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, "Matched Clusters Distance versus Cluster Size", "Cluster Size^{(" + ref_name + ")} [# Cells]", "#Delta R", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].num_cells, dr); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H2D_plotter_type>( - "delta_cells_vs_delta_R", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - RETFUNC(-2500), - RETFUNC(2500), - true, "Matched Clusters Distance versus Difference in Number of Cells", "#Delta R", "#Delta Cells", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - std::vector<int> num_cells[2][4]; - for (int j = 0; j < 4; ++j) - { - num_cells[0][j].resize(ev.ref_clusters.size()); - } - for (int j = 0; j < 4; ++j) - { - num_cells[1][j].resize(ev.test_clusters.size()); - } - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const int ref_idx = ev.ref_tag_array[i]; - const int test_idx = ev.test_tag_array[i]; - const float this_SNR = ev.SNR_array[i]; - if (ref_idx >= 0) - { - operate_on_types(num_cells[0], this_SNR, [&](std::vector<int> * vec) - { - (*vec)[ref_idx] += 1; - }); - } - if (test_idx >= 0) - { - operate_on_types(num_cells[1], this_SNR, [&](std::vector<int> * vec) - { - (*vec)[test_idx] += 1; - }); - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - const double dr = ev.delta_R_array[i]; - const int this_cluster = i; - const int match_cluster = this_match; - group->global->Fill(dr, num_cells[1][0][match_cluster] - num_cells[0][0][this_cluster]); - group->t1->Fill(dr, num_cells[1][1][match_cluster] - num_cells[0][1][this_cluster]); - group->t2->Fill(dr, num_cells[1][2][match_cluster] - num_cells[0][2][this_cluster]); - group->t3->Fill(dr, num_cells[1][3][match_cluster] - num_cells[0][3][this_cluster]); - - } - } - } - - }, - StyleKinds::joined); - - /************************************* - * DELTA (ET) (REL) PLOTS * - *************************************/ - - - add_plot<H1D_plotter_region>( - "delta_E_hist", - RETFUNC(min_vals[i].energy), - RETFUNC(max_vals[i].energy), - true, 0, "Energy Difference", "#font[52]{E}^{(" + test_name + ")} - #font[52]{E}^{(" + ref_name + ")} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = ev.test_clusters[match_cluster].energy - ev.ref_clusters[i].energy; - fill_regions(group, ev.ref_clusters[i].eta, de); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "delta_Et_hist", - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - true, 0, "Transverse Energy Difference", "#font[52]{E}_{T}^{(" + test_name + ")} - #font[52]{E}_{T}^{(" + ref_name + ")} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = ev.test_clusters[match_cluster].transverse_energy - ev.ref_clusters[i].transverse_energy; - fill_regions(group, ev.ref_clusters[i].eta, de); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "delta_E_rel_hist", - RETFUNC(min_delta_E_rel[i]), - RETFUNC(max_delta_E_rel[i]), - true, 0, "Relative Energy Difference", "#(){E^{(" + test_name + ")} - E^{(" + ref_name + ")}}/E^{(" + ref_name + ")}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = (ev.test_clusters[match_cluster].energy - ev.ref_clusters[i].energy); - const double refe = ev.ref_clusters[i].energy; - if (std::abs(refe) < min_energy_cut) - { - continue; - } - fill_regions(group, ev.ref_clusters[i].eta, de / refe); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "delta_Et_rel_hist", - RETFUNC(min_delta_Et_rel[i]), - RETFUNC(max_delta_Et_rel[i]), - true, 0, "Relative Transverse Energy Difference", "#(){E_{T}^{(" + test_name + ")} - E_{T}^{(" + ref_name + ")}}/E_{T}^{(" + ref_name + ")}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double det = ev.delta_Et_rel_array[i]; - if (std::abs(ev.ref_clusters[i].transverse_energy) < min_energy_cut) - { - continue; - } - if (det >= -1) - { - fill_regions(group, ev.ref_clusters[i].eta, det); - } - } - } - - }, - StyleKinds::joined); - - add_plot<H2D_plotter_region>( - "delta_Et_rel_vs_Et", - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - RETFUNC(min_delta_Et_rel[i]), - RETFUNC(max_delta_Et_rel[i]), - true, "Relative Transverse Energy Difference versus Transverse Energy", "E_{T}^{(" + ref_name + ")} [GeV]", "#(){E_{T}^{(" + test_name + ")} - E_{T}^{(" + ref_name + ")}}/E_{T}^{(" + ref_name + ")}", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double det = ev.delta_Et_rel_array[i]; - if (std::abs(ev.ref_clusters[i].transverse_energy) < min_energy_cut) - { - continue; - } - if (det >= -1) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].transverse_energy, det); - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H2D_plotter_region>( - "Et1_vs_Et2", - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - true, "Transverse Energy Comparison", "E_{T}^{(" + ref_name + ")} [GeV]", "E_{T}^{(" + test_name + ")} [GeV]", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].transverse_energy, ev.test_clusters[this_match].transverse_energy); - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H2D_plotter_region>( - "E1_vs_E2", - RETFUNC(min_vals[i].energy), - RETFUNC(max_vals[i].energy), - RETFUNC(min_vals[i].energy), - RETFUNC(max_vals[i].energy), - true, "Energy Comparison", "E^{(" + ref_name + ")} [GeV]", "E^{(" + test_name + ")} [GeV]", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.r2t_matches.size(); ++i) - { - const int this_match = ev.r2t_matches[i]; - if (this_match >= 0) - { - fill_regions(group, ev.ref_clusters[i].eta, ev.ref_clusters[i].energy, ev.test_clusters[this_match].energy); - } - } - } - - }, - StyleKinds::joined); - - - /************************************* - * SEPARATE HISTOGRAMS * - *************************************/ - add_plot<joined_plotter_region>( - "cluster_eta_hist", "Cluster #eta", "#eta", "Counts", - add_plot<H1D_plotter_region>( - "cluster_eta_hist_ref", - RETFUNC(min_vals[i].eta), - RETFUNC(max_vals[i].eta), - true, 0, std::string("Cluster #eta") + " (" + ref_name + ")", "#eta", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & refc : ev.ref_clusters) - { - fill_regions(group, refc.eta, refc.eta); - } - } - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "cluster_eta_hist_test", - RETFUNC(min_vals[i].eta), - RETFUNC(max_vals[i].eta), - true, 0, std::string("Cluster #eta") + " (" + ref_name + ")", "#eta", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & testc : ev.test_clusters) - { - fill_regions(group, testc.eta, testc.eta); - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_region>( - "cluster_phi_hist", "Cluster #phi", "#phi", "Counts", - add_plot<H1D_plotter_region>( - "cluster_phi_hist_ref", - RETFUNC(min_vals[i].phi), - RETFUNC(max_vals[i].phi), - true, 0, std::string("Cluster #phi") + " (" + ref_name + ")", "#phi", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & refc : ev.ref_clusters) - { - fill_regions(group, refc.eta, refc.phi); - } - } - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "cluster_phi_hist_test", - RETFUNC(min_vals[i].phi), - RETFUNC(max_vals[i].phi), - true, 0, std::string("Cluster #phi") + " (" + ref_name + ")", "#phi", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & testc : ev.test_clusters) - { - fill_regions(group, testc.eta, testc.phi); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "Et_hist", "Cluster Transverse Energy", "#font[52]{E}_{T} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - add_plot<H1D_plotter_region>( - "Et_hist_ref", - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - true, 0, std::string("Cluster Transverse Energy") + " (" + ref_name + ")", "#font[52]{E}_{T} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & refc : ev.ref_clusters) - { - fill_regions(group, refc.eta, refc.transverse_energy); - } - } - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "Et_hist_test", - RETFUNC(min_vals[i].transverse_energy), - RETFUNC(max_vals[i].transverse_energy), - true, 0, std::string("Cluster Transverse Energy") + " (" + test_name + ")", "E_{T} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & testc : ev.test_clusters) - { - fill_regions(group, testc.eta, testc.transverse_energy); - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_region>( - "E_hist", "Cluster Energy", "#font[52]{E} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - add_plot<H1D_plotter_region>( - "E_hist_ref", - RETFUNC(min_vals[i].energy), - RETFUNC(max_vals[i].energy), - true, 0, std::string("Cluster Energy") + " (" + ref_name + ")", "#font[52]{E} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & refc : ev.ref_clusters) - { - fill_regions(group, refc.eta, refc.energy); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "E_hist_test", - RETFUNC(min_vals[i].energy), - RETFUNC(max_vals[i].energy), - true, 0, std::string("Cluster Energy") + " (" + test_name + ")", "#font[52]{E} [GeV]", (normalize ? "Average Number of Clusters per Event" : "Clusters"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & testc : ev.test_clusters) - { - fill_regions(group, testc.eta, testc.energy); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "cluster_size_hist", "Cluster Size", "Cluster Size [# Cells]", "Counts", - add_plot<H1D_plotter_region>( - "cluster_size_hist_ref", - RETFUNC(min_vals[i].num_cells), - RETFUNC(max_vals[i].num_cells), - false, 0, std::string("Cluster Size") + " (" + ref_name + ")", "Cluster Size [# Cells]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & refc : ev.ref_clusters) - { - fill_regions(group, refc.eta, refc.num_cells); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "cluster_size_hist_test", - RETFUNC(min_vals[i].num_cells), - RETFUNC(max_vals[i].num_cells), - false, 0, std::string("Cluster Size") + " (" + test_name + ")", "Cluster Size [# Cells]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & testc : ev.test_clusters) - { - fill_regions(group, testc.eta, testc.num_cells); - } - } - - }, - StyleKinds::test), - test_name); - add_plot<joined_plotter_region>( - "cluster_size_hist_cumul", "Cluster Size", "Cluster Size [# Cells]", "Fraction of Larger Clusters", - add_plot<H1D_plotter_region>( - "cluster_size_hist_ref_cumul", - RETFUNC(min_vals[i].num_cells), - RETFUNC(max_vals[i].num_cells), - false, -1, std::string("Cluster Size") + " (" + ref_name + ")", "Cluster Size [# Cells]", "Fraction of Larger Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & refc : ev.ref_clusters) - { - fill_regions(group, refc.eta, refc.num_cells); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "cluster_size_hist_test_cumul", - RETFUNC(min_vals[i].num_cells), - RETFUNC(max_vals[i].num_cells), - false, -1, std::string("Cluster Size") + " (" + test_name + ")", "Cluster Size [# Cells]", "Fraction of Larger Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto & testc : ev.test_clusters) - { - fill_regions(group, testc.eta, testc.num_cells); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "cluster_number_hist", "Number of Clusters Per Event", "Number of Clusters Per Event", (normalize ? "Fraction of Events" : "Events"), - add_plot<H1D_plotter_region>( - "cluster_number_hist_ref", - RETFUNC(min_cluster_number[i]), - RETFUNC(max_cluster_number[i]), - false, 0, std::string("Number of Clusters Per Event") + " (" + ref_name + ")", "Number of Clusters Per Event", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - int ref_counter[4] = {0, 0, 0, 0}; - - for (const auto & refc : ev.ref_clusters) - { - operate_on_regions(ref_counter, refc.eta, [](int * val) - { - *val = *val + 1; - } ); - } - - group->global->Fill(ref_counter[0]); - group->t1->Fill(ref_counter[1]); - group->t2->Fill(ref_counter[2]); - group->t3->Fill(ref_counter[3]); - - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "cluster_number_hist_test", - RETFUNC(min_cluster_number[i]), - RETFUNC(max_cluster_number[i]), - false, 0, std::string("Number of Clusters Per Event") + " (" + test_name + ")", "Number of Clusters Per Event", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - int test_counter[4] = {0, 0, 0, 0}; - for (const auto & testc : ev.test_clusters) - { - operate_on_regions(test_counter, testc.eta, [](int * val) - { - *val = *val + 1; - } ); - } - group->global->Fill(test_counter[0]); - group->t1->Fill(test_counter[1]); - group->t2->Fill(test_counter[2]); - group->t3->Fill(test_counter[3]); - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "term_cell_E_perc_hist", "Percentage of Cluster Energy From Terminal Cells", "%", "Counts", - add_plot<H1D_plotter_region>( - "term_cell_E_perc_hist_ref", - RETFUNC(0), - RETFUNC(100.), - false, 0, std::string("Percentage of Cluster Energy From Terminal Cells") + " (" + ref_name + ")", "%", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<double> ref_termE(ev.ref_clusters.size(), 0.); - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const double this_energy = ev.energy_array[i]; - const double this_absenergy = std::abs(this_energy); - const float this_SNR = ev.SNR_array[i]; - const int ref_idx = ev.ref_tag_array[i]; - if (this_SNR > SNR_thresholds[0] && this_SNR <= SNR_thresholds[1]) - { - if (ref_idx >= 0) - { - ref_termE[ref_idx] += this_absenergy; - } - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double res = 100. * ref_termE[i] / ev.ref_clusters[i].abs_energy; - fill_regions( group, ev.ref_clusters[i].eta, res ); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "term_cell_E_perc_hist_test", - RETFUNC(0), - RETFUNC(100.), - false, 0, std::string("Percentage of Cluster Energy From Terminal Cells") + " (" + test_name + ")", "%", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - std::vector<double> test_termE(ev.test_clusters.size(), 0.); - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const double this_energy = ev.energy_array[i]; - const double this_absenergy = std::abs(this_energy); - const float this_SNR = ev.SNR_array[i]; - const int test_idx = ev.test_tag_array[i]; - if (this_SNR > SNR_thresholds[0] && this_SNR <= SNR_thresholds[1]) - { - if (test_idx >= 0) - { - test_termE[test_idx] += this_absenergy; - } - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - const double res = 100. * test_termE[i] / ev.test_clusters[i].abs_energy; - fill_regions( group, ev.test_clusters[i].eta, res ); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<H2D_plotter_region>( - "term_cell_E_perc_vs_E_ref", - RETFUNC(min_vals[i].abs_energy), - RETFUNC(max_vals[i].abs_energy), - RETFUNC(0.), - RETFUNC(100.), - false, "Percentage of Cluster Energy From Terminal Cells versus Cluster Energy (" + ref_name + ")", "#||{E} [GeV]", "%", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - std::vector<double> ref_termE(ev.ref_clusters.size(), 0.); - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const double this_energy = ev.energy_array[i]; - const double this_absenergy = std::abs(this_energy); - const float this_SNR = ev.SNR_array[i]; - const int ref_idx = ev.ref_tag_array[i]; - if (this_SNR > SNR_thresholds[0] && this_SNR <= SNR_thresholds[1]) - { - if (ref_idx >= 0) - { - ref_termE[ref_idx] += this_absenergy; - } - } - } - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double res = 100. * ref_termE[i] / ev.ref_clusters[i].abs_energy; - fill_regions( group, ev.ref_clusters[i].eta, ev.ref_clusters[i].abs_energy, res ); - } - } - - }, - StyleKinds::ref); - - - add_plot<H2D_plotter_region>( - "term_cell_E_perc_vs_E_test", - RETFUNC(min_vals[i].abs_energy), - RETFUNC(max_vals[i].abs_energy), - RETFUNC(0.), - RETFUNC(100.), - false, "Percentage of Cluster Energy From Terminal Cells versus Cluster Energy (" + test_name + ")", "#||{E} [GeV]", "%", - [&](hist_group_2D * group) - { - for (const auto & ev : events) - { - std::vector<double> test_termE(ev.test_clusters.size(), 0.); - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - const double this_energy = ev.energy_array[i]; - const double this_absenergy = std::abs(this_energy); - const float this_SNR = ev.SNR_array[i]; - const int test_idx = ev.test_tag_array[i]; - if (this_SNR > SNR_thresholds[0] && this_SNR <= SNR_thresholds[1]) - { - if (test_idx >= 0) - { - test_termE[test_idx] += this_absenergy; - } - } - } - for (size_t i = 0; i < ev.test_clusters.size(); ++i) - { - const double res = 100. * test_termE[i] / ev.test_clusters[i].abs_energy; - fill_regions( group, ev.test_clusters[i].eta, ev.test_clusters[i].abs_energy, res ); - } - } - - }, - StyleKinds::test); - - /************************************* - * UNMATCHED STUFF * - *************************************/ - - add_plot<joined_plotter_region>( - "unmatched_number_hist", "Number of Unmatched Clusters per Event", "Unmatched Clusters Per Event", (normalize ? "Fraction of Events" : "Events"), - add_plot<H1D_plotter_region>( - "unmatched_number_hist_ref", - RETFUNC(min_unmatched_number[i]), - RETFUNC(max_unmatched_number[i]), - false, 0, std::string("Number of Unmatched Clusters per Event") + " (" + ref_name + ")", "Unmatched Clusters Per Event", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - int ref_counter[4] = {0, 0, 0, 0}; - - for (const auto refc : ev.ref_unmatched) - { - operate_on_regions(ref_counter, ev.ref_clusters[refc].eta, [](int * val) - { - *val = *val + 1; - } ); - } - - group->global->Fill(ref_counter[0]); - group->t1->Fill(ref_counter[1]); - group->t2->Fill(ref_counter[2]); - group->t3->Fill(ref_counter[3]); - - } - group->global->GetXaxis()->SetNdivisions(10, 0, 0); - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_number_hist_test", - RETFUNC(min_unmatched_number[i]), - RETFUNC(max_unmatched_number[i]), - false, 0, std::string("Number of Unmatched Clusters per Event") + " (" + test_name + ")", "Unmatched Clusters Per Event", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - int test_counter[4] = {0, 0, 0, 0}; - for (const auto testc : ev.test_unmatched) - { - operate_on_regions(test_counter, ev.test_clusters[testc].eta, [](int * val) - { - *val = *val + 1; - } ); - } - group->global->Fill(test_counter[0]); - group->t1->Fill(test_counter[1]); - group->t2->Fill(test_counter[2]); - group->t3->Fill(test_counter[3]); - } - group->global->GetXaxis()->SetNdivisions(10, 0, 0); - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_region>( - "unmatched_perc_hist", "Percentage of Unmatched Clusters per Event", "%", "Counts", - add_plot<H1D_plotter_region>( - "unmatched_perc_hist_ref", - RETFUNC(0), - RETFUNC(150.*double(max_unmatched_number[i]) / double(min_cluster_number[i])), - false, 0, std::string("Percentage of Unmatched Clusters per Event") + " (" + ref_name + ")", "%", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - int ref_counter[4] = {0, 0, 0, 0}; - for (const auto refc : ev.ref_unmatched) - { - operate_on_regions(ref_counter, ev.ref_clusters[refc].eta, [](int * val) - { - *val = *val + 1; - } ); - } - group->global->Fill(100.*double(ref_counter[0]) / - double(ev.test_has_more[0] ? ev.min_cluster_number[0] : ev.max_cluster_number[0] ) ); - group->t1->Fill(100.*double(ref_counter[1]) / - double(ev.test_has_more[1] ? ev.min_cluster_number[1] : ev.max_cluster_number[1] ) ); - group->t2->Fill(100.*double(ref_counter[2]) / - double(ev.test_has_more[2] ? ev.min_cluster_number[2] : ev.max_cluster_number[2] ) ); - group->t3->Fill(100.*double(ref_counter[3]) / - double(ev.test_has_more[3] ? ev.min_cluster_number[3] : ev.max_cluster_number[3] ) ); - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_perc_hist_test", - RETFUNC(0), - RETFUNC(150.*double(max_unmatched_number[i]) / double(min_cluster_number[i])), - false, 0, std::string("Percentage of Unmatched Clusters per Event") + " (" + test_name + ")", "%", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - - int test_counter[4] = {0, 0, 0, 0}; - for (const auto testc : ev.test_unmatched) - { - operate_on_regions(test_counter, ev.test_clusters[testc].eta, [](int * val) - { - *val = *val + 1; - } ); - } - - group->global->Fill(100.*double(test_counter[0]) / - double(ev.test_has_more[0] ? ev.max_cluster_number[0] : ev.min_cluster_number[0] ) ); - group->t1->Fill(100.*double(test_counter[1]) / - double(ev.test_has_more[1] ? ev.max_cluster_number[1] : ev.min_cluster_number[1] ) ); - group->t2->Fill(100.*double(test_counter[2]) / - double(ev.test_has_more[2] ? ev.max_cluster_number[2] : ev.min_cluster_number[2] ) ); - group->t3->Fill(100.*double(test_counter[3]) / - double(ev.test_has_more[3] ? ev.max_cluster_number[3] : ev.min_cluster_number[3] ) ); - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "unmatched_E_hist", "Unmatched Cluster Energy", "#font[52]{E} [GeV]", "Unmatched Clusters", - add_plot<H1D_plotter_region>( - "unmatched_E_hist_ref", - RETFUNC(unmatched_min_vals[i].energy), - RETFUNC(unmatched_max_vals[i].energy), - true, 0, std::string("Unmatched Cluster Energy") + " (" + ref_name + ")", "#font[52]{E} [GeV]", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto refc : ev.ref_unmatched) - { - fill_regions(group, ev.ref_clusters[refc].eta, ev.ref_clusters[refc].energy); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_E_hist_test", - RETFUNC(unmatched_min_vals[i].energy), - RETFUNC(unmatched_max_vals[i].energy), - true, 0, std::string("Unmatched Cluster Energy") + " (" + test_name + ")", "#font[52]{E} [GeV]", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto testc : ev.test_unmatched) - { - fill_regions(group, ev.test_clusters[testc].eta, ev.test_clusters[testc].energy); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "unmatched_Et_hist", "Unmatched Cluster Transverse Energy", "#font[52]{E}_{T} [GeV]", "Unmatched Clusters", - add_plot<H1D_plotter_region>( - "unmatched_Et_hist_ref", - RETFUNC(unmatched_min_vals[i].transverse_energy), - RETFUNC(unmatched_max_vals[i].transverse_energy), - true, 0, std::string("Unmatched Cluster Transverse Energy") + " (" + ref_name + ")", "#font[52]{E}_{T} [GeV]", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto refc : ev.ref_unmatched) - { - fill_regions(group, ev.ref_clusters[refc].eta, ev.ref_clusters[refc].transverse_energy); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_Et_hist_test", - RETFUNC(unmatched_min_vals[i].transverse_energy), - RETFUNC(unmatched_max_vals[i].transverse_energy), - true, 0, std::string("Unmatched Cluster Transverse Energy") + " (" + test_name + ")", "#font[52]{E}_{T} [GeV]", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto testc : ev.test_unmatched) - { - fill_regions(group, ev.test_clusters[testc].eta, ev.test_clusters[testc].transverse_energy); - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_region>( - "unmatched_sizes_hist", "Unmatched Cluster Sizes", "Unmatched Cluster Size [Cells]", "Unmatched Clusters", - add_plot<H1D_plotter_region>( - "unmatched_sizes_hist_ref", - RETFUNC(unmatched_min_vals[i].num_cells), - RETFUNC(unmatched_max_vals[i].num_cells), - false, 0, std::string("Unmatched Cluster Sizes") + " (" + ref_name + ")", "Unmatched Cluster Size [Cells]", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto refc : ev.ref_unmatched) - { - fill_regions(group, ev.ref_clusters[refc].eta, ev.ref_clusters[refc].num_cells); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_sizes_hist_test", - RETFUNC(unmatched_min_vals[i].num_cells), - RETFUNC(unmatched_max_vals[i].num_cells), - false, 0, std::string("Unmatched Cluster Sizes") + " (" + test_name + ")", "Unmatched Cluster Size [Cells]", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto testc : ev.test_unmatched) - { - fill_regions(group, ev.test_clusters[testc].eta, ev.test_clusters[testc].num_cells); - } - } - - }, - StyleKinds::test), - test_name); - add_plot<joined_plotter_region>( - "unmatched_sizes_hist_cumul", "Unmatched Cluster Sizes", "Cluster Size [# Cells]", "Fraction of Larger Clusters", - add_plot<H1D_plotter_region>( - "unmatched_sizes_hist_ref_cumul", - RETFUNC(unmatched_min_vals[i].num_cells), - RETFUNC(unmatched_max_vals[i].num_cells), - false, -1, std::string("Unmatched Cluster Sizes") + " (" + ref_name + ")", "Cluster Size [# Cells]", "Fraction of Larger Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto refc : ev.ref_unmatched) - { - fill_regions(group, ev.ref_clusters[refc].eta, ev.ref_clusters[refc].num_cells); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_sizes_hist_test_cumul", - RETFUNC(unmatched_min_vals[i].num_cells), - RETFUNC(unmatched_max_vals[i].num_cells), - false, -1, std::string("Unmatched Cluster Sizes") + " (" + test_name + ")", "Cluster Size [# Cells]", "Fraction of Larger Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto testc : ev.test_unmatched) - { - fill_regions(group, ev.test_clusters[testc].eta, ev.test_clusters[testc].num_cells); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "unmatched_eta_hist", "Unmatched Cluster #eta", "#eta", "Unmatched Clusters", - add_plot<H1D_plotter_region>( - "unmatched_eta_hist_ref", - RETFUNC(unmatched_min_vals[i].eta), - RETFUNC(unmatched_max_vals[i].eta), - true, 0, std::string("Unmatched Cluster #eta") + " (" + ref_name + ")", "#eta", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto refc : ev.ref_unmatched) - { - fill_regions(group, ev.ref_clusters[refc].eta, ev.ref_clusters[refc].eta); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_eta_hist_test", - RETFUNC(unmatched_min_vals[i].eta), - RETFUNC(unmatched_max_vals[i].eta), - true, 0, std::string("Unmatched Cluster #eta") + " (" + test_name + ")", "#eta", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto testc : ev.test_unmatched) - { - fill_regions(group, ev.test_clusters[testc].eta, ev.test_clusters[testc].eta); - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_region>( - "unmatched_phi_hist", "Unmatched Cluster #phi", "#phi", "Unmatched Clusters", - add_plot<H1D_plotter_region>( - "unmatched_phi_hist_ref", - RETFUNC(unmatched_min_vals[i].phi), - RETFUNC(unmatched_max_vals[i].phi), - true, 0, std::string("Unmatched Cluster #phi") + " (" + ref_name + ")", "#phi", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto refc : ev.ref_unmatched) - { - fill_regions(group, ev.ref_clusters[refc].eta, ev.ref_clusters[refc].phi); - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_region>( - "unmatched_phi_hist_test", - RETFUNC(unmatched_min_vals[i].phi), - RETFUNC(unmatched_max_vals[i].phi), - true, 0, std::string("Unmatched Cluster #phi") + " (" + test_name + ")", "#phi", "Unmatched Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (const auto testc : ev.test_unmatched) - { - fill_regions(group, ev.test_clusters[testc].eta, ev.test_clusters[testc].phi); - } - } - - }, - StyleKinds::test), - test_name); - - /************************************* - * SAME CELL CLUSTERS * - *************************************/ - add_plot<H1D_plotter_type>( - "equal_cells_delta_R", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, 0, "Same Cell Clusters Distance", "#Delta R", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(dr); - //All cells match - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(dr); - //Seed cells match - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(dr); - //Seed and grow cells match - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(dr); - //Seed, grow and terminal cells match - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "equal_cells_delta_R_cumul", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, -1, "Fraction of Same Cell Clusters at a Distance", "#Delta R", "Fraction of More Distant Clusters", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const double dr = ev.delta_R_array[i]; - if (dr >= 0) - { - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(dr); - //All cells match - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(dr); - //Seed cells match - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(dr); - //Seed and grow cells match - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(dr); - //Seed, grow and terminal cells match - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "equal_cells_delta_eta", - RETFUNC(min_delta_eta[i]), - RETFUNC(max_delta_eta[i]), - true, 0, "Same Cell Clusters #Delta #eta", "#eta^{(" + test_name + ")} - #eta^{(" + ref_name + ")}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_eta = ev.test_clusters[match_cluster].eta - ev.ref_clusters[i].eta; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_eta); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_eta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_eta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_eta); - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "equal_cells_delta_phi", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, 0, "Same Cell Clusters #Delta #phi", "#phi^{(" + test_name + ")} - #phi^{(" + ref_name + ")}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_phi = minDiffPhi(ev.test_clusters[match_cluster].phi, ev.ref_clusters[i].phi); - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_phi); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_phi); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_phi); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_phi); - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "equal_cells_delta_E", - RETFUNC(min_delta_E[i]), - RETFUNC(max_delta_E[i]), - true, 0, "Same Cell Clusters #Delta E", "E^{(" + test_name + ")} - E^{(" + ref_name + ")} [GeV]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = ev.test_clusters[match_cluster].energy - ev.ref_clusters[i].energy; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(de); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(de); - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "equal_cells_delta_E_rel", - RETFUNC(min_delta_E_rel[i]), - RETFUNC(max_delta_E_rel[i]), - true, 0, "Same Cell Clusters #Delta E/E", "#(){E^{(" + test_name + ")} - E^{(" + ref_name + ")}}/#(){E^{(" + ref_name + ")}}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = (ev.test_clusters[match_cluster].energy - ev.ref_clusters[i].energy) / std::abs(ev.ref_clusters[i].energy); - if (std::abs(ev.ref_clusters[i].energy) < min_energy_cut) - { - continue; - } - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(de); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(de); - } - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_type>( - "equal_cells_delta_Et", - RETFUNC(min_delta_Et[i]), - RETFUNC(max_delta_Et[i]), - true, 0, "Same Cell Clusters #Delta E_{T}", "E_{T}^{(" + test_name + ")} - E_{T}^{(" + ref_name + ")} [GeV]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = ev.test_clusters[match_cluster].transverse_energy - ev.ref_clusters[i].transverse_energy; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(de); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(de); - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "equal_cells_delta_Et_rel", - RETFUNC(min_delta_Et_rel[i]), - RETFUNC(max_delta_Et_rel[i]), - true, 0, "Same Cell Clusters #Delta E_{T}/E_{T}", "#(){E_T^{(" + test_name + ")} - E_T^{(" + ref_name + ")}}/#(){E_T^{(" + ref_name + ")}}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double de = (ev.test_clusters[match_cluster].transverse_energy - ev.ref_clusters[i].transverse_energy) / std::abs(ev.ref_clusters[i].transverse_energy); - if (std::abs(ev.ref_clusters[i].transverse_energy) < min_energy_cut) - { - continue; - } - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(de); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(de); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(de); - } - } - } - } - - }, - StyleKinds::joined); - - /************************************* - * POST-PROCESS CALCULATIONS * - *************************************/ - add_plot<joined_plotter_type>( - "post_calc_delta_R", "Post-Process Calculated Clusters Distance", "#Delta R", "Counts", - add_plot<H1D_plotter_type>( - "post_calc_delta_R_ref", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, 0, std::string("Post-Process Calculated Clusters Distance") + " (" + ref_name + ")", "#Delta R", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_ref = ev.ref_clusters[i].delta_R_post(); - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_ref); - } - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>( - "post_calc_delta_R_test", - RETFUNC(min_delta_R[i]), - RETFUNC(max_delta_R[i]), - false, 0, std::string("Post-Process Calculated Clusters Distance") + " (" + test_name + ")", "#Delta R", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_test = ev.test_clusters[match_cluster].delta_R_post(); - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_test); - } - } - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_type>( - "post_calc_delta_eta", "Post-Processed Calculated #Delta #eta", "#eta^{(Impl)} - #eta^{(Post)}", "Counts", - add_plot<H1D_plotter_type>( - "post_calc_delta_eta_ref", - RETFUNC(min_delta_eta[i]), - RETFUNC(max_delta_eta[i]), - true, 0, std::string("Post-Processed Calculated #Delta #eta") + " (" + ref_name + ")", "#eta^{(Impl)} - #eta^{(Post)}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_ref = ev.ref_clusters[i].eta - ev.ref_clusters[i].eta_post; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_ref); - } - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>( - "post_calc_delta_eta_test", - RETFUNC(min_delta_eta[i]), - RETFUNC(max_delta_eta[i]), - true, 0, std::string("Post-Processed Calculated #Delta #eta") + " (" + test_name + ")", "#eta^{(Impl)} - #eta^{(Post)}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_test = ev.test_clusters[match_cluster].eta - ev.ref_clusters[i].eta_post; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_test); - } - } - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_type>( - "post_calc_delta_phi", "Post-Processed Calculated #Delta #phi", "#phi^{(Impl)} - #phi^{(Post)}", "Counts", - add_plot<H1D_plotter_type>( - "post_calc_delta_phi_ref", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, 0, std::string("Post-Processed Calculated #Delta #phi") + " (" + ref_name + ")", "#phi^{(Impl)} - #phi^{(Post)}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_ref = minDiffPhi(ev.ref_clusters[i].phi, - ev.ref_clusters[i].phi_post); - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_ref); - } - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>( - "post_calc_delta_phi_test", - RETFUNC(min_delta_phi[i]), - RETFUNC(max_delta_phi[i]), - true, 0, std::string("Post-Processed Calculated #Delta #phi") + " (" + test_name + ")", "#phi^{(Impl)} - #phi^{(Post)}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_test = minDiffPhi(ev.test_clusters[match_cluster].phi, - ev.test_clusters[match_cluster].phi_post); - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_test); - } - } - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_type>( - "post_calc_delta_E", "Post-Processed Calculated #Delta E", "E^{(Impl)} - E^{(Post)} [GeV]", "Counts", - add_plot<H1D_plotter_type>( - "post_calc_delta_E_ref", - RETFUNC(min_delta_E[i]), - RETFUNC(max_delta_E[i]), - true, 0, std::string("Post-Processed Calculated #Delta E") + " (" + ref_name + ")", "E^{(Impl)} - E^{(Post)} [GeV]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_ref = ev.ref_clusters[i].energy - ev.ref_clusters[i].energy_post; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_ref); - } - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>( - "post_calc_delta_E_test", - RETFUNC(min_delta_E[i]), - RETFUNC(max_delta_E[i]), - true, 0, std::string("Post-Processed Calculated #Delta E") + " (" + test_name + ")", "E^{(Impl)} - E^{(Post)} [GeV]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_test = ev.test_clusters[match_cluster].energy - ev.test_clusters[match_cluster].energy_post; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_test); - } - } - } - } - - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_type>( - "post_calc_delta_E_rel", "Post-Processed Calculated #Delta E / E", "#(){E^{(Impl)} - E^{(Post)}}/#(){E^{(Post)}} ", "Counts", - add_plot<H1D_plotter_type>( - "post_calc_delta_E_rel_ref", - RETFUNC(min_delta_E_rel[i]), - RETFUNC(max_delta_E_rel[i]), - true, 0, std::string("Post-Processed Calculated #Delta E / E") + " (" + ref_name + ")", "#(){E^{(Impl)} - E^{(Post)}}/#(){E^{(Post)}} ", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_ref = (ev.ref_clusters[i].energy - ev.ref_clusters[i].energy_post) / ev.ref_clusters[i].energy_post; - if (std::abs(ev.ref_clusters[i].energy_post) < min_energy_cut || - std::abs(ev.test_clusters[match_cluster].energy_post) < min_energy_cut) - { - continue; - } - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_ref); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_ref); - } - } - } - } - - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_type>( - "post_calc_delta_E_rel_test", - RETFUNC(min_delta_E_rel[i]), - RETFUNC(max_delta_E_rel[i]), - true, 0, std::string("Post-Processed Calculated #Delta E / E") + " (" + test_name + ")", "#(){E^{(Impl)} - E^{(Post)}}/#(){E^{(Post)}} ", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta_test = (ev.test_clusters[match_cluster].energy - ev.test_clusters[match_cluster].energy_post) / ev.test_clusters[match_cluster].energy_post; - if (std::abs(ev.ref_clusters[i].energy_post) < min_energy_cut || - std::abs(ev.test_clusters[match_cluster].energy_post) < min_energy_cut) - { - continue; - } - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta_test); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta_test); - } - } - } - } - - }, - StyleKinds::test), - test_name); - - add_plot<H1D_plotter_type>( - "delta_post_E", - RETFUNC(min_delta_E[i]), - RETFUNC(max_delta_E[i]), - true, 0, "Post-Processed Calculated #Delta E", "E^{(" + test_name + ", Post)} - E^{(" + ref_name + ", Post)} [GeV]", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta = ev.test_clusters[match_cluster].energy_post - ev.ref_clusters[i].energy_post; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta); - } - } - } - } - - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_type>( - "delta_post_eta", - RETFUNC(min_delta_E[i]), - RETFUNC(max_delta_E[i]), - true, 0, "Post-Processed Calculated #Delta #eta", "#eta^{(" + test_name + ", Post)} - #eta^{(" + ref_name + ", Post)}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta = ev.test_clusters[match_cluster].eta_post - ev.ref_clusters[i].eta_post; - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta); - } - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_type>( - "delta_post_phi", - RETFUNC(min_delta_E[i]), - RETFUNC(max_delta_E[i]), - true, 0, "Post-Processed Calculated #Delta #phi", "#phi^{(" + test_name + ", Post)} - #phi^{(" + ref_name + ", Post)}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double delta = minDiffPhi(ev.test_clusters[match_cluster].phi_post, ev.ref_clusters[i].phi_post); - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta); - } - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_type>( - "delta_post_E_rel", - RETFUNC(1), - RETFUNC(-1), - true, 0, "Post-Processed Calculated #Delta E / E", "2 #times #(){E^{(" + test_name + ", Post)} - E^{(" + ref_name + ", Post)}}/#(){E^{(" + test_name + ", Post)} + E^{(" + ref_name + ", Post)}}", "Counts", - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (size_t i = 0; i < ev.ref_clusters.size(); ++i) - { - const int match_cluster = ev.r2t_matches[i]; - if (match_cluster >= 0) - { - const double E_ref = ev.ref_clusters[i].energy_post; - const double E_test = ev.test_clusters[i].energy_post; - const double delta = 2 * (E_test - E_ref) / (E_test + E_ref); - if (std::abs(E_ref + E_test) < 2 * min_energy_cut) - { - continue; - } - if (ev.cluster_same_cells[0][i]) - { - group->global->Fill(delta); - } - if (ev.cluster_same_cells[1][i]) - { - group->t1->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i]) - { - group->t2->Fill(delta); - } - if (ev.cluster_same_cells[1][i] && ev.cluster_same_cells[2][i] && ev.cluster_same_cells[3][i]) - { - group->t3->Fill(delta); - } - } - } - } - - }, - StyleKinds::joined); - - add_plot<H1D_plotter_region>( - "cell_E_dist", - RETFUNC(-5000), - RETFUNC(5000), - true, 0, "Cell Energy", "Cell Energy [GeV]", (normalize ? "Average Cells per Event" : "Cells"), - [&](hist_group_1D * group) - { - for (const auto & ev : events) - { - for (int i = 0; i < CaloRecGPU::NCaloCells; ++i) - { - fill_regions(group, geometry->eta[i], ev.energy_array[i] * 1e-3); - } - } - - }, - StyleKinds::joined); - - std::cout << "Finished populating plots." << std::endl; -} - -#undef RETFUNC - -#endif //CALORECGPU_TOOLS_CLUSTERPLOTTERPLOTS_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/plotter/PlotterAuxDefines.h b/Calorimeter/CaloRecGPU/tools/plotter/PlotterAuxDefines.h deleted file mode 100644 index e32efc50e7fb42886c7bda0d085cfb25c2387322..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/plotter/PlotterAuxDefines.h +++ /dev/null @@ -1,2583 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_TOOLS_PLOTTERAUXDEFINES_H -#define CALORECGPU_TOOLS_PLOTTERAUXDEFINES_H - -#include "CaloRecGPU/CUDAFriendlyClasses.h" -#include "CaloRecGPU/Helpers.h" - -#include <cmath> -#include <iostream> -#include <fstream> -#include <type_traits> -#include <string> -#include <vector> -#include <array> -#include <algorithm> -#include <map> -#include <memory> -#include <sstream> -#include <numeric> -#include <iomanip> -#include <functional> - -#include "CxxUtils/checker_macros.h" - -#ifdef ATLAS_CHECK_THREAD_SAFETY - - ATLAS_NO_CHECK_FILE_THREAD_SAFETY; - -#endif - -#include <TROOT.h> // the TROOT object is the entry point to the ROOT system -#include <TH1F.h> -#include <TCanvas.h> // graphics canvas -#include <TFile.h> -#include <TStyle.h> -#include <TPaveStats.h> -#include <TH2F.h> -#include <THStack.h> -#include <TLatex.h> -#include <TLine.h> -#include <TLegend.h> -#include <TPave.h> -#include <TPad.h> -#include <TMarker.h> -#include <TMultiGraph.h> -#include <TGraphErrors.h> - - - -inline bool sortCaloCellRatio(const int & cell1Tag, const int & cell2Tag) -{ - return cell1Tag > cell2Tag; -} - - -static constexpr const char * regNames[3] = {"central", "end-cap", "forward"}; -static constexpr float regCuts[3] = {1.5, 3.2, 5}; - -static constexpr float SNR_thresholds[3] = {0., 2., 4.}; - -template <class T> -constexpr T pi = CaloRecGPU::Helpers::Constants::pi<T>; - -template <class T> -T wrapPhi( const T phi ) -{ - return phi; - /* - const T comp = phi / pi<T>; - T ret = std::fmod(comp + 1, 2); - if (ret < 0) - { - ret += 2; - } - return (ret - 1) * pi<T>;*/ -} - -template <class T1, class T2> -decltype(std::declval<T1>() - std::declval<T2>()) minDiffPhi(const T1 phi1, const T2 phi2) -{ - using T = decltype(phi1 - phi2); - - const T phi_r1 = wrapPhi<T>(phi1); - const T phi_r2 = wrapPhi<T>(phi2); - - return wrapPhi<T>(phi_r1 - phi_r2); -} - -template <class Tb, class Ta> -inline Tb proxim_ath(const Tb b, const Ta a) -{ - const Ta aplus = a + pi<Ta>; - const Ta aminus = a - pi<Ta>; - Tb ret = b; - if (b > aplus) - { - do - { - ret -= 2 * pi<Tb>; - } - while (ret > aplus); - } - else if (b < aminus) - { - do - { - ret += 2 * pi<Tb>; - } - while (ret < aminus); - } - return ret; -} - -template <class Obj, class F, class ... Args> -void operate_on_regions (Obj * arr, const float eta, F && f, Args && ... args) -//f must take an Obj * that points to the object in which to operate. -{ - f(arr, std::forward<Args>(args)...); - const float abs_eta = std::abs(eta); - if (abs_eta < regCuts[0]) - { - f(arr + 1, std::forward<Args>(args)...); - } - else if (abs_eta < regCuts[1]) - { - f(arr + 2, std::forward<Args>(args)...); - } - else if (abs_eta < regCuts[2]) - { - f(arr + 3, std::forward<Args>(args)...); - } - else - { - //std::cout << "ERROR: " << abs_eta << " is outside expected eta parameters!" << std::endl; - } -} - -template <class Obj, class F, class ... Args> -void operate_on_types (Obj * arr, const float SNR, F && f, Args && ... args) -//f must take an Obj * that points to the object in which to operate. -{ - f(arr, std::forward<Args>(args)...); - if (SNR > SNR_thresholds[2]) - { - f(arr + 1, std::forward<Args>(args)...); - } - else if (SNR > SNR_thresholds[1]) - { - f(arr + 2, std::forward<Args>(args)...); - } - if (SNR > SNR_thresholds[0]) - { - f(arr + 3, std::forward<Args>(args)...); - } -} - -inline int get_legacy_tag(const CaloRecGPU::tag_type tag) -{ - if (CaloRecGPU::Tags::is_part_of_cluster(tag)) - { - return CaloRecGPU::Tags::get_index_from_tag(tag); - } - else - { - return -1; - } -} - -struct ClusterData; - -/*! - Put a variable to its most positive possible value. -*/ -template <class T> void set_to_highest(T && val) -{ - if constexpr (std::is_arithmetic_v< std::decay_t<T> >) - { - val = std::numeric_limits< std::decay_t<T> >::max(); - } - else if constexpr (std::is_same_v< std::decay_t<T>, ClusterData >) - { - val.set_all_to_highest(); - } - else - { - //Bleep. - } -} - -/*! - Put a variable to its most negative possible value. -*/ -template <class T> void set_to_lowest(T && val) -{ - if constexpr (std::is_arithmetic_v< std::decay_t<T> >) - { - val = std::numeric_limits< std::decay_t<T> >::lowest(); - } - else if constexpr (std::is_same_v< std::decay_t<T>, ClusterData >) - { - val.set_all_to_lowest(); - } - else - { - //Bleep. - } -} - -struct ClusterData -{ - int num_cells{}; - float energy{}; - float transverse_energy{}; - float eta{}; - float phi{}; - double abs_energy{}; - double eta_post{}; - double phi_post{}; - double energy_post{}; - - ClusterData(const int n_c = 0, const float en = 0, const float e_t = 0, const float h = 0, const float f = 0, const double abs_e = 0, - const double h_post = 0, const double f_post = 0, const double en_post = 0): - num_cells(n_c), energy(en), transverse_energy(e_t), eta(h), phi(f), abs_energy(abs_e), - eta_post(h_post), phi_post(f_post), energy_post(en_post) - { - } - - void set_all_to_highest() - { - set_to_highest(num_cells); - set_to_highest(energy); - set_to_highest(transverse_energy); - set_to_highest(eta); - set_to_highest(phi); - set_to_highest(abs_energy); - set_to_highest(eta_post); - set_to_highest(phi_post); - set_to_highest(energy_post); - } - - void set_all_to_lowest() - { - set_to_lowest(num_cells); - set_to_lowest(energy); - set_to_lowest(transverse_energy); - set_to_lowest(eta); - set_to_lowest(phi); - set_to_lowest(abs_energy); - set_to_lowest(eta_post); - set_to_lowest(phi_post); - set_to_lowest(energy_post); - } - - void set(const int n_num, const float n_ene, const float n_et, const float n_eta, const float n_phi, const double abs_e) - { - num_cells = n_num; - energy = n_ene; - transverse_energy = n_et; - eta = n_eta; - phi = n_phi; - abs_energy = abs_e; - } - - void set(const int n_num, const float n_ene, const float n_et, const float n_eta, const float n_phi) - { - num_cells = n_num; - energy = n_ene; - transverse_energy = n_et; - eta = n_eta; - phi = n_phi; - } - - void set_to_min(const int n_num, const float n_ene, const float n_et, - const float n_eta, const float n_phi, const double n_abs_e, - const double n_eta_post, const double n_phi_post, const double n_ene_post) - { - num_cells = std::min(num_cells, n_num); - energy = std::min(energy, n_ene); - transverse_energy = std::min(transverse_energy, n_et); - eta = std::min(eta, n_eta); - phi = std::min(phi, n_phi); - abs_energy = std::min(abs_energy, n_abs_e); - eta_post = std::min(eta_post, n_eta_post); - phi_post = std::min(phi_post, n_phi_post); - energy_post = std::min(energy_post, n_ene_post); - } - - - void set_to_max(const int n_num, const float n_ene, const float n_et, - const float n_eta, const float n_phi, const double n_abs_e, - const double n_eta_post, const double n_phi_post, const double n_ene_post) - { - num_cells = std::max(num_cells, n_num); - energy = std::max(energy, n_ene); - transverse_energy = std::max(transverse_energy, n_et); - eta = std::max(eta, n_eta); - phi = std::max(phi, n_phi); - abs_energy = std::max(abs_energy, n_abs_e); - eta_post = std::max(eta_post, n_eta_post); - phi_post = std::max(phi_post, n_phi_post); - energy_post = std::max(energy_post, n_ene_post); - } - - void set_to_min(const int n_num, const float n_ene, const float n_et, const float n_eta, const float n_phi, const double n_abs_e) - { - num_cells = std::min(num_cells, n_num); - energy = std::min(energy, n_ene); - transverse_energy = std::min(transverse_energy, n_et); - eta = std::min(eta, n_eta); - phi = std::min(phi, n_phi); - abs_energy = std::min(abs_energy, n_abs_e); - } - - void set_to_max(const int n_num, const float n_ene, const float n_et, const float n_eta, const float n_phi, const double n_abs_e) - { - num_cells = std::max(num_cells, n_num); - energy = std::max(energy, n_ene); - transverse_energy = std::max(transverse_energy, n_et); - eta = std::max(eta, n_eta); - phi = std::max(phi, n_phi); - abs_energy = std::max(abs_energy, n_abs_e); - } - - void set_to_min(const ClusterData & other) - { - set_to_min(other.num_cells, other.energy, other.transverse_energy, other.eta, - other.phi, other.abs_energy, other.eta_post, other.phi_post, other.energy_post); - } - - void set_to_max(const ClusterData & other) - { - set_to_max(other.num_cells, other.energy, other.transverse_energy, other.eta, - other.phi, other.abs_energy, other.eta_post, other.phi_post, other.energy_post); - } - - double delta_R(const double other_eta, const double other_phi) const - { - const double delta_eta = (eta - other_eta); - const double delta_phi = minDiffPhi(phi, other_phi); - - return std::sqrt(delta_eta * delta_eta + delta_phi * delta_phi); - } - - double delta_R(const ClusterData & other) const - { - return delta_R(other.eta, other.phi); - } - - double delta_R_post(const double other_eta, const double other_phi) const - { - const double delta_eta = (eta_post - other_eta); - const double delta_phi = minDiffPhi(phi_post, other_phi); - - return std::sqrt(delta_eta * delta_eta + delta_phi * delta_phi); - } - - double delta_R_post(const ClusterData & other) const - { - return delta_R_post(other.eta_post, other.phi_post); - } - - double delta_R_post() const - { - return delta_R(eta_post, phi_post); - } - -}; - - -struct BasePlotter -{ - int num_bins = 250; - - int canvas_x = 800, canvas_y = 600; - - std::string plotter_name{"Results"}; - std::string ref_name{"CPU"}, test_name{"GPU"}; - std::string label_type_1{"Seed"}, label_type_2{"Growing"}, label_type_3{"Terminal"}; - std::string suffix_type_1{"seed"}, suffix_type_2{"grow"}, suffix_type_3{"term"}; - std::string label_region_1{"Center"}, label_region_2{"End-Cap"}, label_region_3{"Forward"}; - std::string suffix_region_1{"center"}, suffix_region_2{"endcap"}, suffix_region_3{"forward"}; - std::vector<std::string> file_extensions = {std::string("pdf"), std::string("eps"), std::string("png")}; - std::vector<std::string> print_options = {std::string("EmbedFonts"), std::string(), std::string()}; - //This is only valid for PDF files! - //If file_extension is changed, this should be too! - - virtual size_t num() const - { - return 1; - } - - enum class StyleKinds - { - ref = 0, test, joined, Number - }; - - template <class T> struct PlotKinds - { - T ref; - T test; - T joined; - }; - - struct ElementStyle_t - { - Color_t color; - Style_t style; - float alpha; - int size; - }; - - struct GraphStyle_t - { - ElementStyle_t line, fill, marker; - }; - - std::array<GraphStyle_t, int(StyleKinds::Number)> - Styles{ GraphStyle_t{ ElementStyle_t{kBlue, 1, 1.0f, 1}, ElementStyle_t{kBlue, 0/*3004*/, 1.0f, 1}, ElementStyle_t{kBlue, 20, 1.0f, 1} }, //Ref - GraphStyle_t{ ElementStyle_t{kRed, 1, 1.0f, 1}, ElementStyle_t{kRed, 0/*3005*/, 1.0f, 1}, ElementStyle_t{kRed, 21, 1.0f, 1} }, //Test - GraphStyle_t{ ElementStyle_t{1, 1, 1.0f, 1}, ElementStyle_t{kGray + 1, 0, 1.0f, 1}, ElementStyle_t{kGray + 1, 22, 1.0f, 1} } }; //Joined - // Line, Fill - // (c, s, a) (c, s, a) - //So Styles[<kind>].<element>.<style> - //(e. g. Styles[StyleKinds::test].fill.color) - - inline static bool place_title = false; - inline static bool yaxis_bins = true; - inline static std::string plot_label = ""; - inline static bool place_ATLAS_label = true; - - static std::string stringify_pretty_number (const double num) - { - std::stringstream sstr; - sstr << std::setprecision(2) << std::fixed << num; - //std::cout << sstr.str() << std::endl; - return sstr.str(); - } - - static std::string approximate_string(const double val) - { - if (val >= 1e-2 && val <= 1e4) - { - return stringify_pretty_number(std::ceil(val * 1e3) * 1e-3); - } - else - { - double log = std::floor(std::log10(val)); - return stringify_pretty_number(std::ceil(val * pow(10, 3 - log)) * 1e-3) + " #times 10^{" + std::to_string(int(log)) + "}"; - } - } - - template <class Plot> - static std::string get_bin_label(Plot * gr) - { - const double width = gr->GetXaxis()->GetBinWidth(1); - std::string_view xtext = gr->GetXaxis()->GetTitle(); - const size_t pos_l = xtext.find_last_of('['); - const size_t pos_r = xtext.find_last_of(']'); - if (pos_l == std::string_view::npos || pos_r == std::string_view::npos || pos_r < pos_l) - { - return approximate_string(width); - } - else - { - return approximate_string(width) + " " + std::string(xtext.substr(pos_l + 1, pos_r - pos_l - 1)); - } - } - - static void ATLASLabel(Double_t x, Double_t y) - { - TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); - l.SetNDC(); - l.SetTextFont(72); - l.SetTextColor(1); - - double delx = 0.115 * 696 * gPad->GetWh() / (472 * gPad->GetWw()); - - l.DrawLatex(x, y, "ATLAS"); - if (plot_label != "") - { - TLatex p; - p.SetNDC(); - p.SetTextFont(42); - p.SetTextColor(1); - p.DrawLatex(x + delx, y, plot_label.c_str()); - // p.DrawLatex(x,y,"#sqrt{s}=900GeV"); - } - } - - inline static double labelstart_x = 0.625; - inline static double labelstart_y = 0.625; - //Well, legend, but... - inline static double labelsize_x = 0.25; - inline static double labelsize_y = 0.25; - - inline static double labeloffset_x = -0.225; - inline static double labeloffset_y = labelsize_y + 0.01; - //These control the position of the "ATLAS ..." label - //in relation to the plot legend. - - inline static double extraspacefactor_add = 0.; - inline static double extraspacefactor_multiply = 2.5; - - inline static bool normalize = false; - - inline static std::string extra_text = "#sqrt{s} = 13 TeV"; - - inline static double extralabeloffset_x = 0.075; - inline static double extralabeloffset_y = -0.04; - - static void extra_text_label(Double_t x, Double_t y) - { - TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize); - l.SetNDC(); - l.SetTextColor(1); - l.SetTextSize(0.04); - - l.DrawLatex(x, y, extra_text.c_str()); - } - - static void plot_one(TCanvas * cv, TH1 * gr, const std::string & file, - const std::vector<std::string> & exts, const std::vector<std::string> & options) - { - cv->cd(); - cv->Clear(); - if (place_ATLAS_label) - { - gStyle->SetOptStat(0000); - gStyle->SetOptTitle(place_title); - - if (yaxis_bins) - { - std::string title = gr->GetYaxis()->GetTitle(); - title += " / " + get_bin_label(gr); - gr->GetYaxis()->SetTitle(title.c_str()); - } - gr->SetMaximum(gr->GetMaximum() * extraspacefactor_multiply + extraspacefactor_add); - gr->Draw(""); - ATLASLabel(labelstart_x + labeloffset_x, labelstart_y + labeloffset_y); - extra_text_label(labelstart_x + extralabeloffset_x, labelstart_y + extralabeloffset_y); - } - else - { - gStyle->SetOptStat(2200); - gStyle->SetOptTitle(place_title); - gr->Draw(""); - } - cv->SetLogy(1); - for (size_t i = 0; i < exts.size(); ++i) - { - cv->SaveAs((file + "." + exts[i]).c_str(), options[i].c_str()); - } - } - - static void plot_one(TCanvas * cv, TH2 * gr, const std::string & file, - const std::vector<std::string> & exts, const std::vector<std::string> & options) - { - cv->cd(); - cv->Clear(); - if (place_ATLAS_label) - { - gStyle->SetOptStat(0000); - } - else - { - gStyle->SetOptStat(2200); - } - gStyle->SetOptTitle(place_title); - gr->Draw("colsz"); - cv->SetLogy(0); - cv->SetLogz(1); - for (size_t i = 0; i < exts.size(); ++i) - { - cv->SaveAs((file + "." + exts[i]).c_str(), options[i].c_str()); - } - } - - static void plot_one(TCanvas * cv, THStack * hs, const std::string & file, - const std::vector<std::string> & exts, const std::vector<std::string> & options) - { - cv->cd(); - cv->Clear(); - if (place_ATLAS_label) - { - gStyle->SetOptStat(0000); - } - else - { - gStyle->SetOptStat(2200); - } - gStyle->SetOptTitle(place_title); - std::vector <Style_t> styles(hs->GetNhists()); - TIter iter(hs->GetHists()); - iter.Begin(); - for (int i = 0; iter != iter.End(); iter(), ++i) - { - TH1F * hist = (TH1F *) *iter; - styles[i] = hist->GetLineStyle(); - hist->SetLineStyle(0); - if (place_ATLAS_label) - { - if (yaxis_bins) - { - std::string title = hist->GetYaxis()->GetTitle(); - title += " / " + get_bin_label(hist); - hist->GetYaxis()->SetTitle(title.c_str()); - } - hist->SetMaximum(hist->GetMaximum() * extraspacefactor_multiply + extraspacefactor_add); - } - } - hs->Draw("nostack"); - if (place_ATLAS_label) - { - if (yaxis_bins) - { - std::string title = hs->GetYaxis()->GetTitle(); - title += " / " + get_bin_label(hs); - hs->GetYaxis()->SetTitle(title.c_str()); - } - TLegend * leg = gPad->BuildLegend(labelstart_x, labelstart_y, labelstart_x + labelsize_x, labelstart_y + labelsize_y, "", "l"); - if (place_ATLAS_label) - { - ATLASLabel(labelstart_x + labeloffset_x, labelstart_y + labeloffset_y); - extra_text_label(labelstart_x + extralabeloffset_x, labelstart_y + extralabeloffset_y); - } - - leg->SetBorderSize(0); - leg->SetFillColor(0); - leg->SetTextFont(42); - leg->SetTextSize(0.0275); - } - else - { - gPad->BuildLegend(0.75, 0.75, 0.95, 0.95, ""); - } - iter.Begin(); - for (int i = 0; iter != iter.End(); iter(), ++i) - { - TH1F * hist = (TH1F *) *iter; - hist->SetLineStyle(styles[i]); - styles[i] = hist->GetFillStyle(); - hist->SetFillStyle(0); - } - hs->Draw("nostack same"); - iter.Begin(); - for (int i = 0; iter != iter.End(); iter(), ++i) - { - TH1F * hist = (TH1F *) *iter; - hist->SetFillStyle(styles[i]); - } - /* - //This is an attempt for plot overlap to work - //without transparency/patterns. - //It kinda does, but it isn't pretty... - std::vector<std::unique_ptr<TH1F>> temps; - TIter iter(hs->GetHists()); - for (iter.Begin(); iter != iter.End(); iter() ) - { - temps.emplace_back(std::make_unique<TH1F>(* ((TH1F *) *iter))); - temps.back()->SetLineColorAlpha(0, 0.); - //temps.back()->Rebin(, "", ); - for(int i = 1; i <= temps.back()->GetNbinsX(); ++i) - { - double min = temps.back()->GetBinContent(i); - TIter other = iter; - for (other.Begin(); other != iter; other()) - { - TH1F * otherhistptr = (TH1F *) *other; - min = std::min(min, otherhistptr->GetBinContent(i)); - } - temps.back()->SetBinContent(i, min); - //We could just set to 0, - //but I'll keep like this - //so we can check what happens - //if we drop SetLineColorAlpha(0,0.) - } - temps.back()->Draw("same"); - } - */ - gPad->Modified(); - gPad->Update(); - cv->Update(); - cv->SetLogy(1); - for (size_t i = 0; i < exts.size(); ++i) - { - cv->SaveAs((file + "." + exts[i]).c_str(), options[i].c_str()); - } - } - - static void plot_one(TCanvas * cv, TGraphErrors * gr, const std::string & file, - const std::vector<std::string> & exts, const std::vector<std::string> & options) - { - cv->cd(); - cv->Clear(); - if (place_ATLAS_label) - { - //gStyle->SetOptStat(0000); - gStyle->SetOptTitle(place_title); - - gr->SetMaximum(gr->GetMaximum() * extraspacefactor_multiply + extraspacefactor_add); - gr->Draw("ACP"); - ATLASLabel(labelstart_x + labeloffset_x, labelstart_y + labeloffset_y); - extra_text_label(labelstart_x + extralabeloffset_x, labelstart_y + extralabeloffset_y); - } - else - { - //gStyle->SetOptStat(2200); - gStyle->SetOptTitle(place_title); - gr->Draw("ACP"); - } - cv->SetLogy(0); - for (size_t i = 0; i < exts.size(); ++i) - { - cv->SaveAs((file + "." + exts[i]).c_str(), options[i].c_str()); - } - } - - static void plot_one(TCanvas * cv, TMultiGraph * mg, const std::string & file, - const std::vector<std::string> & exts, const std::vector<std::string> & options) - { - cv->cd(); - cv->Clear(); - /* - if (place_ATLAS_label) - { - gStyle->SetOptStat(0000); - } - else - { - gStyle->SetOptStat(2200); - } - */ - gStyle->SetOptTitle(place_title); - mg->Draw("ACP"); - if (place_ATLAS_label) - { - if (yaxis_bins) - { - std::string title = mg->GetYaxis()->GetTitle(); - title += " / " + get_bin_label(mg); - mg->GetYaxis()->SetTitle(title.c_str()); - } - TLegend * leg = gPad->BuildLegend(labelstart_x, labelstart_y, labelstart_x + labelsize_x, labelstart_y + labelsize_y, "", "l"); - if (place_ATLAS_label) - { - ATLASLabel(labelstart_x + labeloffset_x, labelstart_y + labeloffset_y); - extra_text_label(labelstart_x + extralabeloffset_x, labelstart_y + extralabeloffset_y); - } - - leg->SetBorderSize(0); - leg->SetFillColor(0); - leg->SetTextFont(42); - leg->SetTextSize(0.0275); - } - else - { - gPad->BuildLegend(0.75, 0.75, 0.95, 0.95, ""); - } - gPad->Modified(); - gPad->Update(); - cv->Update(); - cv->SetLogy(0); - for (size_t i = 0; i < exts.size(); ++i) - { - cv->SaveAs((file + "." + exts[i]).c_str(), options[i].c_str()); - } - } - - struct hist_stacker - { - std::unique_ptr<THStack> global, t1, t2, t3; - hist_stacker(const std::string & histname, const std::string & hist_title, const std::string & x_label, - const std::string & y_label, const std::string & t1_label, const std::string & t2_label, - const std::string & t3_label): - global(new THStack((histname + "_g").c_str(), (hist_title + " ;" + x_label + " ;" + y_label).c_str())), - t1(new THStack((histname + "_t1").c_str(), (hist_title + " (" + t1_label + ") ;" + x_label + " ;" + y_label).c_str())), - t2(new THStack((histname + "_t2").c_str(), (hist_title + " (" + t2_label + ") ;" + x_label + " ;" + y_label).c_str())), - t3(new THStack((histname + "_t3").c_str(), (hist_title + " (" + t3_label + ") ;" + x_label + " ;" + y_label).c_str())) - { - } - - hist_stacker(): global(nullptr), t1(nullptr), t2(nullptr), t3(nullptr) - { - } - }; - - struct graph_stacker - { - std::unique_ptr<TMultiGraph> global, t1, t2, t3; - graph_stacker(const std::string & graphname, const std::string & hist_title, const std::string & x_label, - const std::string & y_label, const std::string & t1_label, const std::string & t2_label, - const std::string & t3_label): - global(new TMultiGraph((graphname + "_g").c_str(), (hist_title + " ;" + x_label + " ;" + y_label).c_str())), - t1(new TMultiGraph((graphname + "_t1").c_str(), (hist_title + " (" + t1_label + ") ;" + x_label + " ;" + y_label).c_str())), - t2(new TMultiGraph((graphname + "_t2").c_str(), (hist_title + " (" + t2_label + ") ;" + x_label + " ;" + y_label).c_str())), - t3(new TMultiGraph((graphname + "_t3").c_str(), (hist_title + " (" + t3_label + ") ;" + x_label + " ;" + y_label).c_str())) - { - } - - graph_stacker(): global(nullptr), t1(nullptr), t2(nullptr), t3(nullptr) - { - } - }; - - template <class T> - struct hist_group - { - std::unique_ptr<T> global, t1, t2, t3; - - void set_style(const GraphStyle_t & gs) - { - global->SetLineColorAlpha(gs.line.color, gs.line.alpha); - global->SetLineStyle(gs.line.style); - global->SetFillColorAlpha(gs.fill.color, gs.fill.alpha); - global->SetFillStyle(gs.fill.style); - global->SetMarkerStyle(gs.marker.style); - global->SetMarkerColorAlpha(gs.marker.color, gs.marker.alpha); - global->SetMarkerSize(gs.marker.size); - - t1->SetLineColorAlpha(gs.line.color, gs.line.alpha); - t1->SetLineStyle(gs.line.style); - t1->SetFillColorAlpha(gs.fill.color, gs.fill.alpha); - t1->SetFillStyle(gs.fill.style); - t1->SetMarkerStyle(gs.marker.style); - t1->SetMarkerColorAlpha(gs.marker.color, gs.marker.alpha); - t1->SetMarkerSize(gs.marker.size); - - t2->SetLineColorAlpha(gs.line.color, gs.line.alpha); - t2->SetLineStyle(gs.line.style); - t2->SetFillColorAlpha(gs.fill.color, gs.fill.alpha); - t2->SetFillStyle(gs.fill.style); - t2->SetMarkerStyle(gs.marker.style); - t2->SetMarkerColorAlpha(gs.marker.color, gs.marker.alpha); - t2->SetMarkerSize(gs.marker.size); - - t3->SetLineColorAlpha(gs.line.color, gs.line.alpha); - t3->SetLineStyle(gs.line.style); - t3->SetFillColorAlpha(gs.fill.color, gs.fill.alpha); - t3->SetFillStyle(gs.fill.style); - t3->SetMarkerStyle(gs.marker.style); - t3->SetMarkerColorAlpha(gs.marker.color, gs.marker.alpha); - t3->SetMarkerSize(gs.marker.size); - } - - }; - - struct hist_group_1D : public hist_group<TH1F> - { - hist_group_1D(const std::array<double, 4> & min, const std::array<double, 4> & max, const int num_bins, - const std::string & histname, const std::string & hist_title, const std::string & x_label, - const std::string & y_label, const std::string & t1_label, const std::string & t2_label, - const std::string & t3_label) - { - global.reset(new TH1F( (histname + "_g").c_str(), (hist_title + " ;" + x_label + " ;" + y_label).c_str(), - num_bins, min[0], max[0])); - t1.reset(new TH1F( (histname + "_t1").c_str(), (hist_title + " (" + t1_label + ") ;" + x_label + " ;" + y_label).c_str(), - num_bins, min[1], max[1])); - t2.reset(new TH1F( (histname + "_t2").c_str(), (hist_title + " (" + t2_label + ") ;" + x_label + " ;" + y_label).c_str(), - num_bins, min[2], max[2])); - t3.reset(new TH1F( (histname + "_t3").c_str(), (hist_title + " (" + t3_label + ") ;" + x_label + " ;" + y_label).c_str(), - num_bins, min[3], max[3])); - /* - std::cout << "Building " << histname << "\nRanges: "; - for (int i = 0; i < 4; ++i) - { - std::cout << "(" << min[i] << " | " << max[i] << ")"; - } - std::cout << std::endl; - */ - } - - hist_group_1D(const std::array<double, 4> & min, const std::array<double, 4> & max, const int num_bins, - const std::string & histname, const std::string & hist_title) - { - global.reset(new TH1F( (histname + "_g").c_str(), hist_title.c_str(), num_bins, min[0], max[0])); - t1.reset(new TH1F( (histname + "_t1").c_str(), hist_title.c_str(), num_bins, min[1], max[1])); - t2.reset(new TH1F( (histname + "_t2").c_str(), hist_title.c_str(), num_bins, min[2], max[2])); - t3.reset(new TH1F( (histname + "_t3").c_str(), hist_title.c_str(), num_bins, min[3], max[3])); - /* - std::cout << "Building " << histname << "\nRanges: "; - for (int i = 0; i < 4; ++i) - { - std::cout << "(" << min[i] << " | " << max[i] << ")"; - } - std::cout << std::endl; - */ - } - - template <class F> - void populate (F && f, const int cumulative, const size_t num_events) - { - f(this); - if (cumulative != 0) - { - global->Sumw2(false); - t1->Sumw2(false); - t2->Sumw2(false); - t3->Sumw2(false); - std::unique_ptr<TH1F> a((TH1F *) global->GetCumulative(cumulative > 0)); - std::unique_ptr<TH1F> b((TH1F *) t1->GetCumulative(cumulative > 0)); - std::unique_ptr<TH1F> c((TH1F *) t2->GetCumulative(cumulative > 0)); - std::unique_ptr<TH1F> d((TH1F *) t3->GetCumulative(cumulative > 0)); - a->Scale(1. / global->GetEntries()); - b->Scale(1. / t1->GetEntries()); - c->Scale(1. / t2->GetEntries()); - d->Scale(1. / t3->GetEntries()); - a.swap(global); - b.swap(t1); - c.swap(t2); - d.swap(t3); - global->Sumw2(false); - t1->Sumw2(false); - t2->Sumw2(false); - t3->Sumw2(false); - } - else if (normalize) - { - global->Scale(1. / num_events); - t1->Scale(1. / num_events); - t2->Scale(1. / num_events); - t3->Scale(1. / num_events); - global->Sumw2(false); - t1->Sumw2(false); - t2->Sumw2(false); - t3->Sumw2(false); - } - } - - - void add_to_stack(hist_stacker & stack) - { - stack.global->Add(global.get()); - stack.t1->Add(t1.get()); - stack.t2->Add(t2.get()); - stack.t3->Add(t3.get()); - } - - }; - - struct hist_group_2D : public hist_group<TH2F> - { - hist_group_2D(const std::array<double, 4> & min_x, const std::array<double, 4> & max_x, - const std::array<double, 4> & min_y, const std::array<double, 4> & max_y, const int num_bins, - const std::string & histname, const std::string & hist_title, const std::string & x_label, - const std::string & y_label, const std::string & t1_label, const std::string & t2_label, - const std::string & t3_label) - { - global.reset(new TH2F( (histname + "_g").c_str(), (hist_title + " ;" + x_label + " ;" + y_label).c_str(), - num_bins, min_x[0], max_x[0], num_bins, min_y[0], max_y[0])); - t1.reset(new TH2F( (histname + "_t1").c_str(), (hist_title + " (" + t1_label + ") ;" + x_label + " ;" + y_label).c_str(), - num_bins, min_x[1], max_x[1], num_bins, min_y[1], max_y[1])); - t2.reset(new TH2F( (histname + "_t2").c_str(), (hist_title + " (" + t2_label + ") ;" + x_label + " ;" + y_label).c_str(), - num_bins, min_x[2], max_x[2], num_bins, min_y[2], max_y[2])); - t3.reset(new TH2F( (histname + "_t3").c_str(), (hist_title + " (" + t3_label + ") ;" + x_label + " ;" + y_label).c_str(), - num_bins, min_x[2], max_x[3], num_bins, min_y[3], max_y[3])); - } - - template <class F> - void populate (F && f, const int /*ignore*/, const size_t /*also_ignore*/) - { - f(this); - } - - }; - - struct graph_group_1D : public hist_group<TGraphErrors> - { - std::array<double, 4> maxes, mines; - - private: - - static void construct_pretty(std::unique_ptr<TGraphErrors> & ptr, - const std::string & graphname, const std::string & graph_title, - const double min, const double max) - { - ptr.reset(new TGraphErrors()); - ptr->SetName(graphname.c_str()); - ptr->SetTitle(graph_title.c_str()); - ptr->SetMinimum(min); - ptr->SetMaximum(max); - } - - public: - - graph_group_1D(const std::array<double, 4> & min, const std::array<double, 4> & max, const int /*num_bins*/, - const std::string & graphname, const std::string & graph_title, const std::string & x_label, - const std::string & y_label, const std::string & t1_label, const std::string & t2_label, - const std::string & t3_label): maxes(max), mines(min) - { - construct_pretty(global, graphname + "_g", graph_title + " ;" + x_label + " ;" + y_label, min[0], max[0]); - construct_pretty(t1, graphname + "_t1", graph_title + " (" + t1_label + ") ;" + x_label + " ;" + y_label, min[1], max[1]); - construct_pretty(t2, graphname + "_t2", graph_title + " (" + t2_label + ") ;" + x_label + " ;" + y_label, min[2], max[2]); - construct_pretty(t3, graphname + "_t3", graph_title + " (" + t3_label + ") ;" + x_label + " ;" + y_label, min[3], max[3]); - } - - graph_group_1D(const std::array<double, 4> & min, const std::array<double, 4> & max, const int /*num_bins*/, - const std::string & graphname, const std::string & graph_title): maxes(max), mines(min) - { - construct_pretty(global, graphname + "_g", graph_title, min[0], max[0]); - construct_pretty(t1, graphname + "_t1", graph_title, min[1], max[1]); - construct_pretty(t2, graphname + "_t2", graph_title, min[2], max[2]); - construct_pretty(t3, graphname + "_t3", graph_title, min[3], max[3]); - } - - template <class F> - void populate (F && f, const int /*ignore*/, const size_t /*also_ignore*/) - { - f(this); - if (maxes[0] != mines[0]) - { - global->GetYaxis()->SetLimits(mines[0], maxes[0]); - } - } - - - void add_to_stack(graph_stacker & stack) - { - stack.global->Add(global.release()); - stack.t1->Add(t1.release()); - stack.t2->Add(t2.release()); - stack.t3->Add(t3.release()); - } - }; - - enum class PlotterKind - { - type = 0, region, time, type2D, region2D, graph, Number - }; - - struct plotter_base - { - std::string hist_name, hist_title, x_label, y_label; - const BasePlotter * parent{}; - - virtual PlotterKind plotter_kind() const = 0; - - plotter_base() = default; - plotter_base(const plotter_base &) = default; - plotter_base(plotter_base &&) = default; - plotter_base & operator= (const plotter_base &) = default; - plotter_base & operator= (plotter_base &&) = default; - - virtual ~plotter_base() {} - - virtual void plot(const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const = 0; - virtual void plot(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const = 0; - virtual void plot(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & wanted_min_y, const std::array<double, 4> & wanted_max_y, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const = 0; - - virtual void plot(const double wanted_min_x, const double wanted_max_x, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - this->plot(std::array<double, 4> {wanted_min_x, wanted_min_x, wanted_min_x, wanted_min_x}, - std::array<double, 4> {wanted_max_x, wanted_max_x, wanted_max_x, wanted_max_x}, - path, prefix, suffix); - } - - virtual void plot(const double wanted_min_x, const double wanted_max_x, - const double wanted_min_y, const double wanted_max_y, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - this->plot(std::array<double, 4> {wanted_min_x, wanted_min_x, wanted_min_x, wanted_min_x}, - std::array<double, 4> {wanted_max_x, wanted_max_x, wanted_max_x, wanted_max_x}, - std::array<double, 4> {wanted_min_y, wanted_min_y, wanted_min_y, wanted_min_y}, - std::array<double, 4> {wanted_max_y, wanted_max_y, wanted_max_y, wanted_max_y}, - path, prefix, suffix); - } - - virtual void calc_data_range(std::array<double, 4> & /*min*/, std::array<double, 4> & /*max*/) const - { - std::cout << "ERROR: Should not be seeing this!" << std::endl; - } - - virtual void calc_data_range(std::array<double, 4> & /*min*/, std::array<double, 4> & /*max*/, - const std::array<double, 4> & /*wanted_min*/, const std::array<double, 4> & /*wanted_max*/) const - { - std::cout << "ERROR: Should not be seeing this!" << std::endl; - } - }; - - template <class group_T> - struct basic_plotter : public plotter_base - { - using plotter_base::plot; - using plotter_base::calc_data_range; - - bool can_be_negative{}; - - int cumulative{}; - //0 means no, < 0 means backward, > 0 means forward accumulation - - StyleKinds style_ref; - std::function<void(group_T *)> populator; - - virtual void save(const std::string & base_name, const group_T & group) const = 0; - - virtual group_T create_group(const std::string & title_override = "") const - { - group_T ret = this->construct_group(title_override); - ret.populate(populator, cumulative, parent->num()); - ret.set_style(parent->Styles[int(style_ref)]); - return ret; - } - - virtual group_T create_group(const std::array<double, 4> & wanted_min_x, - const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & wanted_min_y, - const std::array<double, 4> & wanted_max_y, - const std::string & title_override = "", - const bool force_range = false) const - { - group_T ret = this->construct_group(wanted_min_x, wanted_max_x, wanted_min_y, wanted_max_y, title_override, force_range); - ret.populate(populator, cumulative, parent->num()); - ret.set_style(parent->Styles[int(style_ref)]); - return ret; - } - - virtual group_T create_group(const std::array<double, 4> & wanted_min_x, - const std::array<double, 4> & wanted_max_x, - const std::string & title_override = "", - const bool force_range = false) const - { - group_T ret = this->construct_group(wanted_min_x, wanted_max_x, title_override, force_range); - ret.populate(populator, cumulative, parent->num()); - ret.set_style(parent->Styles[int(style_ref)]); - return ret; - } - - - virtual group_T create_group(const double wanted_min_x, const double wanted_max_x, - const double wanted_min_y, const double wanted_max_y, - const std::string & title_override = "", - const bool force_range = false) const - { - group_T ret = this->construct_group(wanted_min_x, wanted_max_x, wanted_min_y, wanted_max_y, title_override, force_range); - ret.populate(populator, cumulative, parent->num()); - ret.set_style(parent->Styles[int(style_ref)]); - return ret; - } - - virtual group_T create_group(const double wanted_min_x, const double wanted_max_x, - const std::string & title_override = "", - const bool force_range = false) const - { - group_T ret = this->construct_group(wanted_min_x, wanted_max_x, title_override, force_range); - ret.populate(populator, cumulative, parent->num()); - ret.set_style(parent->Styles[int(style_ref)]); - return ret; - } - - - virtual group_T construct_group(const std::string & title_override = "") const = 0; - - virtual group_T construct_group(const std::array<double, 4> & wanted_min_x, - const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & wanted_min_y, - const std::array<double, 4> & wanted_max_y, - const std::string & title_override = "", - const bool force_range = false) const = 0; - - virtual group_T construct_group(const std::array<double, 4> & wanted_min_x, - const std::array<double, 4> & wanted_max_x, - const std::string & title_override = "", - const bool force_range = false) const = 0; - - - virtual group_T construct_group(const double wanted_min_x, const double wanted_max_x, - const double wanted_min_y, const double wanted_max_y, - const std::string & title_override = "", - const bool force_range = false) const - { - return this->construct_group(std::array<double, 4> {wanted_min_x, wanted_min_x, wanted_min_x, wanted_min_x}, - std::array<double, 4> {wanted_max_x, wanted_max_x, wanted_max_x, wanted_max_x}, - std::array<double, 4> {wanted_min_y, wanted_min_y, wanted_min_y, wanted_min_y}, - std::array<double, 4> {wanted_max_y, wanted_max_y, wanted_max_y, wanted_max_y}, - title_override, force_range); - } - - virtual group_T construct_group(const double wanted_min_x, const double wanted_max_x, - const std::string & title_override = "", - const bool force_range = false) const - { - return this->construct_group(std::array<double, 4> {wanted_min_x, wanted_min_x, wanted_min_x, wanted_min_x}, - std::array<double, 4> {wanted_max_x, wanted_max_x, wanted_max_x, wanted_max_x}, - title_override, force_range); - } - - - virtual void plot(const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - group_T group = this->create_group(); - this->save(path + "/" + prefix + hist_name + suffix, group); - } - - virtual void plot(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - group_T group = this->create_group(wanted_min_x, wanted_max_x); - this->save(path + "/" + prefix + hist_name + suffix, group); - } - - virtual void plot(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & wanted_min_y, const std::array<double, 4> & wanted_max_y, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - group_T group = this->create_group(wanted_min_x, wanted_max_x, wanted_min_y, wanted_max_y); - this->save(path + "/" + prefix + hist_name + suffix, group); - } - - }; - - struct H1D_plotter : public basic_plotter<hist_group_1D> - { - using basic_plotter<hist_group_1D>::plot; - using basic_plotter<hist_group_1D>::calc_data_range; - using basic_plotter<hist_group_1D>::create_group; - using basic_plotter<hist_group_1D>::construct_group; - - std::function<double(int)> min_calc; - std::function<double(int)> max_calc; - template <class F1, class F2, class F3> - H1D_plotter(const BasePlotter * p, const std::string & name, F1 && minc, F2 && maxc, const bool cbn, const int cml, - const std::string & title, const std::string & xlbl, const std::string & ylbl, - F3 && popl, const StyleKinds & stl) - { - hist_name = name; - hist_title = title; - x_label = xlbl; - y_label = ylbl; - parent = p; - can_be_negative = cbn; - cumulative = cml; - style_ref = stl; - populator = popl; - min_calc = minc; - max_calc = maxc; - } - - void calc_data_range(std::array<double, 4> & min, std::array<double, 4> & max) const override - { - for (int i = 0; i < 4; ++i) - { - const double data_min = min_calc(i); - const double data_max = max_calc(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - } - - void calc_data_range(std::array<double, 4> & min, std::array<double, 4> & max, - const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max) const override - { - for (int i = 0; i < 4; ++i) - { - if ( (wanted_min[i] <= -1 && !can_be_negative) || wanted_max[i] < 0) - { - const double data_min = min_calc(i); - const double data_max = max_calc(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - else - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - } - }; - - struct H1D_plotter_type : public H1D_plotter - { - using H1D_plotter::plot; - using H1D_plotter::calc_data_range; - using H1D_plotter::create_group; - using H1D_plotter::construct_group; - - PlotterKind plotter_kind() const - { - return PlotterKind::type; - } - - using H1D_plotter::H1D_plotter; - - hist_group_1D construct_group(const std::string & title_override = "") const - { - std::array<double, 4> min, max; - - calc_data_range(min, max); - - if (title_override == "") - { - return hist_group_1D(min, max, parent->num_bins, hist_name, hist_title, - x_label, y_label, parent->label_type_1, parent->label_type_2, parent->label_type_3); - } - else - { - return hist_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - hist_group_1D construct_group(const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max, - const std::string & title_override = "", - const bool force_range = false) const - { - std::array<double, 4> min, max; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - else - { - calc_data_range(min, max, wanted_min, wanted_max); - } - - if (title_override == "") - { - return hist_group_1D(min, max, parent->num_bins, hist_name, hist_title, - x_label, y_label, parent->label_type_1, parent->label_type_2, parent->label_type_3); - } - else - { - return hist_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - hist_group_1D construct_group(const std::array<double, 4> & min, const std::array<double, 4> & max, - const std::array<double, 4> & /*ignore1*/, const std::array<double, 4> & /*ignore2*/, - const std::string & title_override = "", - const bool force_range = false) const - { - return this->construct_group(min, max, title_override, force_range); - } - - void save(const std::string & base_name, const hist_group_1D & group) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, group.global.get(), base_name, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t1.get(), base_name + "_" + parent->suffix_type_1, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t2.get(), base_name + "_" + parent->suffix_type_2, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t3.get(), base_name + "_" + parent->suffix_type_3, parent->file_extensions, parent->print_options); - } - }; - - struct H1D_plotter_region : public H1D_plotter - { - using H1D_plotter::plot; - using H1D_plotter::calc_data_range; - using H1D_plotter::create_group; - using H1D_plotter::construct_group; - - PlotterKind plotter_kind() const - { - return PlotterKind::region; - } - - using H1D_plotter::H1D_plotter; - - hist_group_1D construct_group(const std::string & title_override = "") const - { - std::array<double, 4> min, max; - - calc_data_range(min, max); - - if (title_override == "") - { - return hist_group_1D(min, max, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_region_1, parent->label_region_2, parent->label_region_3); - } - else - { - return hist_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - hist_group_1D construct_group(const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max, - const std::string & title_override = "", - const bool force_range = false) const - { - std::array<double, 4> min, max; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - else - { - calc_data_range(min, max, wanted_min, wanted_max); - } - - if (title_override == "") - { - return hist_group_1D(min, max, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_region_1, parent->label_region_2, parent->label_region_3); - } - else - { - return hist_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - hist_group_1D construct_group(const std::array<double, 4> & min, const std::array<double, 4> & max, - const std::array<double, 4> & /*ignore1*/, const std::array<double, 4> & /*ignore2*/, - const std::string & title_override = "", - const bool force_range = false) const - { - return this->construct_group(min, max, title_override, force_range); - } - - void save(const std::string & base_name, const hist_group_1D & group) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, group.global.get(), base_name, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t1.get(), base_name + "_" + parent->suffix_region_1, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t2.get(), base_name + "_" + parent->suffix_region_2, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t3.get(), base_name + "_" + parent->suffix_region_3, parent->file_extensions, parent->print_options); - } - }; - - - struct H1D_plotter_time : public H1D_plotter - { - using H1D_plotter::plot; - using H1D_plotter::calc_data_range; - using H1D_plotter::create_group; - using H1D_plotter::construct_group; - - PlotterKind plotter_kind() const - { - return PlotterKind::time; - } - - using H1D_plotter::H1D_plotter; - - hist_group_1D construct_group(const std::string & title_override = "") const - { - std::array<double, 4> min, max; - - calc_data_range(min, max); - - if (title_override == "") - { - return hist_group_1D(min, max, parent->num_bins, hist_name, hist_title, - x_label, y_label, "", "", ""); - } - else - { - return hist_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - hist_group_1D construct_group(const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max, - const std::string & title_override = "", - const bool force_range = false) const - { - std::array<double, 4> min, max; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - else - { - calc_data_range(min, max, wanted_min, wanted_max); - } - - if (title_override == "") - { - return hist_group_1D(min, max, parent->num_bins, hist_name, hist_title, - x_label, y_label, "", "", ""); - } - else - { - return hist_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - hist_group_1D construct_group(const std::array<double, 4> & min, const std::array<double, 4> & max, - const std::array<double, 4> & /*ignore1*/, const std::array<double, 4> & /*ignore2*/, - const std::string & title_override = "", - const bool force_range = false) const - { - return this->construct_group(min, max, title_override, force_range); - } - - void save(const std::string & base_name, const hist_group_1D & group) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, group.global.get(), base_name, parent->file_extensions, parent->print_options); - } - }; - - - struct graph_plotter : public basic_plotter<graph_group_1D> - { - using basic_plotter<graph_group_1D>::plot; - using basic_plotter<graph_group_1D>::calc_data_range; - using basic_plotter<graph_group_1D>::create_group; - using basic_plotter<graph_group_1D>::construct_group; - - std::function<double(int)> min_calc; - std::function<double(int)> max_calc; - template <class F1, class F2, class F3> - graph_plotter(const BasePlotter * p, const std::string & name, F1 && minc, F2 && maxc, const bool cbn, const int cml, - const std::string & title, const std::string & xlbl, const std::string & ylbl, - F3 && popl, const StyleKinds & stl) - { - hist_name = name; - hist_title = title; - x_label = xlbl; - y_label = ylbl; - parent = p; - can_be_negative = cbn; - cumulative = cml; - style_ref = stl; - populator = popl; - min_calc = minc; - max_calc = maxc; - } - - void calc_data_range(std::array<double, 4> & min, std::array<double, 4> & max) const override - { - for (int i = 0; i < 4; ++i) - { - const double data_min = min_calc(i); - const double data_max = max_calc(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - } - - void calc_data_range(std::array<double, 4> & min, std::array<double, 4> & max, - const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max) const override - { - for (int i = 0; i < 4; ++i) - { - if ( (wanted_min[i] <= -1 && !can_be_negative) || wanted_max[i] < 0) - { - const double data_min = min_calc(i); - const double data_max = max_calc(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - else - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - } - - PlotterKind plotter_kind() const override - { - return PlotterKind::graph; - } - - graph_group_1D construct_group(const std::string & title_override = "") const override - { - std::array<double, 4> min, max; - - calc_data_range(min, max); - - if (title_override == "") - { - return graph_group_1D(min, max, parent->num_bins, hist_name, hist_title, - x_label, y_label, "", "", ""); - } - else - { - return graph_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - graph_group_1D construct_group(const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max, - const std::string & title_override = "", - const bool force_range = false) const override - { - std::array<double, 4> min{}, max{}; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - else - { - calc_data_range(min, max, wanted_min, wanted_max); - } - - if (title_override == "") - { - return graph_group_1D(min, max, parent->num_bins, hist_name, hist_title, - x_label, y_label, "", "", ""); - } - else - { - return graph_group_1D(min, max, parent->num_bins, hist_name, title_override); - } - } - - graph_group_1D construct_group(const std::array<double, 4> & min, const std::array<double, 4> & max, - const std::array<double, 4> & /*ignore1*/, const std::array<double, 4> & /*ignore2*/, - const std::string & title_override = "", - const bool force_range = false) const override - { - return this->construct_group(min, max, title_override, force_range); - } - - void save(const std::string & base_name, const graph_group_1D & group) const override - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, group.global.get(), base_name, parent->file_extensions, parent->print_options); - } - }; - - struct H2D_plotter : public basic_plotter<hist_group_2D> - { - using basic_plotter<hist_group_2D>::plot; - using basic_plotter<hist_group_2D>::calc_data_range; - using basic_plotter<hist_group_2D>::create_group; - using basic_plotter<hist_group_2D>::construct_group; - - std::function<double(int)> min_calc_x; - std::function<double(int)> max_calc_x; - std::function<double(int)> min_calc_y; - std::function<double(int)> max_calc_y; - template <class F1, class F2, class F3, class F4, class F5> - H2D_plotter(const BasePlotter * p, const std::string & name, F1 && mincx, F2 && maxcx, F3 && mincy, F4 && maxcy, - const bool cbn, const std::string & title, const std::string & xlbl, const std::string & ylbl, - F5 && popl, const StyleKinds & stl) - { - hist_name = name; - hist_title = title; - x_label = xlbl; - y_label = ylbl; - parent = p; - can_be_negative = cbn; - style_ref = stl; - populator = popl; - min_calc_x = mincx; - max_calc_x = maxcx; - min_calc_y = mincy; - max_calc_y = maxcy; - } - - void calc_data_range_x(std::array<double, 4> & min, std::array<double, 4> & max) const - { - for (int i = 0; i < 4; ++i) - { - const double data_min = min_calc_x(i); - const double data_max = max_calc_x(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - } - - void calc_data_range_x(std::array<double, 4> & min, std::array<double, 4> & max, - const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max) const - { - for (int i = 0; i < 4; ++i) - { - if ( (wanted_min[i] <= -1 && !can_be_negative) || wanted_max[i] < 0) - { - const double data_min = min_calc_x(i); - const double data_max = max_calc_x(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - else - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - } - - void calc_data_range_y(std::array<double, 4> & min, std::array<double, 4> & max) const - { - for (int i = 0; i < 4; ++i) - { - const double data_min = min_calc_y(i); - const double data_max = max_calc_y(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - } - - void calc_data_range_y(std::array<double, 4> & min, std::array<double, 4> & max, - const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max) const - { - for (int i = 0; i < 4; ++i) - { - if ( (wanted_min[i] <= -1 && !can_be_negative) || wanted_max[i] < 0) - { - const double data_min = min_calc_y(i); - const double data_max = max_calc_y(i); - - const double data_range = data_max - data_min; - - min[i] = ( can_be_negative ? - data_min - 0.05 * data_range : - std::max(data_min - 0.05 * data_range, -0.5) ); - max[i] = data_max + 0.05 * data_range; - } - else - { - min[i] = wanted_min[i]; - max[i] = wanted_max[i]; - } - } - } - }; - - struct H2D_plotter_type : public H2D_plotter - { - using H2D_plotter::plot; - using H2D_plotter::calc_data_range; - using H2D_plotter::calc_data_range_x; - using H2D_plotter::calc_data_range_y; - using H2D_plotter::create_group; - using H2D_plotter::construct_group; - - PlotterKind plotter_kind() const - { - return PlotterKind::type2D; - } - - using H2D_plotter::H2D_plotter; - - hist_group_2D construct_group(const std::string & /*title_override = ""*/) const - { - std::array<double, 4> min_x, max_x, min_y, max_y; - - calc_data_range_x(min_x, max_x); - calc_data_range_y(min_y, max_y); - - return hist_group_2D(min_x, max_x, min_y, max_y, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_type_1, parent->label_type_2, parent->label_type_3); - } - - hist_group_2D construct_group(const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max, - const std::string & /*title_override = ""*/, - const bool force_range = false) const - { - std::array<double, 4> min_x, max_x, min_y, max_y; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min_x[i] = wanted_min[i]; - max_x[i] = wanted_max[i]; - } - } - else - { - calc_data_range_x(min_x, max_x, wanted_min, wanted_max); - } - - calc_data_range_y(min_y, max_y); - - return hist_group_2D(min_x, max_x, min_y, max_y, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_type_1, parent->label_type_2, parent->label_type_3); - } - - hist_group_2D construct_group(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & wanted_min_y, const std::array<double, 4> & wanted_max_y, - const std::string & /*title_override = ""*/, - const bool force_range = false) const - { - std::array<double, 4> min_x, max_x, min_y, max_y; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min_x[i] = wanted_min_x[i]; - max_x[i] = wanted_max_x[i]; - min_y[i] = wanted_min_y[i]; - max_y[i] = wanted_max_y[i]; - } - } - else - { - calc_data_range_x(min_x, max_x, wanted_min_x, wanted_max_x); - calc_data_range_y(min_y, max_y, wanted_min_y, wanted_max_y); - } - - return hist_group_2D(min_x, max_x, min_y, max_y, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_type_1, parent->label_type_2, parent->label_type_3); - } - - void save(const std::string & base_name, const hist_group_2D & group) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, group.global.get(), base_name, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t1.get(), base_name + "_" + parent->suffix_type_1, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t2.get(), base_name + "_" + parent->suffix_type_2, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t3.get(), base_name + "_" + parent->suffix_type_3, parent->file_extensions, parent->print_options); - } - }; - - - struct H2D_plotter_region : public H2D_plotter - { - using H2D_plotter::plot; - using H2D_plotter::calc_data_range; - using H2D_plotter::calc_data_range_x; - using H2D_plotter::calc_data_range_y; - using H2D_plotter::create_group; - using H2D_plotter::construct_group; - - PlotterKind plotter_kind() const - { - return PlotterKind::region2D; - } - - using H2D_plotter::H2D_plotter; - - hist_group_2D construct_group(const std::string & /*title_override = ""*/) const - { - std::array<double, 4> min_x, max_x, min_y, max_y; - - calc_data_range_x(min_x, max_x); - calc_data_range_y(min_y, max_y); - - return hist_group_2D(min_x, max_x, min_y, max_y, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_region_1, parent->label_region_2, parent->label_region_3); - } - - hist_group_2D construct_group(const std::array<double, 4> & wanted_min, const std::array<double, 4> & wanted_max, - const std::string & /*title_override = ""*/, - const bool force_range = false) const - { - std::array<double, 4> min_x, max_x, min_y, max_y; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min_x[i] = wanted_min[i]; - max_x[i] = wanted_max[i]; - } - } - else - { - calc_data_range_x(min_x, max_x, wanted_min, wanted_max); - } - - calc_data_range_y(min_y, max_y); - - return hist_group_2D(min_x, max_x, min_y, max_y, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_region_1, parent->label_region_2, parent->label_region_3); - } - - hist_group_2D construct_group(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & wanted_min_y, const std::array<double, 4> & wanted_max_y, - const std::string & /*title_override = ""*/, - const bool force_range = false) const - { - std::array<double, 4> min_x, max_x, min_y, max_y; - - if (force_range) - { - for (int i = 0; i < 4; ++i) - { - min_x[i] = wanted_min_x[i]; - max_x[i] = wanted_max_x[i]; - min_y[i] = wanted_min_y[i]; - max_y[i] = wanted_max_y[i]; - } - } - else - { - calc_data_range_x(min_x, max_x, wanted_min_x, wanted_max_x); - calc_data_range_y(min_y, max_y, wanted_min_y, wanted_max_y); - } - - return hist_group_2D(min_x, max_x, min_y, max_y, parent->num_bins, hist_name, hist_title, x_label, y_label, - parent->label_region_1, parent->label_region_2, parent->label_region_3); - } - - void save(const std::string & base_name, const hist_group_2D & group) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, group.global.get(), base_name, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t1.get(), base_name + "_" + parent->suffix_type_1, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t2.get(), base_name + "_" + parent->suffix_type_2, parent->file_extensions, parent->print_options); - plot_one(&cv, group.t3.get(), base_name + "_" + parent->suffix_type_3, parent->file_extensions, parent->print_options); - } - }; - - struct joined_plotter : public plotter_base - { - using plotter_base::plot; - using plotter_base::calc_data_range; - - std::vector<const plotter_base *> parts; - std::vector<std::string> labels; - - void add_plot() - { - } - - void add_plot(const plotter_base * pplt, const std::string & label) - { - const H1D_plotter * conv_1 = dynamic_cast<const H1D_plotter *>(pplt); - const joined_plotter * conv_2 = dynamic_cast<const joined_plotter *>(pplt); - const graph_plotter * conv_3 = dynamic_cast<const graph_plotter *>(pplt); - if (conv_1 != nullptr) - { - parts.push_back(conv_1); - labels.push_back(label); - //std::cout << "Added " << pplt->hist_name << " as " << label << std::endl; - } - else if (conv_2 != nullptr && this->plotter_kind() == conv_2->plotter_kind()) - { - for (size_t i = 0; i < conv_2->parts.size(); ++i) - { - parts.push_back(conv_2->parts[i]); - labels.push_back(label + ": " + conv_2->labels[i]); - } - //std::cout << "Added all from " << pplt->hist_name << " as " << label << std::endl; - } - else if (conv_3 != nullptr) - { - parts.push_back(conv_3); - labels.push_back(label); - //std::cout << "Added " << pplt->hist_name << " as " << label << std::endl; - } - else - { - std::cout << "WARNING: Trying to add to plot '" << hist_name - << "' an invalid plot: '" << pplt->hist_name << "' (labelled '" << label << "')" << std::endl; - } - } - - template <class ... Rest> - void add_plot(const plotter_base * pplt, const std::string & label, Rest && ... rest) - { - add_plot(pplt, label); - add_plot(std::forward<Rest>(rest)...); - } - - joined_plotter(const BasePlotter * p, const std::string & name, const std::string & title, const std::string & xlbl, const std::string & ylbl) - { - hist_name = name; - hist_title = title; - x_label = xlbl; - y_label = ylbl; - parent = p; - } - - template <class ... Rest> - joined_plotter(const BasePlotter * p, const std::string & name, const std::string & title, - const std::string & xlbl, const std::string & ylbl, Rest && ... rest): - joined_plotter(p, name, title, xlbl, ylbl) - { - add_plot(std::forward<Rest>(rest)...); - } - - virtual hist_stacker create_stack() const = 0; - virtual void save(const std::string & base_name, const hist_stacker & stacker) const = 0; - - protected: - virtual void do_plots(const std::array<double, 4> & min_x, const std::array<double, 4> & max_x, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - std::vector<hist_group_1D> hists; - hist_stacker stacker = this->create_stack(); - - hists.reserve(parts.size()); - - for (size_t i = 0; i < parts.size(); ++i) - { - const H1D_plotter * ptr = dynamic_cast<const H1D_plotter *>(parts[i]); - if (ptr == nullptr) - { - std::cout << "ERROR: Converting to graph plotter (" << i << ", " << labels[i] << ")." << std::endl; - continue; - } - hists.push_back(ptr->create_group(min_x, max_x, labels[i], true)); - hists.back().add_to_stack(stacker); - } - - this->save(path + "/" + prefix + hist_name + suffix, stacker); - } - - public: - - - virtual void plot(const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - std::array<double, 4> real_min_x; - std::array<double, 4> real_max_x; - - for (int j = 0; j < 4; ++j) - { - set_to_highest(real_min_x[j]); - set_to_lowest(real_max_x[j]); - } - - for (size_t i = 0; i < parts.size(); ++i) - { - std::array<double, 4> temp_min_x, temp_max_x; - parts[i]->calc_data_range(temp_min_x, temp_max_x); - for (int j = 0; j < 4; ++j) - { - real_min_x[j] = std::min(real_min_x[j], temp_min_x[j]); - real_max_x[j] = std::max(real_max_x[j], temp_max_x[j]); - } - } - - this->do_plots(real_min_x, real_max_x, path, prefix, suffix); - } - - virtual void plot(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - std::array<double, 4> real_min_x; - std::array<double, 4> real_max_x; - - for (int j = 0; j < 4; ++j) - { - set_to_highest(real_min_x[j]); - set_to_lowest(real_max_x[j]); - } - - for (size_t i = 0; i < parts.size(); ++i) - { - std::array<double, 4> temp_min_x, temp_max_x; - parts[i]->calc_data_range(temp_min_x, temp_max_x, wanted_min_x, wanted_max_x); - for (int j = 0; j < 4; ++j) - { - real_min_x[j] = std::min(real_min_x[j], temp_min_x[j]); - real_max_x[j] = std::max(real_max_x[j], temp_max_x[j]); - } - } - - this->do_plots(real_min_x, real_max_x, path, prefix, suffix); - } - - virtual void plot(const std::array<double, 4> & wanted_min_x, const std::array<double, 4> & wanted_max_x, - const std::array<double, 4> & /*ignore1*/, const std::array<double, 4> & /*ignore2*/, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const - { - this->plot(wanted_min_x, wanted_max_x, path, prefix, suffix); - } - - }; - - struct joined_plotter_type : public joined_plotter - { - using joined_plotter::plot; - using joined_plotter::do_plots; - using joined_plotter::calc_data_range; - - PlotterKind plotter_kind() const - { - return PlotterKind::type; - } - - using joined_plotter::joined_plotter; - - virtual hist_stacker create_stack() const - { - return hist_stacker(hist_name, hist_title, x_label, y_label, parent->label_type_1, parent->label_type_2, parent->label_type_3); - } - - virtual void save(const std::string & base_name, const hist_stacker & stacker) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, stacker.global.get(), base_name, parent->file_extensions, parent->print_options); - plot_one(&cv, stacker.t1.get(), base_name + "_" + parent->suffix_type_1, parent->file_extensions, parent->print_options); - plot_one(&cv, stacker.t2.get(), base_name + "_" + parent->suffix_type_2, parent->file_extensions, parent->print_options); - plot_one(&cv, stacker.t3.get(), base_name + "_" + parent->suffix_type_3, parent->file_extensions, parent->print_options); - } - }; - - struct joined_plotter_region : public joined_plotter - { - using joined_plotter::plot; - using joined_plotter::do_plots; - using joined_plotter::calc_data_range; - - PlotterKind plotter_kind() const - { - return PlotterKind::region; - } - - using joined_plotter::joined_plotter; - - virtual hist_stacker create_stack() const - { - return hist_stacker(hist_name, hist_title, x_label, y_label, parent->label_region_1, parent->label_region_2, parent->label_region_3); - } - - virtual void save(const std::string & base_name, const hist_stacker & stacker) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, stacker.global.get(), base_name, parent->file_extensions, parent->print_options); - plot_one(&cv, stacker.t1.get(), base_name + "_" + parent->suffix_region_1, parent->file_extensions, parent->print_options); - plot_one(&cv, stacker.t2.get(), base_name + "_" + parent->suffix_region_2, parent->file_extensions, parent->print_options); - plot_one(&cv, stacker.t3.get(), base_name + "_" + parent->suffix_region_3, parent->file_extensions, parent->print_options); - } - }; - - struct joined_plotter_time : public joined_plotter - { - using joined_plotter::plot; - using joined_plotter::do_plots; - using joined_plotter::calc_data_range; - - PlotterKind plotter_kind() const - { - return PlotterKind::time; - } - - using joined_plotter::joined_plotter; - - virtual hist_stacker create_stack() const - { - return hist_stacker(hist_name, hist_title, x_label, y_label, "", "", ""); - } - - virtual void save(const std::string & base_name, const hist_stacker & stacker) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, stacker.global.get(), base_name, parent->file_extensions, parent->print_options); - } - }; - - struct joined_plotter_graph : public joined_plotter - { - using joined_plotter::plot; - using joined_plotter::do_plots; - using joined_plotter::calc_data_range; - - PlotterKind plotter_kind() const override - { - return PlotterKind::graph; - } - - virtual hist_stacker create_stack() const override - { - std::cout << "ERROR: You shouldn't be seeing this!" << std::endl; - return hist_stacker{}; - } - - using joined_plotter::joined_plotter; - - virtual void save(const std::string & base_name, const graph_stacker & stacker) const - { - TCanvas cv("cv", "canvas", parent->canvas_x, parent->canvas_y); - plot_one(&cv, stacker.global.get(), base_name, parent->file_extensions, parent->print_options); - } - - - virtual void save(const std::string & /*base_name*/, const hist_stacker & /*stacker*/) const override - { - std::cout << "ERROR: You shouldn't be seeing this!" << std::endl; - return; - } - - protected: - - void do_plots(const std::array<double, 4> & min_x, const std::array<double, 4> & max_x, - const std::string & path, const std::string & prefix = "", const std::string & suffix = "") const override - { - std::vector<graph_group_1D> hists; - graph_stacker stacker(hist_name, hist_title, x_label, y_label, "", "", ""); - - hists.reserve(parts.size()); - - for (size_t i = 0; i < parts.size(); ++i) - { - const graph_plotter * pltr = dynamic_cast<const graph_plotter *>(parts[i]); - if (pltr == nullptr) - { - std::cout << "ERROR: Converting to graph plotter (" << i << ", " << labels[i] << ")." << std::endl; - continue; - } - hists.push_back(pltr->create_group(min_x, max_x, labels[i], true)); - hists.back().add_to_stack(stacker); - } - - this->save(path + "/" + prefix + hist_name + suffix, stacker); - } - }; - - std::map<std::string, std::unique_ptr<plotter_base>> plots; - //We need this to be ordered so one can use a lexicographical compare - //to allow a limited form of globbing in the end. - //(Should futurely be expanded to a more general form?) - - template <class T, class ... Args> - plotter_base * add_plot(Args && ... args) - { - std::unique_ptr<plotter_base> ptr = std::make_unique<T>(this, std::forward<Args>(args)...); - if (ptr){ - auto it = plots.try_emplace(ptr->hist_name, std::move(ptr)); - return it.first->second.get(); - } - return nullptr; - } - - - template <class Graph, class ... Args> - void fill_regions(Graph * all, Graph * central, Graph * endcap, Graph * forward, const float eta, Args && ... args) const - { - - all->Fill(std::forward<Args>(args)...); - - const float abs_eta = std::abs(eta); - if (abs_eta < regCuts[0]) - { - central->Fill(std::forward<Args>(args)...); - } - else if (abs_eta < regCuts[1]) - { - endcap->Fill(std::forward<Args>(args)...); - } - else if (abs_eta < regCuts[2]) - { - forward->Fill(std::forward<Args>(args)...); - } - else - { - //std::cout << "ERROR: " << abs_eta << " is outside expected eta parameters!" << std::endl; - } - } - - template <class Graph, class ... Args> - void fill_types(Graph * all, Graph * seed, Graph * grow, Graph * terminal, const float SNR, Args && ... args) const - { - - all->Fill(std::forward<Args>(args)...); - - if (SNR > SNR_thresholds[2]) - { - seed->Fill(std::forward<Args>(args)...); - } - else if (SNR > SNR_thresholds[1]) - { - grow->Fill(std::forward<Args>(args)...); - } - else if (SNR > SNR_thresholds[0]) - { - terminal->Fill(std::forward<Args>(args)...); - } - else - { - //std::cout << "ERROR: " << abs_eta << " is outside expected eta parameters!" << std::endl; - } - } - - template <class Graph, class ... Args> - void fill_regions(hist_group<Graph> * group, const float x, Args && ... args) const - { - fill_regions(group->global.get(), group->t1.get(), group->t2.get(), group->t3.get(), x, std::forward<Args>(args)...); - } - - template <class Graph, class ... Args> - void fill_types(hist_group<Graph> * group, const float x, Args && ... args) const - { - fill_types(group->global.get(), group->t1.get(), group->t2.get(), group->t3.get(), x, std::forward<Args>(args)...); - } - - std::vector<plotter_base *> get_plots(const std::string & name) const - { - std::vector<plotter_base *> ret; - std::cout << "INFO: Trying to find plot(s) called '" << name << "'. " << std::flush; - const auto it = plots.find(name); - if (it != plots.end()) - { - ret.push_back(it->second.get()); - } - else - { - const auto str_find = name.rfind("*"); - if (str_find != std::string::npos) - { - const std::string substr = name.substr(0, str_find); - auto map_it = plots.lower_bound(substr); - if (map_it != plots.end() && map_it->first.find(substr) == std::string::npos) - { - ++map_it; - } - for (; map_it != plots.end() && map_it->first.find(substr) != std::string::npos; ++map_it) - { - ret.push_back(map_it->second.get()); - } - } - } - std::cout << "Found " << ret.size() << "." << std::endl; - return ret; - } - - template <class ... Args> - void plot(const std::string & name, Args && ... args) const - { - const auto plots = get_plots(name); - if (plots.size() == 0) - { - std::cout << "ERROR: Trying to plot non-existent plot: '" << name << "'" << std::endl; - } - else - { - for (const auto & plt : plots) - { - plt->plot(std::forward<Args>(args)...); - } - } - } -}; - - -template <class PlotT> -void plot_together_helper(const std::string & /*name*/, PlotT * /*p*/) -{ -} - -template <class PlotT> -void plot_together_helper(const std::string & name, PlotT * p, const BasePlotter * plotter) -{ - const auto it = plotter->plots.find(name); - p->add_plot(it->second.get(), plotter->plotter_name); -} - - -template <class PlotT> -void plot_together_helper(const std::string & name, PlotT * p, const BasePlotter & plotter) -{ - const auto it = plotter.plots.find(name); - p->add_plot(it->second.get(), plotter.plotter_name); -} - -template <class PlotT, class ... Rest> -void plot_together_helper(const std::string & name, PlotT * p, const BasePlotter & plotter, Rest && ... rest) -{ - plot_together_helper(name, p, plotter); - plot_together_helper(name, p, std::forward<Rest>(rest)...); -} - -template <class PlotT, class ... Rest> -void plot_together_helper(const std::string & name, PlotT * p, const BasePlotter * plotter, Rest && ... rest) -{ - plot_together_helper(name, p, plotter); - plot_together_helper(name, p, std::forward<Rest>(rest)...); -} - - -template <class ... Rest> -std::vector<std::unique_ptr<BasePlotter::plotter_base>> plot_together(const std::string & name, const BasePlotter & first, Rest && ... rest) -{ - std::vector <std::unique_ptr<BasePlotter::plotter_base>> togetherplots; - - const auto plotters = first.get_plots(name); - - if (plotters.size() == 0) - { - std::cout << "ERROR: Trying to plot non-existent plot: '" << name << "'" << std::endl; - return togetherplots; - } - - for (const auto & pplt : plotters) - { - switch (pplt->plotter_kind()) - { - case BasePlotter::PlotterKind::type: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_type>(&first, pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, first.plotter_name); - plot_together_helper(ret, std::forward<Rest>(rest)...); - togetherplots.emplace_back(ret.release()); - } - break; - case BasePlotter::PlotterKind::region: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_region>(&first, pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, first.plotter_name); - plot_together_helper(pplt->hist_name, ret, std::forward<Rest>(rest)...); - togetherplots.emplace_back(ret.release()); - } - break; - case BasePlotter::PlotterKind::time: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_time>(&first, pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, first.plotter_name); - plot_together_helper(pplt->hist_name, ret, std::forward<Rest>(rest)...); - togetherplots.emplace_back(ret.release()); - } - break; - case BasePlotter::PlotterKind::graph: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_graph>(&first, pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, first.plotter_name); - plot_together_helper(pplt->hist_name, ret, std::forward<Rest>(rest)...); - togetherplots.emplace_back(ret.release()); - } - break; - default: - std::cout << "ERROR: Unsupported kind of plotter for joint plotting: " << int(pplt->plotter_kind()) << "." << std::endl; - } - } - return togetherplots; -} - -std::vector<std::unique_ptr<BasePlotter::plotter_base>> plot_together(const std::string & name, const std::vector<const BasePlotter *> & plots) -{ - std::vector <std::unique_ptr<BasePlotter::plotter_base>> togetherplots; - - if (plots.size() == 0) - { - return togetherplots; - } - - const auto plotters = plots[0]->get_plots(name); - - if (plotters.size() == 0) - { - std::cout << "ERROR: Trying to plot non-existent plot: '" << name << "'" << std::endl; - return togetherplots; - } - - for (const auto & pplt : plotters) - { - switch (pplt->plotter_kind()) - { - case BasePlotter::PlotterKind::type: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_type>(plots[0], pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, plots[0]->plotter_name); - for (size_t i = 1; i < plots.size(); ++i) - { - const auto it2 = plots[i]->plots.find(pplt->hist_name); - ret->add_plot(it2->second.get(), plots[i]->plotter_name); - } - togetherplots.emplace_back(ret.release()); - } - break; - case BasePlotter::PlotterKind::region: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_region>(plots[0], pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, plots[0]->plotter_name); - for (size_t i = 1; i < plots.size(); ++i) - { - const auto it2 = plots[i]->plots.find(pplt->hist_name); - ret->add_plot(it2->second.get(), plots[i]->plotter_name); - } - togetherplots.emplace_back(ret.release()); - } - break; - case BasePlotter::PlotterKind::time: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_time>(plots[0], pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, plots[0]->plotter_name); - for (size_t i = 1; i < plots.size(); ++i) - { - const auto it2 = plots[i]->plots.find(pplt->hist_name); - ret->add_plot(it2->second.get(), plots[i]->plotter_name); - } - togetherplots.emplace_back(ret.release()); - } - break; - case BasePlotter::PlotterKind::graph: - { - auto ret = std::make_unique<BasePlotter::joined_plotter_graph>(plots[0], pplt->hist_name, pplt->hist_title, pplt->x_label, pplt->y_label); - ret->add_plot(pplt, plots[0]->plotter_name); - for (size_t i = 1; i < plots.size(); ++i) - { - const auto it2 = plots[i]->plots.find(pplt->hist_name); - ret->add_plot(it2->second.get(), plots[i]->plotter_name); - } - togetherplots.emplace_back(ret.release()); - } - break; - default: - std::cout << "ERROR: Unsupported kind of plotter for joint plotting: " << int(pplt->plotter_kind()) << "." << std::endl; - } - } - - return togetherplots; -} - -struct TogetherPlot -{ - std::vector<const BasePlotter *> plots; - - - void add_plot(const BasePlotter * bp) - { - //std::cout << "Adding " << bp->plotter_name << std::endl; - plots.push_back(bp); - } - - void add_plot() - { - } - - template <class ... Rest> - void add_plot(const BasePlotter * bp, Rest && ... rest) - { - add_plot(bp); - add_plot(std::forward<Rest>(rest)...); - } - - template<class ... Args> - TogetherPlot(Args && ... args) - { - add_plot(std::forward<Args>(args)...); - } - - - template <class ... Args> - void plot(const std::string & name, Args && ... args) const - { - std::vector< std::unique_ptr<BasePlotter::plotter_base> > plotters = plot_together(name, plots); - for (const auto & plt : plotters) - { - plt->plot(std::forward<Args>(args)...); - } - } -}; - -#endif //CALORECGPU_TOOLS_PLOTTERAUXDEFINES_H diff --git a/Calorimeter/CaloRecGPU/tools/plotter/TimePlotter.h b/Calorimeter/CaloRecGPU/tools/plotter/TimePlotter.h deleted file mode 100644 index e12ab81bfaeebc522fb4d092a8ea2ccff5b03834..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/plotter/TimePlotter.h +++ /dev/null @@ -1,1046 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// - -#ifndef CALORECGPU_TOOLS_TIMEPLOTTER_H -#define CALORECGPU_TOOLS_TIMEPLOTTER_H - -#include <cstdlib> -#include <iostream> -#include <algorithm> -#include <string> -#include <cstring> -#include <fstream> -#include "PlotterAuxDefines.h" - - -#include <vector> -#include <string> -#include <set> -#include <limits> -#include <utility> -#include <map> -#include <type_traits> - -#include <boost/filesystem.hpp> - -using namespace std::literals::string_literals; -//Not too good. -//But we kinda need that ""s thing for ease of writing something... - -#include "CxxUtils/checker_macros.h" - -#ifdef ATLAS_CHECK_THREAD_SAFETY - - ATLAS_NO_CHECK_FILE_THREAD_SAFETY; - -#endif - - -namespace PlaceholderClassesForColumnProperties -{ - struct ColMaxT {}; - inline static constexpr ColMaxT col_max{}; - struct ColMinT {}; - inline static constexpr ColMinT col_min{}; - struct ColAvgT {}; - inline static constexpr ColAvgT col_avg{}; - struct ColStdDevT {}; - inline static constexpr ColStdDevT col_stddev{}; -} - -struct TimeTable -{ - std::vector<std::string> column_text; - std::unordered_map<std::string, size_t> column_map; - std::vector<std::vector<double>> columns; - - std::vector<double> maxs, mins, averages, std_devs; - - size_t num_events() const - { - if (columns.size() == 0) - { - return 0; - } - return columns.front().size(); - } - - void load_from_file(const boost::filesystem::path & filename) - { - std::ifstream is(filename.native()); - if (!is.is_open()) - { - std::cout << "ERROR: Could not open '" << filename << "' to load times!" << std::endl; - return; - } - else - { - std::cout << "INFO: Loading times from '" << filename << "'." << std::endl; - } - - column_text.clear(); - column_map.clear(); - columns.clear(); - - while (is.good() && is.peek() != '\n') - { - std::string temp; - is >> temp; - //This reads space-separated columns, - //which is exactly what we want. - - if (temp == "Event_Number") - { - continue; - } - - for (auto & x : temp) - //Replace underscores by spaces to get the intended names... - { - if (x == '_') - { - x = ' '; - } - } - - const auto pos = temp.rfind("HybridClusterProcessor."); - - if (pos != std::string::npos) - { - temp = temp.substr(pos + 23); - //Get rid of the prefix for the global... - } - - column_map[temp] = column_text.size(); - column_text.push_back(temp); - if (is.good() && is.peek() == ' ') - { - is.get(); - } - //Exclude possible spaces before the line break - } - - columns.resize(column_text.size()); - - is.get(); - - while (is.get() != '\n') - { - continue; - } - //Exclude the first event: setup-time delays and so on. - - while (is.good()) - { - int count = 0; - while (is.good() && is.peek() != '\n') - { - double temp = 0.; - is >> temp; - if (is.fail()) - { - break; - } - if (count > 0) - { - columns[count - 1].push_back(temp); - } - //The first element is the event number... - ++count; - if (is.good() && is.peek() == ' ') - { - is.get(); - } - //Exclude possible spaces before the line break - } - is.get(); - } - is.close(); - } - - TimeTable(const boost::filesystem::path & filename) - { - load_from_file(filename); - } - - private: - - void check_column_outliers(std::set<int> & to_remove, const size_t col_idx, const double factor = 20., const int ignore_largest = 30) const - { - const std::vector<double> & col = columns[col_idx]; - if (col.size() < 1) - { - std::cout << "ERROR: Trying to remove outliers from empty time column (" << col_idx << ": " << column_text[col_idx] << ")!" << std::endl; - return; - } - - std::vector<double> copy_col = col; - - std::sort(copy_col.begin(), copy_col.end()); - - const int ignore_limit = std::min(ignore_largest, int(copy_col.size() / 4)); - - - double mu = copy_col[0]; - - for (size_t i = 1; i < copy_col.size() - ignore_limit; ++i) - { - mu += copy_col[i]; - } - - mu /= std::max(size_t(copy_col.size() - ignore_limit), size_t(1)); - - const double upper_limit = (mu - copy_col[0]) * factor + mu; - - for (size_t i = 0; i < copy_col.size(); ++i) - { - if (col[i] > upper_limit) - { - to_remove.insert(i); - } - } - } - - void reorder_column_to_exclude_outliers(const std::set<int> & to_remove, std::vector<double> & col) - { - int last_valid = col.size() - 1; - const auto stop = to_remove.crend(); - for (auto it = to_remove.crbegin(); it != stop; ++it) - { - col[*it] = col[last_valid]; - last_valid--; - } - col.resize(col.size() - to_remove.size()); - } - - public: - - void check_outliers(std::set<int> & to_remove, const double factor = 20., const int ignore_largest = 30) const - { - for (size_t i = 0; i < columns.size(); ++i) - { - check_column_outliers(to_remove, i, factor, ignore_largest); - } - } - - void exclude_outliers(const std::set<int> & to_remove) - { - for (auto & col : columns) - { - reorder_column_to_exclude_outliers(to_remove, col); - } - } - - void calculate_stats() - { - for (const auto & col : columns) - { - double sum = 0, sum_sqr = 0, max, min; - set_to_highest(min); - set_to_lowest(max); - for (const auto & t : col) - { - sum += t; - sum_sqr += t * t; - min = std::min(min, t); - max = std::max(max, t); - } - const double avg = sum / col.size(); - const double std_dev = std::sqrt(sum_sqr / col.size() - avg * avg); - maxs.push_back(max); - mins.push_back(min); - averages.push_back(avg); - std_devs.push_back(std_dev); - } - } - - - template <class ... Args> - auto get(const std::string & column_name, Args && ... args) const - { - return this->get(column_map.at(column_name), std::forward<Args>(args)...); - } - - template <class ... Args> - auto get(const std::string & column_name, Args && ... args) - { - return this->get(column_map.at(column_name), std::forward<Args>(args)...); - } - - const std::vector<double> & get(const size_t column_index) const - { - return columns[column_index]; - } - - std::vector<double> & get(const size_t column_index) - { - return columns[column_index]; - } - - double get(const size_t column_index, const size_t idx) const - { - return columns[column_index][idx]; - } - - double & get(const size_t column_index, const size_t idx) - { - return columns[column_index][idx]; - } - - template <class T> - double get(const size_t column_index, const T & ) const - { - using namespace PlaceholderClassesForColumnProperties; - - if constexpr (std::is_same_v<T, ColMaxT>) - { - return maxs[column_index]; - } - else if constexpr (std::is_same_v<T, ColMinT>) - { - return mins[column_index]; - } - else if constexpr (std::is_same_v<T, ColAvgT>) - { - return averages[column_index]; - } - else if constexpr (std::is_same_v<T, ColStdDevT>) - { - return std_devs[column_index]; - } - else - { - return -1; - } - } - -}; - -struct TimeHolder -{ - size_t num_threads; - std::map<std::string, TimeTable> times; - - void ready_for_plotting(const double factor = 20., const int ignore_largest = 30) - { - std::set<int> to_exclude; - for (const auto & it : times) - { - it.second.check_outliers(to_exclude, factor, ignore_largest); - } - for (auto & it : times) - { - it.second.exclude_outliers(to_exclude); - it.second.calculate_stats(); - } - } - - TimeHolder(const boost::filesystem::path & foldername, const size_t n_thrs): num_threads(n_thrs) - { - for (auto const & dir_entry : boost::filesystem::directory_iterator(foldername)) - { - if (!boost::filesystem::is_regular_file(dir_entry)) - { - continue; - } - const boost::filesystem::path file_path = dir_entry; - if (file_path.extension() != ".txt") - { - continue; - } - const std::string file_string = file_path.stem().native(); - const auto pos = file_string.rfind("Times"); - if (pos == std::string::npos) - { - continue; - } - times.emplace(file_string.substr(0, pos), file_path); - } - ready_for_plotting(); - } - - - size_t num_events() const - { - if (times.size() == 0) - { - return 0; - } - return times.begin()->second.num_events(); - } - - template <class ... Args> - auto get(const std::string & table_name, Args && ... args) const - { - return times.at(table_name).get(std::forward<Args>(args)...); - } - - template <class ... Args> - auto get(const std::string & table_name, Args && ... args) - { - return times.at(table_name).get(std::forward<Args>(args)...); - } - - const TimeTable & get(const std::string & table_name) const - { - return times.at(table_name); - } - - TimeTable & get(const std::string & table_name) - { - return times.at(table_name); - } - - - bool has_growing_data() const - { - return times.count("TopoAutomatonClustering") > 0; - } - - bool has_splitting_data() const - { - return times.count("ClusterSplitter") > 0; - } - -}; - -struct TimePlotter : public BasePlotter -{ - std::vector<TimeHolder> runs; - - bool has_growing_data() const - { - return runs.back().has_growing_data(); - } - - bool has_splitting_data() const - { - return runs.back().has_splitting_data(); - } - - TimePlotter(const boost::filesystem::path & pth) - { - for (auto const & dir_entry : boost::filesystem::directory_iterator(pth)) - { - if (!boost::filesystem::is_directory(dir_entry)) - { - continue; - } - const boost::filesystem::path inner_dir = dir_entry; - const std::string dir_string = inner_dir.native(); - const auto pos = dir_string.rfind("times_"); - if (pos == std::string::npos) - { - continue; - } - const size_t num_threads = std::strtoull(dir_string.substr(pos + 6).c_str(), nullptr, 10); - if (num_threads == 0) - { - std::cout << "WARNING: Skipping '" << inner_dir << "' for invalid thread number (" << dir_string.substr(pos + 6) << ")" << std::endl; - continue; - } - runs.emplace_back(inner_dir, num_threads); - } - std::sort(runs.begin(), runs.end(), [](const TimeHolder & a, const TimeHolder & b) - { - return a.num_threads < b.num_threads; - }); - if (has_growing_data()) - { - populate_growing_plots(); - } - if (has_splitting_data()) - { - populate_splitting_plots(); - } - if (has_growing_data() && has_splitting_data()) - { - populate_overall_plots(); - } - } - - size_t max_num_threads() const - { - return runs.back().num_threads; - } - - virtual size_t num() const - { - if (runs.size() == 0) - { - return 0; - } - return runs.back().num_events(); - } - - template <class ... Args> - auto get(const size_t num_threads, Args && ... args) const - { - return runs[num_threads].get(std::forward<Args>(args)...); - } - - const TimeHolder & get(const size_t num_threads) const - { - return runs[num_threads]; - } - - template <class ... Args> - auto get(const size_t num_threads, Args && ... args) - { - return runs[num_threads].get(std::forward<Args>(args)...); - } - - TimeHolder & get(const size_t num_threads) - { - return runs[num_threads]; - } - - virtual ~TimePlotter() - { - } - - TimePlotter(const TimePlotter &) = delete; - TimePlotter(TimePlotter &&) = default; - - TimePlotter & operator= (const TimePlotter &) = delete; - TimePlotter & operator= (TimePlotter &&) = default; - - private: - - - - void populate_generic_plots(const std::string & suffix, - const std::vector <std::pair<std::string, std::string>> & ref_ts, - const std::vector <std::pair<std::string, std::string>> & test_ts, - const std::vector <std::pair<std::string, std::string>> & extra_ts); - - public: - - std::vector <std::pair<std::string, std::string>> - growing_default = {std::make_pair("Global"s, "DefaultGrowing"s)}, - growing_test = {std::make_pair("TopoAutomatonClustering"s, "Total"s), std::make_pair("PropCalcPostGrowing"s, "Total"s)}, - growing_extra = {std::make_pair("EventDataExporter"s, "Total"s), std::make_pair("ClusterImporter"s, "Total"s)}, - splitting_default = {std::make_pair("Global"s, "DefaultSplitting"s)}, - splitting_test = {std::make_pair("ClusterSplitter"s, "Total"s), std::make_pair("PropCalcPostSplitting"s, "Total"s)}, - splitting_extra = {std::make_pair("EventDataExporter"s, "Total"s), std::make_pair("ClusterImporter"s, "Total"s)}, - growsplit_default = {std::make_pair("Global"s, "DefaultGrowing"s), std::make_pair("Global"s, "DefaultSplitting"s)}, - growsplit_test = {std::make_pair("TopoAutomatonClustering"s, "Total"s), std::make_pair("ClusterSplitter"s, "Total"s), std::make_pair("PropCalcPostSplitting"s, "Total"s)}, - growsplit_extra = {std::make_pair("EventDataExporter"s, "Total"s), std::make_pair("ClusterImporter"s, "Total"s)}; - - - void populate_growing_plots() - { - populate_generic_plots("grow", growing_default, growing_test, growing_extra); - } - void populate_splitting_plots() - { - populate_generic_plots("split", splitting_default, splitting_test, splitting_extra); - } - void populate_overall_plots() - { - populate_generic_plots("growsplit", growsplit_default, growsplit_test, growsplit_extra); - } - - - template <class T> - static double sum_all(const TimeHolder & holder, const std::vector < std::pair<std::string, std::string> > & vs, const T & id) - { - double ret = 0; - for (const auto & pr : vs) - { - ret += holder.get(pr.first, pr.second, id); - } - return ret; - } - - template <class F> - static void calculate_stats (const size_t num_events, double & avg, double & std_dev, const F & func) - { - double sum = 0, sum_sqr = 0; - for (size_t i = 0; i < num_events; ++i) - { - const double res = func(i); - sum += res; - sum_sqr += res * res; - } - avg = sum / num_events; - std_dev = std::sqrt(sum_sqr / num_events - avg * avg); - } - - -}; - -#ifndef RETFUNC - #define RETFUNC(...) [&]([[maybe_unused]] const int i){ return double(__VA_ARGS__); } -#endif - -void TimePlotter::populate_generic_plots(const std::string & suffix, - const std::vector <std::pair<std::string, std::string>> & ref_ts, - const std::vector <std::pair<std::string, std::string>> & test_ts, - const std::vector <std::pair<std::string, std::string>> & extra_ts) -{ - std::cout << "Started populating '" << suffix << "' time plots." << std::endl; - - using namespace PlaceholderClassesForColumnProperties; - - for (const TimeHolder & holder : runs) - { - add_plot<joined_plotter_time> - (std::string("time_dist_") + suffix + "_" + std::to_string(holder.num_threads), - "Event Processing Time", "#font[52]{t} [#mus]", (normalize ? "Fraction of Events" : "Events"), - add_plot<H1D_plotter_time> - (std::string("time") + "dist_reference_" + std::to_string(holder.num_threads), - RETFUNC(sum_all(holder, ref_ts, col_min)), - RETFUNC(sum_all(holder, ref_ts, col_max)), - false, 0, "CPU Event Processing Time", "#font[52]{t} [#mus]", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - - for (size_t i = 0; i < holder.num_events(); ++i) - { - group->global->Fill(sum_all(holder, ref_ts, i)); - } - }, - StyleKinds::ref), - ref_name, - add_plot<H1D_plotter_time> - (std::string("time_dist_test_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(sum_all(holder, test_ts, col_min) + sum_all(holder, extra_ts, col_min)), - RETFUNC(sum_all(holder, test_ts, col_max) + sum_all(holder, extra_ts, col_max)), - false, 0, "GPU Event Processing Time", "#font[52]{t} [#mus]", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - group->global->Fill(sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i)); - } - }, - StyleKinds::test), - test_name - ); - - - add_plot<H1D_plotter_time> - (std::string("time_frac_algorithm_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(0), - RETFUNC(1), - false, 0, "Fraction of the GPU Processing Time Due to the Algorithm", - "#font[52]{t}^{(Algorithm)}/#font[52]{t}^{(" + test_name + ")}", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - group->global->Fill(sum_all(holder, test_ts, i) / (sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i))); - } - }, - StyleKinds::test); - - add_plot<H1D_plotter_time> - (std::string("time_frac_convs_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(0), - RETFUNC(1), - false, 0, "Fraction of the GPU Processing Time Due to Data Conversions", - "#font[52]{t}^{(Conversions)}/#font[52]{t}^{(" + test_name + ")}", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - const double conversion_t = holder.get("EventDataExporter", "Total", i) + - holder.get("ClusterImporter", "Total", i) - - holder.get("EventDataExporter", "Transfer to GPU", i) - - holder.get("ClusterImporter", "Transfer from GPU", i); - //Safe to hardcode this since it will be the same for all (grow, split & both) - - group->global->Fill(conversion_t / (sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i))); - } - }, - StyleKinds::test); - - - add_plot<H1D_plotter_time> - (std::string("time_frac_transfers_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(0), - RETFUNC(1), - false, 0, "Fraction of the GPU Processing Time Due to Data Transfers", - "#font[52]{t}^{(Transfers)}/#font[52]{t}^{(" + test_name + ")}", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - const double transfer_t = holder.get("EventDataExporter", "Transfer to GPU", i) + - holder.get("ClusterImporter", "Transfer from GPU", i); - //Safe to hardcode this since it will be the same for all (grow, split & both) - - group->global->Fill(transfer_t / (sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i))); - } - }, - StyleKinds::test); - - add_plot<H1D_plotter_time> - (std::string("time_ratio_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(0), - RETFUNC(1), - false, 0, "Ratio Between GPU and CPU Event Processing Time", - "#font[52]{t}^{(" + test_name + ")}/#font[52]{t}^{(" + ref_name + ")}", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - const double gpu_t = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - const double cpu_t = sum_all(holder, ref_ts, i); - - group->global->Fill(gpu_t / cpu_t); - } - }, - StyleKinds::joined); - - add_plot<H1D_plotter_time> - (std::string("time_speedup_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(0), - RETFUNC(50), - false, 0, "GPU Speed-Up of Event Processing Time in Relation to the CPU", - "Speed-Up #(){#font[52]{t}^{(" + ref_name + ")}/#font[52]{t}^{(" + test_name + ")}}", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - const double gpu_t = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - const double cpu_t = sum_all(holder, ref_ts, i); - - group->global->Fill(cpu_t / gpu_t); - } - }, - StyleKinds::joined); - - - add_plot<H1D_plotter_time> - (std::string("time_speedup_fake_") + suffix + "_" + std::to_string(holder.num_threads), - RETFUNC(0), - RETFUNC(75), - false, 0, "Algorithm Speed-Up of Event Processing Time in Relation to the CPU", - "Speed-Up #(){#font[52]{t}^{(" + ref_name + ")}/#font[52]{t}^{(Algorithm)}}", (normalize ? "Fraction of Events" : "Events"), - [&](hist_group_1D * group) - { - for (size_t i = 0; i < holder.num_events(); ++i) - { - const double gpu_t = sum_all(holder, test_ts, i); - const double cpu_t = sum_all(holder, ref_ts, i); - - group->global->Fill(cpu_t / gpu_t); - } - }, - StyleKinds::joined); - - } - - //-----------------------------------------------------------// - // Start of global plots // - //-----------------------------------------------------------// - - - add_plot<joined_plotter_graph> - (std::string("time_global_exec_") + suffix, "Execution Time", "# CPU Threads", "Execution Time [#mu#font[52]{s}]", - add_plot<graph_plotter> - (std::string("time_global_exec_ref_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Execution Time (CPU)", - "# CPU Threads", "Execution Time [#mu#font[52]{s}]", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - return sum_all(holder, ref_ts, i); - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - } - }, - StyleKinds::ref), - ref_name, - add_plot<graph_plotter> - (std::string("time_global_exec_test_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Execution Time (GPU)", - "# CPU Threads", "Execution Time [#mu#font[52]{s}]", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - return sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - } - }, - StyleKinds::test), - test_name); - - add_plot<joined_plotter_graph> - (std::string("time_global_throughput_") + suffix, "Throughput", "# CPU Threads", "Throughput [event/#font[52]{s}]", - add_plot<graph_plotter> - (std::string("time_global_throughput_ref_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Throughput (CPU)", - "# CPU Threads", "Throughput [event/#font[52]{s}]", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - return 1e6 * double(holder.num_threads) / sum_all(holder, ref_ts, i); - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - } - }, - StyleKinds::ref), - ref_name, - add_plot<graph_plotter> - (std::string("time_global_throughput_test_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Throughput (GPU)", - "# CPU Threads", "Throughput [event/#font[52]{s}]", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - const double gpu_t = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - return 1e6 * double(holder.num_threads) / gpu_t; - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - } - }, - StyleKinds::test), - test_name); - - - add_plot<joined_plotter_graph> - (std::string("time_global_scaling_") + suffix, "Multithreading Scaling", "# CPU Threads", - "Scaling #(){Throughput/N_{threads}/Throughput#(){1 thread}}", - add_plot<graph_plotter> - (std::string("time_global_scaling_ref_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Multithreading Scaling (CPU)", - "# CPU Threads", "Scaling #(){Throughput/{N}_{threads}/Throughput#(){1 thread}}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - return sum_all(get(0), ref_ts, i) / sum_all(holder, ref_ts, i); - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - - } - }, - StyleKinds::ref), - ref_name, - add_plot<graph_plotter> - (std::string("time_global_scaling_test_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Multithreading Scaling (GPU)", - "# CPU Threads", "Scaling #(){Throughput/{N}_{threads}/Throughput#(){1 thread}}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - const double gpu_ref_t = sum_all(get(0), test_ts, i) + sum_all(get(0), extra_ts, i); - - const double gpu_t = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - - return gpu_ref_t / gpu_t; - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - - } - }, - StyleKinds::test), - test_name); - - add_plot<graph_plotter> - (std::string("time_global_speedup_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "GPU Speed-Up of Event Processing Time in Relation to the CPU", - "# CPU Threads", "Speed-Up #(){#font[52]{t}^{(" + ref_name + ")}/#font[52]{t}^{(" + test_name + ")}}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - const double gpu_t = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - return sum_all(holder, ref_ts, i) / gpu_t; - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - - } - }, - StyleKinds::joined); - - add_plot<graph_plotter> - (std::string("time_global_speedup_fake_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Algorithm Speed-Up of Event Processing Time in Relation to the CPU", - "# CPU Threads", "Speed-Up #(){#font[52]{t}^{(" + ref_name + ")}/#font[52]{t}^{(Algorithm)}}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - return sum_all(holder, ref_ts, i) / sum_all(holder, test_ts, i); - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - } - }, - StyleKinds::joined); - - - add_plot<graph_plotter> - (std::string("time_global_frac_algorithm_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Fraction of the GPU Processing Time Due to the Algorithm", - "# CPU Threads", "#font[52]{t}^{(Algorithm)}/#font[52]{t}^{(" + test_name + ")}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - return sum_all(holder, test_ts, i) / (sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i)); - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - - } - }, - StyleKinds::joined); - - - add_plot<graph_plotter> - (std::string("time_global_frac_convs_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Fraction of the GPU Processing Time Due to Data Conversions", - "# CPU Threads", "#font[52]{t}^{(Conversions)}/#font[52]{t}^{(" + test_name + ")}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - const double conversion_t = holder.get("EventDataExporter", "Total", i) + - holder.get("ClusterImporter", "Total", i) - - holder.get("EventDataExporter", "Transfer to GPU", i) - - holder.get("ClusterImporter", "Transfer from GPU", i); - //Safe to hardcode this since it will be the same for all (grow, split & both) - - const double total_time = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - return conversion_t / total_time; - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - - } - }, - StyleKinds::joined); - - - add_plot<graph_plotter> - (std::string("time_global_frac_transfers_") + suffix, - RETFUNC(0), - RETFUNC(0), - false, 0, "Fraction of the GPU Processing Time Due to Data Transfers", - "# CPU Threads", "#font[52]{t}^{(Transfers)}/#font[52]{t}^{(" + test_name + ")}", - [&](graph_group_1D * group) - { - for (auto & holder : runs) - { - double avg = 0, std_dev = 0; - - calculate_stats(holder.num_events(), avg, std_dev, - [&](const size_t i) - { - const double transfer_t = holder.get("EventDataExporter", "Transfer to GPU", i) + holder.get("ClusterImporter", "Transfer from GPU", i); - const double total_time = sum_all(holder, test_ts, i) + sum_all(holder, extra_ts, i); - return transfer_t / total_time; - }); - - group->global->AddPoint(holder.num_threads, avg); - group->global->SetPointError(group->global->GetN() - 1, 0., std_dev); - - } - }, - StyleKinds::joined); - -} - -#undef RETFUNC - -#endif //CALORECGPU_TOOLS_TIMEPLOTTER_H \ No newline at end of file diff --git a/Calorimeter/CaloRecGPU/tools/plotter/clusterplotter.cxx b/Calorimeter/CaloRecGPU/tools/plotter/clusterplotter.cxx deleted file mode 100644 index 0563d35b8f43c2f94ccb500eb1e041421c32a714..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloRecGPU/tools/plotter/clusterplotter.cxx +++ /dev/null @@ -1,1377 +0,0 @@ -// -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -// -#include <cstdlib> -#include <iostream> -#include <algorithm> -#include <map> -#include <string> -#include <cstring> -#include <fstream> -#include <list> -#include "PlotterAuxDefines.h" - -#include <boost/filesystem.hpp> - -#include "CxxUtils/checker_macros.h" - -#ifdef ATLAS_CHECK_THREAD_SAFETY - - ATLAS_NO_CHECK_FILE_THREAD_SAFETY; - -#endif - -#include "ClusterPlotter.h" -#include "TimePlotter.h" - - -struct PlotDefs -{ - std::string name; - std::string pref; - std::string suf; - double xmin, xmax, ymin, ymax; - int bin_size; - double labelx, labely; - - PlotDefs(const std::string & n = "", const std::string & p = "", const std::string & s = "", - const double xmi = -1, const double xma = -1, const double ymi = -1, const double yma = -1, - const int bs = -1, const double lx = -1, const double ly = -1): - name(n), pref(p), suf(s), xmin(xmi), xmax(xma), ymin(ymi), ymax(yma), bin_size(bs), labelx(lx), labely(ly) - { - } - - void reset() - { - name = ""; - pref = ""; - suf = ""; - xmin = -1; - xmax = -1; - ymin = -1; - ymax = -1; - bin_size = -1; - labelx = -1; - labely = -1; - } - - template <class Stream> friend - Stream & operator << (Stream & str, const PlotDefs & pd) - { - str << pd.name << "|" << pd.pref << "|" << pd.suf << "|" << pd.xmin << " " << pd.xmax << " " << pd.ymin << " " << pd.ymax << " " << pd.bin_size << " " << pd.labelx << " " << pd.labely << std::endl; - return str; - } - - template <class Stream> friend - Stream & operator>> (Stream & str, PlotDefs & pd) - { - pd.reset(); - - std::string line; - std::getline(str, line); - - const size_t pos_1 = line.find('|'); - if (pos_1 == std::string::npos) - { - return str; - } - pd.name = line.substr(0, pos_1); - - size_t pos_final = pos_1; - - const size_t pos_2 = line.find('|', pos_1 + 1); - - - if (pos_2 != std::string::npos) - { - pd.pref = line.substr(pos_1 + 1, pos_2 - pos_1 - 1); - pos_final = pos_2; - - const size_t pos_3 = line.find('|', pos_2 + 1); - if (pos_3 != std::string::npos) - { - pd.suf = line.substr(pos_2 + 1, pos_3 - pos_2 - 1); - pos_final = pos_3; - } - } - - std::stringstream readstr(line.substr(pos_final + 1)); - - readstr >> pd.xmin >> pd.xmax >> pd.ymin >> pd.ymax >> pd.bin_size >> pd.labelx >> pd.labely; - - return str; - } -}; - -struct ProgArgs -{ - std::vector<std::string> in_paths; - std::vector<std::string> names; - std::string out_path; - double min_similarity = 0.; - double term_weight= 0.; - double grow_weight= 0.; - double seed_weight= 0.; - bool place_titles{}; - std::string plot_label; - std::vector<PlotDefs> plot_reqs; - std::vector<PlotDefs> togetherplot_reqs; - std::vector<PlotDefs> timeplot_reqs; - std::vector<PlotDefs> timetogetherplot_reqs; - bool normalize_hists{}; - bool skip_almost_everything{}; - bool use_ATLAS_style{}; - std::string file_filter; - int max_events{}; - bool just_png{}; - bool do_clusters{}; - bool do_times{}; - std::string constant_foldername; - std::string reference_foldername; - std::string test_foldername; - void reset() - { - in_paths.clear(); - names.clear(); - out_path = "./plots/"; - min_similarity = CaloRecGPU::default_min_similarity; - term_weight = CaloRecGPU::default_term_weight; - grow_weight = CaloRecGPU::default_grow_weight; - seed_weight = CaloRecGPU::default_seed_weight; - place_titles = false; - plot_label = ""; - plot_reqs.clear(); - togetherplot_reqs.clear(); - timeplot_reqs.clear(); - timetogetherplot_reqs.clear(); - normalize_hists = false; - skip_almost_everything = false; - use_ATLAS_style = true; - file_filter = ""; - max_events = -1; - just_png = false; - do_clusters = true; - do_times = true; - constant_foldername = "val_modified_grow"; - reference_foldername = "val_default_grow"; - test_foldername = "val_modified_grow"; - } -}; - -void read_plots_file(const boost::filesystem::path & file, std::vector<PlotDefs> & vec) -{ - vec.clear(); - if (file == "none" || file == "NONE") - { - return; - } - std::ifstream in(file); - while (in.good()) - { - if (in.peek() == '\n') - { - in.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); - } - else if (in.peek() == '#') - { - in.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); - } - else - { - PlotDefs pd; - in >> pd; - if (pd.name != "") - { - vec.push_back(pd); - } - } - } - /* - for (const auto & pd : vec) - { - std::cout << " READ: " << pd << std::endl; - } - */ -} - - -void set_default_plots(ProgArgs & args) -{ - [[maybe_unused]] constexpr int default_num_bins = 250; - [[maybe_unused]] constexpr int shorter_num_bins = 100; - [[maybe_unused]] constexpr int small_num_bins = 50; - [[maybe_unused]] constexpr int smallest_num_bins = 25; - /* - - args.plot_reqs.emplace_back("diff_num_hist", "", "", -1, -1, -1, -1, smallest_num_bins); - args.plot_reqs.emplace_back("diff_num_hist", "", "_zoom", -10, 10); - args.plot_reqs.emplace_back("diff_num_rel_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("frac_cell_diff_reg_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("frac_cell_diff_type_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("frac_cell_diff_reg_hist", "", "_zoom", 0, 0.2); - args.plot_reqs.emplace_back("frac_cell_diff_type_hist", "", "_zoom", 0, 0.2); - - args.plot_reqs.emplace_back("diff_cell_per_cluster", "", "", -1, -1, -1, -1, default_num_bins); - args.plot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom1", 0, 2500); - args.plot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom2", 0, 500); - args.plot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom3", 0, 100); - - args.plot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "", -1, -1); - args.plot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom1", 0, 0.5); - args.plot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom2", 0., 0.25); - args.plot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom3", 0., 0.05); - - args.plot_reqs.emplace_back("delta_R_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_R_hist", "", "_zoom1", 0., 0.25); - args.plot_reqs.emplace_back("delta_R_hist", "", "_zoom2", 0., 0.001); - args.plot_reqs.emplace_back("delta_R_hist", "", "_zoom3", 0., 0.0001); - */ - - args.plot_reqs.emplace_back("delta_cells_vs_delta_R", "", "", -1, -1, -1, -1, default_num_bins); - args.plot_reqs.emplace_back("delta_cells_vs_delta_R", "", "_zoom1", 0., 0.25, -1, -1); - args.plot_reqs.emplace_back("delta_cells_vs_delta_R", "", "_zoom2", 0., 0.001, -1, -1); - args.plot_reqs.emplace_back("delta_cells_vs_delta_R", "", "_zoom3", 0., 0.0001, -1, -1); - - args.plot_reqs.emplace_back("delta_R_vs_E", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("delta_R_vs_E", "", "_zoom", -1000, 1000, 0, 0.15); - args.plot_reqs.emplace_back("delta_R_vs_Et", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("delta_R_vs_Et", "", "_zoom1", -175, 175, 0, 0.15); - args.plot_reqs.emplace_back("delta_R_vs_Et", "", "_zoom2", -75, 75, 0, 0.15); - args.plot_reqs.emplace_back("delta_R_vs_Eta", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("delta_R_vs_Eta", "", "_zoom", -7.5, 7.5, 0, 0.15); - args.plot_reqs.emplace_back("delta_R_vs_Phi", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("delta_R_vs_Phi", "", "_zoom", -1, -1, 0, 0.15); - args.plot_reqs.emplace_back("delta_R_vs_size", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("delta_R_vs_size", "", "_zoom", 0, 3000, 0., 0.15); - - args.plot_reqs.emplace_back("delta_Et_rel_vs_Et", "", "", -1, -1, -1., 10.); - args.plot_reqs.emplace_back("delta_Et_rel_vs_Et", "", "_zoom1", -150, 150, -0.25, 0.25); - args.plot_reqs.emplace_back("delta_Et_rel_vs_Et", "", "_zoom2", -75, 75, -0.25, 0.25); - args.plot_reqs.emplace_back("delta_Et_rel_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom", -0.5, 0.5); - args.plot_reqs.emplace_back("Et1_vs_Et2", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("Et1_vs_Et2", "", "_zoom", -100, 100, -100, 100); - args.plot_reqs.emplace_back("E1_vs_E2", "", "", -1, -1, -1, -1); - args.plot_reqs.emplace_back("E1_vs_E2", "", "_zoom", -200, 200, -200, 200); - /* - args.plot_reqs.emplace_back("Et_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("Et_hist", "", "_zoom1", -200, 200); - args.plot_reqs.emplace_back("Et_hist", "", "_zoom2", -100, 100); - args.plot_reqs.emplace_back("E_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("E_hist", "", "_zoom", -1500, 1500); - args.plot_reqs.emplace_back("cluster_size_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("cluster_size_hist", "", "_zoom", 0, 1000); - args.plot_reqs.emplace_back("cluster_eta_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("cluster_eta_hist", "", "_full", -7.5, 7.5); - args.plot_reqs.emplace_back("cluster_eta_hist", "", "_zoom0", -50, 50); - args.plot_reqs.emplace_back("cluster_eta_hist", "", "_zoom1", -10, 10); - args.plot_reqs.emplace_back("cluster_eta_hist", "", "_zoom2", -3, 3); - args.plot_reqs.emplace_back("cluster_phi_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("cluster_phi_hist", "", "_full", -pi<double>, pi<double>); - - - args.plot_reqs.emplace_back("delta_eta_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_eta_hist", "", "_zoom1", -10, 10); - args.plot_reqs.emplace_back("delta_eta_hist", "", "_zoom3", -1, 1); - args.plot_reqs.emplace_back("delta_eta_hist", "", "_zoom3", -0.25, 0.25); - args.plot_reqs.emplace_back("delta_eta_hist", "", "_zoom4", -0.1, 0.1); - args.plot_reqs.emplace_back("delta_eta_hist", "", "_zoom5", -0.01, 0.01); - args.plot_reqs.emplace_back("delta_eta_hist", "", "_zoom6", -0.001, 0.001); - - args.plot_reqs.emplace_back("delta_phi_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_phi_hist", "", "_full", -pi<double>, pi<double>); - - args.plot_reqs.emplace_back("delta_E_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom1", -1000, 1000); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom2", -500, 500); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom3", -100, 100); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom4", -50, 50); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom5", -10, 10); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom6", -1, 1); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom7", -0.1, 0.1); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom8", -0.01, 0.01); - args.plot_reqs.emplace_back("delta_E_hist", "", "_zoom9", -0.001, 0.001); - - args.plot_reqs.emplace_back("delta_Et_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom1", -1000, 1000); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom2", -500, 500); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom3", -100, 100); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom4", -50, 50); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom5", -10, 10); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom6", -1, 1); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom7", -0.1, 0.1); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom8", -0.01, 0.01); - args.plot_reqs.emplace_back("delta_Et_hist", "", "_zoom9", -0.001, 0.001); - - - - args.plot_reqs.emplace_back("cluster_number_hist", "", "", -1, -1, -1, -1, smallest_num_bins); - args.plot_reqs.emplace_back("term_cell_E_perc_hist", "", "", -1, -1); - */ - - args.plot_reqs.emplace_back("term_cell_E_perc_vs_E_ref", "", "", -1, -1, -1, -1, default_num_bins); - args.plot_reqs.emplace_back("term_cell_E_perc_vs_E_test", "", "", -1, -1, -1, -1); - - /* - - - args.plot_reqs.emplace_back("unmatched_number_hist", "", "", -1, -1, -1, -1, smallest_num_bins); - - - args.plot_reqs.emplace_back("unmatched_perc_hist", "", "", -1, -1, -1, -1, small_num_bins); - - - args.plot_reqs.emplace_back("unmatched_E_hist", "", "", -1, -1, -1, -1, shorter_num_bins); - args.plot_reqs.emplace_back("unmatched_E_hist", "", "_zoom", -50, 100); - args.plot_reqs.emplace_back("unmatched_Et_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("unmatched_Et_hist", "", "_zoom1", -50, 50); - args.plot_reqs.emplace_back("unmatched_Et_hist", "", "_zoom2", -20, 20); - args.plot_reqs.emplace_back("unmatched_sizes_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("unmatched_sizes_hist", "", "_zoom", 0, 1000); - args.plot_reqs.emplace_back("unmatched_eta_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("unmatched_eta_hist", "", "_full", -7.5, 7.5); - args.plot_reqs.emplace_back("unmatched_eta_hist", "", "_zoom", -3, 3); - args.plot_reqs.emplace_back("unmatched_phi_hist", "", "", -1, -1); - args.plot_reqs.emplace_back("unmatched_phi_hist", "", "_full", -pi<double>, pi<double>); - - args.plot_reqs.emplace_back("equal_cells_delta_R", "", "", -1, -1, -1, -1, default_num_bins); - args.plot_reqs.emplace_back("equal_cells_delta_R", "", "_zoom1", 0., 0.25); - args.plot_reqs.emplace_back("equal_cells_delta_R", "", "_zoom2", 0., 0.001); - args.plot_reqs.emplace_back("equal_cells_delta_R", "", "_zoom3", 0., 0.0001); - - - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "", -1, -1); - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom1", -10, 10); - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom2", -1, 1); - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom3", -0.25, 0.25); - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom4", -0.1, 0.1); - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom5", -0.01, 0.01); - args.plot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom6", -0.001, 0.001); - - - args.plot_reqs.emplace_back("equal_cells_delta_phi", "", "", -1, -1); - args.plot_reqs.emplace_back("equal_cells_delta_phi", "", "_full", -pi<double>, pi<double>); - args.plot_reqs.emplace_back("equal_cells_delta_phi", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("equal_cells_delta_phi", "", "_zoom2", -0.1, 0.1); - - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "", -1, -1); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom1", -1000, 1000); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom2", -500, 500); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom3", -100, 100); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom4", -50, 50); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom5", -10, 10); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom6", -1, 1); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom7", -0.1, 0.1); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom8", -0.01, 0.01); - args.plot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom9", -0.001, 0.001); - - args.plot_reqs.emplace_back("equal_cells_delta_E_rel", "", "", -1, -1); - args.plot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom2", -0.5, 0.5); - args.plot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom3", -0.1, 0.1); - - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "", -1, -1); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom1", -1000, 1000); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom2", -500, 500); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom3", -100, 100); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom4", -50, 50); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom5", -10, 10); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom6", -1, 1); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom7", -0.1, 0.1); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom8", -0.01, 0.01); - args.plot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom9", -0.001, 0.001); - - args.plot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "", -1, -1); - args.plot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom2", -0.5, 0.5); - args.plot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom3", -0.1, 0.1); - */ - /* - - args.plot_reqs.emplace_back("post_calc_delta_R", "", "", -1, -1); - args.plot_reqs.emplace_back("post_calc_delta_R", "", "_zoom1", 0., 0.25); - args.plot_reqs.emplace_back("post_calc_delta_R", "", "_zoom2", 0., 0.001); - args.plot_reqs.emplace_back("post_calc_delta_R", "", "_zoom3", 0., 0.0001); - - - args.plot_reqs.emplace_back("post_calc_delta_eta", "", "", -1, -1); - args.plot_reqs.emplace_back("post_calc_delta_eta", "", "_zoom1", -10, 10); - args.plot_reqs.emplace_back("post_calc_delta_eta", "", "_zoom2", -1, 1); - args.plot_reqs.emplace_back("post_calc_delta_eta", "", "_zoom3", -0.25, 0.25); - args.plot_reqs.emplace_back("post_calc_delta_eta", "", "_zoom4", -0.1, 0.1); - args.plot_reqs.emplace_back("post_calc_delta_eta", "", "_zoom5", -0.01, 0.01); - - - args.plot_reqs.emplace_back("post_calc_delta_phi", "", "", -1, -1); - args.plot_reqs.emplace_back("post_calc_delta_phi", "", "_full", -pi<double>, pi<double>); - args.plot_reqs.emplace_back("post_calc_delta_phi", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("post_calc_delta_phi", "", "_zoom2", -0.1, 0.1); - - args.plot_reqs.emplace_back("post_calc_delta_E", "", "", -1, -1); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom1", -1000, 1000); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom2", -500, 500); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom3", -100, 100); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom4", -50, 50); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom5", -10, 10); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom6", -1, 1); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom7", -0.1, 0.1); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom8", -0.01, 0.01); - args.plot_reqs.emplace_back("post_calc_delta_E", "", "_zoom9", -0.001, 0.001); - - args.plot_reqs.emplace_back("post_calc_delta_E_rel", "", "", -1, -1); - args.plot_reqs.emplace_back("post_calc_delta_E_rel", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("post_calc_delta_E_rel", "", "_zoom2", -0.5, 0.5); - args.plot_reqs.emplace_back("post_calc_delta_E_rel", "", "_zoom3", -0.1, 0.1); - args.plot_reqs.emplace_back("post_calc_delta_E_rel", "", "_zoom4", -0.005, 0.005); - - - args.plot_reqs.emplace_back("delta_post_E", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_post_E", "", "_zoom1", -1000, 1000); - args.plot_reqs.emplace_back("delta_post_E", "", "_zoom2", -500, 500); - args.plot_reqs.emplace_back("delta_post_E", "", "_zoom3", -100, 100); - args.plot_reqs.emplace_back("delta_post_E", "", "_zoom4", -50, 50); - args.plot_reqs.emplace_back("delta_post_E", "", "_zoom5", -10, 10); - args.plot_reqs.emplace_back("delta_post_E", "", "_zoom6", -1, 1); - - - args.plot_reqs.emplace_back("delta_post_E_rel", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_post_E_rel", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("delta_post_E_rel", "", "_zoom2", -0.5, 0.5); - args.plot_reqs.emplace_back("delta_post_E_rel", "", "_zoom3", -0.1, 0.1); - args.plot_reqs.emplace_back("delta_post_E_rel", "", "_zoom4", -0.005, 0.005); - - args.plot_reqs.emplace_back("delta_post_eta", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_post_eta", "", "_zoom1", -10, 10); - args.plot_reqs.emplace_back("delta_post_eta", "", "_zoom2", -1, 1); - args.plot_reqs.emplace_back("delta_post_eta", "", "_zoom3", -0.25, 0.25); - args.plot_reqs.emplace_back("delta_post_eta", "", "_zoom4", -0.1, 0.1); - - - args.plot_reqs.emplace_back("delta_post_phi", "", "", -1, -1); - args.plot_reqs.emplace_back("delta_post_phi", "", "_full", -pi<double>, pi<double>); - args.plot_reqs.emplace_back("delta_post_phi", "", "_zoom1", -1, 1); - args.plot_reqs.emplace_back("delta_post_phi", "", "_zoom2", -0.1, 0.1); - - - - - args.plot_reqs.emplace_back("time_histogram", "", "", -1, -1, small_num_bins); - args.plot_reqs.emplace_back("time_histogram", "", "_zoom1", 0, 60000); - args.plot_reqs.emplace_back("time_histogram", "", "_zoom2", 5000, 60000); - - args.plot_reqs.emplace_back("time_ratio_histogram", "", "", -1, -1); - args.plot_reqs.emplace_back("time_ratio_histogram", "", "_zoom1", 0, 5); - args.plot_reqs.emplace_back("time_ratio_histogram", "", "_zoom2", 0, 2); - args.plot_reqs.emplace_back("time_ratio_histogram", "", "_zoom3", 0, 1); - args.plot_reqs.emplace_back("time_ratio_histogram", "", "_zoom4", 0, 0.75); - args.plot_reqs.emplace_back("time_ratio_histogram", "", "_zoom5", 0, 0.5); - - args.plot_reqs.emplace_back("time_calc_gpu", "", "", -1, -1); - - */ - - - args.togetherplot_reqs.emplace_back("cluster_number_hist", "", "", -1, -1, -1, -1, smallest_num_bins); - args.togetherplot_reqs.emplace_back("cluster_number_hist", "", "_zoom1", 0, 1800); - args.togetherplot_reqs.emplace_back("diff_num_hist", "", "", -1, -1); - - args.togetherplot_reqs.emplace_back("diff_num_hist", "", "_zoom1", -10.5, 10.5, -1, -1, 21); - - args.togetherplot_reqs.emplace_back("unmatched_number_hist", "", "", -0.5, 5.5, -1, -1, 6); - -/* - args.togetherplot_reqs.emplace_back("time_histogram", "", "", -1, -1, -1, -1, small_num_bins); - args.togetherplot_reqs.emplace_back("time_histogram", "", "_zoom1", 0, 60000); - args.togetherplot_reqs.emplace_back("time_histogram", "", "_zoom2", 5000, 60000); - - args.togetherplot_reqs.emplace_back("time_ratio_histogram", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("time_ratio_histogram", "", "_zoom1", 0, 5); - args.togetherplot_reqs.emplace_back("time_ratio_histogram", "", "_zoom2", 0, 2); - args.togetherplot_reqs.emplace_back("time_ratio_histogram", "", "_zoom3", 0, 1); - args.togetherplot_reqs.emplace_back("time_ratio_histogram", "", "_zoom4", 0, 0.75); - args.togetherplot_reqs.emplace_back("time_ratio_histogram", "", "_zoom5", 0, 0.5); - - - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "_zoom1", 0, 25); - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "_zoom2", 0, 20); - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "_zoom3", 0, 15); - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "_zoom4", 0, 10); - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "_zoom5", 0, 5); - args.togetherplot_reqs.emplace_back("time_invratio_histogram", "", "_zoom5", 0, 5); - - args.togetherplot_reqs.emplace_back("time_calc_gpu", "", "", -1, -1); - - - args.togetherplot_reqs.emplace_back("time_histogram_modified", "", "", -1, -1); -*/ - - args.togetherplot_reqs.emplace_back("unmatched_E_hist", "", "", -1, -1, -1, -1, smallest_num_bins); - args.togetherplot_reqs.emplace_back("unmatched_E_hist", "", "_zoom1", -50, 50); - args.togetherplot_reqs.emplace_back("unmatched_E_hist", "", "_zoom2", -20, 20); - args.togetherplot_reqs.emplace_back("unmatched_Et_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("unmatched_Et_hist", "", "_zoom1", -50, 50); - args.togetherplot_reqs.emplace_back("unmatched_Et_hist", "", "_zoom2", -20, 20); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist", "", "_zoom", 0, 1000); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist_cumul", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist_cumul", "", "_zoom1", 0, 1000); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist_cumul", "", "_zoom2", 0, 500); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist_cumul", "", "_zoom3", 0, 250); - args.togetherplot_reqs.emplace_back("unmatched_sizes_hist_cumul", "", "_zoom4", 0, 100); - args.togetherplot_reqs.emplace_back("unmatched_eta_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("unmatched_eta_hist", "", "_full", -7.5, 7.5); - args.togetherplot_reqs.emplace_back("unmatched_eta_hist", "", "_zoom", -3, 3); - args.togetherplot_reqs.emplace_back("unmatched_phi_hist", "", "", -1, -1); - - args.togetherplot_reqs.emplace_back("Et_hist", "", "", -1, -1, -1, -1, default_num_bins); - args.togetherplot_reqs.emplace_back("Et_hist", "", "_zoom1", 0, 200); - args.togetherplot_reqs.emplace_back("Et_hist", "", "_zoom2", 0, 100); - args.togetherplot_reqs.emplace_back("E_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("E_hist", "", "_zoom", -1500, 1500); - args.togetherplot_reqs.emplace_back("cluster_size_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("cluster_size_hist", "", "_zoom", 0, 1000); - args.togetherplot_reqs.emplace_back("cluster_size_hist_cumul", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("cluster_size_hist_cumul", "", "_zoom1", 0, 1000); - args.togetherplot_reqs.emplace_back("cluster_size_hist_cumul", "", "_zoom2", 0, 500); - args.togetherplot_reqs.emplace_back("cluster_size_hist_cumul", "", "_zoom3", 0, 250); - args.togetherplot_reqs.emplace_back("cluster_size_hist_cumul", "", "_zoom4", 0, 100); - args.togetherplot_reqs.emplace_back("cluster_eta_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("cluster_eta_hist", "", "_full", -7.5, 7.5); - args.togetherplot_reqs.emplace_back("cluster_eta_hist", "", "_zoom0", -50, 50); - args.togetherplot_reqs.emplace_back("cluster_eta_hist", "", "_zoom1", -10, 10); - args.togetherplot_reqs.emplace_back("cluster_eta_hist", "", "_zoom2", -3, 3); - args.togetherplot_reqs.emplace_back("cluster_phi_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("cluster_phi_hist", "", "_full", -pi<double>, pi<double>); - - args.togetherplot_reqs.emplace_back("delta_R_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_R_hist", "", "_zoom1", 0., 0.25); - args.togetherplot_reqs.emplace_back("delta_R_hist", "", "_zoom2", 0., 0.001); - args.togetherplot_reqs.emplace_back("delta_R_hist", "", "_zoom3", 0., 0.0001); - - args.togetherplot_reqs.emplace_back("delta_R_hist_cumul", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_R_hist_cumul", "", "_zoom1", 0., 0.25); - args.togetherplot_reqs.emplace_back("delta_R_hist_cumul", "", "_zoom2", 0., 0.001); - args.togetherplot_reqs.emplace_back("delta_R_hist_cumul", "", "_zoom3", 0., 0.0001); - - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "", -1, -1, -1, -1, small_num_bins); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom1", 0, 2500); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom1p5", 0, 1000); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom2", 0, 500); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom2p5", 0, 125); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom3", 0, 100); - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster", "", "_zoom4", -0.5, 50.5, -1, -1, 51); - - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "", -1, -1, -1, -1, small_num_bins); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom1", 0, 0.5); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom2", 0., 0.25); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom3", 0., 0.05); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster", "", "_zoom4", 0., 0.01); - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom1", 0, 2500); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom1p5", 0, 1000); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom2", 0, 500); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom2p5", 0, 125); - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom3", 0, 100); - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom3p5", -0.5, 75.5, -1, -1, 76); - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom4", -0.5, 50.5, -1, -1, 51); - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom5", -0.5, 25.5, -1, -1, 26); - - args.togetherplot_reqs.emplace_back("diff_cell_per_cluster_cumul", "", "_zoom6", -0.5, 10.5, -1, -1, 11); - - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "", -1, -1, -1, -1, small_num_bins); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom1", 0, 0.5); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom2", 0., 0.25); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom2p5", 0., 0.2); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom3", 0., 0.05); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom4", 0., 0.01); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom5", 0., 0.005); - args.togetherplot_reqs.emplace_back("rel_diff_cell_per_cluster_cumul", "", "_zoom6", 0., 0.002); - - args.togetherplot_reqs.emplace_back("equal_cells_delta_R", "", "", -1, -1, -1, -1, default_num_bins); - args.togetherplot_reqs.emplace_back("equal_cells_delta_R", "", "_zoom1", 0., 0.25); - args.togetherplot_reqs.emplace_back("equal_cells_delta_R", "", "_zoom2", 0., 0.001); - args.togetherplot_reqs.emplace_back("equal_cells_delta_R", "", "_zoom3", 0., 0.0001); - - args.togetherplot_reqs.emplace_back("equal_cells_delta_R_cumul", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_R_cumul", "", "_zoom1", 0., 0.25); - args.togetherplot_reqs.emplace_back("equal_cells_delta_R_cumul", "", "_zoom2", 0., 0.001); - args.togetherplot_reqs.emplace_back("equal_cells_delta_R_cumul", "", "_zoom3", 0., 0.0001); - - - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom1", -10, 10); - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom2", -1, 1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom3", -0.25, 0.25); - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom4", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom5", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("equal_cells_delta_eta", "", "_zoom6", -0.001, 0.001); - - - args.togetherplot_reqs.emplace_back("equal_cells_delta_phi", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_phi", "", "_full", -pi<double>, pi<double>); - args.togetherplot_reqs.emplace_back("equal_cells_delta_phi", "", "_zoom1", -1, 1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_phi", "", "_zoom2", -0.1, 0.1); - - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom1", -1000, 1000); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom2", -500, 500); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom3", -100, 100); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom4", -50, 50); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom5", -10, 10); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom6", -1, 1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom7", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom8", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E", "", "_zoom9", -0.001, 0.001); - - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom1", -1, 1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom2", -0.5, 0.5); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom3", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom4", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom5", -0.001, 0.001); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom5p5", -0.0004, 0.0004); - args.togetherplot_reqs.emplace_back("equal_cells_delta_E_rel", "", "_zoom6", -0.0001, 0.0001); - - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom1", -1000, 1000); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom2", -500, 500); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom3", -100, 100); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom4", -50, 50); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom5", -10, 10); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom6", -1, 1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom7", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom8", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et", "", "_zoom9", -0.001, 0.001); - - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom1", -1, 1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom2", -0.5, 0.5); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom3", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom4", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom5", -0.001, 0.001); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom5p5", -0.0002, 0.0002); - args.togetherplot_reqs.emplace_back("equal_cells_delta_Et_rel", "", "_zoom6", -0.0001, 0.0001); - - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "_zoom1", -10, 10); - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "_zoom3", -1, 1); - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "_zoom3", -0.25, 0.25); - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "_zoom4", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "_zoom5", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("delta_eta_hist", "", "_zoom6", -0.001, 0.001); - - args.togetherplot_reqs.emplace_back("delta_phi_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_phi_hist", "", "_full", -pi<double>, pi<double>); - - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom1", -1000, 1000); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom2", -500, 500); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom2p5", -200, 200); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom3", -100, 100); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom4", -50, 50); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom5", -10, 10); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom6", -1, 1); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom7", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom8", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("delta_E_hist", "", "_zoom9", -0.001, 0.001); - - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom1", -1000, 1000); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom2", -500, 500); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom3", -100, 100); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom4", -50, 50); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom4p5", -20, 20); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom5", -10, 10); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom6", -1, 1); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom7", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom8", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("delta_Et_hist", "", "_zoom9", -0.001, 0.001); - - - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom0", -1000, 1000); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom1", -100, 100); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom2", -10, 10); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom3", -1, 1); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom4", -0.5, 0.5); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom5", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom6", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom7", -0.001, 0.001); - args.togetherplot_reqs.emplace_back("delta_E_rel_hist", "", "_zoom8", -0.0001, 0.0001); - - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "", -1, -1); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom0", -1000, 1000); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom1", -100, 100); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom2", -10, 10); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom3", -1, 1); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom4", -0.5, 0.5); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom5", -0.1, 0.1); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom6", -0.01, 0.01); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom7", -0.001, 0.001); - args.togetherplot_reqs.emplace_back("delta_Et_rel_hist", "", "_zoom8", -0.0001, 0.0001); -} - - -void set_default_time_plots(ProgArgs & args) -{ - [[maybe_unused]] constexpr int default_num_bins = 250; - [[maybe_unused]] constexpr int shorter_num_bins = 100; - [[maybe_unused]] constexpr int small_num_bins = 50; - [[maybe_unused]] constexpr int smallest_num_bins = 25; - - args.timeplot_reqs.emplace_back("time_dist_*", "", "", -1, -1); - - args.timeplot_reqs.emplace_back("time_frac_*", "", "", -1, -1); - - args.timeplot_reqs.emplace_back("time_ratio_*", "", "", -1, -1); - - args.timeplot_reqs.emplace_back("time_speedup_*", "", "", -1, -1); - - args.timetogetherplot_reqs.emplace_back("time_global_*", "", "", -1, -1); - - /* - args.timetogetherplot_reqs.emplace_back("time_global_frac*", "", "_zoom1", 0, 1); - args.timetogetherplot_reqs.emplace_back("time_global_frac*", "", "_zoom2", 0, 0.5); - args.timetogetherplot_reqs.emplace_back("time_global_frac*", "", "_zoom3", 0, 0.25); - args.timetogetherplot_reqs.emplace_back("time_global_frac*", "", "_zoom4", 0, 0.125);*/ - -} - -bool setup_arguments(ProgArgs & args, size_t argc, char ** argv) -{ - args.reset(); - - if (argc < 2) - { - std::cout << "Expected arguments: <list of input dirs ...>\n" - "Optional arguments: [-o <output dir>]\n" - " [-s <maximum similarity>]\n" - " [-w <term cell weight> <grow cell weight> <seed cell weight>]\n" - " [-n <list of plotter names>]\n" - " [-t {for plots with titles}]\n" - " [-l <plot labels>]\n" - " [-i <line-separated file with separate plots> (<line-separated file with together plots>)]\n" - " [-u <line-separated file with separate time plots> (<line-separated file with time together plots>)]\n" - " [-r {to renormalize histograms with the number of events}]\n" - " [-c {to skip filling anything other than cell information}]\n" - " [-b {to use the default style rather than ATLAS}]\n" - " [-f <required string in event names>]\n" - " [-e <max events to load (< 0 for unlimited)>]\n" - " [-j {for emitting just .png output}]\n" - " [-x {for disabling the cluster plots}]\n" - " [-z {for disabling the time plots}]\n" - " [-d <constant folder> <reference results folder> <test results folder>]\n" - << std::endl; - return true; - } - - size_t arg = 1; - - bool specified_plot_files = false; - bool specified_time_plot_files = false; - - for (; arg < argc; ++arg) - { - std::string text(argv[arg]); - if (text.size() > 0 && text[0] == '-') - //Not the most elegant solution, but eh... - { - break; - } - if (!boost::filesystem::exists(text)) - { - std::cout << "ERROR: Input directory '" << text << "' does not exist!" << std::endl; - return true; - } - args.in_paths.push_back(text); - } - for (; arg < argc; ++arg) - { - if (!std::strcmp(argv[arg], "-o")) - { - if (argc > arg + 1) - { - ++arg; - args.out_path = argv[arg]; - } - else - { - std::cout << "ERROR: '-o' provided without specifying output dir!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-s")) - { - if (argc > arg + 1) - { - ++arg; - args.min_similarity = std::atof(argv[arg]); - } - else - { - std::cout << "ERROR: '-s' provided without specifying minimum similarity!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-w")) - { - if (argc > arg + 3) - { - args.term_weight = std::atof(argv[arg + 1]); - args.grow_weight = std::atof(argv[arg + 2]); - args.seed_weight = std::atof(argv[arg + 3]); - arg += 3; - } - else - { - std::cout << "ERROR: '-w' provided without properly specifying the weights!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-n")) - { - if (argc > arg + args.in_paths.size()) - { - ++arg; - for (size_t i = 0; i < args.in_paths.size() && arg < argc; ++i, ++arg) - { - args.names.emplace_back(argv[arg]); - } - } - else - { - std::cout << "ERROR: '-n' provided with an insufficient number of plots!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-t")) - { - args.place_titles = true; - } - else if (!std::strcmp(argv[arg], "-l")) - { - if (argc > arg + 1) - { - ++arg; - args.plot_label = argv[arg]; - } - else - { - std::cout << "ERROR: '-l' provided without specifying plot label!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-i")) - { - if (argc > arg + 1) - { - ++arg; - read_plots_file(argv[arg], args.plot_reqs); - if (argc > arg + 1) - { - ++arg; - read_plots_file(argv[arg], args.togetherplot_reqs); - } - specified_plot_files = true; - } - else - { - std::cout << "ERROR: '-i' provided without specifying valid plot files!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-u")) - { - if (argc > arg + 1) - { - ++arg; - read_plots_file(argv[arg], args.timeplot_reqs); - if (argc > arg + 1) - { - ++arg; - read_plots_file(argv[arg], args.timetogetherplot_reqs); - } - specified_time_plot_files = true; - } - else - { - std::cout << "ERROR: '-u' provided without specifying valid time plot files!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-r")) - { - args.normalize_hists = true; - } - else if (!std::strcmp(argv[arg], "-c")) - { - args.skip_almost_everything = true; - } - else if (!std::strcmp(argv[arg], "-b")) - { - args.use_ATLAS_style = false; - } - if (!std::strcmp(argv[arg], "-f")) - { - if (argc > arg + 1) - { - ++arg; - args.file_filter = argv[arg]; - } - else - { - std::cout << "ERROR: '-f' provided without specifying file filter!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-e")) - { - if (argc > arg + 1) - { - ++arg; - args.max_events = std::atoi(argv[arg]); - } - else - { - std::cout << "ERROR: '-e' provided without specifying max number of events!" << std::endl; - return true; - } - } - else if (!std::strcmp(argv[arg], "-j")) - { - args.just_png = true; - } - else if (!std::strcmp(argv[arg], "-x")) - { - args.do_clusters = false; - } - else if (!std::strcmp(argv[arg], "-z")) - { - args.do_times = false; - } - else if (!std::strcmp(argv[arg], "-d")) - { - if (argc > arg + 3) - { - args.constant_foldername = argv[arg + 1]; - args.reference_foldername = argv[arg + 2]; - args.test_foldername = argv[arg + 3]; - arg += 3; - } - else - { - std::cout << "ERROR: '-d' provided without properly specifying the folders!" << std::endl; - return true; - } - } - } - - if (!boost::filesystem::exists(args.out_path)) - { - if (boost::filesystem::create_directories(args.out_path)) - { - std::cout << "WARNING: Output path '" << args.out_path << "' did not exist and was created!" << std::endl; - } - else - { - std::cout << "ERROR: Output path '" << args.out_path << "' did not exist and couldn't be created!" << std::endl; - return true; - } - } - - BasePlotter::place_title = args.place_titles; - BasePlotter::normalize = args.normalize_hists; - BasePlotter::place_ATLAS_label = args.use_ATLAS_style; - - if (!specified_plot_files) - { - set_default_plots(args); - } - - if (!specified_time_plot_files) - { - set_default_time_plots(args); - } - - return false; -} - - - - -void do_plots (const ProgArgs & args) -{ - - std::cout << "Plotting:\n"; - for (size_t i = 0; i < args.in_paths.size(); ++i) - { - std::string name = (args.names.size() > 0 ? args.names[i] : ""); - for (int k = name.size(); k < 32; ++k) - { - name += " "; - } - std::cout << " " << name << " " << args.in_paths[i] << "\n"; - } - std::cout << std::endl; - - std::list<ClusterPlotter> plotters; - std::list<TimePlotter> time_plotters; - - /* - if (args.do_clusters) - { - plotters.reserve(args.in_paths.size()); - } - if (args.do_times) - { - time_plotters.reserve(args.in_paths.size()); - } - */ - //No need to reserve with lists, - //as pointer stability is ensured. - //In fact, no *way* to reserve with lists. - - TogetherPlot together, time_together; - - for (const auto & in_path : args.in_paths) - { - if (args.do_clusters) - { - plotters.emplace_back(in_path + "/" + args.constant_foldername, - in_path + "/" + args.reference_foldername, - in_path + "/" + args.test_foldername, - args.max_events, - args.file_filter, - args.min_similarity, - args.term_weight, - args.grow_weight, - args.seed_weight); - } - if (args.do_times) - { - time_plotters.emplace_back(in_path); - } - - if (args.names.size() > 0 && args.names.size() >= plotters.size()) - { - if (args.do_clusters) - { - plotters.back().plotter_name = args.names[plotters.size() - 1]; - } - if (args.do_times) - { - time_plotters.back().plotter_name = args.names[time_plotters.size() - 1]; - } - } - - auto set_single_properties = [&](BasePlotter & ptr) - { - if (!args.use_ATLAS_style) - { - ptr.Styles[0].line.color = 1; - ptr.Styles[1].line.color = 1; - ptr.Styles[2].line.color = 1; - - ptr.Styles[0].fill.style = 3004; - ptr.Styles[1].fill.style = 3005; - ptr.Styles[2].fill.style = 1001; - - ptr.Styles[0].fill.color = kBlue; - ptr.Styles[1].fill.color = kRed; - ptr.Styles[2].fill.color = kGray + 1; - - std::cout << "Set custom style successfully." << std::endl; - } - if (args.just_png) - { - ptr.file_extensions = {"png"}; - ptr.print_options = {""}; - } - }; - - if (args.do_clusters) - { - set_single_properties(plotters.back()); - } - if (args.do_times) - { - set_single_properties(time_plotters.back()); - } - - const std::string out_dir = args.out_path + "/plots_" + std::to_string(std::max(plotters.size(), time_plotters.size())); - - - if (!boost::filesystem::exists(out_dir)) - { - if (boost::filesystem::create_directories(out_dir)) - { - std::cout << "WARNING: Output path '" << out_dir << "' did not exist and was created!" << std::endl; - } - else - { - std::cout << "ERROR: Output path '" << out_dir << "' did not exist and couldn't be created!" << std::endl; - continue; - } - } - - if (args.do_clusters) - { - std::cout << "\n Plotting " << plotters.back().plotter_name << " from '" << in_path << "' to '" << out_dir << "'\n" << std::endl; - } - else if (args.do_times) - { - std::cout << "\n Plotting " << time_plotters.back().plotter_name << " from '" << in_path << "' to '" << out_dir << "'\n" << std::endl; - } - - auto actually_plot = [&](BasePlotter & plotter, const std::vector<PlotDefs> & plot_reqs) - { - plotter.plot_label = args.plot_label; - const int prev_num_bins = plotter.num_bins; - - for (const auto & el : plot_reqs) - { - if (el.bin_size > 0) - { - plotter.num_bins = el.bin_size; - } - if (el.labelx > 0) - { - BasePlotter::labelstart_x = el.labelx; - } - if (el.labely > 0) - { - BasePlotter::labelstart_y = el.labely; - } - plotter.plot(el.name, el.xmin, el.xmax, el.ymin, el.ymax, out_dir, el.pref, el.suf); - } - plotter.num_bins = prev_num_bins; - }; - - if (args.do_clusters) - { - actually_plot(plotters.back(), args.plot_reqs); - } - if (args.do_times) - { - actually_plot(time_plotters.back(), args.timeplot_reqs); - } - } - - auto set_together_style = [&](auto & plt_list) - { - if (args.use_ATLAS_style) - { - plt_list.front().Styles[0].line.color = kOrange + 3; - plt_list.front().Styles[0].line.style = 3; - plt_list.front().Styles[1].line.color = kRed; - plt_list.front().Styles[1].line.style = 1; - plt_list.front().Styles[2].line.color = kRed; - plt_list.front().Styles[2].line.style = 1; - - plt_list.back().Styles[0].line.color = kCyan - 5; - plt_list.back().Styles[0].line.style = 4; - plt_list.back().Styles[1].line.color = kBlue; - plt_list.back().Styles[1].line.style = 2; - plt_list.back().Styles[2].line.color = kBlue; - plt_list.back().Styles[2].line.style = 2; - } - else - { - plt_list.front().Styles[0].fill.color = kOrange + 3; - plt_list.front().Styles[1].fill.color = kRed; - plt_list.front().Styles[2].fill.color = kRed; - - plt_list.back().Styles[0].fill.color = kCyan - 5; - plt_list.back().Styles[1].fill.color = kBlue; - plt_list.back().Styles[2].fill.color = kBlue; - - plt_list.front().Styles[0].fill.style = 3007; - plt_list.front().Styles[1].fill.style = 3004; - plt_list.front().Styles[2].fill.style = 3004; - - plt_list.back().Styles[0].fill.style = 3006; - plt_list.back().Styles[1].fill.style = 3005; - plt_list.back().Styles[2].fill.style = 3005; - - - plt_list.front().Styles[0].marker.color = kOrange + 3; - plt_list.front().Styles[1].marker.color = kRed; - plt_list.front().Styles[2].marker.color = kRed; - plt_list.front().Styles[0].marker.style = 20; - plt_list.front().Styles[1].marker.style = 20; - plt_list.front().Styles[2].marker.style = 20; - - plt_list.back().Styles[0].marker.color = kCyan - 5; - plt_list.back().Styles[1].marker.color = kBlue; - plt_list.back().Styles[2].marker.color = kBlue; - plt_list.back().Styles[0].marker.style = 21; - plt_list.back().Styles[1].marker.style = 21; - plt_list.back().Styles[2].marker.style = 21; - - } - }; - - if (args.do_clusters) - { - set_together_style(plotters); - for (const auto & plotter : plotters) - { - together.add_plot(&plotter); - } - } - if (args.do_times) - { - set_together_style(time_plotters); - for (const auto & time_plotter : time_plotters) - { - time_together.add_plot(&time_plotter); - } - } - - std::cout << "\n Plotting together.\n" << std::endl; - - auto actually_do_plots = [&](auto & together_plt, auto & plt_list, auto & plot_reqs) - { - const int prev_num_bins_front = plt_list.front().num_bins; - const int prev_num_bins_back = plt_list.back().num_bins; - - for (const auto & el : plot_reqs) - { - if (el.bin_size > 0) - { - plt_list.front().num_bins = el.bin_size; - plt_list.back().num_bins = el.bin_size; - } - together_plt.plot(el.name, el.xmin, el.xmax, el.ymin, el.ymax, args.out_path, el.pref, el.suf); - } - - plt_list.front().num_bins = prev_num_bins_front; - plt_list.back().num_bins = prev_num_bins_back; - }; - - if (args.do_clusters) - { - actually_do_plots(together, plotters, args.togetherplot_reqs); - } - if (args.do_times) - { - actually_do_plots(time_together, time_plotters, args.timetogetherplot_reqs); - } - - std::cout << "\n Done!\n" << std::endl; - -} - - -std::unique_ptr<TStyle> CreateAtlasStyle() -{ - std::unique_ptr<TStyle> atlasStyle = std::make_unique<TStyle>("ATLAS", "Atlas style"); - - // use plain black on white colors - Int_t icol = 0; // WHITE - atlasStyle->SetFrameBorderMode(icol); - atlasStyle->SetFrameFillColor(icol); - atlasStyle->SetCanvasBorderMode(icol); - atlasStyle->SetCanvasColor(icol); - atlasStyle->SetPadBorderMode(icol); - atlasStyle->SetPadColor(icol); - atlasStyle->SetStatColor(icol); - //atlasStyle->SetFillColor(icol); // don't use: white fill color for *all* objects - - // set the paper & margin sizes - atlasStyle->SetPaperSize(20, 26); - - // set margin sizes - atlasStyle->SetPadTopMargin(0.05); - atlasStyle->SetPadRightMargin(0.05); - atlasStyle->SetPadBottomMargin(0.16); - atlasStyle->SetPadLeftMargin(0.16); - - // set title offsets (for axis label) - atlasStyle->SetTitleXOffset(1.4); - atlasStyle->SetTitleYOffset(1.4); - - // use large fonts - //Int_t font=72; // Helvetica italics - Int_t font = 42; // Helvetica - Double_t tsize = 0.05; - atlasStyle->SetTextFont(font); - - atlasStyle->SetTextSize(tsize); - atlasStyle->SetLabelFont(font, "x"); - atlasStyle->SetTitleFont(font, "x"); - atlasStyle->SetLabelFont(font, "y"); - atlasStyle->SetTitleFont(font, "y"); - atlasStyle->SetLabelFont(font, "z"); - atlasStyle->SetTitleFont(font, "z"); - - atlasStyle->SetLabelSize(tsize, "x"); - atlasStyle->SetTitleSize(tsize, "x"); - atlasStyle->SetLabelSize(tsize, "y"); - atlasStyle->SetTitleSize(tsize, "y"); - atlasStyle->SetLabelSize(tsize, "z"); - atlasStyle->SetTitleSize(tsize, "z"); - - // use bold lines and markers - atlasStyle->SetMarkerStyle(20); - atlasStyle->SetMarkerSize(1.2); - atlasStyle->SetHistLineWidth(2.); - atlasStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes - - // get rid of X error bars (as recommended in ATLAS figure guidelines) - atlasStyle->SetErrorX(0.0001); - // get rid of error bar caps - atlasStyle->SetEndErrorSize(0.); - - // do not display any of the standard histogram decorations - atlasStyle->SetOptTitle(0); - //atlasStyle->SetOptStat(1111); - atlasStyle->SetOptStat(0); - //atlasStyle->SetOptFit(1111); - atlasStyle->SetOptFit(0); - - // put tick marks on top and RHS of plots - atlasStyle->SetPadTickX(1); - atlasStyle->SetPadTickY(1); - - return atlasStyle; - -} - -int main(int argc, char ** argv) -{ - - TH1::AddDirectory(false); - ProgArgs args; - - if (setup_arguments(args, argc, argv)) - { - return 1; - } - - std::unique_ptr<TStyle> atlasStyle = CreateAtlasStyle(); - - if (args.use_ATLAS_style) - { - gROOT->SetStyle("ATLAS"); - gROOT->ForceStyle(); - } - - do_plots(args); - //"Maker" - - //do_plots(args, "ClusterSplitter_", "Splitter"); - //"Splitter - //do_plots(args, "", ""); - //Neither "Splitter" nor "Maker" - - return 0; - -} diff --git a/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloTrackingGeometryBuilderImpl.h b/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloTrackingGeometryBuilderImpl.h index acb137a58c57fa3331dedbed4691323e34d2514c..227f73947478522b082af32872d47a5126ce9610 100644 --- a/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloTrackingGeometryBuilderImpl.h +++ b/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloTrackingGeometryBuilderImpl.h @@ -10,8 +10,13 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/SystemOfUnits.h" // Trk +#include "TrkDetDescrInterfaces/ICaloTrackingVolumeBuilder.h" #include "TrkDetDescrInterfaces/IGeometryBuilderCond.h" +#include "TrkDetDescrInterfaces/ITrackingVolumeArrayCreator.h" +#include "TrkDetDescrInterfaces/ITrackingVolumeCreator.h" +#include "TrkDetDescrInterfaces/ITrackingVolumeHelper.h" #include "TrkDetDescrUtils/GeometrySignature.h" #include "TrkDetDescrUtils/LayerIndexSampleMap.h" #include "TrkGeometry/Material.h" @@ -28,14 +33,8 @@ namespace Trk { class Layer; class MagneticFieldProperties; -class ICaloTrackingVolumeBuilder; -class ITrackingVolumeCreator; -class ITrackingVolumeHelper; -class ITrackingVolumeArrayCreator; } // namespace Trk -class IEnvelopeDefSvc; - namespace Calo { /** @class CaloTrackingGeometryBuilderImpl @@ -73,37 +72,37 @@ class CaloTrackingGeometryBuilderImpl : public AthAlgTool { const IInterface*); //!< Helper Tool to create TrackingVolume Arrays - ToolHandle<Trk::ITrackingVolumeArrayCreator> m_trackingVolumeArrayCreator; + PublicToolHandle<Trk::ITrackingVolumeArrayCreator> m_trackingVolumeArrayCreator{this, "TrackingVolumeArrayCreator", "Trk::TrackingVolumeArrayCreator/TrackingVolumeArrayCreator"}; //!< Helper Tool to create TrackingVolumes - ToolHandle<Trk::ITrackingVolumeHelper> m_trackingVolumeHelper; + PublicToolHandle<Trk::ITrackingVolumeHelper> m_trackingVolumeHelper{this, "TrackingVolumeHelper", "Trk::TrackingVolumeHelper/TrackingVolumeHelper"}; //!< Second helper for volume creation - ToolHandle<Trk::ITrackingVolumeCreator> m_trackingVolumeCreator; + PublicToolHandle<Trk::ITrackingVolumeCreator> m_trackingVolumeCreator{this, "TrackingVolumeCreator", "Trk::CylinderVolumeCreator/TrackingVolumeCreator"}; //!< Volume Builder for the Liquid Argon Calorimeter - ToolHandle<Trk::ICaloTrackingVolumeBuilder> m_lArVolumeBuilder; + PublicToolHandle<Trk::ICaloTrackingVolumeBuilder> m_lArVolumeBuilder{this, "LArVolumeBuilder", "LAr::LArVolumeBuilder/LArVolumeBuilder"}; //!< Volume Builder for the Tile Calorimeter - ToolHandle<Trk::ICaloTrackingVolumeBuilder> m_tileVolumeBuilder; + PublicToolHandle<Trk::ICaloTrackingVolumeBuilder> m_tileVolumeBuilder{this, "TileVolumeBuilder", "Tile::TileVolumeBuilder/TileVolumeBuilder"}; //!< Material properties - Trk::Material m_caloMaterial; - Trk::Material m_Ar; - Trk::Material m_Al; - Trk::Material m_Scint; - Trk::Material m_crackMaterial; + Trk::Material m_caloMaterial{}; + Trk::Material m_Ar{140.036, 856.32, 39.948, 18., 0.0014}; + Trk::Material m_Al{88.93, 388.62, 26.98, 13., 0.0027}; + Trk::Material m_Scint{424.35, 707.43, 11.16, 5.61, 0.001}; // from G4 definition + Trk::Material m_crackMaterial{424.35, 707.43, 11.16, 5.61, 0.001}; // Scintillator/Glue (G4 def.) - double m_caloEnvelope; //!< Envelope cover for Gap Layers + DoubleProperty m_caloEnvelope{this, "GapLayerEnvelope", 25 * Gaudi::Units::mm}; //!< Envelope cover for Gap Layers // enclosing endcap/cylindervolume - ServiceHandle<IEnvelopeDefSvc> m_enclosingEnvelopeSvc; + ServiceHandle<IEnvelopeDefSvc> m_enclosingEnvelopeSvc{this, "EnvelopeDefinitionSvc", "AtlasGeometry_EnvelopeDefSvc"}; - double m_caloDefaultRadius; //!< the radius if not built from GeoModel - double m_caloDefaultHalflengthZ; //!< the halflength in z if not built from + DoubleProperty m_caloDefaultRadius{this, "CalorimeterRadius", 4250.}; //!< the radius if not built from GeoModel + DoubleProperty m_caloDefaultHalflengthZ{this, "CalorimeterHalflengthZ", 6500.}; //!< the halflength in z if not built from //!< GeoModel - bool m_indexStaticLayers; //!< forces robust indexing for layers + BooleanProperty m_indexStaticLayers{this, "IndexStaticLayers", true}; //!< forces robust indexing for layers - bool m_recordLayerIndexCaloSampleMap; //!< for deposition methods - std::string m_layerIndexCaloSampleMapName; //!< name to record it + BooleanProperty m_recordLayerIndexCaloSampleMap{this, "RecordLayerIndexCaloSampleMap", true}; //!< for deposition methods + StringProperty m_layerIndexCaloSampleMapName{this, "LayerIndexCaloSampleMapName", "LayerIndexCaloSampleMap"}; //!< name to record it - bool m_buildMBTS; //!< MBTS like detectors + BooleanProperty m_buildMBTS{this, "BuildMBTS", true}; //!< MBTS like detectors // //!< MBTS like detectors std::vector<double> m_mbtsRadiusGap; //!< MBTS like detectors std::vector<int> m_mbtsPhiSegments; //!< MBTS like detectors @@ -111,8 +110,8 @@ class CaloTrackingGeometryBuilderImpl : public AthAlgTool { std::vector<double> m_mbtsPositionZ; //!< MBTS like detectors std::vector<double> m_mbtsStaggeringZ; //!< MBTS like detectors - std::string m_entryVolume; //!< name of the Calo entrance - std::string m_exitVolume; //!< name of the Calo container + StringProperty m_entryVolume{this, "EntryVolumeName", "Calo::Container::EntryVolume"}; //!< name of the Calo entrance + StringProperty m_exitVolume{this, "ExitVolumeName", "Calo::Container"}; //!< name of the Calo container /** method to establish a link between the LayerIndex and the CaloCell_ID in * an associative container */ diff --git a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderImpl.cxx b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderImpl.cxx index 807cf6cf4b0795ac52d6366a826d11b2c4a2b438..625c008c6eccae9f456fd82b79934e75650afb1a 100644 --- a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderImpl.cxx +++ b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderImpl.cxx @@ -5,12 +5,8 @@ // Calo #include "CaloTrackingGeometry/CaloTrackingGeometryBuilderImpl.h" // Trk -#include "TrkDetDescrInterfaces/ICaloTrackingVolumeBuilder.h" #include "TrkDetDescrInterfaces/IDynamicLayerCreator.h" #include "TrkDetDescrInterfaces/ILayerArrayCreator.h" -#include "TrkDetDescrInterfaces/ITrackingVolumeArrayCreator.h" -#include "TrkDetDescrInterfaces/ITrackingVolumeCreator.h" -#include "TrkDetDescrInterfaces/ITrackingVolumeHelper.h" #include "TrkDetDescrUtils/BinUtility.h" #include "TrkDetDescrUtils/BinnedArray.h" #include "TrkDetDescrUtils/BinnedArray1D1D.h" @@ -40,52 +36,7 @@ // constructor Calo::CaloTrackingGeometryBuilderImpl::CaloTrackingGeometryBuilderImpl( const std::string& t, const std::string& n, const IInterface* p) - : AthAlgTool(t, n, p), - m_trackingVolumeArrayCreator( - "Trk::TrackingVolumeArrayCreator/TrackingVolumeArrayCreator"), - m_trackingVolumeHelper("Trk::TrackingVolumeHelper/TrackingVolumeHelper"), - m_trackingVolumeCreator( - "Trk::CylinderVolumeCreator/TrackingVolumeCreator"), - m_lArVolumeBuilder("LAr::LArVolumeBuilder/LArVolumeBuilder"), - m_tileVolumeBuilder("Tile::TileVolumeBuilder/TileVolumeBuilder"), - m_caloMaterial{}, - m_Ar(140.036, 856.32, 39.948, 18., 0.0014), - m_Al(88.93, 388.62, 26.98, 13., 0.0027), - m_Scint(424.35, 707.43, 11.16, 5.61, 0.001), //from G4 definition - m_crackMaterial( 424.35, 707.43, 11.16, 5.61, 0.001), //Scintillator/Glue (G4 def.) - m_caloEnvelope(25 * Gaudi::Units::mm), - m_enclosingEnvelopeSvc("AtlasGeometry_EnvelopeDefSvc", n), - m_caloDefaultRadius(4250.), - m_caloDefaultHalflengthZ(6500.), - m_indexStaticLayers(true), - m_recordLayerIndexCaloSampleMap(false), - m_layerIndexCaloSampleMapName("LayerIndexCaloSampleMap"), - m_buildMBTS(true), - // m_mbstSurfaceShape(2), - m_entryVolume("Calo::Container::EntryVolume"), - m_exitVolume("Calo::Container") { - // declare the properties via Python - declareProperty("LArVolumeBuilder", m_lArVolumeBuilder); - declareProperty("TileVolumeBuilder", m_tileVolumeBuilder); - declareProperty("TrackingVolumeArrayCreator", m_trackingVolumeArrayCreator); - declareProperty("TrackingVolumeHelper", m_trackingVolumeHelper); - declareProperty("TrackingVolumeCreator", m_trackingVolumeCreator); - declareProperty("GapLayerEnvelope", m_caloEnvelope); - // envelope definition service - declareProperty("EnvelopeDefinitionSvc", m_enclosingEnvelopeSvc); - // empty calorimeter to be built - declareProperty("CalorimeterRadius", m_caloDefaultRadius); - declareProperty("CalorimeterHalflengthZ", m_caloDefaultHalflengthZ); - // unique layer handling - declareProperty("IndexStaticLayers", m_indexStaticLayers); - // for energy deposition - declareProperty("RecordLayerIndexCaloSampleMap", - m_recordLayerIndexCaloSampleMap); - declareProperty("LayerIndexCaloSampleMapName", m_layerIndexCaloSampleMapName); - // MBTS like detectors - declareProperty("BuildMBTS", m_buildMBTS); - declareProperty("EntryVolumeName", m_entryVolume); - declareProperty("ExitVolumeName", m_exitVolume); + : AthAlgTool(t, n, p) { } // destructor diff --git a/Control/AthToolSupport/AsgTools/AsgTools/AnaToolHandle.icc b/Control/AthToolSupport/AsgTools/AsgTools/AnaToolHandle.icc index 767167958c3d8eb739255977dedc4d5a8a00eeb2..1f8b5a8e339bc50c9754a23637768ea8aa2e3493 100644 --- a/Control/AthToolSupport/AsgTools/AsgTools/AnaToolHandle.icc +++ b/Control/AthToolSupport/AsgTools/AsgTools/AnaToolHandle.icc @@ -825,6 +825,9 @@ namespace asg if (m_handleUser->isSet()) return detail::AnaToolHandleMode::USER; + if (m_config.empty() && m_name.empty()) + return detail::AnaToolHandleMode::EMPTY; + if (!m_originalTypeAndName.empty() && m_handleUser->typeAndName() != m_originalTypeAndName) return detail::AnaToolHandleMode::USER; @@ -866,9 +869,6 @@ namespace asg if (m_config.empty() && !m_handleUser->typeAndName().empty() && (m_handleUser->type() != this->type() || m_handleUser->name() != this->name())) return detail::AnaToolHandleMode::USER; - if (m_config.empty() && m_name.empty()) - return detail::AnaToolHandleMode::EMPTY; - if (isPublic()) return detail::AnaToolHandleMode::CREATE_SHARED; else diff --git a/Control/AthToolSupport/AsgTools/AsgTools/AsgTool.icc b/Control/AthToolSupport/AsgTools/AsgTools/AsgTool.icc index 6a8a5a8c7c057015024cb1fcc8fbbf3d95ee7ed7..734d440ed80528e8a24329ed862071c6720f6ea5 100644 --- a/Control/AthToolSupport/AsgTools/AsgTools/AsgTool.icc +++ b/Control/AthToolSupport/AsgTools/AsgTools/AsgTool.icc @@ -46,35 +46,36 @@ namespace asg { #include "Gaudi/Property.h" #include "GaudiKernel/System.h" -using Property = Gaudi::Details::PropertyBase; - -template <class TYPE, class VERIFIER = Gaudi::Details::Property::NullVerifier, - class HANDLERS = Gaudi::Details::Property::UpdateHandler> -using PropertyWithValue = Gaudi::Property<TYPE, VERIFIER, HANDLERS>; - namespace asg { template< class T > const T* AsgTool::getProperty( const std::string& name ) const { - // Get the property object (if it exists): - const Gaudi::Details::PropertyBase* prop = Gaudi::Utils::getProperty( this, name ); - if( ! prop ) { - ATH_MSG_WARNING( "Property with name \"" << name << "\" not found" ); - return 0; - } - - // Try to cast it to the required type: - const PropertyWithValue< T >* tprop = - dynamic_cast< const PropertyWithValue< T >* >( prop ); - if( ! tprop ) { - ATH_MSG_WARNING( "Property \"" << name << "\" is of type: " - << System::typeinfoName( *( prop->type_info() ) ) ); - return 0; - } - - // Okay, we succeeded: + // Check if the property exists. + if( ! hasProperty( name ) ) { + ATH_MSG_WARNING( "Property with name \"" << name << "\" not found" ); + return nullptr; + } + + // Get the property object. + const auto* prop = property( name ); + if( prop == nullptr ) { + ATH_MSG_FATAL( "Internal coding error detected!" ); + return nullptr; + } + + // Cast it to the underlying type. + const Gaudi::Property<T&>* tprop = + dynamic_cast< const Gaudi::Property<T&>* >( prop ); + if( ! tprop ) { + ATH_MSG_WARNING( "Property \"" << name << "\" is of type: " + << System::typeinfoName( *( prop->type_info() ) ) ); + return nullptr; + } + + + // Okay, we succeeded: return &( tprop->value() ); } diff --git a/Control/AthViews/src/ViewDataVerifier.cxx b/Control/AthViews/src/ViewDataVerifier.cxx index b0e45919872a5a1afddd1bad3c7c622a4663df09..9c4157532e1e6a1933054e0c3b1652c559cfa2a4 100644 --- a/Control/AthViews/src/ViewDataVerifier.cxx +++ b/Control/AthViews/src/ViewDataVerifier.cxx @@ -55,6 +55,13 @@ StatusCode ViewDataVerifier::initialize() StatusCode ViewDataVerifier::execute(const EventContext& ctx) const { + // Don't actually test for data presence in normal running + // The VDV will just tell the scheduler that the data is available + // Downstream algs can then fail if this is incorrect + if ( ATH_LIKELY( !this->msgLvl( MSG::DEBUG ) ) ) { + return StatusCode::SUCCESS; + } + // Retrieve the current view from the EventContext auto viewProxy = Atlas::getExtendedEventContext(ctx).proxy(); diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index 2c1c69634c6d75df77457805fcab0aa6b96076a3..f939af31470d53497328d2b3b9496be7e927d4d1 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -370,9 +370,9 @@ def initConfigFlags(): _addFlagsCategory(acf, "Tracking", __tracking, 'TrkConfig') def __acts(): - from ActsInterop.ActsConfigFlags import createActsConfigFlags + from ActsConfig.ActsConfigFlags import createActsConfigFlags return createActsConfigFlags() - _addFlagsCategory(acf, "Acts", __acts, 'ActsInterop') + _addFlagsCategory(acf, "Acts", __acts, 'ActsConfig') def __hgtd(): from HGTD_Config.HGTD_ConfigFlags import createHGTD_ConfigFlags diff --git a/Control/AthenaExamples/AthExThinning/CMakeLists.txt b/Control/AthenaExamples/AthExThinning/CMakeLists.txt index ae02c987f8e46e469c27e4ea4c759f9ccf5f6961..ba530e2a94a874d3c775b39570d05ecebbf7cc4b 100644 --- a/Control/AthenaExamples/AthExThinning/CMakeLists.txt +++ b/Control/AthenaExamples/AthExThinning/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( AthExThinning ) @@ -47,10 +47,10 @@ atlas_install_runtime( test/*.ref ) atlas_add_test( test_thinning SCRIPT test/test_thinning.sh PROPERTIES TIMEOUT 900 - LOG_IGNORE_PATTERN ":::running" ) + POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( test_pythinning SCRIPT test/test_pythinning.sh PROPERTIES TIMEOUT 900 - LOG_IGNORE_PATTERN ":::running" - DEPENDS test_thinning ) + DEPENDS test_thinning + POST_EXEC_SCRIPT nopost.sh ) diff --git a/Control/AthenaExamples/AthExThinning/python/Lib.py b/Control/AthenaExamples/AthExThinning/python/Lib.py index b17d328b44a469ec07be7c58c84c19d20ce029ee..7ebf849b6fc5503ff299c872553decc5ed15f9c8 100644 --- a/Control/AthenaExamples/AthExThinning/python/Lib.py +++ b/Control/AthenaExamples/AthExThinning/python/Lib.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # @file: AthExThinning/python/Lib.py # @purpose: a set of Py-components to tests py-thinning @@ -105,20 +105,20 @@ class PyWriteThinnedData( PyAthena.Alg ): self.Elephantino ) return StatusCode.Failure - self.msg.debug( "IN particles: %i", particles.size() ) - self.msg.debug( "IN decay:" ) - self.msg.debug( " p1: px= %r", decay.p1().px() / Units.GeV ) - self.msg.debug( " p2: px= %r", decay.p2().px() / Units.GeV ) - self.msg.debug( " l1: px= %r", decay.l1().px() / Units.GeV ) - self.msg.debug( " l2: px= %r", decay.l2().px() / Units.GeV ) - - self.msg.debug( "IN elephantino:" ) - self.msg.debug( " leg1: px= %r", elephantino.leg1().px() / Units.GeV ) - self.msg.debug( " leg2: px= %r", elephantino.leg2().px() / Units.GeV ) - self.msg.debug( " leg3: px= %r", elephantino.leg3().px() / Units.GeV ) - self.msg.debug( " leg4: px= %r", elephantino.leg4().px() / Units.GeV ) - self.msg.debug( " ear1: px= %r", elephantino.ear1().px() / Units.GeV ) - self.msg.debug( " ear2: px= %r", elephantino.ear2().px() / Units.GeV ) + self.msg.info( "IN particles: %i", particles.size() ) + self.msg.info( "IN decay:" ) + self.msg.info( " p1: px= %r", decay.p1().px() / Units.GeV ) + self.msg.info( " p2: px= %r", decay.p2().px() / Units.GeV ) + self.msg.info( " l1: px= %r", decay.l1().px() / Units.GeV ) + self.msg.info( " l2: px= %r", decay.l2().px() / Units.GeV ) + + self.msg.info( "IN elephantino:" ) + self.msg.info( " leg1: px= %r", elephantino.leg1().px() / Units.GeV ) + self.msg.info( " leg2: px= %r", elephantino.leg2().px() / Units.GeV ) + self.msg.info( " leg3: px= %r", elephantino.leg3().px() / Units.GeV ) + self.msg.info( " leg4: px= %r", elephantino.leg4().px() / Units.GeV ) + self.msg.info( " ear1: px= %r", elephantino.ear1().px() / Units.GeV ) + self.msg.info( " ear2: px= %r", elephantino.ear2().px() / Units.GeV ) ## thinning dec = ROOT.SG.ThinningDecision (particlesName) diff --git a/Control/AthenaExamples/AthExThinning/share/ReadThinnedData_jobOptions.py b/Control/AthenaExamples/AthExThinning/share/ReadThinnedData_jobOptions.py index b2df311128cf5ec48793a4dd8a4342f3c5678f36..3cdf7324bc966e889647f1aa07eb0dcb1a001b09 100644 --- a/Control/AthenaExamples/AthExThinning/share/ReadThinnedData_jobOptions.py +++ b/Control/AthenaExamples/AthExThinning/share/ReadThinnedData_jobOptions.py @@ -49,7 +49,7 @@ topSequence += AthExThinning__ReadThinnedData( Particles = "Particles", Decay = "TwoBodyDecay", Elephantino = "PinkElephantino", - OutputLevel = DEBUG + OutputLevel = INFO ) #-------------------------------------------------------------- diff --git a/Control/AthenaExamples/AthExThinning/share/WriteThinnedData_jobOptions.py b/Control/AthenaExamples/AthExThinning/share/WriteThinnedData_jobOptions.py index d46ecf7b0916005259d8a1e0de9d229e3c0ae6ec..0c3cb4968365ea3411243d06af82273e6bcc04d6 100644 --- a/Control/AthenaExamples/AthExThinning/share/WriteThinnedData_jobOptions.py +++ b/Control/AthenaExamples/AthExThinning/share/WriteThinnedData_jobOptions.py @@ -4,6 +4,8 @@ # #============================================================== # +import os + import AthenaCommon.AtlasUnixStandardJob from AthenaCommon.Constants import VERBOSE,DEBUG,INFO,WARNING,ERROR @@ -55,12 +57,12 @@ topSequence += WriteThinnedData( Elephantino = "PinkElephantino", Filter = [ True, False, False, False, True, False, False, True, True, False ], - OutputLevel = DEBUG ) + OutputLevel = INFO ) #-------------------------------------------------------------- # POOL Persistency #-------------------------------------------------------------- -import AthenaPoolCnvSvc.WriteAthenaPool as wap +import AthenaPoolCnvSvc.WriteAthenaPool from OutputStreamAthenaPool.CreateOutputStreams import createOutputStream if 'OUTPUT' not in dir(): diff --git a/Control/AthenaExamples/AthExThinning/share/test_pythinning.py b/Control/AthenaExamples/AthExThinning/share/test_pythinning.py index 7815e32777a792172670e3238411a6a61f452a7f..7aebb95003e41bdde3a1bb4d5d0451b96c5d90f0 100644 --- a/Control/AthenaExamples/AthExThinning/share/test_pythinning.py +++ b/Control/AthenaExamples/AthExThinning/share/test_pythinning.py @@ -1,8 +1,5 @@ #!/usr/bin/env python -from __future__ import print_function - -import sys import os from AthenaCommon import ChapPy diff --git a/Control/AthenaExamples/AthExThinning/share/test_pythinning.ref b/Control/AthenaExamples/AthExThinning/share/test_pythinning.ref deleted file mode 100644 index 761791c73fb573d2d1d979d2af7223f7ba72239a..0000000000000000000000000000000000000000 --- a/Control/AthenaExamples/AthExThinning/share/test_pythinning.ref +++ /dev/null @@ -1,62 +0,0 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -::: ChapPy is launching script [AthExThinning/test_pythinning.py] ::: -################################################################################ -## testing Thinning exercize... -## installing reference files... - -tmp-pythinning/AthExThinning_makeData.ref - -tmp-pythinning/pyWriteThinnedData.ref - -tmp-pythinning/ReadThinnedData.ref - -tmp-pythinning/ReadNonThinnedData.ref - - -################################################################################ -## Preparing input data... - - -################################################################################ -## Validation of [Input Data] -## ref: tmp-pythinning/AthExThinning_makeData.ref -## chk: tmp-pythinning/my.pydata.tothin.pool.log -## filter: [grep '^CreateData' | grep INFO ] -==> Validation [OK] - - -################################################################################ -## Testing [writing thinned data]... - - -################################################################################ -## Validation of [PyWriteThinnedData] -## ref: tmp-pythinning/pyWriteThinnedData.ref -## chk: tmp-pythinning/pythinned.data.pool.log -## filter: [grep "^Py:WriteThinnedData "] -==> Validation [OK] - - -################################################################################ -## Testing [reading thinned data]... - - -################################################################################ -## Validation of [ReadThinnedData] -## ref: tmp-pythinning/ReadThinnedData.ref -## chk: tmp-pythinning/reaccessed.pythinned.data.pool.log -## filter: [grep "^ReadThinnedData " | grep -v "Property update for OutputLevel" | grep -v "input handles" | grep -v "output handles" | grep -v "Data Deps for"] -==> Validation [OK] - - -################################################################################ -## Testing [reading non-thinned data]... - - -################################################################################ -## Validation of [ReadNonThinnedData] -## ref: tmp-pythinning/ReadNonThinnedData.ref -## chk: tmp-pythinning/reaccessed.non.pythinned.data.pool.log -## filter: [grep "^Py:ReadNonThinnedData "] -==> Validation [OK] - -## [All tests completed] -## Bye. -################################################################################ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/Control/AthenaExamples/AthExThinning/share/test_thinning.py b/Control/AthenaExamples/AthExThinning/share/test_thinning.py index ca6dd4f767fd0391d70c925dceb47c13a9161477..51f6ef7fbfb6ee153cb84fe900fa1280c5eee585 100755 --- a/Control/AthenaExamples/AthExThinning/share/test_thinning.py +++ b/Control/AthenaExamples/AthExThinning/share/test_thinning.py @@ -1,14 +1,8 @@ #!/usr/bin/env python -from __future__ import print_function - -import sys import os -from AthenaCommon import ChapPy - -from future import standard_library -standard_library.install_aliases() import subprocess +from AthenaCommon import ChapPy ###----------------------------------------------------- EVTMAX = 5 @@ -123,7 +117,7 @@ print ("#"*80) sc,out = doValidation( "WriteThinnedData", workDir("WriteThinnedData.ref"), workDir("thinned.data.pool.log"), - "grep \"^WriteThinnedData \" | grep -v \"Property update for OutputLevel\" | grep -v \"input handles\" | grep -v \"output handles\" | grep -v \"Data Deps for\"" ) + "grep \"^WriteThinnedData \"" ) if sc != 0: raise SystemExit("ERROR") diff --git a/Control/AthenaExamples/AthExThinning/share/test_thinning.ref b/Control/AthenaExamples/AthExThinning/share/test_thinning.ref deleted file mode 100644 index e73854cb11d11896638f2c732da2197f68280ee8..0000000000000000000000000000000000000000 --- a/Control/AthenaExamples/AthExThinning/share/test_thinning.ref +++ /dev/null @@ -1,62 +0,0 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -::: ChapPy is launching script [AthExThinning/test_thinning.py] ::: -################################################################################ -## testing Thinning exercize... -## installing reference files... - -tmp-thinning/AthExThinning_makeData.ref - -tmp-thinning/WriteThinnedData.ref - -tmp-thinning/ReadThinnedData.ref - -tmp-thinning/ReadNonThinnedData.ref - - -################################################################################ -## Preparing input data... - - -################################################################################ -## Validation of [Input Data] -## ref: tmp-thinning/AthExThinning_makeData.ref -## chk: tmp-thinning/my.data.tothin.pool.log -## filter: [grep '^CreateData' | grep INFO ] -==> Validation [OK] - - -################################################################################ -## Testing [writing thinned data]... - - -################################################################################ -## Validation of [WriteThinnedData] -## ref: tmp-thinning/WriteThinnedData.ref -## chk: tmp-thinning/thinned.data.pool.log -## filter: [grep "^WriteThinnedData " | grep -v "Property update for OutputLevel" | grep -v "input handles" | grep -v "output handles" | grep -v "Data Deps for"] -==> Validation [OK] - - -################################################################################ -## Testing [reading thinned data]... - - -################################################################################ -## Validation of [ReadThinnedData] -## ref: tmp-thinning/ReadThinnedData.ref -## chk: tmp-thinning/reaccessed.thinned.data.pool.log -## filter: [grep "^ReadThinnedData " | grep -v "Property update for OutputLevel" | grep -v "input handles" | grep -v "output handles" | grep -v "Data Deps for"] -==> Validation [OK] - - -################################################################################ -## Testing [reading non-thinned data]... - - -################################################################################ -## Validation of [ReadNonThinnedData] -## ref: tmp-thinning/ReadNonThinnedData.ref -## chk: tmp-thinning/reaccessed.non.thinned.data.pool.log -## filter: [grep "^Py:ReadNonThinnedData "] -==> Validation [OK] - -## [All tests completed] -## Bye. -################################################################################ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/Control/AthenaExamples/AthExThinning/src_lib/ReadThinnedData.cxx b/Control/AthenaExamples/AthExThinning/src_lib/ReadThinnedData.cxx index a05877531278ac67974f29aab1ea1136121c130e..42b263a98bf760a4d4144348bef4f71ac234c3d9 100644 --- a/Control/AthenaExamples/AthExThinning/src_lib/ReadThinnedData.cxx +++ b/Control/AthenaExamples/AthExThinning/src_lib/ReadThinnedData.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // ReadThinnedData.cxx @@ -149,40 +149,40 @@ StatusCode ReadThinnedData::checkTest( const std::string& testName ) } const double igev = 1. / Gaudi::Units::GeV; - ATH_MSG_DEBUG + ATH_MSG_INFO ("IN particles: " << particles->size() << endmsg << "IN iparticles: " << iparticles->size() << endmsg << "IN decay: " << endmsg << " p1: px= " << decay->p1()->px() * igev << endmsg << " p2: px= " << decay->p2()->px() * igev); - msg(MSG::DEBUG) << " l1: px= "; - if ( decay->l1() ) { msg(MSG::DEBUG) << decay->l1()->px() * igev << endmsg; - } else { msg(MSG::DEBUG) << "[thinned!]" << endmsg; + msg(MSG::INFO) << " l1: px= "; + if ( decay->l1() ) { msg(MSG::INFO) << decay->l1()->px() * igev << endmsg; + } else { msg(MSG::INFO) << "[thinned!]" << endmsg; } - msg(MSG::DEBUG) << " l2: px= "; - if ( decay->l2() ) { msg(MSG::DEBUG) << decay->l2()->px() * igev << endmsg; - } else { msg(MSG::DEBUG) << "[thinned!]" << endmsg; + msg(MSG::INFO) << " l2: px= "; + if ( decay->l2() ) { msg(MSG::INFO) << decay->l2()->px() * igev << endmsg; + } else { msg(MSG::INFO) << "[thinned!]" << endmsg; } - msg(MSG::DEBUG) + msg(MSG::INFO) << "IN elephantino: " << endmsg << " leg1: px= " << elephantino->leg1()->px() * igev << endmsg << " leg2: px= " << elephantino->leg2()->px() * igev << endmsg << " leg3: px= " << elephantino->leg3()->px() * igev << endmsg << " leg4: px= " << elephantino->leg4()->px() * igev << endmsg; - msg(MSG::DEBUG) << " ear1: px= "; + msg(MSG::INFO) << " ear1: px= "; if ( elephantino->ear1() ) { - msg(MSG::DEBUG) << elephantino->ear1()->px() * igev << endmsg; + msg(MSG::INFO) << elephantino->ear1()->px() * igev << endmsg; } else { - msg(MSG::DEBUG) << "[thinned!]" << endmsg; + msg(MSG::INFO) << "[thinned!]" << endmsg; } - msg(MSG::DEBUG) << " ear2: px= "; + msg(MSG::INFO) << " ear2: px= "; if ( elephantino->ear2() ) { - msg(MSG::DEBUG) << elephantino->ear2()->px() * igev << endmsg; + msg(MSG::INFO) << elephantino->ear2()->px() * igev << endmsg; } else { - msg(MSG::DEBUG) << "[thinned!]" << endmsg; + msg(MSG::INFO) << "[thinned!]" << endmsg; } msg(MSG::INFO) << "Particles | IParticles : " << endmsg; diff --git a/Control/AthenaExamples/AthExThinning/src_lib/WriteThinnedData.cxx b/Control/AthenaExamples/AthExThinning/src_lib/WriteThinnedData.cxx index 4fee9df108f94e57ce5b3a27871d70bc1b4a33af..df0f5db7160a8d55b7467687f1f9f0be830dfa59 100644 --- a/Control/AthenaExamples/AthExThinning/src_lib/WriteThinnedData.cxx +++ b/Control/AthenaExamples/AthExThinning/src_lib/WriteThinnedData.cxx @@ -159,14 +159,14 @@ StatusCode WriteThinnedData::test( const EventContext& ctx, SG::ReadHandle<AthExElephantino> elephantino (m_elephantinoKeys[testNum], ctx); const double igev = 1. / Gaudi::Units::GeV; - ATH_MSG_DEBUG("IN particles: " << particles->size() << endmsg + ATH_MSG_INFO("IN particles: " << particles->size() << endmsg << "IN decay: " << endmsg << " p1: px= " << decay->p1()->px() * igev << endmsg << " p2: px= " << decay->p2()->px() * igev << endmsg << " l1: px= " << decay->l1()->px() * igev << endmsg << " l2: px= " << decay->l2()->px() * igev); - ATH_MSG_DEBUG("IN elephantino: " << endmsg + ATH_MSG_INFO("IN elephantino: " << endmsg << " leg1: px= " << elephantino->leg1()->px() * igev << endmsg << " leg2: px= " << elephantino->leg2()->px() * igev << endmsg << " leg3: px= " << elephantino->leg3()->px() * igev << endmsg diff --git a/Control/AthenaExamples/AthExThinning/test/ReadThinnedData.ref b/Control/AthenaExamples/AthExThinning/test/ReadThinnedData.ref index e3994362d8782735f1e58ae708d2bbaf9f51dd42..e8cb8c44f14593f6bb7d036ee413880f81f77a63 100644 --- a/Control/AthenaExamples/AthExThinning/test/ReadThinnedData.ref +++ b/Control/AthenaExamples/AthExThinning/test/ReadThinnedData.ref @@ -1,20 +1,19 @@ ReadThinnedData INFO Initializing ReadThinnedData... -ReadThinnedData DEBUG Executing ReadThinnedData... ReadThinnedData INFO Reading data for [test1]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -22,20 +21,20 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test2]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -43,42 +42,41 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test3]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== -ReadThinnedData DEBUG Executing ReadThinnedData... ReadThinnedData INFO Reading data for [test1]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -86,20 +84,20 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test2]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -107,42 +105,41 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test3]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== -ReadThinnedData DEBUG Executing ReadThinnedData... ReadThinnedData INFO Reading data for [test1]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -150,20 +147,20 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test2]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -171,42 +168,41 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test3]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== -ReadThinnedData DEBUG Executing ReadThinnedData... ReadThinnedData INFO Reading data for [test1]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -214,20 +210,20 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test2]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -235,42 +231,41 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test3]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== -ReadThinnedData DEBUG Executing ReadThinnedData... ReadThinnedData INFO Reading data for [test1]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -278,20 +273,20 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test2]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 @@ -299,20 +294,20 @@ ReadThinnedData INFO 80 | 80 ReadThinnedData INFO 90 | 90 ReadThinnedData INFO ====================== ReadThinnedData INFO Reading data for [test3]... -ReadThinnedData DEBUG IN particles: 4 -ReadThinnedData DEBUG IN iparticles: 4 -ReadThinnedData DEBUG IN decay: -ReadThinnedData DEBUG p1: px= 10 -ReadThinnedData DEBUG p2: px= 50 -ReadThinnedData DEBUG l1: px= [thinned!] -ReadThinnedData DEBUG l2: px= [thinned!] -ReadThinnedData DEBUG IN elephantino: -ReadThinnedData DEBUG leg1: px= 10 -ReadThinnedData DEBUG leg2: px= 50 -ReadThinnedData DEBUG leg3: px= 80 -ReadThinnedData DEBUG leg4: px= 90 -ReadThinnedData DEBUG ear1: px= [thinned!] -ReadThinnedData DEBUG ear2: px= [thinned!] +ReadThinnedData INFO IN particles: 4 +ReadThinnedData INFO IN iparticles: 4 +ReadThinnedData INFO IN decay: +ReadThinnedData INFO p1: px= 10 +ReadThinnedData INFO p2: px= 50 +ReadThinnedData INFO l1: px= [thinned!] +ReadThinnedData INFO l2: px= [thinned!] +ReadThinnedData INFO IN elephantino: +ReadThinnedData INFO leg1: px= 10 +ReadThinnedData INFO leg2: px= 50 +ReadThinnedData INFO leg3: px= 80 +ReadThinnedData INFO leg4: px= 90 +ReadThinnedData INFO ear1: px= [thinned!] +ReadThinnedData INFO ear2: px= [thinned!] ReadThinnedData INFO Particles | IParticles : ReadThinnedData INFO 10 | 10 ReadThinnedData INFO 50 | 50 diff --git a/Control/AthenaExamples/AthExThinning/test/WriteThinnedData.ref b/Control/AthenaExamples/AthExThinning/test/WriteThinnedData.ref index 21e5b610740ca21cb7b38fe799af63d1f35fb6bd..038f74cdb033c25b06acd87c767b35e368716013 100644 --- a/Control/AthenaExamples/AthExThinning/test/WriteThinnedData.ref +++ b/Control/AthenaExamples/AthExThinning/test/WriteThinnedData.ref @@ -1,19 +1,18 @@ WriteThinnedData INFO Initializing WriteThinnedData... -WriteThinnedData DEBUG Executing WriteThinnedData... WriteThinnedData INFO Performing thinning test [test1]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -66,19 +65,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test1] has been performed. WriteThinnedData INFO Performing thinning test [test2]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -131,19 +130,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test2] has been performed. WriteThinnedData INFO Performing thinning test [test3]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO IParticles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -195,21 +194,20 @@ WriteThinnedData INFO leg4: px= 90 WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test3] has been performed. -WriteThinnedData DEBUG Executing WriteThinnedData... WriteThinnedData INFO Performing thinning test [test1]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -262,19 +260,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test1] has been performed. WriteThinnedData INFO Performing thinning test [test2]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -327,19 +325,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test2] has been performed. WriteThinnedData INFO Performing thinning test [test3]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO IParticles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -391,21 +389,20 @@ WriteThinnedData INFO leg4: px= 90 WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test3] has been performed. -WriteThinnedData DEBUG Executing WriteThinnedData... WriteThinnedData INFO Performing thinning test [test1]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -458,19 +455,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test1] has been performed. WriteThinnedData INFO Performing thinning test [test2]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -523,19 +520,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test2] has been performed. WriteThinnedData INFO Performing thinning test [test3]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO IParticles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -587,21 +584,20 @@ WriteThinnedData INFO leg4: px= 90 WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test3] has been performed. -WriteThinnedData DEBUG Executing WriteThinnedData... WriteThinnedData INFO Performing thinning test [test1]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -654,19 +650,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test1] has been performed. WriteThinnedData INFO Performing thinning test [test2]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -719,19 +715,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test2] has been performed. WriteThinnedData INFO Performing thinning test [test3]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO IParticles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -783,21 +779,20 @@ WriteThinnedData INFO leg4: px= 90 WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test3] has been performed. -WriteThinnedData DEBUG Executing WriteThinnedData... WriteThinnedData INFO Performing thinning test [test1]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -850,19 +845,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test1] has been performed. WriteThinnedData INFO Performing thinning test [test2]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO Particles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove @@ -915,19 +910,19 @@ WriteThinnedData INFO ear1: px= 20 WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO [test2] has been performed. WriteThinnedData INFO Performing thinning test [test3]... -WriteThinnedData DEBUG IN particles: 10 -WriteThinnedData DEBUG IN decay: -WriteThinnedData DEBUG p1: px= 10 -WriteThinnedData DEBUG p2: px= 50 -WriteThinnedData DEBUG l1: px= 20 -WriteThinnedData DEBUG l2: px= 100 -WriteThinnedData DEBUG IN elephantino: -WriteThinnedData DEBUG leg1: px= 10 -WriteThinnedData DEBUG leg2: px= 50 -WriteThinnedData DEBUG leg3: px= 80 -WriteThinnedData DEBUG leg4: px= 90 -WriteThinnedData DEBUG ear1: px= 20 -WriteThinnedData DEBUG ear2: px= 100 +WriteThinnedData INFO IN particles: 10 +WriteThinnedData INFO IN decay: +WriteThinnedData INFO p1: px= 10 +WriteThinnedData INFO p2: px= 50 +WriteThinnedData INFO l1: px= 20 +WriteThinnedData INFO l2: px= 100 +WriteThinnedData INFO IN elephantino: +WriteThinnedData INFO leg1: px= 10 +WriteThinnedData INFO leg2: px= 50 +WriteThinnedData INFO leg3: px= 80 +WriteThinnedData INFO leg4: px= 90 +WriteThinnedData INFO ear1: px= 20 +WriteThinnedData INFO ear2: px= 100 WriteThinnedData INFO IParticles | filter : WriteThinnedData INFO 10 | keep WriteThinnedData INFO 20 | remove diff --git a/Control/AthenaExamples/AthExThinning/test/pyWriteThinnedData.ref b/Control/AthenaExamples/AthExThinning/test/pyWriteThinnedData.ref index d3efd0900e47892ad89ea5aaf6ae2234d6b031af..b6c2f3a9e684d8217ef83393b3ca2585c16bb41c 100644 --- a/Control/AthenaExamples/AthExThinning/test/pyWriteThinnedData.ref +++ b/Control/AthenaExamples/AthExThinning/test/pyWriteThinnedData.ref @@ -1,21 +1,20 @@ Py:WriteThinnedData INFO Initializing WriteThinnedData -Py:WriteThinnedData DEBUG Executing WriteThinnedData... Py:WriteThinnedData INFO Performing thinning test [test1]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -70,19 +69,19 @@ Py:WriteThinnedData INFO [test1] has been performed. Py:WriteThinnedData INFO Performing thinning test [test2]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -137,19 +136,19 @@ Py:WriteThinnedData INFO [test2] has been performed. Py:WriteThinnedData INFO Performing thinning test [test3]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO IParticles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -201,23 +200,22 @@ Py:WriteThinnedData INFO leg4: px= 90.0 Py:WriteThinnedData INFO ear1: px= 20.0 Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO [test3] has been performed. -Py:WriteThinnedData DEBUG Executing WriteThinnedData... Py:WriteThinnedData INFO Performing thinning test [test1]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -272,19 +270,19 @@ Py:WriteThinnedData INFO [test1] has been performed. Py:WriteThinnedData INFO Performing thinning test [test2]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -339,19 +337,19 @@ Py:WriteThinnedData INFO [test2] has been performed. Py:WriteThinnedData INFO Performing thinning test [test3]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO IParticles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -403,23 +401,22 @@ Py:WriteThinnedData INFO leg4: px= 90.0 Py:WriteThinnedData INFO ear1: px= 20.0 Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO [test3] has been performed. -Py:WriteThinnedData DEBUG Executing WriteThinnedData... Py:WriteThinnedData INFO Performing thinning test [test1]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -474,19 +471,19 @@ Py:WriteThinnedData INFO [test1] has been performed. Py:WriteThinnedData INFO Performing thinning test [test2]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -541,19 +538,19 @@ Py:WriteThinnedData INFO [test2] has been performed. Py:WriteThinnedData INFO Performing thinning test [test3]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO IParticles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -605,23 +602,22 @@ Py:WriteThinnedData INFO leg4: px= 90.0 Py:WriteThinnedData INFO ear1: px= 20.0 Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO [test3] has been performed. -Py:WriteThinnedData DEBUG Executing WriteThinnedData... Py:WriteThinnedData INFO Performing thinning test [test1]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -676,19 +672,19 @@ Py:WriteThinnedData INFO [test1] has been performed. Py:WriteThinnedData INFO Performing thinning test [test2]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -743,19 +739,19 @@ Py:WriteThinnedData INFO [test2] has been performed. Py:WriteThinnedData INFO Performing thinning test [test3]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO IParticles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -807,23 +803,22 @@ Py:WriteThinnedData INFO leg4: px= 90.0 Py:WriteThinnedData INFO ear1: px= 20.0 Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO [test3] has been performed. -Py:WriteThinnedData DEBUG Executing WriteThinnedData... Py:WriteThinnedData INFO Performing thinning test [test1]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -878,19 +873,19 @@ Py:WriteThinnedData INFO [test1] has been performed. Py:WriteThinnedData INFO Performing thinning test [test2]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO Particles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove @@ -945,19 +940,19 @@ Py:WriteThinnedData INFO [test2] has been performed. Py:WriteThinnedData INFO Performing thinning test [test3]... Py:WriteThinnedData INFO particles: 10 Py:WriteThinnedData INFO iparticles: 10 -Py:WriteThinnedData DEBUG IN particles: 10 -Py:WriteThinnedData DEBUG IN decay: -Py:WriteThinnedData DEBUG p1: px= 10.0 -Py:WriteThinnedData DEBUG p2: px= 50.0 -Py:WriteThinnedData DEBUG l1: px= 20.0 -Py:WriteThinnedData DEBUG l2: px= 100.0 -Py:WriteThinnedData DEBUG IN elephantino: -Py:WriteThinnedData DEBUG leg1: px= 10.0 -Py:WriteThinnedData DEBUG leg2: px= 50.0 -Py:WriteThinnedData DEBUG leg3: px= 80.0 -Py:WriteThinnedData DEBUG leg4: px= 90.0 -Py:WriteThinnedData DEBUG ear1: px= 20.0 -Py:WriteThinnedData DEBUG ear2: px= 100.0 +Py:WriteThinnedData INFO IN particles: 10 +Py:WriteThinnedData INFO IN decay: +Py:WriteThinnedData INFO p1: px= 10.0 +Py:WriteThinnedData INFO p2: px= 50.0 +Py:WriteThinnedData INFO l1: px= 20.0 +Py:WriteThinnedData INFO l2: px= 100.0 +Py:WriteThinnedData INFO IN elephantino: +Py:WriteThinnedData INFO leg1: px= 10.0 +Py:WriteThinnedData INFO leg2: px= 50.0 +Py:WriteThinnedData INFO leg3: px= 80.0 +Py:WriteThinnedData INFO leg4: px= 90.0 +Py:WriteThinnedData INFO ear1: px= 20.0 +Py:WriteThinnedData INFO ear2: px= 100.0 Py:WriteThinnedData INFO IParticles | filter : Py:WriteThinnedData INFO 10 | keep Py:WriteThinnedData INFO 20 | remove diff --git a/Control/AthenaIPCTools/src/AthenaHDFStreamTool.cxx b/Control/AthenaIPCTools/src/AthenaHDFStreamTool.cxx index 75bcf570420c540be459d1e7b9d3c843b3f84c29..f9df1064f0ce1e1c7b949b21cc432e873b5600fa 100644 --- a/Control/AthenaIPCTools/src/AthenaHDFStreamTool.cxx +++ b/Control/AthenaIPCTools/src/AthenaHDFStreamTool.cxx @@ -114,7 +114,7 @@ StatusCode AthenaHDFStreamTool::getLockedEvent(void** target, unsigned int&/* st FileIncident endFileIncident(name(), "EndInputFile", "HDF:test.h5"); //FIXME, hardcoded filename m_incidentSvc->fireIncident(endFileIncident); ATH_MSG_INFO("AthenaHDFStreamTool::getLockedEvent: no more events = " << m_event_iter); - return(StatusCode::FAILURE); + return(StatusCode::RECOVERABLE); } const hsize_t offset[1] = {m_event_iter}; diff --git a/Control/AthenaMonitoring/test/test_run3dq_q442_aod.sh b/Control/AthenaMonitoring/test/test_run3dq_q442_aod.sh index 65f1a8b335ab60c582655e2c6a0c88f975e0fed4..89446d81659da4725964c275d7754f6a7b6b55b4 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_q442_aod.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_q442_aod.sh @@ -17,5 +17,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/ExampleMonitorOutput.root) -hist_diff.sh ExampleMonitorOutput.root $REFFILE -x TIME_execute -i > log.HIST_Diff 2>&1 +hist_diff.sh ExampleMonitorOutput.root $REFFILE -x 'TIME_(execute|convert|prepareROBs)' -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_q442_esd.sh b/Control/AthenaMonitoring/test/test_run3dq_q442_esd.sh index 42acdca05e435f84ab7278191da6aac28ff3f275..bc1cdcf27c9d04bac73dcde06c3f76b8e70de91a 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_q442_esd.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_q442_esd.sh @@ -19,5 +19,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/ExampleMonitorOutput.root) -hist_diff.sh ExampleMonitorOutput.root $REFFILE -x "(TIME_execute|TotalEnergyVsEtaPhi.*_CSCveto|CandidateMNBFebs)" -i > log.HIST_Diff 2>&1 +hist_diff.sh ExampleMonitorOutput.root $REFFILE -x "(TIME_(execute|convert|prepareROBs)|TotalEnergyVsEtaPhi.*_CSCveto|CandidateMNBFebs)" -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_q442_esd_cosmics.sh b/Control/AthenaMonitoring/test/test_run3dq_q442_esd_cosmics.sh index 7cf635a653ac6aa461e5e59657743984df445551..e382bdb8d5adb5ec9a2a78bb84765e199322fb34 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_q442_esd_cosmics.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_q442_esd_cosmics.sh @@ -19,5 +19,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/ExampleMonitorOutput.root) -hist_diff.sh ExampleMonitorOutput.root $REFFILE -x "(TIME_execute|TotalEnergyVsEtaPhi.*_CSCveto)" -i > log.HIST_Diff 2>&1 +hist_diff.sh ExampleMonitorOutput.root $REFFILE -x "(TIME_(execute|convert|prepareROBs)|TotalEnergyVsEtaPhi.*_CSCveto)" -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_recotf_q442_rawtoall.sh b/Control/AthenaMonitoring/test/test_run3dq_recotf_q442_rawtoall.sh index 407a6ec64ed9d084dc583af7c518a8411df40b14..300e733941467190e069d7b0b15862e73458ff06 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_recotf_q442_rawtoall.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_recotf_q442_rawtoall.sh @@ -17,5 +17,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/myHIST.root) -hist_diff.sh myHIST.root $REFFILE -x TIME_execute -i > log.HIST_Diff 2>&1 +hist_diff.sh myHIST.root $REFFILE -x 'TIME_(execute|convert|prepareROBs)' -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall.sh b/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall.sh index 0a4378ad788293d62b4ba5506bbd6f6127144c57..13a6f87cffa521a5992d5e27ce97d817ed79e437 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall.sh @@ -17,5 +17,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/myHIST.root) -hist_diff.sh myHIST.root $REFFILE -x TIME_execute -i > log.HIST_Diff 2>&1 +hist_diff.sh myHIST.root $REFFILE -x 'TIME_(execute|convert|prepareROBs)' -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall_mt_t2.sh b/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall_mt_t2.sh index 552dae92ca0c831839975f28e4354028e793127b..6e029bff0919e7792ae1835a120f6b8addf71781 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall_mt_t2.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_rawtoall_mt_t2.sh @@ -17,5 +17,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/myHIST.root) -hist_diff.sh myHIST.root $REFFILE -x "(TIME_execute|L1Calo/CPM_CMX/Errors/Transmission_Simulation/MismatchEventNumbers|CandidateMNBFebs)" -i > log.HIST_Diff 2>&1 +hist_diff.sh myHIST.root $REFFILE -x "(TIME_(execute|convert|prepareROBs)|L1Calo/CPM_CMX/Errors/Transmission_Simulation/MismatchEventNumbers|CandidateMNBFebs)" -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_twostep.sh b/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_twostep.sh index 1b2cc7491044565b84b4b6dc2d377f4a6ebe3906..b3a13be57dbcf5451eabee03144dfa0fcf5c40c1 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_twostep.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_recotf_q449_twostep.sh @@ -17,5 +17,5 @@ ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} REFFILE=(./ref-*/myHIST.root) -hist_diff.sh myHIST.root $REFFILE -x TIME_execute -i > log.HIST_Diff 2>&1 +hist_diff.sh myHIST.root $REFFILE -x 'TIME_(execute|convert|prepareROBs)' -i > log.HIST_Diff 2>&1 echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaServices/CMakeLists.txt b/Control/AthenaServices/CMakeLists.txt index 0c52f89e07abe74e5f32ce1f875413da9a760885..e957eb9d3dd0aa25a7bd0cf2a4dc63082855ee83 100644 --- a/Control/AthenaServices/CMakeLists.txt +++ b/Control/AthenaServices/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( AthenaServices ) @@ -32,7 +32,7 @@ atlas_add_test( AthenaOutputStream_test INCLUDE_DIRS ${Boost_INCLUDE_DIRS} LINK_LIBRARIES TestTools AsgTools AthenaKernel SGTools StoreGateLib GaudiKernel AthenaBaseComps PersistentDataModel RootAuxDynIO - LOG_IGNORE_PATTERN "^AthenaRootStrea... +(INFO|DEBUG)|^SGAudSvc +(INFO|DEBUG)|of type DataHistory|DEBUG Recorded object|object modifiable when retrieved|^ToolSvc +DEBUG Service base class initialized|^ServiceManager +DEBUG Initializing service|^IncidentSvc *DEBUG Adding .* listener|DecisionSvc +DEBUG|^IoComponentMgr +(INFO|DEBUG)|DBReplicaSvc|^HistogramPersis.*DEBUG|^ItemListSvc +(INFO|DEBUG)|Info File PoolFileCatalog.xml does not exist|DataModelCompatSvc::initialize|^ProxyProviderSvc +DEBUG|^DataModelCompatSvc +DEBUG|^AthenaOutputStreamVERBOSE|^AthenaOutputStream +DEBUG|^TimelineSvc +DEBUG|CLIDRegistry entries|in DataObject @0x" ) + LOG_SELECT_PATTERN "AthenaOutputStream_test" ) # Avoid spurious ubsan warnings. set_target_properties( AthenaServices_AthenaOutputStream_test PROPERTIES ENABLE_EXPORTS True ) diff --git a/Control/AthenaServices/share/AthenaOutputStream_test.ref b/Control/AthenaServices/share/AthenaOutputStream_test.ref index a2e0a0caec37b74e7973bcf3d519482c8d13bab8..6acec560abe39f6630c77d52fd3cccc9c1b954fc 100644 --- a/Control/AthenaServices/share/AthenaOutputStream_test.ref +++ b/Control/AthenaServices/share/AthenaOutputStream_test.ref @@ -1,103 +1,12 @@ *** AthenaOutputStream_test starts *** - - -ApplicationMgr DEBUG Getting my own properties -ApplicationMgr INFO Application Manager Configured successfully -EventLoopMgr WARNING Unable to locate service "EventSelector" -EventLoopMgr WARNING No events will be processed from external input. -ApplicationMgr INFO Application Manager Initialized successfully -ApplicationMgr Ready -DecisionSvc INFO Inserting stream: AthenaOutputStream with no Algs -AthDictLoaderSvc INFO in initialize... -AthDictLoaderSvc INFO acquired Dso-registry -OutputStreamSeq... DEBUG Initializing OutputStreamSequencerSvc -AthenaOutputStr... INFO Initializing AthenaOutputStream.AthenaOutputStreamTool -PoolSvc DEBUG OutputLevel is 2 -APRFileCatalog DEBUG addCatalog("xmlcatalog_file:PoolFileCatalog.xml") -AthenaPoolCnvSvc DEBUG Setting StorageType to ROOTTREEINDEX -AthenaPoolCnvSvc DEBUG Registering all Tools in ToolHandleArray OutputStreamingTool -ServiceManager FATAL No Service factory for DetectorStore available. -AthenaOutputStr... ERROR ServiceLocatorHelper::service: can not locate service DetectorStore -AthenaOutputStream INFO Data output: DidNotNameOutput.root -AthenaOutputStream INFO ../O reinitialization... -AthDictLoaderSvc INFO could not retrieve typename for clid [13] -AthDictLoaderSvc DEBUG loading [Foo (from clid=8101)]... -AthDictLoaderSvc DEBUG loading [Foo]... -AthDictLoaderSvc DEBUG loading [Foo]... -AthDictLoaderSvc DEBUG loading [Foo (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [Foo]... -AthDictLoaderSvc DEBUG loading [Bar (from clid=8107)]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar (from clid=8107)]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar (from clid=8107)]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Bar (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [Bar]... -AthDictLoaderSvc DEBUG loading [Fee (from clid=8108)]... -AthDictLoaderSvc DEBUG loading [Fee]... -AthDictLoaderSvc DEBUG loading [Fee]... -AthDictLoaderSvc DEBUG loading [Fee (from clid=8108)]... -AthDictLoaderSvc DEBUG loading [Fee]... -AthDictLoaderSvc DEBUG loading [Fee]... -AthDictLoaderSvc DEBUG loading [Baz (from clid=8211)]... -AthDictLoaderSvc DEBUG loading [Baz]... -AthDictLoaderSvc DEBUG loading [Baz]... -AthDictLoaderSvc DEBUG loading [Baz (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [Baz]... -AthDictLoaderSvc DEBUG loading [Baz (from clid=8211)]... -AthDictLoaderSvc DEBUG loading [Baz]... -AthDictLoaderSvc DEBUG loading [Baz]... -AthDictLoaderSvc DEBUG loading [Baz (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [Baz]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer (from clid=8212)]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer (from clid=8212)]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer (from typeinfo)]... -AthDictLoaderSvc DEBUG loading [BazAuxContainer]... -AthDictLoaderSvc DEBUG loading [Token]... -AthenaOutputStream INFO Either high or low (or both) float compression lists are defined. Float compression will be applied. -AthenaOutputStream INFO High compression will use 10 mantissa bits, and low compression will use 16 mantissa bits. -AlgExecStateSvc DEBUG preInit: will add Alg AthenaOutputStream later - + INPUT IGNORED ( 'AthenaAttributeList' , '' ) - + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_AthenaOutputStream' ) - + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_AthenaOutputStream' ) -AthenaOutputStr...WARNING add: can not find clid 13 in clid db -MetaDataSvc INFO Initializing MetaDataSvc -MetaDataSvc DEBUG Registering all Tools in ToolHandleArray MetaDataTools -MetaDataSvc DEBUG Not translating metadata item ID #13 -MetaDataSvc DEBUG Not translating metadata item ID #8101 -MetaDataSvc DEBUG Not translating metadata item ID #8107 -MetaDataSvc DEBUG Not translating metadata item ID #8107 -MetaDataSvc DEBUG Not translating metadata item ID #8107 -MetaDataSvc DEBUG Not translating metadata item ID #8108 -MetaDataSvc DEBUG Not translating metadata item ID #8108 -MetaDataSvc DEBUG Not translating metadata item ID #8211 -MetaDataSvc DEBUG Not translating metadata item ID #8211 -MetaDataSvc DEBUG Not translating metadata item ID #8212 -MetaDataSvc DEBUG Not translating metadata item ID #8212 -8212 compAux. -8212 seiAux. -8101 due -8101 uno -8107 due -8107 uno -8108 cinque -8107 quattro -8211 comp -8211 sei -StoreGateSvc DEBUG Retrieved const pointer to object SelectionVetoes_AthenaOutputStream of type SG::SelectionVetoes(CLID 3789442) -StoreGateSvc DEBUG Retrieved const pointer to object CompressionInfo_AthenaOutputStream of type SG::CompressionInfo(CLID 39950991) +AthenaOutputStream_test 8212 compAux. +AthenaOutputStream_test 8212 seiAux. +AthenaOutputStream_test 8101 due +AthenaOutputStream_test 8101 uno +AthenaOutputStream_test 8107 due +AthenaOutputStream_test 8107 uno +AthenaOutputStream_test 8108 cinque +AthenaOutputStream_test 8107 quattro +AthenaOutputStream_test 8211 comp +AthenaOutputStream_test 8211 sei *** AthenaOutputStream_test OK *** diff --git a/Control/AthenaServices/share/AthenaOutputStream_test.txt b/Control/AthenaServices/share/AthenaOutputStream_test.txt index e2ea2eac38937f05908ad8733938789dfecbf0ef..db5b88d8e1303202b86e3f9e25dfc69b3a9147bf 100644 --- a/Control/AthenaServices/share/AthenaOutputStream_test.txt +++ b/Control/AthenaServices/share/AthenaOutputStream_test.txt @@ -1,9 +1,8 @@ /// job opts for AthenaOutputStream unit test -// $Id: AthenaOutputStream_test.txt,v 1.5 2007-06-24 05:37:15 calaf Exp $ - MessageSvc.OutputLevel = 2; StoreGateSvc.OutputLevel = 2; +ApplicationMgr.ExtSvc += { "StoreGateSvc/DetectorStore" }; AthenaOutputStream.OutputLevel = 1; diff --git a/Control/AthenaServices/test/AthenaOutputStream_test.cxx b/Control/AthenaServices/test/AthenaOutputStream_test.cxx index 4653f2b5ab201bf8e9508dc05476f61c044916b1..d99c4c29e7b46edc5bcdd440a1d502b43beacf77 100644 --- a/Control/AthenaServices/test/AthenaOutputStream_test.cxx +++ b/Control/AthenaServices/test/AthenaOutputStream_test.cxx @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** @file AthenaOutputStream_test.cxx * @brief unit test for AthenaOutputStream * * @author Paolo Calafiura <pcalafiura@lbl.gov> -ATLAS Collaboration - * $Id: AthenaOutputStream_test.cxx,v 1.5 2007-05-18 17:02:25 calaf Exp $ **/ #undef NDEBUG @@ -117,7 +116,7 @@ int main() { DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (obj); if (!dbb) std::abort(); const SG::DataProxy* proxy = pStore->proxy (dbb->object()); - std::cout << dbb->clID() << " " << proxy->name() << "\n"; + std::cout << appName << " " << dbb->clID() << " " << proxy->name() << "\n"; } const SG::SelectionVetoes* selvetoes = nullptr; diff --git a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref index d66b445aba70bc39cb21ce6e4970c1c0eeeb75e0..ffdddca993c80fbcf17a81f02656ecd0be47a3d4 100644 --- a/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref +++ b/Control/DataModelTest/DataModelRunTests/share/xAODTestSymlinks1MT.ref @@ -45,12 +45,12 @@ AvalancheSchedulerSvc 0 INFO Data Depe o INPUT ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) o INPUT ( 'SG::AuxElement' , 'StoreGateSvc+cinfo' ) xAODTestAlg - o INPUT ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) - o INPUT ( 'DMTest::S1' , 'StoreGateSvc+S2' ) - o INPUT ( 'DMTest::S2' , 'StoreGateSvc+S2' ) - o INPUT ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) - o OUTPUT ( 'DMTest::C' , 'StoreGateSvc+cinfo2' ) - o OUTPUT ( 'SG::AuxElement' , 'StoreGateSvc+cinfo2' ) + o INPUT ( 'DMTest::CVec' , 'StoreGateSvc+cvec' ) [xAODTestAlg.xAODTestWriteCInfoTool] + o INPUT ( 'DMTest::S1' , 'StoreGateSvc+S2' ) [xAODTestAlg.xAODTestReadSymlinkTool] + o INPUT ( 'DMTest::S2' , 'StoreGateSvc+S2' ) [xAODTestAlg.xAODTestReadSymlinkTool] + o INPUT ( 'DMTest::S2' , 'StoreGateSvc+S2alias' ) [xAODTestAlg.xAODTestReadSymlinkTool] + o OUTPUT ( 'DMTest::C' , 'StoreGateSvc+cinfo2' ) [xAODTestAlg.xAODTestWriteCInfoTool] + o OUTPUT ( 'SG::AuxElement' , 'StoreGateSvc+cinfo2' ) [xAODTestAlg.xAODTestReadSymlinkTool] EndIncFiringAlg none IncidentProcAlg2 diff --git a/Control/PileUpMT/src/PileUpMTAlg.cxx b/Control/PileUpMT/src/PileUpMTAlg.cxx index 83a3fd720a4a70359f97a3f6ae93f5c2ddd155d8..0ebe6eefd9d813a93d04f7778fb91c8f42443aed 100644 --- a/Control/PileUpMT/src/PileUpMTAlg.cxx +++ b/Control/PileUpMT/src/PileUpMTAlg.cxx @@ -58,17 +58,18 @@ PileUpMTAlg::PileUpMTAlg(const std::string& name, ISvcLocator* pSvcLocator) PileUpMTAlg::~PileUpMTAlg() {} StatusCode PileUpMTAlg::get_ei(StoreGateSvc& sg, std::unique_ptr<const xAOD::EventInfo>& ei_, - bool /* pileup */) const { + bool pileup) const { + std::string key = pileup ? "EventInfo" : "HSEventInfo"; xAOD::EventInfo* newEi = new xAOD::EventInfo(); xAOD::EventAuxInfo* eiAux = new xAOD::EventAuxInfo(); newEi->setStore(eiAux); - SG::ReadHandle<xAOD::EventInfo> ei_h("EventInfo", sg.name()); + SG::ReadHandle<xAOD::EventInfo> ei_h(key, sg.name()); const xAOD::EventInfo* ei = ei_h.get(); if (ei != nullptr) { *newEi = *ei; } else { - SG::ReadHandle<::EventInfo> ei2_h("EventInfo", sg.name()); + SG::ReadHandle<::EventInfo> ei2_h(key, sg.name()); const ::EventInfo* ei2 = ei2_h.get(); if (ei2 == nullptr) { // Just in case @@ -172,7 +173,7 @@ StatusCode PileUpMTAlg::initialize() { } } } - m_evtInfoContKey = fmt::format("{}Container", m_evtInfoKey.key()); + m_evtInfoContKey = "PileUpEventInfo"; ATH_CHECK(m_evtInfoKey.initialize()); ATH_CHECK(m_evtInfoContKey.initialize()); return StatusCode::SUCCESS; @@ -192,6 +193,7 @@ StatusCode PileUpMTAlg::execute() { ATH_MSG_DEBUG("Executing " << name() << "..."); // Gaudi::Hive::setCurrentContext(ctx); const EventContext& ctx = Gaudi::Hive::currentContext(); + const auto& evtID = ctx.eventID(); const long long hs_id = ctx.evt() + m_skippedHSEvents.value(); ATH_CHECK(evtStore().retrieve()); if (m_fracLowPt != 0) { @@ -225,6 +227,13 @@ StatusCode PileUpMTAlg::execute() { overlaidEvt->setEvtStore(evtStore().get()); overlaidEvt->clearSubEvents(); + // This was the problem. Need to fix overlaidEvt using context run and lb number + overlaidEvt->setRunNumber(evtID.run_number()); + overlaidEvt->setLumiBlock(evtID.lumi_block()); + overlaidEvt->setEventNumber(evtID.event_number()); + overlaidEvt->setBCID(evtID.bunch_crossing_id()); + overlaidEvt->setTimeStamp(evtID.time_stamp()); + overlaidEvt->setTimeStampNSOffset(evtID.time_stamp_ns_offset()); // Pileup container SG::WriteHandle<xAOD::EventInfoContainer> puCont(m_evtInfoContKey, ctx); ATH_CHECK(puCont.record(std::make_unique<xAOD::EventInfoContainer>(), @@ -239,7 +248,7 @@ StatusCode PileUpMTAlg::execute() { // Set properties bool sf_updated = false; - float lumi_sf = m_beamLumi->scaleFactor(hsEvt->runNumber(), hsEvt->lumiBlock(), sf_updated); + float lumi_sf = m_beamLumi->scaleFactor(evtID.run_number(), evtID.lumi_block(), sf_updated); float cur_avg_mu = lumi_sf * m_avgMu; overlaidEvt->setAverageInteractionsPerCrossing(cur_avg_mu); overlaidEvt->setActualInteractionsPerCrossing(m_beamInt->normFactor(0) * cur_avg_mu); @@ -372,29 +381,9 @@ StatusCode PileUpMTAlg::execute() { } // Setup tools - // Account for existing subevents - std::map<int, int> existing_subevt_bc_counts{}; - for (const auto& se : overlaidEvt->subEvents()) { - existing_subevt_bc_counts[se.time() / m_BCSpacing]++; - } for (auto&& tool : m_puTools) { - // First figure out how many events we need to run on - unsigned int n_evts = 0; - for (int bc = m_earliestDeltaBC; bc <= m_latestDeltaBC; ++bc) { - if (tool->toProcess(bc * m_BCSpacing)) { - std::size_t bc_idx = bc - m_earliestDeltaBC; - n_evts += existing_subevt_bc_counts[bc]; - n_evts += n_low_pt[bc_idx]; - n_evts += n_high_pt[bc_idx]; - n_evts += m_numCavern; - n_evts += n_beam_halo[bc_idx]; - n_evts += n_beam_gas[bc_idx]; - } - } - ATH_MSG_DEBUG(tool.name() << " will handle " << n_evts << " events"); - // Setup the tool + // Reset filter -- Don't know if this is necessary tool->resetFilter(); - ATH_CHECK(tool->prepareEvent(ctx, n_evts)); } // Now add the events @@ -453,45 +442,32 @@ StatusCode PileUpMTAlg::execute() { } } - // Sort so we can go 1 BC at a time - ranges::stable_sort(const_cast<std::vector<SubEvent>&>(overlaidEvt->subEvents()), - ranges::less{}, &SubEvent::time); - auto subevt_bc_intervals = rv::group_by(overlaidEvt->subEvents(), - [](const SubEvent& lhs, const SubEvent& rhs) { - return lhs.time() == rhs.time(); - }) - | ranges::to<std::vector>; for (auto&& tool : m_puTools) { - for (const auto& bc_interval : subevt_bc_intervals) { - const SubEventIterator start_evt = bc_interval.begin(); - const SubEventIterator end_evt = bc_interval.end(); - if (!tool->toProcess(start_evt->time())) { - continue; - } - try { - ATH_CHECK(tool->processBunchXing(start_evt->time(), start_evt, end_evt)); - } - catch (const std::exception& e) { - ATH_MSG_ERROR("Caught exception processing subevent: " << e.what() << ", TOOL: " - << tool.name()); - return StatusCode::FAILURE; - } - } try { - // Merge event - ATH_CHECK(tool->mergeEvent(ctx)); - } - catch (const std::exception& e) { - ATH_MSG_ERROR("Caught exception merging event: " << e.what() - << ", TOOL: " << tool.name()); + ATH_CHECK(tool->processAllSubEvents(ctx)); + } catch (const std::exception& e) { + ATH_MSG_ERROR("Caught exception running " << tool.name() << ": " + << e.what()); + const auto evt_ids = + overlaidEvt->subEvents() | + rv::transform([](const SubEvent& sev) { + return fmt::format("({}, {})", sev.ptr()->runNumber(), + sev.ptr()->eventNumber()); + }) | + ranges::to<std::vector>; + const std::string evts = + fmt::format("[{}]", fmt::join(evt_ids, ", ")); + ATH_MSG_ERROR("Exception occured in one of these events: " << evts); + return StatusCode::FAILURE; } // Propagate filter result if (!tool->filterPassed()) { setFilterPassed(false); } } - ATH_MSG_DEBUG(fmt::format("***** Took {:%OMm %OSs} to process all subevents", - std::chrono::high_resolution_clock::now() - now)); + ATH_MSG_DEBUG( + fmt::format("***** Took {:%OMm %OSs} to process all subevents", + std::chrono::high_resolution_clock::now() - now)); // // Save hash (direct copy from PileUpEventLoopMgr) PileUpHashHelper pileUpHashHelper; diff --git a/Control/PileUpTools/PileUpTools/PileUpMergeSvc.icc b/Control/PileUpTools/PileUpTools/PileUpMergeSvc.icc index 3ca0b1b698150515d29118fbe35892c05334a2d9..032da98ae3b961dbcbf44370bc51937ed5733c3c 100755 --- a/Control/PileUpTools/PileUpTools/PileUpMergeSvc.icc +++ b/Control/PileUpTools/PileUpTools/PileUpMergeSvc.icc @@ -1,13 +1,15 @@ /* -*- C++ -*- */ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include <algorithm> /* make_pair */ #include <cassert> #include <string> +#include <fmt/format.h> + /* #include "boost/concept_check.hpp" */ #include "GaudiKernel/System.h" #include "GaudiKernel/StatusCode.h" @@ -18,9 +20,18 @@ #include "AthenaBaseComps/AthMsgStreamMacros.h" namespace { - template <class DATALINK, typename KEY> - void fillLink(DATALINK& l, const KEY& k, IProxyDict* sg = 0) - { l.toIdentifiedObject(k, sg); } + template <typename KEY> + std::string mkHSKey(const KEY& k) { + return fmt::format("HS{}", k); + } + + template <class DATALINK, typename KEY> + void fillLink(DATALINK& l, const KEY& k, IProxyDict* sg = 0) { + l.toIdentifiedObject(k, sg); + if (!l.isValid()) { + l.toIdentifiedObject(mkHSKey(k), sg); + } + } struct NoKey {}; //MsgStream& operator <<(MsgStream& os, const NoKey&) { os << "Default"; return os; } @@ -69,6 +80,9 @@ PileUpMergeSvc::retrieveOriginal(const KEY& dataKey, const DATA*& data) { if( pEvent->subEvents().size() ) { //here we assume that the original event is the first in pEvent list sc = pEvent->subEvents()[0].ptr()->evtStore()->retrieve(data, dataKey); + if (!sc) { + sc = pEvent->subEvents()[0].ptr()->evtStore()->retrieve(data, mkHSKey(dataKey)); + } } } return sc; @@ -240,6 +254,9 @@ PileUpMergeSvc::retrieveSingleSubEvtData(const KEY& dataKey, const DATA*& data, iEvt->ptr()->runNumber()); StatusCode sc = seStore.retrieve(data, dataKey); + if (!sc) { + sc = seStore.retrieve(data, mkHSKey(dataKey)); + } return sc; } diff --git a/Control/StoreGate/StoreGate/WriteDecorHandle.icc b/Control/StoreGate/StoreGate/WriteDecorHandle.icc index cade3e069c2ff831212853da802aa5a19957053b..5e4a36cc4a3e2e2656b9779e0bdae2a8bade2f0e 100644 --- a/Control/StoreGate/StoreGate/WriteDecorHandle.icc +++ b/Control/StoreGate/StoreGate/WriteDecorHandle.icc @@ -180,9 +180,12 @@ WriteDecorHandle<T, D>::operator() (const AuxElement& e) // of this check. We previously called cptr() here, but that's // redundant with vectorData(). if (m_state != RENOUNCED && e.container() != this->vectorData()) { +#if 0 + // Disable temporarily --- see ATLSUSYBGF-672. throwExcBadDecorElement (Gaudi::DataHandle::Writer, this->clid(), this->m_decorKey); +#endif } return m_acc (e); } diff --git a/Control/StoreGate/test/WriteDecorHandle_test.cxx b/Control/StoreGate/test/WriteDecorHandle_test.cxx index 68ef1d08ca1742f04d12316bcec6e285366a5f7a..bdf78a25d33f5820b9bd5544689f03fbc39e09af 100644 --- a/Control/StoreGate/test/WriteDecorHandle_test.cxx +++ b/Control/StoreGate/test/WriteDecorHandle_test.cxx @@ -248,8 +248,9 @@ void test3() cont2->push_back (new MyObj(1)); cont2->push_back (new MyObj(2)); cont2->push_back (new MyObj(3)); - const MyObjCont* pcont2 = cont2.get(); - EXPECT_EXCEPTION( SG::ExcBadDecorElement, h1 (*(*pcont2)[1]) = 11 ); + // Disable temporarily --- see ATLSUSYBGF-672. + //const MyObjCont* pcont2 = cont2.get(); + //EXPECT_EXCEPTION( SG::ExcBadDecorElement, h1 (*(*pcont2)[1]) = 11 ); } @@ -366,7 +367,8 @@ void test6() assert (foo1_proxy->refCount() == 1); h1 (*(*pcont1)[0]) = 11; assert (foo1_proxy->refCount() == 2); - EXPECT_EXCEPTION( SG::ExcBadDecorElement, h1 (*(*pcont2)[0]) = 12 ); + // Disable temporarily --- see ATLSUSYBGF-672. + //EXPECT_EXCEPTION( SG::ExcBadDecorElement, h1 (*(*pcont2)[0]) = 12 ); SG::WriteDecorHandleKey<MyObjCont> k2 ("foo2.aaa"); assert (k2.initialize().isSuccess()); diff --git a/Control/xAODRootAccess/Root/TAuxStore.cxx b/Control/xAODRootAccess/Root/TAuxStore.cxx index 0c3fe0eaba15399f2d75c378852d850327a48b3f..3aa6e8a2c3aab2efdc62ff498329ca7e212e603e 100644 --- a/Control/xAODRootAccess/Root/TAuxStore.cxx +++ b/Control/xAODRootAccess/Root/TAuxStore.cxx @@ -1808,12 +1808,12 @@ namespace xAOD { // general experience with the ROOT code, I'm going to say no... TClass* aux_vec_cl = TClass::GetClass( Utils::getTypeName( *aux_vec_ti ).c_str() ); - if( aux_vec_cl && aux_vec_cl->GetConversionStreamerInfo( cl, 0 ) ) { + if( aux_vec_cl && aux_vec_cl->GetConversionStreamerInfo( cl, cl->GetClassVersion() ) ) { return kTRUE; } TClass* aux_obj_cl = TClass::GetClass( Utils::getTypeName( *aux_obj_ti ).c_str() ); - if( aux_obj_cl && aux_obj_cl->GetConversionStreamerInfo( cl, 0 ) ) { + if( aux_obj_cl && aux_obj_cl->GetConversionStreamerInfo( cl, cl->GetClassVersion() ) ) { return kFALSE; } diff --git a/DataQuality/DataQualityConfigurations/config/Jets/collisions_run.config b/DataQuality/DataQualityConfigurations/config/Jets/collisions_run.config index 180db156fce479ce401766851ee5b63e5d0fb2a2..66fe025bc28188c9e0058fa4eede3ef71e531a83 100644 --- a/DataQuality/DataQualityConfigurations/config/Jets/collisions_run.config +++ b/DataQuality/DataQualityConfigurations/config/Jets/collisions_run.config @@ -47,16 +47,15 @@ output top_level { # weight = 0 # } -# Commented out - to be added later -# output ptrange200GeVto500GeV { -# weight = 0 -# } -# output highptrange500GeVto1TeV { -# weight = 0 -# } -# output highptrange1TeVto2TeV { -# weight = 0 -# } + output highptrange200GeVto500GeV { + weight = 0 + } + output highptrange500GeVto1TeV { + weight = 0 + } + output highptrange1TeVto2TeV { + weight = 0 + } # output highptrange2TeVto8TeV { # weight = 0 # } @@ -104,16 +103,15 @@ output top_level { # weight = 0 # } -# Commented out - to be added later -# output ptrange200GeVto500GeV { -# weight = 0 -# } -# output highptrange500GeVto1TeV { -# weight = 0 -# } -# output highptrange1TeVto2TeV { -# weight = 0 -# } + output highptrange200GeVto500GeV { + weight = 0 + } + output highptrange500GeVto1TeV { + weight = 0 + } + output highptrange1TeVto2TeV { + weight = 0 + } # output highptrange2TeVto8TeV { # weight = 0 # } @@ -165,16 +163,15 @@ output top_level { # weight = 0 # } -# Commented out - to be added later -# output ptrange200GeVto500GeV { -# weight = 0 -# } -# output highptrange500GeVto1TeV { -# weight = 0 -# } -# output highptrange1TeVto2TeV { -# weight = 0 -# } + output highptrange200GeVto500GeV { + weight = 0 + } + output highptrange500GeVto1TeV { + weight = 0 + } + output highptrange1TeVto2TeV { + weight = 0 + } # output highptrange2TeVto8TeV { # weight = 0 # } @@ -214,15 +211,15 @@ dir Jets { ###################SUMMARY######################### dir standardHistos { - hist phi_eta { + hist eta_phi { output = Jets/AntiKt4EMTopoJets algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_e { + hist eta_phi_e { output = Jets/AntiKt4EMTopoJets algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_pt { + hist eta_phi_pt { output = Jets/AntiKt4EMTopoJets algorithm = JetEtaPhiAve_BinsDiff } @@ -337,15 +334,15 @@ dir Jets { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta { + hist eta_phi { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_e { + hist eta_phi_e { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_pt { + hist eta_phi_pt { algorithm = JetEtaPhiAve_BinsDiff display = StatBox } @@ -847,24 +844,155 @@ dir Jets { display = StatBox algorithm = JetKin_Chisq } + hist nconstit_highJVF { + display = StatBox + algorithm = JetKin_Chisq + } + hist N90Constituents_highJVF { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } #Close dir highJVF } -# Close dir AntiKt4EMTopoJets + ######################################################## + ################# high pT ranges ####################### + dir highptrange200GeVto500GeV { + output = Jets/AntiKt4EMTopoJets/highptrange200GeVto500GeV + hist pt_highptrange200GeVto500GeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist m_highptrange200GeVto500GeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange200GeVto500GeV + } + dir highptrange500GeVto1TeV { + output = Jets/AntiKt4EMTopoJets/highptrange500GeVto1TeV + hist pt_highptrange500GeVto1TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist m_highptrange500GeVto1TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange500GeVto1TeV + } + dir highptrange1TeVto2TeV { + output = Jets/AntiKt4EMTopoJets/highptrange1TeVto2TeV + hist pt_highptrange1TeVto2TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist m_highptrange1TeVto2TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange1TeVto2TeV + } + ######################################################## + # Close dir AntiKt4EMTopoJets } dir AntiKt4LCTopoJets { algorithm = JetGatherData ###################SUMMARY######################### dir standardHistos { - hist phi_eta { + hist eta_phi { output = Jets/AntiKt4LCTopoJets algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_e { + hist eta_phi_e { output = Jets/AntiKt4LCTopoJets algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_pt { + hist eta_phi_pt { output = Jets/AntiKt4LCTopoJets algorithm = JetEtaPhiAve_BinsDiff } @@ -982,15 +1110,15 @@ dir Jets { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta { + hist eta_phi { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_e { + hist eta_phi_e { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_pt { + hist eta_phi_pt { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } @@ -1502,8 +1630,139 @@ dir Jets { display = StatBox algorithm = JetKin_Chisq } + hist nconstit_highJVF { + display = StatBox + algorithm = JetKin_Chisq + } + hist N90Constituents_highJVF { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } #Close dir highJVF } + ######################################################## + ################# high pT ranges ####################### + dir highptrange200GeVto500GeV { + output = Jets/AntiKt4LCTopoJets/highptrange200GeVto500GeV + hist pt_highptrange200GeVto500GeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange200GeVto500GeV { + algorithm = JetKin_Chisq + display = StatBox + } + hist m_highptrange200GeVto500GeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange200GeVto500GeV + } + dir highptrange500GeVto1TeV { + output = Jets/AntiKt4LCTopoJets/highptrange500GeVto1TeV + hist pt_highptrange500GeVto1TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange500GeVto1TeV { + algorithm = JetKin_Chisq + display = StatBox + } + hist m_highptrange500GeVto1TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange500GeVto1TeV + } + dir highptrange1TeVto2TeV { + output = Jets/AntiKt4LCTopoJets/highptrange1TeVto2TeV + hist pt_highptrange1TeVto2TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange1TeVto2TeV { + algorithm = JetKin_Chisq + display = StatBox + } + hist m_highptrange1TeVto2TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange1TeVto2TeV + } + ######################################################## # Close dir AntiKt4LCTopoJets } @@ -1512,15 +1771,15 @@ dir Jets { ###################SUMMARY######################### dir standardHistos { - hist phi_eta { + hist eta_phi { output = Jets/AntiKt4EMPFlowJets algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_e { + hist eta_phi_e { output = Jets/AntiKt4EMPFlowJets algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_pt { + hist eta_phi_pt { output = Jets/AntiKt4EMPFlowJets algorithm = JetEtaPhiAve_BinsDiff } @@ -1638,15 +1897,15 @@ dir Jets { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta { + hist eta_phi { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_e { + hist eta_phi_e { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } - hist phi_eta_pt { + hist eta_phi_pt { display = StatBox algorithm = JetEtaPhiAve_BinsDiff } @@ -2049,8 +2308,139 @@ dir Jets { display = StatBox algorithm = JetKin_Chisq } + hist nconstit_highJVF { + display = StatBox + algorithm = JetKin_Chisq + } + hist N90Constituents_highJVF { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highJVF { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } #Close dir highJVF } + ######################################################## + ################# high pT ranges ####################### + dir highptrange200GeVto500GeV { + output = Jets/AntiKt4EMPFlowJets/highptrange200GeVto500GeV + hist pt_highptrange200GeVto500GeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist m_highptrange200GeVto500GeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange200GeVto500GeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange200GeVto500GeV + } + dir highptrange500GeVto1TeV { + output = Jets/AntiKt4EMPFlowJets/highptrange500GeVto1TeV + hist pt_highptrange500GeVto1TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist m_highptrange500GeVto1TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange500GeVto1TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange500GeVto1TeV + } + dir highptrange1TeVto2TeV { + output = Jets/AntiKt4EMPFlowJets/highptrange1TeVto2TeV + hist pt_highptrange1TeVto2TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist highpt_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist m_highptrange1TeVto2TeV { + display = StatBox,LogY + algorithm = JetKin_Chisq + } + hist eta_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist phi_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetKin_Chisq + } + hist eta_phi_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_e_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + hist eta_phi_pt_highptrange1TeVto2TeV { + display = StatBox + algorithm = JetEtaPhiAve_BinsDiff + } + #Close dir highrange1TeVto2TeV + } + ######################################################## # Close dir AntiKt4EMPFlowJets } #Close dir Jets diff --git a/DataQuality/DataQualityUtils/scripts/DeMoAtlasDataLoss.py b/DataQuality/DataQualityUtils/scripts/DeMoAtlasDataLoss.py index b109ea06bdffb5e002977edc7a1d23602c2bd5f2..3cb4ad380e446d4f1b5fffafff2b423a4704cc4d 100644 --- a/DataQuality/DataQualityUtils/scripts/DeMoAtlasDataLoss.py +++ b/DataQuality/DataQualityUtils/scripts/DeMoAtlasDataLoss.py @@ -174,7 +174,10 @@ for iSyst in systemList2: print("==== %s"%iSyst) if (len(affectedLBs[iSyst])): for i in range(len(periodName)): - percentLoss = dataLossPerPeriod[iSyst][periodName[i]]/periodLumi[periodName[i]]/10000 + if (periodLumi[periodName[i]] != 0.): + percentLoss = dataLossPerPeriod[iSyst][periodName[i]]/periodLumi[periodName[i]]/10000 + else: + percentLoss = 0. if percentLoss != 0.: print("Period %s -> %.4f percent"%(periodName[i],percentLoss)) hprof_dataLossPerSystem[iSyst].Fill(i,percentLoss) diff --git a/DataQuality/DataQualityUtils/scripts/DeMoDaemon-grl.exe b/DataQuality/DataQualityUtils/scripts/DeMoDaemon-grl.exe index daeae9fd37cf721201021c3eb0fd2dcf20071bf1..c1a8621d7194471d03d132275a57a173edebb5c2 100755 --- a/DataQuality/DataQualityUtils/scripts/DeMoDaemon-grl.exe +++ b/DataQuality/DataQualityUtils/scripts/DeMoDaemon-grl.exe @@ -33,7 +33,7 @@ echo "Now in ${rundir}" export AtlasSetup=/afs/cern.ch/atlas/software/dist/AtlasSetup source $AtlasSetup/scripts/asetup.sh Athena,22.0.81 -systems='Pixel SCT TRT LAr Tile MDT TGC RPC Trig_L1 Trig_HLT Lumi Global ALFA LUCID ZDC IDGlobal BTag CaloCP MuonCP ' +systems='Pixel SCT TRT LAr Tile MDT TGC RPC Trig_L1 Trig_HLT Lumi Global ALFA AFP LUCID ZDC IDGlobal BTag CaloCP MuonCP ' if [ $option == "resetYS" ]; then @@ -81,7 +81,7 @@ do done echo "Derive ATLAS data loss" -cmd="python $ScriptPath/DeMoAtlasDataLoss.py -b -y ${year} -t ${tag}" +cmd="python DeMoAtlasDataLoss.py -b -y ${year} -t ${tag}" eval ${cmd} echo "Generate webpage" diff --git a/DataQuality/DataQualityUtils/scripts/DeMoDaemon.exe b/DataQuality/DataQualityUtils/scripts/DeMoDaemon.exe index 33c7eeed21d81ca1f90995decc4dab38a7c91f80..89987c51aabda63d6b55dbfb3918f7afe29c81a1 100755 --- a/DataQuality/DataQualityUtils/scripts/DeMoDaemon.exe +++ b/DataQuality/DataQualityUtils/scripts/DeMoDaemon.exe @@ -36,7 +36,7 @@ cmd="python $ScriptPath/DeMoUpdate.py --runListUpdate -y ${year}" echo "** ${cmd} **" eval "${cmd}" -systems='Pixel SCT TRT LAr Tile MDT TGC RPC Trig_L1 Trig_HLT Lumi Global ALFA LUCID ZDC IDGlobal BTag CaloCP MuonCP ' +systems='Pixel SCT TRT LAr Tile MDT TGC RPC Trig_L1 Trig_HLT Lumi Global ALFA AFP LUCID ZDC IDGlobal BTag CaloCP MuonCP ' if [ $option == "resetYS" ]; then @@ -90,7 +90,7 @@ do done echo "Derive ATLAS data loss" -cmd="python $ScriptPath/DeMoAtlasDataLoss.py -b -y ${year} -t ${tag}" +cmd="python DeMoAtlasDataLoss.py -b -y ${year} -t ${tag}" eval ${cmd} echo "Generate webpage" diff --git a/DataQuality/DataQualityUtils/scripts/DeMoGenerateWWW.py b/DataQuality/DataQualityUtils/scripts/DeMoGenerateWWW.py index ad0dbc0a51f53495da51616359d0feb72f1f3e47..42b87c1688dd8e2f977af0c320582d684e8bb4de 100644 --- a/DataQuality/DataQualityUtils/scripts/DeMoGenerateWWW.py +++ b/DataQuality/DataQualityUtils/scripts/DeMoGenerateWWW.py @@ -15,11 +15,11 @@ from DeMoLib import retrieveYearTagProperties,returnPeriod maindir = "/afs/cern.ch/user/a/atlasdqm/www/DeMo" libdir = os.path.dirname(__file__) -weeklyYear = "2022" +weeklyYear = "2023" weeklyTag = "AtlasReady" global run3_yt -run3_yt = {"2022":["AtlasReady","GRL","GRL_ignore-TRIGMUO-TRIGLAR","GRL_ignore-TRIGLAR"], +run3_yt = {"2022":["AtlasReady_BestLumi_HEAD","AtlasReady_BestLumi","GRL_M"], "2023":["AtlasReady"]} # run3_yt_description is retrieved from the DeMoConfig.dat files. See below @@ -31,7 +31,7 @@ subsystems = {"Inner detector":["Pixel","SCT","TRT"], "Calorimeters":["LAr","Tile"], "Muon":["RPC","MDT","TGC","CSC"], "Trigger/Lumi/Global":["Trig_L1","Trig_HLT","Lumi","Global"], - "Forward": ["ALFA","LUCID","ZDC"], + "Forward": ["ALFA","AFP","LUCID","ZDC"], "Combined perf.":["IDGlobal","BTag","CaloCP","MuonCP"]} global subsystemName subsystemName = {"Pixel":"Pixel", @@ -48,6 +48,7 @@ subsystemName = {"Pixel":"Pixel", "Lumi":"Luminosity", "Global":"Global", "ALFA":"ALFA", + "AFP":"AFP", "LUCID":"LUCID", "ZDC":"ZDC", "IDGlobal":"ID global", @@ -82,128 +83,132 @@ def addHeader(page,year): run3 = (year != "Run2") - page.write('''<!doctype html>''') - page.write('''<html lang=''>''') - page.write('''<head>''') - page.write(''' <meta charset='utf-8'>''') - page.write(''' <meta http-equiv="X-UA-Compatible" content="IE=edge">''') - page.write(''' <meta name="viewport" content="width=device-width, initial-scale=1">''') - page.write(''' <link rel="stylesheet" href="styles.css">''') - page.write(''' <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>''') - page.write(''' <script src="script.js"></script>''') - page.write(''' <title>DeMo outputs</title>''') - page.write('''</head> ''') - page.write('''<body>''') - - - page.write('''<div id='cssmenu'>''') - page.write('''<ul>''') + page.write('''<!doctype html>\n''') + page.write('''<html lang=''>\n''') + page.write('''<head>\n''') + page.write(''' <meta charset='utf-8'>\n''') + page.write(''' <meta http-equiv="X-UA-Compatible" content="IE=edge">\n''') + page.write(''' <meta name="viewport" content="width=device-width, initial-scale=1">\n''') + page.write(''' <link rel="stylesheet" href="styles.css">\n''') + page.write(''' <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>\n''') + page.write(''' <script src="script.js"></script>\n''') + page.write(''' <title>DeMo outputs</title>\n''') + page.write('''</head> \n''') + page.write('''<body>\n''') + + + page.write('''<div id='cssmenu'>\n''') + page.write('''<ul>\n''') if (year == "Run2"): - page.write(''' <li><a href='index-Run2.html'><span><b>Run 2</b></span></a></li>''') + page.write(''' <li><a href='index-Run2.html'><span><b>Run 2</b></span></a></li>\n''') else: - page.write(''' <li><a href='index-Run2.html'><span>Run 2</span></a></li>''') + page.write(''' <li><a href='index-Run2.html'><span>Run 2</span></a></li>\n''') for irun3_year in run3_yt.keys(): if (irun3_year == year): - page.write(''' <li><a href='index-%s.html'><span><b>%s</b></span></a></li>'''%(irun3_year,irun3_year)) + page.write(''' <li><a href='index-%s.html'><span><b>%s</b></span></a></li>\n'''%(irun3_year,irun3_year)) else: - page.write(''' <li><a href='index-%s.html'><span>%s</span></a></li>'''%(irun3_year,irun3_year)) - page.write('''</ul>''') - page.write('''</div>''') + page.write(''' <li><a href='index-%s.html'><span>%s</span></a></li>\n'''%(irun3_year,irun3_year)) + page.write('''</ul>\n''') + page.write('''</div>\n''') - page.write('''<div id='cssmenu'>''') - page.write('''<ul>''') + page.write('''<div id='cssmenu'>\n''') + page.write('''<ul>\n''') ### Year stats for all systems - page.write(''' <li class='active has-sub'><a><span>Overview</span></a>''') - page.write(''' <ul>''') + page.write(''' <li class='active has-sub'><a><span>Overview</span></a>\n''') + page.write(''' <ul>\n''') if (run3): if (year == weeklyYear): - page.write(''' <li><a href='Weekly.html'><span>Weekly</span></a></li>''') + page.write(''' <li><a href='Weekly.html'><span>Weekly</span></a></li>\n''') for iTag in run3_yt[year]: - page.write(''' <li><hr><a href='YearStats-%s-%s.html'><span>Year stats - %s </span></a></li>'''%(year,iTag,run3_yt_description[iTag])) - page.write(''' <li><a href='recapDefectsHighlights-%s-%s.html'><span>Defect highlights (beta) - %s </span></a></li>'''%(year,iTag,run3_yt_description[iTag])) + page.write(''' <li><hr><a href='YearStats-%s-%s.html'><span>Year stats - %s </span></a></li>\n'''%(year,iTag,run3_yt_description["%s_%s"%(year,iTag)])) + page.write(''' <li><a href='recapDefectsHighlights-%s-%s.html'><span>Defect highlights (beta) - %s </span></a></li>\n'''%(year,iTag,run3_yt_description["%s_%s"%(year,iTag)])) else: - page.write(''' <li><a href='YearStats-2018-DQPaper_2018.html'><span>2018 overview - DQ Paper</span></a></li>''') - page.write(''' <li><a href='YearStats-2017-DQPaper_2017.html'><span>2017 overview - DQ Paper</span></a></li>''') - page.write(''' <li><a href='YearStats-2016-DQPaper_2016.html'><span>2016 overview - DQ Paper</span></a></li>''') - page.write(''' <li><a href='YearStats-2015-DQPaper_2015.html'><span>2015 overview - DQ Paper</span></a></li>''') + page.write(''' <li><a href='YearStats-2018-DQPaper_2018.html'><span>2018 overview - DQ Paper</span></a></li>\n''') + page.write(''' <li><a href='YearStats-2017-DQPaper_2017.html'><span>2017 overview - DQ Paper</span></a></li>\n''') + page.write(''' <li><a href='YearStats-2016-DQPaper_2016.html'><span>2016 overview - DQ Paper</span></a></li>\n''') + page.write(''' <li><a href='YearStats-2015-DQPaper_2015.html'><span>2015 overview - DQ Paper</span></a></li>\n''') - page.write(''' </ul>''') - page.write(''' </li>''') + page.write(''' </ul>\n''') + page.write(''' </li>\n''') for iSystem in subsystems.keys(): page.write(''' <li class='active has-sub'><a><span>%s</span></a>'''%iSystem) - page.write(''' <ul>''') + page.write(''' <ul>\n''') for iSystem in subsystems[iSystem]: if ((run3) and (iSystem not in subsystemNotInRun3)) or ((not run3) and (iSystem not in subsystemNotInRun2)): page.write('''<li class='has-sub'><a ><span>%s</span></a>'''%subsystemName[iSystem]) - page.write(''' <ul>''') + page.write(''' <ul>\n''') else: continue if (run3) and (iSystem not in subsystemNotInRun3): if (year == weeklyYear): - page.write(''' <li><a href='%s-Weekly.html'><span>Weekly</span></a></li>'''%(iSystem)) + page.write(''' <li><a href='%s-Weekly.html'><span>Weekly</span></a></li>\n'''%(iSystem)) for iTag in run3_yt[year]: - page.write(''' <li><hr><a href='%s-YearStats-%s-%s.html'><span>Year stats - %s </span></a></li>'''%(iSystem,year,iTag,run3_yt_description[iTag])) - page.write(''' <li><a href='%s-recapDefects-%s-%s.html'><span>Defect recap - %s </span></a></li>'''%(iSystem,year,iTag,run3_yt_description[iTag])) + page.write(''' <li><hr><a href='%s-YearStats-%s-%s.html'><span>Year stats - %s </span></a></li>\n'''%(iSystem,year,iTag,run3_yt_description["%s_%s"%(year,iTag)])) + page.write(''' <li><a href='%s-recapDefects-%s-%s.html'><span>Defect recap - %s </span></a></li>\n'''%(iSystem,year,iTag,run3_yt_description["%s_%s"%(year,iTag)])) elif (iSystem not in subsystemNotInRun2): - page.write(''' <li><hr><a href='%s-YearStats-DQPaper_.html'><span>Year stats - Run2</span></a></li>'''%(iSystem)) - page.write(''' <li class='last'><a href='%s-recapDefects-DQPaper_.html'><span>Defect recap - Run2</span></a></li>'''%(iSystem)) - page.write(''' </ul>''') - page.write('''</li>''') - page.write('''</ul>''') - page.write('''</li>''') - - page.write('''</ul>''') - page.write('''</div>''') + page.write(''' <li><hr><a href='%s-YearStats-DQPaper_.html'><span>Year stats - Run2</span></a></li>\n'''%(iSystem)) + page.write(''' <li class='last'><a href='%s-recapDefects-DQPaper_.html'><span>Defect recap - Run2</span></a></li>\n'''%(iSystem)) + page.write(''' </ul>\n''') + page.write('''</li>\n''') + page.write('''</ul>\n''') + page.write('''</li>\n''') - page.write('''<br>''') + page.write('''</ul>\n''') + page.write('''</div>\n''') + + page.write('''<br>\n''') return ################################################################ def addFooter(page): - page.write('''<div style="text-align:left" class="rectangle">''') - page.write('''Link to the <a href="logs/DeMoCron.log"> cron job output </a> - Documentation available <a href="https://twiki.cern.ch/twiki/bin/view/Atlas/DataQualityDemo"> here </a> <br>''') - page.write('''Original developer: Benjamin Trocmé (LPSC Grenoble) - Maintenance: Benjamin Trocmé (LPSC Grenoble)''') - page.write('''</div></body>''') - page.write('''<html>''') + page.write('''<div style="text-align:left" class="rectangle">\n''') + page.write('''Link to the <a href="logs/DeMoCron.log"> cron job output </a> - Documentation available <a href="https://twiki.cern.ch/twiki/bin/view/Atlas/DataQualityDemo"> here </a> <br>\n''') + page.write('''Original developer: Benjamin Trocmé (LPSC Grenoble) - Maintenance: Benjamin Trocmé (LPSC Grenoble)\n''') + page.write('''</div></body>\n''') + page.write('''<html>\n''') return ################################################################ def addHeaderWeekly(page): - page.write('''<div style="text-align:left" class="rectangle">''') - page.write('''Considered dataset: <br>''') - page.write('''- all ATLAS-ready runs acquired in the last 7 days <br>''') - page.write('''- all ATLAS-ready runs fully signed off in the last 7 days <br>''') - page.write('''- all runs considered for the upcoming wednesday formal signoff (list available <a href="%s/runlist-weekly.dat" target="_blank"> here </a>)<br>'''%runListDir) - page.write('''Plots updated daily at midnight<br>''') - page.write('''Status meaning (based on UNCHECKED defect status):<br>''') - page.write('''-EXPR. : no assessment yet<br>''') - page.write('''-BULK : express assessment completed<br>''') - page.write('''-DONE : express and bulk assessment completed (but no final signoff - relevant only for LAr)<br>''') - page.write('''-FINAL OK: assessment completed<br>''') - page.write('''The spade symbol after the status indicates that this run is supposed to be signed off at the upcoming DQ wednesday meeting <br>''') - page.write('''</div>''') + page.write('''<div style="text-align:left" class="rectangle">\n''') + page.write('''Considered dataset: <br>\n''') + page.write('''- all ATLAS-ready runs acquired in the last 7 days <br>\n''') + page.write('''- all ATLAS-ready runs fully signed off in the last 7 days <br>\n''') + page.write('''- all runs considered for the upcoming wednesday formal signoff (list available <a href="%s/%s/runlist-weekly.dat" target="_blank"> here </a>)<br>'''%(runListDir,weeklyYear)) + page.write('''Plots updated daily at midnight<br>\n''') + page.write('''Status meaning (based on UNCHECKED defect status):<br>\n''') + page.write('''-EXPR. : no assessment yet<br>\n''') + page.write('''-BULK : express assessment completed<br>\n''') + page.write('''-DONE : express and bulk assessment completed (but no final signoff - relevant only for LAr)<br>\n''') + page.write('''-FINAL OK: assessment completed<br>\n''') + page.write('''The spade symbol after the status indicates that this run is supposed to be signed off at the upcoming DQ wednesday meeting <br>\n''') + page.write('''</div>\n''') return ################################################################ -def addHeaderYearStatsRecap(page,year="",tag="",system=""): - page.write('''<div style="text-align:left" class="rectangle">''') - page.write('''<b>Dataset </b><br>''') +def addHeaderYearStatsRecap(page,year="",tag="",system="",type="YearStats"): + page.write('''<div style="text-align:left" class="rectangle">\n''') + + if (system != ""): + if (type == "YearStats"): + page.write('''<b>%s - %s</b> - Switch to the <a href="%s-recapDefects-%s-%s.html"> defect recap page</a><br>\n'''%(year,run3_yt_description["%s_%s"%(year,tag)],system,year,tag)) + else: + page.write('''<b>%s - %s</b> - Switch to the <a href="%s-YearStats-%s-%s.html"> year stats page</a><br>\n'''%(year,run3_yt_description["%s_%s"%(year,tag)],system,year,tag)) + else: + page.write('''<b>%s - %s</b><br>\n'''%(year,run3_yt_description["%s_%s"%(year,tag)])) if "AtlasReady" in tag: # Year tag named AtlasReady are usually devoted to monitor all runs - page.write('''All runs with ATLAS ready considered <br>''') - page.write(''' Direct link to the <a href="%s/runlist-%s-%s.dat" target="_blank"> list </a> <br>'''%(runListDir,year,tag)) - page.write('''Plots updated daily at midnight <br>''') + page.write('''All runs with ATLAS ready considered.''') if "GRL" in tag: - page.write('''List of runs derived from the <a href="https://twiki.cern.ch/twiki/bin/view/AtlasProtected/GoodRunListsForAnalysisRun3" target="_blank">GRL twiki </a> <br>''') - page.write(''' Direct link to the <a href="%s/runlist-%s-%s.dat" target="_blank"> list </a> <br>'''%(runListDir,year,tag)) - + page.write('''List of runs derived from the <a href="https://twiki.cern.ch/twiki/bin/view/AtlasProtected/GoodRunListsForAnalysisRun3" target="_blank">GRL twiki </a>.''') + page.write('''<br> Direct link to the <a href="%s/%s/runlist-%s-%s.dat" target="_blank"> list. </a> <br>\n'''%(runListDir,year,year,tag)) # Scan the DeMoLib.py file to extract the monitored defects and the database tags DeMoLibFile = open("%s/DeMoLib.py"%libdir,"r") @@ -224,30 +229,36 @@ def addHeaderYearStatsRecap(page,year="",tag="",system=""): if (system != ""): page.write("<hr>") - page.write('''<b>Monitored defects </b><br>''') + page.write('''<b>Monitored defects </b><br>\n''') if len(listOfDefects["globIntol"])>2: - page.write('''<b> Global intolerable defects</b>: %s <br>'''%listOfDefects["globIntol"]) + page.write('''Global intolerable defects: %s <br>'''%listOfDefects["globIntol"]) if len(listOfDefects["partIntol"])>2: - page.write('''<b> Partition intolerable defects</b>: %s <br>'''%listOfDefects["partIntol"]) + page.write('''Partition intolerable defects: %s <br>'''%listOfDefects["partIntol"]) if len(listOfDefects["globTol"])>2: - page.write('''<b> Global tolerable defects </b>: %s <br>'''%listOfDefects["globTol"]) + page.write('''Global tolerable defects : %s <br>'''%listOfDefects["globTol"]) if len(listOfDefects["partTol"])>2: - page.write('''<b> Partition tolerable defects </b>: %s <br>'''%listOfDefects["partTol"]) - - # Add the time of the last reset - if (os.path.exists("YearStats-%s/%s/%s/lastResetYS.dat"%(system,year,tag))): - lastResetFile = open("YearStats-%s/%s/%s/lastResetYS.dat"%(system,year,tag),"r") - for iline in lastResetFile.readlines(): - page.write("<br> <b> Last year-stats reset:</b> %s"%iline) + page.write('''Partition tolerable defects : %s <br>'''%listOfDefects["partTol"]) # Add the database tags - page.write('''<hr><b>Database tags </b><br>''') + page.write('''<b>Database tags </b><br>\n''') yearTagProperties = retrieveYearTagProperties(year,tag) for iyt in yearTagProperties.keys(): if (iyt == "Defect tag") or (iyt == "OflLumi tag") or (iyt == "OflLumiAcct tag"): - page.write('''%s: %s <br>'''%(iyt,yearTagProperties[iyt])) + page.write('''%s: %s <br>\n'''%(iyt,yearTagProperties[iyt])) if (iyt == "Veto tag") and (system == "LAr"): - page.write('''%s: %s <br>'''%(iyt,yearTagProperties[iyt])) + page.write('''%s: %s <br>\n'''%(iyt,yearTagProperties[iyt])) + + if (system != ""): + page.write('''<hr><a href="YearStats-%s/%s/%s/runs-notYetSignedOff.dat" target="_blank"> Runs not yet signed off </a> - \n'''%(system,year,tag)) + if (type == "YearStats"): + page.write('''<a href="YearStats-%s/%s/%s/daemon-grl.out" target="_blank"> daemon output </a> - \n'''%(system,year,tag)) + else: + page.write('''<a href="YearStats-%s/%s/%s/daemon-grl.out" target="_blank"> daemon output </a> - \n'''%(system,year,tag)) + # Add the time of the last reset + if (os.path.exists("YearStats-%s/%s/%s/lastResetYS.dat"%(system,year,tag))): + lastResetFile = open("YearStats-%s/%s/%s/lastResetYS.dat"%(system,year,tag),"r") + for iline in lastResetFile.readlines(): + page.write("Last year-stats reset: %s"%iline) # Look for remaining tokens p = subprocess.Popen("ls",stdout=subprocess.PIPE) @@ -261,22 +272,25 @@ def addHeaderYearStatsRecap(page,year="",tag="",system=""): if "%s-%s.token"%(year,tag) in iLine: remainingToken = remainingToken + "%s<br>"%iLine if remainingToken != "": - page.write('''<hr><b>Remaining tokens</b>''') + page.write('''<hr><b>Remaining tokens</b>\n''') page.write('''<br>There are some remaining tokens in ~atlasdqm/w1/DeMo: %s <br> This may indicate a problem in processing. Please check the daemon ouputs...'''%remainingToken) + if (system == ""): + page.write('''</div>\n''') + else: + page.write("<hr>\n") - page.write('''</div>''') return ################################################################ def addHeaderRun2RecapDefects(page): - page.write('''<div style="text-align:left" class="rectangle">''') - page.write('''Considered dataset: all "stable beam" runs signed off.''') - page.write('''<br><a href='#2018' target='_self'> 2018 dataset </a>''') - page.write('''<br><a href='#2017' target='_self'> 2017 dataset </a>''') - page.write('''<br><a href='#2016' target='_self'> 2016 dataset </a>''') - page.write('''<br><a href='#2015' target='_self'> 2015 dataset </a>''') - page.write('''</div>''') + page.write('''<div style="text-align:left" class="rectangle">\n''') + page.write('''Considered dataset: all "stable beam" runs signed off.\n''') + page.write('''<br><a href='#2018' target='_self'> 2018 dataset </a>\n''') + page.write('''<br><a href='#2017' target='_self'> 2017 dataset </a>\n''') + page.write('''<br><a href='#2016' target='_self'> 2016 dataset </a>\n''') + page.write('''<br><a href='#2015' target='_self'> 2015 dataset </a>\n''') + page.write('''</div>\n''') return ################################################################ @@ -288,10 +302,10 @@ def createRun2LegacyPages(): for iSystem in subsystemName.keys(): if (iSystem not in subsystemNotInRun2): page.write('''<div style="text-align:left" class="rectangle"> <b>%s</b>'''%iSystem) - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/DQPaper_%s/grl-defects.png" alt="" width="750" content="no-cache" /></figure>'''%(iSystem,iYear,iYear)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/DQPaper_%s/grl-defects.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iSystem,iYear,iYear)) if iSystem == "LAr": - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/DQPaper_%s/grl-veto.png" alt="" width="750" content="no-cache" /></figure>'''%(iSystem,iYear,iYear)) - page.write('''</div>''') + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/DQPaper_%s/grl-veto.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iSystem,iYear,iYear)) + page.write('''</div>\n''') addFooter(page) page.close() @@ -301,12 +315,12 @@ def createRun2LegacyPages(): page = open("%s/%s-YearStats-DQPaper_.html"%(maindir,iSystem),"w") addHeader(page,"Run2") for iYear in ["2015","2016","2017","2018"]: - page.write('''<div style="text-align:left" class="rectangle"><b>%s</b>'''%(iYear)) - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-defects.png" alt="" width="750" content="no-cache" /></figure>'''%(iYear,iYear)) + page.write('''<div style="text-align:left" class="rectangle"><b>%s</b>\n'''%(iYear)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-defects.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iYear,iYear)) if iSystem == "LAr": - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-veto.png" alt="" width="750" content="no-cache" /></figure>'''%(iYear,iYear)) - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-lumi.png" alt="" width="750" content="no-cache" /></figure>'''%(iYear,iYear)) - page.write('''</div>''') + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-veto.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iYear,iYear)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-LAr/%s/DQPaper_%s/grl-lumi.png" alt="" width="750" content="no-cache" /></figure>\n'''%(iYear,iYear)) + page.write('''</div>\n''') addFooter(page) page.close() @@ -317,8 +331,8 @@ def createRun2LegacyPages(): addHeader(page,"Run2") addHeaderRun2RecapDefects(page) for iYear in ["2015","2016","2017","2018"]: - page.write('''<hr>''') - page.write('''<a id='%s'> %s dataset </a>'''%(iYear,iYear)) + page.write('''<hr>\n''') + page.write('''<a id='%s'> %s dataset </a>\n'''%(iYear,iYear)) readFile = open("YearStats-%s/%s/DQPaper_%s/recapDefects.html"%(iSystem,iYear,iYear)) for line in readFile: page.write(line) @@ -333,9 +347,9 @@ def createWeeklyOverview(weeklyYear,weeklyTag): for iSystem in subsystemName.keys(): if (iSystem not in subsystemNotInRun3): weekly.write('''<div style="text-align:left" class="rectangle"> <b>%s</b>'''%subsystemName[iSystem]) - weekly.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/summary-0.png" alt="" width="750" content="no-cache"/></figure>'''%(iSystem,weeklyYear,weeklyTag)) - weekly.write('''<a> Link to the <a href="%s-Weekly.html" > weekly plots.</a>'''%(iSystem)) - weekly.write('''</div>''') + weekly.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/summary-0.png" alt="" width="750" content="no-cache"/></figure>\n'''%(iSystem,weeklyYear,weeklyTag)) + weekly.write('''<a> Link to the <a href="%s-Weekly.html" > weekly plots.</a>\n'''%(iSystem)) + weekly.write('''</div>\n''') addFooter(weekly) weekly.close() @@ -344,12 +358,12 @@ def createWeeklySystem(weeklyYear,weeklyTag,system): page = open("%s/%s-Weekly.html"%(maindir,system),"w") addHeader(page,weeklyYear) addHeaderWeekly(page) - page.write('''<div style="text-align:left" class="rectangle"><b>%s</b> - <a href="YearStats-%s/%s/%s/daemon-weekly.out" target="_blank"> Daemon output </a>'''%(subsystemName[system],system,weeklyYear,weeklyTag)) - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/defects--Run--%s.png" alt="" width="750" content="no-cache" /></figure>'''%(system,weeklyYear,weeklyTag,weeklyTag)) + page.write('''<div style="text-align:left" class="rectangle"><b>%s</b> - <a href="YearStats-%s/%s/%s/daemon-weekly.out" target="_blank"> Daemon output </a>\n'''%(subsystemName[system],system,weeklyYear,weeklyTag)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/defects--Run--%s.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag,weeklyTag)) if system == "LAr" : - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/veto--Run--%s.png" alt="" width="750" content="no-cache" /></figure>'''%(system,weeklyYear,weeklyTag,weeklyTag)) - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/noiseBurst_veto_evol.png" alt="" width="750" content="no-cache" /></figure>'''%(system,weeklyYear,weeklyTag)) - page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/summary-0.png" alt="" width="750" content="no-cache" /></figure>'''%(system,weeklyYear,weeklyTag)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/veto--Run--%s.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag,weeklyTag)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/noiseBurst_veto_evol.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag)) + page.write('''<figure> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/Weekly/summary-0.png" alt="" width="750" content="no-cache" /></figure>\n'''%(system,weeklyYear,weeklyTag)) addFooter(page) page.close() @@ -358,13 +372,13 @@ def createYearStatsSystem(year,tag,system): yearTag = "%s_%s"%(year,tag) page = open("%s/%s-YearStats-%s-%s.html"%(maindir,system,year,tag),"w") addHeader(page,year) - addHeaderYearStatsRecap(page,year,tag,system) - page.write('''<div style="text-align:left" class="rectangle"><b>%s - %s</b> - <a href="YearStats-%s/%s/%s/daemon-grl.out" target="_blank"> daemon output </a> - <a href="YearStats-%s/%s/%s/runs-notYetSignedOff.dat" target="_blank"> Runs not yet signed off </a> - Switch to the <a href="%s-recapDefects-%s-%s.html"> defect recap page</a> </div>'''%(year,run3_yt_description[tag],system,year,tag,system,year,tag,system,year,tag)) - page.write('''<div style="text-align:left" class="rectangle"><figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" alt="" width="750" content="no-cache" /> </a></figure>'''%(system,year,tag,system,year,tag)) + addHeaderYearStatsRecap(page,year,tag,system,"YearStats") + page.write('''<div style="text-align:left" class="rectangle"><figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" alt="" width="750" content="no-cache" /> </a></figure>\n'''%(system,year,tag,system,year,tag)) if system == "LAr" : - page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-veto.png" target="_blank"><img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-veto.png" alt="" width="750" content="no-cache" /></a></figure>'''%(system,year,tag,system,year,tag)) - page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-lumi.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-lumi.png" alt="" width="750" content="no-cache" /></a></figure>'''%(system,year,tag,system,year,tag)) - page.write('''</div>''') + page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-veto.png" target="_blank"><img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-veto.png" alt="" width="750" content="no-cache" /></a></figure>\n'''%(system,year,tag,system,year,tag)) + page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-lumi.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-lumi.png" alt="" width="750" content="no-cache" /></a></figure>\n'''%(system,year,tag,system,year,tag)) + page.write('''</div>\n''') + page.write('''</div>\n''') addFooter(page) page.close() @@ -375,17 +389,18 @@ def createYearStatsOverview(year,tag): addHeader(page,year) addHeaderYearStatsRecap(page,year,tag) - page.write('''<div style="text-align:left" class="rectangle"> <b>ATLAS </b> (beta - still under test)<br>''') - page.write('''Within each system, the overlaps between defects are treated.<br>''') - page.write('''For the ATLAS inefficiency, the overlaps between systems are treated.<br>''') - page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-Global/%s/%s/DataLoss.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-Global/%s/%s/DataLoss.png" alt="" width="750" content="no-cache" /></figure> </a>'''%(year,tag,year,tag)) - page.write('''</div>''') + page.write('''<div style="text-align:left" class="rectangle"> <b>ATLAS </b><br>\n''') + page.write('''Within each system, the overlaps between defects are treated.<br>\n''') + page.write('''For the ATLAS inefficiency, the overlaps between systems are treated.<br>\n''') + page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-Global/%s/%s/DataLoss.png" target="_blank"> <img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-Global/%s/%s/DataLoss.png" alt="" width="750" content="no-cache" /></figure> </a>\n'''%(year,tag,year,tag)) + page.write('''</div>\n''') for iSystem in subsystemName.keys(): if (iSystem not in subsystemNotInRun3): page.write('''<div style="text-align:left" class="rectangle"> <b>%s</b>'''%subsystemName[iSystem]) - page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" target="_blank"><img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" alt="" width="750" content="no-cache" /></a></figure>'''%(iSystem,year,tag,iSystem,year,tag)) - page.write('''</div>''') + page.write('''<figure> <a href="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" target="_blank"><img src="https://atlasdqm.web.cern.ch/atlasdqm/DeMo/YearStats-%s/%s/%s/grl-defects.png" alt="" width="750" content="no-cache" /></a></figure>\n'''%(iSystem,year,tag,iSystem,year,tag)) + page.write('''</div>\n''') + addFooter(page) page.close() @@ -394,14 +409,15 @@ def createDefectRecapSystem(year,tag,system): yearTag = "%s_%s"%(year,tag) page = open("%s/%s-recapDefects-%s-%s.html"%(maindir,system,year,tag),"w") addHeader(page,year) - addHeaderYearStatsRecap(page,year,tag,system) - page.write('''<div style="text-align:left" class="rectangle"><b>%s - %s</b> - <a href="YearStats-%s/%s/%s/daemon-recapDefects.out" target="_blank"> daemon output </a> - <a href="YearStats-%s/%s/%s/runs-notYetSignedOff.dat" target="_blank"> Runs not yet signed off </a> - Switch to the <a href="%s-YearStats-%s-%s.html"> year stats page</a> </div>'''%(year,run3_yt_description[tag],system,year,tag,system,year,tag,system,year,tag)) + addHeaderYearStatsRecap(page,year,tag,system,"Recap") + #page.write('''<div style="text-align:left" class="rectangle"><b>%s - %s</b> - <a href="YearStats-%s/%s/%s/daemon-recapDefects.out" target="_blank"> daemon output </a> - <a href="YearStats-%s/%s/%s/runs-notYetSignedOff.dat" target="_blank"> Runs not yet signed off </a> - Switch to the <a href="%s-YearStats-%s-%s.html"> year stats page</a> </div>\n'''%(year,run3_yt_description[tag],system,year,tag,system,year,tag,system,year,tag)) if (os.path.exists("YearStats-%s/%s/%s/recapDefects.html"%(system,year,tag))): readFile = open("YearStats-%s/%s/%s/recapDefects.html"%(system,year,tag)) for line in readFile: # NB: the recapDefects.html files contain a single line for the whole table. page.write(addLink(line)) + page.write('''</div>\n''') addFooter(page) page.close() @@ -447,8 +463,10 @@ def createDefectRecapHighlights(year,tag): else: runHighlights[runFound][iSystem] = "<th>%s </th><th>%s : %s</th>"%(iovLine[3],currentDefect,addLink(iovLine[7])) - page.write('''<table class="report"><tr class="out0intolerable"> <th width="100pix"></th><th width="100pix"></th><th width="100pix"></th><th width="150pix"></th><th width="100pix"></th></th><th width="1200pix"></th></tr>''') - page.write('''<tr class="out0"><th> Run </th><th> Period </th> <th> Total lumi </th><th> Affected system </th> <th> Lost lumi </th> <th> Comment </th> </tr> ''') + page.write('''<div style="text-align:left" class="rectangle">''') + + page.write('''<table class="report"><tr class="out0"> <th width="100pix"></th><th width="100pix"></th><th width="100pix"></th><th width="150pix"></th><th width="100pix"></th></th><th width="1200pix"></th></tr>\n''') + page.write('''<tr class="out0"><th> Run </th><th> Period </th> <th> Total lumi </th><th> Affected system </th> <th> Lost lumi </th> <th> Comment </th> </tr> \n''') listOfRuns = list(runHighlights.keys()) listOfRuns.sort(reverse=True) @@ -459,14 +477,15 @@ def createDefectRecapHighlights(year,tag): if iSystem == "TotLumi": continue if newRun: - page.write('''<tr class="out1"><th> %s </th> <th> %s </th> <th> %s </th> <th> %s </th> %s </tr> </tr>'''%(iRun,returnPeriod(int(iRun),"Pixel",year,"AtlasReady"),runHighlights[iRun]["TotLumi"],iSystem,runHighlights[iRun][iSystem])) + page.write('''<tr class="out1"><th> %s </th> <th> %s </th> <th> %s </th> <th> %s </th> %s </tr> </tr>\n'''%(iRun,returnPeriod(int(iRun),"Pixel",year,"AtlasReady"),runHighlights[iRun]["TotLumi"],iSystem,runHighlights[iRun][iSystem])) newRun = False else: - page.write('''<tr class="out1"><th> </th> <th> </th> <th> </th> <th> %s </th> %s </tr></tr>'''%(iSystem,runHighlights[iRun][iSystem])) + page.write('''<tr class="out1"><th> </th> <th> </th> <th> </th> <th> %s </th> %s </tr></tr>\n'''%(iSystem,runHighlights[iRun][iSystem])) - page.write('''</table>''') + page.write('''</table>\n''') + page.write('''</div>''') addFooter(page) page.close() @@ -476,7 +495,7 @@ def createDefectRecapHighlights(year,tag): # Main script parser = argparse.ArgumentParser(description='') -parser.add_argument('-y','--year',dest='parser_year',default = "2022",help='Year: Run2, 2022,2023...[Default: 2022].',action='store') +parser.add_argument('-y','--year',dest='parser_year',default = "2023",help='Year: Run2, 2022,2023...[Default: 2023].',action='store') args = parser.parse_args() parser.print_help() @@ -485,11 +504,12 @@ year = args.parser_year # run3_yt_description is retrieved from the DeMoConfig.dat file run3_yt_description = {} -for iTag in run3_yt[year]: - DeMoConfigFile = open("%s/DeMoConfig-%s-%s.dat"%(runListDir,year,iTag),"r") - for iline in DeMoConfigFile: - if "Description: " in iline: - run3_yt_description[iTag] = iline.split("Description: ")[1] +for iYear in run3_yt.keys(): + for iTag in run3_yt[iYear]: + DeMoConfigFile = open("%s/%s/DeMoConfig-%s-%s.dat"%(runListDir,iYear,iYear,iTag),"r") + for iline in DeMoConfigFile: + if "Description: " in iline: + run3_yt_description["%s_%s"%(iYear,iTag)] = (iline.split("Description: ")[1]).replace("\n","") homepage = open("%s/index-%s.html"%(maindir,year),"w") addHeader(homepage,year) diff --git a/DataQuality/DataQualityUtils/scripts/DeMoLib.py b/DataQuality/DataQualityUtils/scripts/DeMoLib.py index f1938038f85251b17bf5f3a228d5024509b5ca54..14fe6cedd4643bff88d89fc6cd4539b2e4e3c9cf 100644 --- a/DataQuality/DataQualityUtils/scripts/DeMoLib.py +++ b/DataQuality/DataQualityUtils/scripts/DeMoLib.py @@ -64,10 +64,10 @@ def returnPeriod(runNb,system,year,tag): ######################################################################## # Return the year/tag properties (defect/veto/lumi tags...) stored in -# YearStats-commonDeMoConfig-[year]-[tag].dat +# YearStats-common/DeMoConfig-[year]-[tag].dat def retrieveYearTagProperties(year,tag): ytp = {"Description":"","Defect tag":"","Veto tag":"","OflLumi tag":"","OflLumiAcct tag":""} - DeMoConfigFile = open("YearStats-common/DeMoConfig-%s-%s.dat"%(year,tag),"r") + DeMoConfigFile = open("YearStats-common/%s/DeMoConfig-%s-%s.dat"%(year,year,tag),"r") for line in DeMoConfigFile: for i_ytp in ytp.keys(): if ("%s: "%i_ytp in line): @@ -76,7 +76,7 @@ def retrieveYearTagProperties(year,tag): for i_ytp in ytp.keys(): if (ytp[i_ytp] == ""): - print("ERROR: Missing (%s) in YearStats-common/DeMoConfig-%s-%s.dat -> Please check or define it with DeMoSetup.py"%(i_ytp,year,tag)) + print("ERROR: Missing (%s) in YearStats-common/%s/DeMoConfig-%s-%s.dat -> Please check or define it with DeMoSetup.py"%(i_ytp,year,year,tag)) return ytp @@ -938,6 +938,42 @@ def initializeMonitoredDefects(system,partitions,defects0,defectVeto,veto,signOf signOff["BULK"] = [] signOff["FINAL"] = [] +#################################### AFP defects + if system == "AFP": + partitions["color"] = {'C':kYellow-9,'A':kYellow,'C_FAR':kOrange,'C_NEAR':kOrange-3,'A_FAR':kRed-3,'A_NEAR':kBlue-3} + partitions["list"] = partitions["color"].keys() + + defects0["prefix"] = ["AFP"] + # Partition intolerable and tolerable defects - Order determines what defect is proeminent + # Warning : do not remove/edit the comment specifying the system. It is used to display the defects in the webpage + defects0["partIntol"] = ["TOF_NOT_OPERATIONAL_HV","TOF_NOT_OPERATIONAL_LV","TOF_WRONG_CABLING","TOF_WRONG_TIMING","TOF_TRIGGER_PROBLEM","SIT_NOT_OPERATIONAL_HV","SIT_NOT_OPERATIONAL_LV","SIT_NOT_OPERATIONAL","SIT_WRONG_TIMING","IN_GARAGE"] # AFP system + defects0["partTol"] = [] # AFP system + # Global intolerable and tolerable defects + # Warning : do not remove/edit the comment specifying the system. It is used to display the defects in the webpage + defects0["globIntol"] = ["WRONG_MAPPING","ERROR"] # AFP system + defects0["globTol"] = [] # AFP system + + veto["all"] = [] # Veto name as defined in the COOL database + veto["COOL"] = {} # Veto name as defined in the COOL database + + defectVeto["description"] = {"TOF_NOT_OPERATIONAL_HV":"[ToF] Non-nominal HV", + "TOF_NOT_OPERATIONAL_LV":"[ToF] Non-operational LV", + "TOF_WRONG_CABLING":"[ToF] Wrong cabling", + "TOF_WRONG_TIMING":"[ToF] Wrong timing", + "TOF_TRIGGER_PROBLEM":"[ToF] Trigger problem", + "SIT_NOT_OPERATIONAL_HV":"[SiT] < 3 planes at nominal HV", + "SIT_NOT_OPERATIONAL_LV":"[SiT] < 3 planes available (LV)", + "SIT_NOT_OPERATIONAL":"[SiT] < 3 SiT planes available", + "SIT_WRONG_TIMING":"[SiT] Wrong timing", + "IN_GARAGE":">= 1 RP in the garage or moving", + "WRONG_MAPPING":"[ToF] Wrong mapping", + "ERROR":"Unknown problem"} + + signOff["EXPR."] = ["AFP_UNCHECKED"] + signOff["BULK"] = ["AFP_BULK_UNCHECKED"] + signOff["FINAL"] = [] + + ################################# ZDC defects if system == "ZDC": partitions["color"] = {} diff --git a/DataQuality/DataQualityUtils/scripts/DeMoSetup.py b/DataQuality/DataQualityUtils/scripts/DeMoSetup.py index deee6bd694468a6a6487e4eb99716d36d9d5f3b7..b637f73e6ec38f93901a098cd3db1a012b8d13d2 100644 --- a/DataQuality/DataQualityUtils/scripts/DeMoSetup.py +++ b/DataQuality/DataQualityUtils/scripts/DeMoSetup.py @@ -20,7 +20,7 @@ runListDir = "./YearStats-common" parser = argparse.ArgumentParser(description='') parser.add_argument('-y','--year',dest='parser_year',default = "2023",help='Year [Default: 2023].',action='store') parser.add_argument('-t','--tag',dest='parser_tag',help='DeMo tag',action='store') -parser.add_argument('-s','--system',dest='parser_system',default="",help='System: LAr, CaloCP... [Default : all systems : LAr,Pixel,SCT,TRT,Tile,MDT,TGC,RPC,Trig_L1,Trig_HLT,Lumi,Global,ALFA,LUCID,ZDC,IDGlobal,BTag,CaloCP,MuonCP]',action='store') +parser.add_argument('-s','--system',dest='parser_system',default="",help='System: LAr, CaloCP... [Default : all systems : LAr,Pixel,SCT,TRT,Tile,MDT,TGC,RPC,Trig_L1,Trig_HLT,Lumi,Global,ALFA,AFP,LUCID,ZDC,IDGlobal,BTag,CaloCP,MuonCP]',action='store') parser.add_argument('--description',dest='parser_description',default = "",help='Short description for DeMo plots',action='store') parser.add_argument('--defectTag',dest='parser_defectTag',default = "",help='Defect tag',action='store') parser.add_argument('--vetoTag',dest='parser_vetoTag',default = "",help='Veto tag (relevant only for LAr)',action='store') @@ -33,13 +33,13 @@ parser.print_help() systems = [] if args.parser_system == "": - systems = ["LAr","Pixel","SCT","TRT","Tile","MDT","TGC","RPC","Trig_L1","Trig_HLT","Lumi","Global","ALFA","LUCID","ZDC","IDGlobal","BTag","CaloCP","MuonCP"] + systems = ["LAr","Pixel","SCT","TRT","Tile","MDT","TGC","RPC","Trig_L1","Trig_HLT","Lumi","Global","ALFA","AFP","LUCID","ZDC","IDGlobal","BTag","CaloCP","MuonCP"] else: systems.append(args.parser_system) b_createDeMoConfig = True -configFilename = "%s/DeMoConfig-%s-%s.dat"%(runListDir,args.parser_year,args.parser_tag) +configFilename = "%s/%s/DeMoConfig-%s-%s.dat"%(runListDir,args.parser_year,args.parser_year,args.parser_tag) if os.path.exists(configFilename): print("Warning: this year/tag apparently already exists. As the database tags must be uniform among systems, I will keep the already defined tags:") os.system("cat %s"%configFilename) @@ -128,7 +128,7 @@ for iSystem in systems: # When requested, generation of run list print("=========== Treatment of run list") -newRunListName = "%s/runlist-%s-%s.dat"%(runListDir,args.parser_year,args.parser_tag) +newRunListName = "%s/%s/runlist-%s-%s.dat"%(runListDir,args.parser_year,args.parser_year,args.parser_tag) if args.parser_xmlGRL != "": if "https" in args.parser_xmlGRL: diff --git a/DataQuality/DataQualityUtils/scripts/DeMoUpdate.py b/DataQuality/DataQualityUtils/scripts/DeMoUpdate.py index 8b6cd37e1eec3130cd8a0d2b5aff305a90714f85..d5320669f8bdcfdf77735885e496fe9f6b6e8f00 100644 --- a/DataQuality/DataQualityUtils/scripts/DeMoUpdate.py +++ b/DataQuality/DataQualityUtils/scripts/DeMoUpdate.py @@ -229,6 +229,21 @@ def extractNamePartition(foundDefect): defectSplitted = foundDefect.split("_",1) if len(defectSplitted) > 1: defectName=defectSplitted[1] + elif (foundDefect.startswith("AFP")): # AFP_[NAME] or AFP_[PART]_[NAME] + if ("_A_" in foundDefect or "_C_" in foundDefect): #AFP_[PART]_[NAME] + defectSplitted = foundDefect.split("_",2) + if len(defectSplitted) > 2: + defectName=defectSplitted[2] + defectPart=defectSplitted[1] + if ("_A_NEAR_" in foundDefect or "_C_NEAR_" in foundDefect or "_A_FAR_" in foundDefect or "_C_FAR_" in foundDefect): #AFP_[PART]_[NEAR/FAR]_[NAME] + defectSplitted = foundDefect.split("_",3) + if len(defectSplitted) > 3: + defectName=defectSplitted[3] + defectPart="%s_%s"%(defectSplitted[1],defectSplitted[2]) + else: + defectSplitted = foundDefect.split("_",1) + if len(defectSplitted) > 1: + defectName=defectSplitted[1] elif (foundDefect.startswith("LCD")): # LCD_[NAME] defectSplitted = foundDefect.split("_",1) if len(defectSplitted) > 1: @@ -276,7 +291,7 @@ def updateRunList(year=time.localtime().tm_year): fileRuns.append(r) print("Adding the ATLAS ready run: %s"%r) outfile.write("%s\n"%r) - allRunListDat = "%s/runlist-%s-AtlasReady.dat"%(runListDir,str(year)) + allRunListDat = "%s/%s/runlist-%s-AtlasReady.dat"%(runListDir,str(year),str(year)) if os.path.isfile(allRunListDat): fRunList = open(allRunListDat,'r+') fileRuns = [l.strip() for l in fRunList.readlines() ] @@ -456,7 +471,7 @@ if len(options['runRange']) == 2: # Run range # runlist['primary'] contains all runs extracted from the runList convoluted with the run range (if any was defined - not mandatory - Deactivated for weeklyReport) # runlist['toprocess'] is derived from the primary list. Some runs may be removed depending on the options (skipAlreadyUpdated) and also for the weekly report (see below) # runlist['toprocess'] contains all run that will be processed and that will be displayed in the final table / plots -runListFilename = "%s/%s"%(runListDir,runlist['filename']) +runListFilename = "%s/%s/%s"%(runListDir,options['year'],runlist['filename']) if os.path.exists(runListFilename): fRunList = open(runListFilename,'r') for iRun in fRunList.readlines(): @@ -471,7 +486,7 @@ if (len(runlist['primary']) == 0): print("No run found -> Exiting") sys.exit() -roughVetoFilename = runListDir+"/%s/roughVeto-%s.dat"%(options['system'],options['year']) +roughVetoFilename = runListDir+"/%s/%s/roughVeto-%s.dat"%(options['system'],options['year'],options['year']) if os.path.exists(roughVetoFilename): fRoughVeto = open(roughVetoFilename,'r') for iRun in fRoughVeto.readlines(): @@ -567,8 +582,8 @@ if options['weekly']: # Weekly report - Look for the last 7-days runs + the sign elif (time.time()-runinfo[run]["Run start"] < oneWeek): print("Run",run,"was acquired during the last seven days") runlist['toprocess'].append(run) - if (os.path.exists("%s/runlist-weekly.dat")%runListDir): - weeklyFile = open("%s/runlist-weekly.dat"%runListDir,'r') + if (os.path.exists("%s/%s/runlist-weekly.dat"%(runListDir,options['year']))): + weeklyFile = open("%s/%s/runlist-weekly.dat"%(runListDir,options['year']),'r') print("I found a runlist-weekly.dat file and will add some runs...") for iRun in weeklyFile.readlines(): if runlist['weekly-dqmeeting'] == "": # The first line of the weekly file contains the date of the DQ meeting @@ -608,6 +623,13 @@ for p in allperiods: else: periodListCurrent[p].append(run) +if (len(allperiods) == 0 and options['updateYearStats']): + print("No period available yet for the runs to process") + print("I am exiting...") + if options['updateYearStats']: + os.system("rm -f %s"%tokenName) + sys.exit() + for irun in runinfo.keys(): runinfo[irun]['newInYearStats'] = False @@ -813,15 +835,19 @@ for irun,runNb in enumerate(runlist['toprocess']): defectDatabase = DQDefects.DefectsDB(tag=options['defectTag']) # Treatement of global filter globalFilterLB = [] + runinfo[runNb]['globalFilter'] = False + runinfo["AllRuns"]['globalFilter'] = False if not options['noGlobalFilter']: retrievedDefects = defectDatabase.retrieve((runNb, 1), (runNb, runinfo[runNb]['nLB']), grlDef["globalFilterDefects"]) for iRetrievedDefects in retrievedDefects: if (iRetrievedDefects.until.lumi > 4000000000): # The GLOBAL_NOTCONSIDERED defect is apparently set by default with a huge end of IOV. + # A priori, it should not survive the 48 hours calibration loop but anyway, In such a case, no filter is applied. # BT October 2022 : this protection should be obsolete with the change of run 2 lines above. To be confirmed - if (time.time()-v_lbTimeSt[len(v_lbTimeSt)][1]) > 48*3600: # During 48 hours after the end of run, the global filter is deactived to display all recent runs - for lb in range(iRetrievedDefects.since.lumi,runinfo[runNb]['nLB']+1): - globalFilterLB.append(lb) +# if (time.time()-v_lbTimeSt[len(v_lbTimeSt)][1]) > 48*3600: # During 48 hours after the end of run, the global filter is deactived to display all recent runs +# for lb in range(iRetrievedDefects.since.lumi,runinfo[runNb]['nLB']+1): +# globalFilterLB.append(lb) + continue else: for lb in range(iRetrievedDefects.since.lumi,iRetrievedDefects.until.lumi): globalFilterLB.append(lb) @@ -833,6 +859,9 @@ for irun,runNb in enumerate(runlist['toprocess']): for lb in list(atlasready.keys()): if (atlasready[lb]>0): runinfo[runNb]['readyLB']+=[lb] if (atlasready[lb]>0) and (lb not in globalFilterLB): runinfo[runNb]['readyLB_globalFilter']+=[lb] + if (lb in globalFilterLB): + runinfo[runNb]['globalFilter'] = True + runinfo["AllRuns"]['globalFilter'] = True runinfo[runNb]['nLBready'] = float(len(runinfo[runNb]['readyLB_globalFilter'])) thisRunPerLB = dict() # Contains various per LB run characteristics retrieved from COOL @@ -1093,7 +1122,7 @@ if (runinfo['AllRuns']['Lumi']!=0): c1[canvasIndex] = TCanvas("runSummary_%s"%canvasIndex,"Run collection - %s"%canvasIndex,10,10,1000,(len(runlist['toprocess'])+6)*22) column[canvasIndex] = [] lineNb[canvasIndex] = 0 - labels_col = ["Run","Run start / stop","LB ready","Peak lumi","Int. lumi","GRL ineff.","Veto ineff.","Period","Status"] + labels_col = ["Run","Run start / stop","LB ready","Peak lumi","Filt. lumi","GRL ineff.","Veto ineff.","Period","Status"] xlow_col = [0.01,0.075,0.405,0.485,0.57,0.65,0.735,0.83,0.89,0.99] ylowTable = 0.99 - 0.98/(len(runlist['toprocess'])+6)*(len(runlist['toprocess'])+2) @@ -1107,6 +1136,8 @@ if (runinfo['AllRuns']['Lumi']!=0): notYetSignedOff_TPave = TPaveText(xlow_col[0],0.01,xlow_col[len(labels_col)],ylowTable) if runlist['weekly-dqmeeting'] != "": notYetSignedOff_TPave.AddText("#club: runs to be signed off at %s"%runlist['weekly-dqmeeting']) + if runinfo['AllRuns']['globalFilter'] != "": + notYetSignedOff_TPave.AddText("#diamond: runs for which a global filter has been applied (for more information, look at the Global system)") notYetSignedOff_TPave.AddText("Completed at %s"%(time.strftime("%H:%M (%d %b)", time.localtime()))) notYetSignedOff_TPave.SetFillColor(kAzure+2) @@ -1118,7 +1149,10 @@ if (runinfo['AllRuns']['Lumi']!=0): column[canvasIndex][1].AddText("%s / %s"%(runinfo[runNb]['Start'],runinfo[runNb]['Stop'])) column[canvasIndex][2].AddText("%s"%(listify(runinfo[runNb]["readyLB"]))) column[canvasIndex][3].AddText("%.1e"%(runinfo[runNb]['peakLumi']*1e30)) - column[canvasIndex][4].AddText("%s"%(strLumi(runinfo[runNb]['Lumi']))) + if (runinfo[runNb]['globalFilter']): + column[canvasIndex][4].AddText("%s #diamond"%(strLumi(runinfo[runNb]['Lumi']))) + else: + column[canvasIndex][4].AddText("%s"%(strLumi(runinfo[runNb]['Lumi']))) column[canvasIndex][5].AddText("%.2f %%"%(runinfo[runNb]['ineffDefect_allIntol'])) column[canvasIndex][6].AddText("%.2f %%"%(runinfo[runNb]['ineffVeto_allVeto'])) column[canvasIndex][7].AddText("%s"%(runinfo[runNb]["period"])) @@ -1173,9 +1207,9 @@ gStyle.SetOptStat(0) if options['plotResults']: gStyle.SetHistMinimumZero() - plotStack("defects--Run--%s"%(yearTagProperties["Description"]),hProfRun_IntolDefect,grlDef["intol"],defectVeto["description"],h1Run_IntLuminosity,False,stackResults,canvasResults,legendResults) + plotStack("defects--Run--%s"%(options['tag']),hProfRun_IntolDefect,grlDef["intol"],defectVeto["description"],h1Run_IntLuminosity,False,stackResults,canvasResults,legendResults) if (len(veto["all"])): - plotStack("veto--Run--%s"%(yearTagProperties["Description"]),hProfRun_Veto,veto["all"],defectVeto["description"],h1Run_IntLuminosity,False,stackResults,canvasResults,legendResults) + plotStack("veto--Run--%s"%(options['tag']),hProfRun_Veto,veto["all"],defectVeto["description"],h1Run_IntLuminosity,False,stackResults,canvasResults,legendResults) if options['vetoLumiEvolution']: for iVeto in veto["all"]: diff --git a/Database/APR/APRTests/share/StorageSvc_AuxStore_test.ref b/Database/APR/APRTests/share/StorageSvc_AuxStore_test.ref index 1910090f33fd56d0cd3d405004fc9f16710ec125..455979fe03b9d46f4715293783f837683bbd833c 100644 --- a/Database/APR/APRTests/share/StorageSvc_AuxStore_test.ref +++ b/Database/APR/APRTests/share/StorageSvc_AuxStore_test.ref @@ -1,11 +1,5 @@ -Initializing Gaudi ApplicationMgr using job opts ../share/ -ApplicationMgr SUCCESS -==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v36r9) - running on aibuild16-024.cern.ch on Tue Dec 20 10:34:47 2022 -==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. @@ -17,12 +11,7 @@ Loading library test_StorageSvc_AuxStoreDict [OVAL] Testing the writing operations createStorageSvc startSession -DbSession INFO Open DbSession -Domain[ROOT_All] INFO > Access DbDomain CREATE [ROOT_All] Session connect -Domain[ROOT_All] INFO -> Access DbDatabase CREATE [ROOT_All] 77331FE0-160F-A15E-904D-1AA331AFB134 -Domain[ROOT_All] INFO pool_test.root -RootDatabase.open INFO pool_test.root File version:62608 Creating objects Creating Shape StorageSvc INFO Building shape according to reflection information using shape ID for: @@ -41,124 +30,12 @@ Committing transaction Committing transaction Deleting written data objects Disconnecting StorageSvc -pool_test.root INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase CREATE [ROOT_All] 77331FE0-160F-A15E-904D-1AA331AFB134 Ending Session -Domain[ROOT_All] INFO > Deaccess DbDomain CREATE [ROOT_All] Releasing StorageSvc [OVAL] ...done [OVAL] Testing the reading operations -DbSession INFO Open DbSession -Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] -Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 77331FE0-160F-A15E-904D-1AA331AFB134 -Domain[ROOT_All] INFO pool_test.root -RootDatabase.open INFO pool_test.root File version:62608 -TBranchAuxDynRe... INFO RootAuxDynIO/src/TBranchAuxDynReader.cxx:266 (FUNC): attribute withdict (id=14 typename=PN7APRTest14AClassWithDictE) has different type than the branch vector<APRTest::AClassWithDict*> Attempting schema evolution. -0: 0 : 0 : withdict[0]= 0x5024eb0 v=0 -1: 1 : 2 : withdict[1]= 0x518c420 v=0 -2: 2 : 4 : withdict[2]= 0x5703bb0 v=0 -3: 3 : 6 : withdict[3]= 0x5851310 v=0 -4: 4 : 8 : withdict[4]= 0x59cb480 v=0 -5: 5 : 10 : withdict[5]= 0x52ab630 v=0 -6: 6 : 12 : withdict[6]= 0x27b6270 v=0 -7: 7 : 14 : withdict[7]= 0x56b8da0 v=0 -8: 8 : 16 : withdict[8]= 0x56b6f30 v=0 -9: 9 : 18 : withdict[9]= 0x59c87a0 v=0 -0: 1000 : 5000 : withdict[0]= 0x59d1840 v=1 -1: 1001 : 5002 : withdict[1]= 0x56add90 v=1 -2: 1002 : 5004 : withdict[2]= 0x52f8850 v=1 -3: 1003 : 5006 : withdict[3]= 0x59c8860 v=1 -4: 1004 : 5008 : withdict[4]= 0x5987710 v=1 -5: 1005 : 5010 : withdict[5]= 0x56b5130 v=1 -6: 1006 : 5012 : withdict[6]= 0x58a0c40 v=1 -7: 1007 : 5014 : withdict[7]= 0x59b8f00 v=1 -8: 1008 : 5016 : withdict[8]= 0x37a1a30 v=1 -9: 1009 : 5018 : withdict[9]= 0x56a9e30 v=1 -0: 2000 : 10000 : withdict[0]= 0x59890f0 v=2 -1: 2001 : 10002 : withdict[1]= 0x4708a50 v=2 -2: 2002 : 10004 : withdict[2]= 0x50c1ea0 v=2 -3: 2003 : 10006 : withdict[3]= 0x520dce0 v=2 -4: 2004 : 10008 : withdict[4]= 0x59ce830 v=2 -5: 2005 : 10010 : withdict[5]= 0x50cfbb0 v=2 -6: 2006 : 10012 : withdict[6]= 0x5994460 v=2 -7: 2007 : 10014 : withdict[7]= 0x5997390 v=2 -8: 2008 : 10016 : withdict[8]= 0x5993550 v=2 -9: 2009 : 10018 : withdict[9]= 0x570f990 v=2 -0: 3000 : 15000 : withdict[0]= 0x58f5fc0 v=3 -1: 3001 : 15002 : withdict[1]= 0x56e9be0 v=3 -2: 3002 : 15004 : withdict[2]= 0x58f6230 v=3 -3: 3003 : 15006 : withdict[3]= 0x57fcf90 v=3 -4: 3004 : 15008 : withdict[4]= 0x59db580 v=3 -5: 3005 : 15010 : withdict[5]= 0x2863540 v=3 -6: 3006 : 15012 : withdict[6]= 0x5005e40 v=3 -7: 3007 : 15014 : withdict[7]= 0x57cfb70 v=3 -8: 3008 : 15016 : withdict[8]= 0x5675ed0 v=3 -9: 3009 : 15018 : withdict[9]= 0x58b2d60 v=3 -0: 4000 : 20000 : withdict[0]= 0x51aa0f0 v=4 -1: 4001 : 20002 : withdict[1]= 0x587b310 v=4 -2: 4002 : 20004 : withdict[2]= 0x59902c0 v=4 -3: 4003 : 20006 : withdict[3]= 0x59b9550 v=4 -4: 4004 : 20008 : withdict[4]= 0x59972c0 v=4 -5: 4005 : 20010 : withdict[5]= 0x58b76c0 v=4 -6: 4006 : 20012 : withdict[6]= 0x57e3eb0 v=4 -7: 4007 : 20014 : withdict[7]= 0x59aff20 v=4 -8: 4008 : 20016 : withdict[8]= 0x58f79b0 v=4 -9: 4009 : 20018 : withdict[9]= 0x43310b0 v=4 -0: 5000 : 25000 : withdict[0]= 0x58c8ab0 v=5 -1: 5001 : 25002 : withdict[1]= 0x58c6f00 v=5 -2: 5002 : 25004 : withdict[2]= 0x59d5e80 v=5 -3: 5003 : 25006 : withdict[3]= 0x286ae80 v=5 -4: 5004 : 25008 : withdict[4]= 0x58b5730 v=5 -5: 5005 : 25010 : withdict[5]= 0x57daba0 v=5 -6: 5006 : 25012 : withdict[6]= 0x51d2c00 v=5 -7: 5007 : 25014 : withdict[7]= 0x46acbd0 v=5 -8: 5008 : 25016 : withdict[8]= 0x52519a0 v=5 -9: 5009 : 25018 : withdict[9]= 0x520dc80 v=5 -0: 6000 : 30000 : withdict[0]= 0x52d28d0 v=6 -1: 6001 : 30002 : withdict[1]= 0x533a500 v=6 -2: 6002 : 30004 : withdict[2]= 0x59de0f0 v=6 -3: 6003 : 30006 : withdict[3]= 0x5215f50 v=6 -4: 6004 : 30008 : withdict[4]= 0x59e0ad0 v=6 -5: 6005 : 30010 : withdict[5]= 0x570f310 v=6 -6: 6006 : 30012 : withdict[6]= 0x46bec10 v=6 -7: 6007 : 30014 : withdict[7]= 0x59ac810 v=6 -8: 6008 : 30016 : withdict[8]= 0x5997570 v=6 -9: 6009 : 30018 : withdict[9]= 0x4727e90 v=6 -0: 7000 : 35000 : withdict[0]= 0x59a78e0 v=7 -1: 7001 : 35002 : withdict[1]= 0x5199170 v=7 -2: 7002 : 35004 : withdict[2]= 0x472a880 v=7 -3: 7003 : 35006 : withdict[3]= 0x520f7e0 v=7 -4: 7004 : 35008 : withdict[4]= 0x27b6020 v=7 -5: 7005 : 35010 : withdict[5]= 0x471c9c0 v=7 -6: 7006 : 35012 : withdict[6]= 0x51a9ff0 v=7 -7: 7007 : 35014 : withdict[7]= 0x470b6d0 v=7 -8: 7008 : 35016 : withdict[8]= 0x47626c0 v=7 -9: 7009 : 35018 : withdict[9]= 0x58c37d0 v=7 -0: 8000 : 40000 : withdict[0]= 0x470f770 v=8 -1: 8001 : 40002 : withdict[1]= 0x469f540 v=8 -2: 8002 : 40004 : withdict[2]= 0x340fed0 v=8 -3: 8003 : 40006 : withdict[3]= 0x4725740 v=8 -4: 8004 : 40008 : withdict[4]= 0x2878350 v=8 -5: 8005 : 40010 : withdict[5]= 0x518dbe0 v=8 -6: 8006 : 40012 : withdict[6]= 0x5513640 v=8 -7: 8007 : 40014 : withdict[7]= 0x518db50 v=8 -8: 8008 : 40016 : withdict[8]= 0x5211610 v=8 -9: 8009 : 40018 : withdict[9]= 0x50be550 v=8 -0: 9000 : 45000 : withdict[0]= 0x5326370 v=9 -1: 9001 : 45002 : withdict[1]= 0x52d4860 v=9 -2: 9002 : 45004 : withdict[2]= 0x5251b30 v=9 -3: 9003 : 45006 : withdict[3]= 0x52522d0 v=9 -4: 9004 : 45008 : withdict[4]= 0x5327680 v=9 -5: 9005 : 45010 : withdict[5]= 0x51a40c0 v=9 -6: 9006 : 45012 : withdict[6]= 0x518ca30 v=9 -7: 9007 : 45014 : withdict[7]= 0x5342590 v=9 -8: 9008 : 45016 : withdict[8]= 0x54af720 v=9 -9: 9009 : 45018 : withdict[9]= 0x52d8b40 v=9 Objects read: 10 -pool_test.root INFO Database being retired... -Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 77331FE0-160F-A15E-904D-1AA331AFB134 Closing the session -Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] [OVAL] ...done [OVAL] Number of floating tokens : 0 [OVAL] Exiting... diff --git a/Database/APR/RootStorageSvc/src/RNTupleContainer.cpp b/Database/APR/RootStorageSvc/src/RNTupleContainer.cpp index 3c8a1417b011ee2eaaee13cb868f72b7b6a415db..a8643c4c3fef89d4c50d170f176d71c7ca09eebc 100644 --- a/Database/APR/RootStorageSvc/src/RNTupleContainer.cpp +++ b/Database/APR/RootStorageSvc/src/RNTupleContainer.cpp @@ -31,12 +31,16 @@ #include <ROOT/RNTupleModel.hxx> #include <ROOT/RNTuple.hxx> #include <ROOT/REntry.hxx> +#include <algorithm> + +#include "TInterpreter.h" +#include <TROOT.h> + using RNTupleModel = ROOT::Experimental::RNTupleModel; using RNTupleReader = ROOT::Experimental::RNTupleReader; using REntry = ROOT::Experimental::REntry; using RFieldValue = ROOT::Experimental::Detail::RFieldValue; -#include <algorithm> using std::string; using namespace pool; @@ -62,8 +66,6 @@ namespace { ErrorHandlerFunc_t ErrorHandlerInit::m_oldHandler ATLAS_THREAD_SAFE; } // namespace -#include "TInterpreter.h" -#include <TROOT.h> namespace { /* Parse header files with typedefs to builtin C++ types (not classes) because genreflex does not allow them in rootmap files and ROOT does not know were to find them on its own @@ -172,14 +174,14 @@ DbStatus RNTupleContainer::open( DbDatabase& dbH, const std::string& nam, log << DbPrintLvl::Debug << "Grouped Container '" << ntupleName << "/" << fieldName << "'" << DbPrint::endmsg; } } + // prepare descriptions for all object data members (aka columns) m_fieldDescs.reserve( cols.size() ); for( const auto& col : cols ) { - string fname = fieldName.empty()? col->name() : fieldName; - for( auto& c : fname ) if( !::isalnum(c) ) c = '_'; - m_fieldDescs.emplace_back( *col ); FieldDesc& dsc = m_fieldDescs.back(); - dsc.fieldname = fname; + dsc.fieldname = fieldName.empty()? col->name() : fieldName; + dsc.sgkey = dsc.fieldname; // remember the original name (usually coming from SG Key) + for( auto& c : dsc.fieldname ) if( !std::isalnum(c) ) c = '_'; if( dsc.typeID() == DbColumn::BLOB or dsc.typeID() == DbColumn::ANY or dsc.typeID() == DbColumn::POINTER ) { if( initObjectFieldDesc(dsc) != Success ) return Error; @@ -250,16 +252,16 @@ RNTupleContainer::initObjectFieldDesc( FieldDesc& dsc ) if( dsc.clazz ) { if ( dsc.clazz->GetStreamerInfo() and dsc.clazz->HasDictionary() ) { // AUX STORE specifics - if( RootAuxDynIO::hasAuxStore(dsc.fieldname, dsc.clazz) ) { + if( RootAuxDynIO::hasAuxStore(dsc.sgkey, dsc.clazz) ) { TClass *storeTClass = dsc.clazz->GetBaseClass("SG::IAuxStoreIO"); if( storeTClass ) { // This is a class implementing SG::IAuxStoreIO // Provide writers for its dynamic attibutes dsc.aux_iostore_IFoffset = dsc.clazz->GetBaseClassOffset( storeTClass ); + // get rid of the AUX_POSTFIX dot at the end (converter to _ earlier) + auto last = dsc.fieldname.end() - 1; + if( *last == '_' ) *last = ':'; } - // get rid of the dot at the end of AUX_POSTFIX - auto last = dsc.fieldname.end() - 1; - if( *last == '.' ) *last = ':'; } return Success; } else { diff --git a/Database/APR/RootStorageSvc/src/RNTupleContainer.h b/Database/APR/RootStorageSvc/src/RNTupleContainer.h index 9e156158489719f8eb832ebb2984cf9c3ac6b3cb..fe7065d1013f218b8f1586473c3ab3abeb8b05ef 100644 --- a/Database/APR/RootStorageSvc/src/RNTupleContainer.h +++ b/Database/APR/RootStorageSvc/src/RNTupleContainer.h @@ -47,9 +47,9 @@ namespace pool { struct FieldDesc : public DbColumn { std::string fieldname; + std::string sgkey; TClass* clazz = nullptr; void* object = nullptr; - void* buffer = nullptr; // ---- extra variables used for AuxDyn attributes // number of rows written to this branch so far diff --git a/Database/APR/RootStorageSvc/src/RootDatabase.cpp b/Database/APR/RootStorageSvc/src/RootDatabase.cpp index 2c539b52e9f47d0ef6763e66acf31045d3ea3673..c7f435f3aeacbf44cd2afdd761037e153a4185d6 100644 --- a/Database/APR/RootStorageSvc/src/RootDatabase.cpp +++ b/Database/APR/RootStorageSvc/src/RootDatabase.cpp @@ -33,8 +33,6 @@ #include "TTree.h" #include "TTreeCache.h" #include "TSystem.h" -#include "Compression.h" -#include "TKey.h" #include "ROOT/RNTuple.hxx" @@ -1092,10 +1090,7 @@ RootDatabase::getNTupleWriter(std::string ntuple_name, bool create) { auto& writer = m_ntupleWriterMap[ntuple_name]; if( !writer and create ) { - DbPrint log(m_file->GetName()); - auto compr = ROOT::CompressionSettings( (ROOT::ECompressionAlgorithm)m_defCompressionAlg, m_defCompression ); - //if( mn ) log << DbPrintLvl::Debug << "Creating RNTuple '" << ntuple_name << "'" << DbPrint::endmsg; - writer = RootAuxDynIO::getNTupleAuxDynWriter(m_file, string("RNT:")+ntuple_name, compr); + writer = RootAuxDynIO::getNTupleAuxDynWriter(m_file, string("RNT:")+ntuple_name, m_file->GetCompressionSettings() ); } if( writer and create ) { // treat the create flag as an indication of a new container client and count them diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref index 53f04c5f31c90c55954f704188faaeb554d48726..64db0b90234abe1066a906de274d532059cdc526 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Concat.ref @@ -8,9 +8,11 @@ PoolSvc DEBUG OutputLevel is 2 AthenaPoolCnvSvc DEBUG Setting StorageType to ROOTTREEINDEX AthenaPoolCnvSvc DEBUG Registering all Tools in ToolHandleArray OutputStreamingTool WriteData INFO in initialize() +WriteData DEBUG data dependencies: + OUTPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + OUTPUT ( 'ExampleHitContainer' , 'StoreGateSvc+PetersHits' ) ReWriteData INFO in initialize() +ReWriteData DEBUG data dependencies: + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + OUTPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) Stream1 DEBUG In initialize @@ -30,7 +32,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -52,7 +55,8 @@ Stream2 DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEve Stream2 DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream2 DEBUG Adding private ToolHandle tool Stream2.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream2 DEBUG Adding private ToolHandle tool Stream2.Stream2Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) +Stream2 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) [Stream2.Stream2Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream2' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream2' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream2' ) @@ -1976,11 +1980,6 @@ PoolSvc DEBUG Disconnect request for contextId=2 Stream2 DEBUG finalize: end optimize output AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref index b313d53f60d5c60270214cf2beb0a9caac8dafef..9533a2c5ca81acfed6fbfda8b85dbea6238c01fa 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref @@ -83,8 +83,6 @@ SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile1... DEBUG --->Reading Param:FID=[F2313678-C96A-964F-89E8-08BAB39F2DA7] SimplePoolFile1... DEBUG --->Reading Param:PFN=[SimplePoolFile1.root] -SimplePoolFile1... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile1... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -121,7 +119,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -1010,11 +1009,6 @@ PoolSvc DEBUG Disconnect request for contextId=1 Stream1 DEBUG finalize: end optimize output AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref index 6f6e0be3ae447e62fc989a04adffd9d1dfc3fcba..d4a7d211151640637faa840f6a90f8cefe9cce90 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref @@ -110,8 +110,6 @@ SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile1... DEBUG --->Reading Param:FID=[F2313678-C96A-964F-89E8-08BAB39F2DA7] SimplePoolFile1... DEBUG --->Reading Param:PFN=[SimplePoolFile1.root] -SimplePoolFile1... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile1... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -166,9 +164,8 @@ SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile4... DEBUG --->Reading Param:FID=[298DE14D-49CF-674A-9171-CEBBD9BEC6F8] SimplePoolFile4... DEBUG --->Reading Param:PFN=[SimplePoolFile4.root] -SimplePoolFile4... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile4... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) @@ -249,8 +246,6 @@ SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile4... DEBUG --->Reading Param:FID=[298DE14D-49CF-674A-9171-CEBBD9BEC6F8] SimplePoolFile4... DEBUG --->Reading Param:PFN=[SimplePoolFile4.root] -SimplePoolFile4... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile4... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] ConditionsContainerExampleHitContainer_p1(PedestalWriteData) ConditionsConta... DEBUG Opening @@ -1000,11 +995,6 @@ ReadCond INFO in finalize() ReadData INFO in finalize() AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref index e3bea332ad4cde4d0173cc22567aa2ca0b4ff856..811ed7dfb812ae206f344edfd37195f9a5f4e19f 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref @@ -111,8 +111,6 @@ SimplePoolFile5... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile5... DEBUG --->Reading Param:FID=[C949FD2E-3B8E-9343-AAE0-0C43] SimplePoolFile5... DEBUG --->Reading Param:PFN=[SimplePoolFile5.root] -SimplePoolFile5... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile5... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile5... DEBUG --> Access DbContainer READ [ROOT_Tree] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -133,6 +131,7 @@ MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//Tag MetaDataSvc DEBUG Registering all Tools in ToolHandleArray MetaDataTools MetaDataSvc DEBUG Adding public ToolHandle tool ToolSvc.IOVDbMetaDataTool (IOVDbMetaDataTool) MetaDataSvc DEBUG Adding public ToolHandle tool ToolSvc.AthPoolEx::ReadMeta (AthPoolEx::ReadMeta) +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) @@ -872,11 +871,6 @@ ReadData INFO in finalize() AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc ToolSvc.AthPool... INFO in finalize() -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref index 7e7ac8a00ead9fd668e2f5f134b6e8364b6d44e1..5cd5edec9bfeaf91a3c18f125321bb2e9ab652ff 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref @@ -86,8 +86,6 @@ SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile1... DEBUG --->Reading Param:FID=[F2313678-C96A-964F-89E8-08BAB39F2DA7] SimplePoolFile1... DEBUG --->Reading Param:PFN=[SimplePoolFile1.root] -SimplePoolFile1... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile1... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -111,10 +109,12 @@ AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. EventInfoCnvAlg... INFO Beam spot information not available EventInfoCnvAlg... INFO Will not fill beam spot information into xAOD::EventInfo ReadData INFO in initialize() +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) ReWriteData INFO in initialize() +ReWriteData DEBUG data dependencies: + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + OUTPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) WriteTag INFO in initialize() @@ -136,7 +136,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -2097,11 +2098,6 @@ PoolSvc DEBUG Disconnect request for contextId=1 Stream1 DEBUG finalize: end optimize output AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref index 0b89cb4ada54944925b1c6f979409ddf3340d190..37aaa0c7ff7487bc588d17d19a90f28f8b4ef93f 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref @@ -110,8 +110,6 @@ SimplePoolRepli... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolRepli... DEBUG --->Reading Param:FID=[095498FF-E805-B142-9948-BD2D4AC79975] SimplePoolRepli... DEBUG --->Reading Param:PFN=[SimplePoolReplica1.root] -SimplePoolRepli... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolRepli... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolRepli... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -135,10 +133,12 @@ AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. EventInfoCnvAlg... INFO Beam spot information not available EventInfoCnvAlg... INFO Will not fill beam spot information into xAOD::EventInfo ReadData INFO in initialize() +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) ReWriteData INFO in initialize() +ReWriteData DEBUG data dependencies: + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + OUTPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) WriteTag INFO in initialize() @@ -160,7 +160,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -2121,11 +2122,6 @@ PoolSvc DEBUG Disconnect request for contextId=1 Stream1 DEBUG finalize: end optimize output AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref index 5ec1926f64ee698851abbc5cdb3a75ec264af4c9..f2fbbaa52ca17923903799a2d347def0c466a9b9 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref @@ -86,8 +86,6 @@ SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile3... DEBUG --->Reading Param:FID=[A811B014-0297-AD47-AF4C-B75EF418982D] SimplePoolFile3... DEBUG --->Reading Param:PFN=[SimplePoolFile3.root] -SimplePoolFile3... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile3... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -111,10 +109,12 @@ AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. EventInfoCnvAlg... INFO Beam spot information not available EventInfoCnvAlg... INFO Will not fill beam spot information into xAOD::EventInfo ReadData INFO in initialize() +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) ReWriteData INFO in initialize() +ReWriteData DEBUG data dependencies: + INPUT IGNORED ( 'ExampleHitContainer' , '' ) + OUTPUT IGNORED ( 'ExampleTrackContainer' , '' ) WriteTag INFO in initialize() @@ -136,7 +136,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -1475,11 +1476,6 @@ PoolSvc DEBUG Disconnect request for contextId=1 Stream1 DEBUG finalize: end optimize output AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref index b4cc8c6ec8ba27da6ec47626c623a0734aa8eeba..eb18e862a1a9d2745bcd15a5da90bec950416773 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref @@ -60,8 +60,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -142,8 +140,6 @@ SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile1... DEBUG --->Reading Param:FID=[F2313678-C96A-964F-89E8-08BAB39F2DA7] SimplePoolFile1... DEBUG --->Reading Param:PFN=[SimplePoolFile1.root] -SimplePoolFile1... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile1... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -163,6 +159,7 @@ MetaData(IOVMet... DEBUG Branch container 'IOVMetaDataContainer_p1__TagInfo' MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//TagInfo) of type ROOT_Tree MetaDataSvc DEBUG Registering all Tools in ToolHandleArray MetaDataTools MetaDataSvc DEBUG Adding public ToolHandle tool ToolSvc.IOVDbMetaDataTool (IOVDbMetaDataTool) +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) @@ -217,8 +214,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -687,8 +682,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -779,8 +772,6 @@ SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile2... DEBUG --->Reading Param:FID=[73F77177-D136-9344-B64D-29693F68D6C2] SimplePoolFile2... DEBUG --->Reading Param:PFN=[SimplePoolFile2.root] -SimplePoolFile2... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile2... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. RootDatabase.se... DEBUG Request tree cache RootDatabase.se... DEBUG File name SimplePoolFile2.root @@ -1347,8 +1338,6 @@ SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile3... DEBUG --->Reading Param:FID=[A811B014-0297-AD47-AF4C-B75EF418982D] SimplePoolFile3... DEBUG --->Reading Param:PFN=[SimplePoolFile3.root] -SimplePoolFile3... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile3... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. RootDatabase.se... DEBUG Request tree cache RootDatabase.se... DEBUG File name SimplePoolFile3.root @@ -1977,11 +1966,6 @@ ApplicationMgr INFO Application Manager Stopped successfully ReadData INFO in finalize() AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref index 0d9604e0f4f9fbf6356afaf0543d7c9fe28deb9d..7eed833ee71e84bccaac48eac014e3e8c7d2aa17 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref @@ -60,8 +60,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -166,8 +164,6 @@ SimplePoolRepli... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolRepli... DEBUG --->Reading Param:FID=[095498FF-E805-B142-9948-BD2D4AC79975] SimplePoolRepli... DEBUG --->Reading Param:PFN=[SimplePoolReplica1.root] -SimplePoolRepli... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolRepli... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolRepli... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -191,6 +187,7 @@ AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. EventInfoCnvAlg... INFO Beam spot information not available EventInfoCnvAlg... INFO Will not fill beam spot information into xAOD::EventInfo ReadData INFO in initialize() +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) @@ -245,8 +242,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -715,8 +710,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -807,8 +800,6 @@ SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile2... DEBUG --->Reading Param:FID=[73F77177-D136-9344-B64D-29693F68D6C2] SimplePoolFile2... DEBUG --->Reading Param:PFN=[SimplePoolFile2.root] -SimplePoolFile2... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile2... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. RootDatabase.se... DEBUG Request tree cache RootDatabase.se... DEBUG File name SimplePoolFile2.root @@ -1375,8 +1366,6 @@ SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile4... DEBUG --->Reading Param:FID=[298DE14D-49CF-674A-9171-CEBBD9BEC6F8] SimplePoolFile4... DEBUG --->Reading Param:PFN=[SimplePoolFile4.root] -SimplePoolFile4... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile4... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. RootDatabase.se... DEBUG Request tree cache RootDatabase.se... DEBUG File name SimplePoolFile4.root @@ -2025,11 +2014,6 @@ ApplicationMgr INFO Application Manager Stopped successfully ReadData INFO in finalize() AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref index cb5d757297606e0ae1c894d3cfc0ba0671300987..21c53a1b27ca7944dadd14073e7d81f59e537854 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref @@ -60,8 +60,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -166,8 +164,6 @@ SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile1... DEBUG --->Reading Param:FID=[F2313678-C96A-964F-89E8-08BAB39F2DA7] SimplePoolFile1... DEBUG --->Reading Param:PFN=[SimplePoolFile1.root] -SimplePoolFile1... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile1... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -187,6 +183,7 @@ MetaData(IOVMet... DEBUG Branch container 'IOVMetaDataContainer_p1__TagInfo' MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//TagInfo) of type ROOT_Tree MetaDataSvc DEBUG Registering all Tools in ToolHandleArray MetaDataTools MetaDataSvc DEBUG Adding public ToolHandle tool ToolSvc.IOVDbMetaDataTool (IOVDbMetaDataTool) +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) @@ -241,8 +238,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -706,8 +701,6 @@ EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree EmptyPoolFile.root DEBUG --->Reading Param:FID=[C7040C30-3363-7D42-B1B7-E3F3B1881030] EmptyPoolFile.root DEBUG --->Reading Param:PFN=[EmptyPoolFile.root] -EmptyPoolFile.root DEBUG --->Reading Param:POOL_VSN=[1.1] -EmptyPoolFile.root DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. PoolSvc DEBUG createCollection() type=ImplicitCollection, connection=PFN:EmptyPoolFile.root, name=POOLContainer_DataHeader, contextID=0 EventSelector DEBUG No events found in: EmptyPoolFile.root skipped!!! @@ -798,8 +791,6 @@ SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile2... DEBUG --->Reading Param:FID=[73F77177-D136-9344-B64D-29693F68D6C2] SimplePoolFile2... DEBUG --->Reading Param:PFN=[SimplePoolFile2.root] -SimplePoolFile2... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile2... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. RootDatabase.se... DEBUG Request tree cache RootDatabase.se... DEBUG File name SimplePoolFile2.root @@ -1390,8 +1381,6 @@ SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile3... DEBUG --->Reading Param:FID=[A811B014-0297-AD47-AF4C-B75EF418982D] SimplePoolFile3... DEBUG --->Reading Param:PFN=[SimplePoolFile3.root] -SimplePoolFile3... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile3... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. RootDatabase.se... DEBUG Request tree cache RootDatabase.se... DEBUG File name SimplePoolFile3.root @@ -2015,11 +2004,6 @@ ApplicationMgr INFO Application Manager Stopped successfully ReadData INFO in finalize() AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref index da2051f28b1ca9389ef4979028940937f0a916e4..f8089c27e1f5c934f254f11e7901999448d2dbb1 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref @@ -109,8 +109,6 @@ SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_All] ##Param ##Params DEBUG Opened container ##Params of type ROOT_Tree SimplePoolFile1... DEBUG --->Reading Param:FID=[F2313678-C96A-964F-89E8-08BAB39F2DA7] SimplePoolFile1... DEBUG --->Reading Param:PFN=[SimplePoolFile1.root] -SimplePoolFile1... DEBUG --->Reading Param:POOL_VSN=[1.1] -SimplePoolFile1... DEBUG --->Reading Param:FORMAT_VSN=[2.0] ##Params DEBUG No objects passing selection criteria... Container has 4 Entries in total. SimplePoolFile1... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaDataHdr(DataHeader) MetaDataHdr(Dat... DEBUG Opening @@ -130,11 +128,13 @@ MetaData(IOVMet... DEBUG Branch container 'IOVMetaDataContainer_p1__TagInfo' MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//TagInfo) of type ROOT_Tree MetaDataSvc DEBUG Registering all Tools in ToolHandleArray MetaDataTools MetaDataSvc DEBUG Adding public ToolHandle tool ToolSvc.IOVDbMetaDataTool (IOVDbMetaDataTool) +ReadData DEBUG data dependencies: + INPUT ( 'DataHeader' , 'StoreGateSvc+EventSelector' ) + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) WriteCond INFO in initialize() AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. +WriteCond DEBUG data dependencies: + INPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) AthenaEventLoopMgr INFO Setup EventSelector service EventSelector ApplicationMgr INFO Application Manager Initialized successfully @@ -1167,11 +1167,6 @@ StorageSvc DEBUG Closing database: FID=298DE14D-49CF-674A-9171-CEBBD9BE RootDatabase.close DEBUG Closing DB SimplePoolFile4.root AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref index 8e50db776d7e840bf1e711ac79423aa11a7f9add..c09964a2448c7805211778fdf459cb0658e10463 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WMeta.ref @@ -8,6 +8,7 @@ PoolSvc DEBUG OutputLevel is 2 AthenaPoolCnvSvc DEBUG Setting StorageType to ROOTTREEINDEX AthenaPoolCnvSvc DEBUG Registering all Tools in ToolHandleArray OutputStreamingTool WriteData INFO in initialize() +WriteData DEBUG data dependencies: + OUTPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + OUTPUT ( 'ExampleHitContainer' , 'StoreGateSvc+PetersHits' ) WriteCond INFO in initialize() @@ -28,7 +29,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+SimpleTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -1048,11 +1050,6 @@ PoolSvc DEBUG Disconnect request for contextId=2 Stream1 DEBUG finalize: end optimize output AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref index 790d71d779e639590ccc0fc0365c6971d7375068..629d57f3cc6af9302b7b3f4cab661d4413cc0940 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Write.ref @@ -10,6 +10,7 @@ PoolSvc DEBUG OutputLevel is 2 AthenaPoolCnvSvc DEBUG Setting StorageType to ROOTTREEINDEX AthenaPoolCnvSvc DEBUG Registering all Tools in ToolHandleArray OutputStreamingTool WriteData INFO in initialize() +WriteData DEBUG data dependencies: + OUTPUT ( 'ExampleHitContainer' , 'StoreGateSvc+MyHits' ) + OUTPUT ( 'ExampleHitContainer' , 'StoreGateSvc+PetersHits' ) WriteTag INFO in initialize() @@ -31,7 +32,8 @@ Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEve Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream1 DEBUG Adding private ToolHandle tool Stream1.Stream1Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) +Stream1 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+MagicTag' ) [Stream1.Stream1Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream1' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream1' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream1' ) @@ -52,7 +54,8 @@ Stream2 DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEve Stream2 DEBUG Adding private ToolHandle tool Stream2.Stream2_MakeEventFormat (xAODMaker::EventFormatStreamHelperTool) Stream2 DEBUG Adding private ToolHandle tool Stream2.FileMetaDataCreatorTool (xAODMaker::FileMetaDataCreatorTool) Stream2 DEBUG Adding private ToolHandle tool Stream2.Stream2Tool (AthenaOutputStreamTool) - + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+RunEventTag' ) +Stream2 DEBUG data dependencies: + + INPUT ( 'AthenaAttributeList' , 'StoreGateSvc+RunEventTag' ) [Stream2.Stream2Tool] + OUTPUT ( 'DataHeader' , 'StoreGateSvc+Stream2' ) + OUTPUT ( 'SG::CompressionInfo' , 'StoreGateSvc+CompressionInfo_Stream2' ) + OUTPUT ( 'SG::SelectionVetoes' , 'StoreGateSvc+SelectionVetoes_Stream2' ) @@ -1530,11 +1533,6 @@ Stream2 DEBUG finalize: end optimize output PoolSvc DEBUG Disconnect request for contextId=3 AthDictLoaderSvc INFO in finalize... ToolSvc INFO Removing all tools created by ToolSvc -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO The Final CPU consumption ( Chrono ) Table (ordered) -*****Chrono***** INFO **************************************************************************************************** -*****Chrono***** INFO **************************************************************************************************** -ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Athena INFO leaving with code 0: "successful run" diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx index 8b32c94768b0779b61b9860a1f29919d3cc6f6aa..7ee77f17a6158cdcab3d9bf47da7ca89b17f7773 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx @@ -502,9 +502,17 @@ StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { ++m_evtCount; void* tokenStr = nullptr; unsigned int status = 0; - if (!m_eventStreamingTool->getLockedEvent(&tokenStr, status).isSuccess()) { + StatusCode sc = m_eventStreamingTool->getLockedEvent(&tokenStr, status); + if (sc.isRecoverable()) { + delete [] (char*)tokenStr; tokenStr = nullptr; + // Return end iterator + ctxt = *m_endIter; + // This is not a real failure but a Gaudi way of handling "end of job" + return(StatusCode::FAILURE); + } + if (sc.isFailure()) { ATH_MSG_FATAL("Cannot get NextEvent from AthenaSharedMemoryTool"); - delete (char*)tokenStr; tokenStr = nullptr; + delete [] (char*)tokenStr; tokenStr = nullptr; return(StatusCode::FAILURE); } if (!eventStore()->clearStore().isSuccess()) { @@ -515,13 +523,13 @@ StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { (*athAttrList)["eventRef"].data<std::string>() = std::string((char*)tokenStr); SG::WriteHandle<AthenaAttributeList> wh(m_attrListKey.value(), eventStore()->name()); if (!wh.record(std::move(athAttrList)).isSuccess()) { - delete (char*)tokenStr; tokenStr = nullptr; + delete [] (char*)tokenStr; tokenStr = nullptr; ATH_MSG_ERROR("Cannot record AttributeList to StoreGate " << StoreID::storeName(eventStore()->storeID())); return(StatusCode::FAILURE); } Token token; token.fromString(std::string((char*)tokenStr)); - delete (char*)tokenStr; tokenStr = nullptr; + delete [] (char*)tokenStr; tokenStr = nullptr; Guid guid = token.dbID(); if (guid != m_guid && m_processMetadata.value()) { if (m_evtCount >= 0 && m_guid != Guid::null()) { diff --git a/Database/AthenaRoot/RootAuxDynIO/CMakeLists.txt b/Database/AthenaRoot/RootAuxDynIO/CMakeLists.txt index c006a53d842ce8d5e5c70c34bfa4957bad15f662..c957259220e61c638cfaeebb593dce0a3eea3938 100644 --- a/Database/AthenaRoot/RootAuxDynIO/CMakeLists.txt +++ b/Database/AthenaRoot/RootAuxDynIO/CMakeLists.txt @@ -10,7 +10,8 @@ find_package( VDT ) atlas_add_library( RootAuxDynIO src/*.cxx PUBLIC_HEADERS RootAuxDynIO - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${VDT_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + ${VDT_INCLUDE_DIRS} #VDT needed by RNTuple LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthContainersInterfaces AthContainersRoot RootUtils diff --git a/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h b/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h index 4121d97c184679fc6c4db22966b2546c467d8c01..d1f215750905abf4fbabc531bfed5c8b05ecac53 100644 --- a/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h +++ b/Database/AthenaRoot/RootAuxDynIO/RootAuxDynIO/RootAuxDynIO.h @@ -126,7 +126,7 @@ namespace RootAuxDynIO virtual size_t size() const = 0; - /// Add a new field to the RNTuple - for now only allowed before the first write + /// Add a new field to the RNTuple virtual void addField( const std::string& field_name, const std::string& attr_type ) = 0; /// Supply data address for a given field @@ -143,7 +143,7 @@ namespace RootAuxDynIO virtual bool isGrouped() const = 0; /// is there a need to call commit()? - virtual bool needsCommit() = 0; + virtual bool needsCommit() const = 0; /// Call Fill() on the ROOT object used by this writer virtual int commit() = 0; diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.cxx b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.cxx index 9e1c3cf90cccea004fb1ba16e7b82ea83dfe0ae8..a85aa075059644eb3f940ea1412669aa6733b5dd 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.cxx +++ b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.cxx @@ -51,6 +51,8 @@ getAuxElementType( bool standalone, std::string& elementTypeName, const std::str { if (standalone) { elementTypeName = storageTypeName; + // Need to stay with 'long long' for [mc]eventNumber as defined in the EventInfo class + if( elementTypeName == "std::uint64_t") return &typeid(unsigned long long); return RootUtils::Type(storageTypeName).getTypeInfo(); } @@ -90,12 +92,10 @@ getAuxElementType( bool standalone, std::string& elementTypeName, const std::str } - SG::auxid_t getAuxIdForAttribute(const std::string& attr_name, const std::string& attr_type, bool standalone) { SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance(); - SG::auxid_t auxid = r.findAuxID(attr_name); if(auxid != SG::null_auxid) return auxid; @@ -111,156 +111,161 @@ getAuxIdForAttribute(const std::string& attr_name, const std::string& attr_type, } // anonymous namespace - -// New RNTupleReader for attributes of an AuxContainer stored in Field 'field_name' -RNTupleAuxDynReader::RNTupleAuxDynReader(const std::string& field_name, RNTupleReader* rntReader) - : m_storeFieldName(field_name), - m_ntupleReader( rntReader ) +namespace RootAuxDynIO { - const RFieldBase *cont_field = m_ntupleReader->GetModel()->GetField(field_name); - if( cont_field ) { - auto field_type = cont_field->GetType(); - string field_prefix = cont_field->GetType() + "_"; - string key = field_name.substr( field_type.size()+1 ); - m_key = key; - TClass *tc = TClass::GetClass( cont_field->GetType().c_str() ); - if( tc ) { - TClass *storeTC = tc->GetBaseClass("SG::IAuxStoreHolder"); - if( storeTC ) { - m_storeHolderOffset = tc->GetBaseClassOffset( storeTC ); +// New RNTupleReader for attributes of an AuxContainer stored in Field 'field_name' + RNTupleAuxDynReader::RNTupleAuxDynReader(const std::string& field_name, RNTupleReader* rntReader) : + AthMessaging(std::string("RNTupleAuxDynReader[")+field_name+"]"), + m_storeFieldName(field_name), + m_ntupleReader( rntReader ) + { + const RFieldBase *cont_field = m_ntupleReader->GetModel()->GetField(field_name); + if( cont_field ) { + std::string field_type = cont_field->GetType(); + std::string field_prefix = field_type + "_"; + if( field_name.rfind( field_type, 0 ) != std::string::npos ) { + m_key = field_name.substr( field_type.size()+1 ); + } + ATH_MSG_VERBOSE("field name=" << field_name << " field_prefix=" << field_prefix << " key=" << m_key); + TClass *tc = TClass::GetClass( cont_field->GetType().c_str() ); + if( tc ) { + TClass *storeTC = tc->GetBaseClass("SG::IAuxStoreHolder"); + if( storeTC ) { + m_storeHolderOffset = tc->GetBaseClassOffset( storeTC ); + } else { + throw std::runtime_error(string("Class ") + tc->GetName() +" does not implement SG::IAuxStoreHolder"); + } } else { - throw std::runtime_error(string("Class ") + tc->GetName() +" does not implement SG::IAuxStoreHolder"); + throw std::runtime_error(string("Class ") + field_type +" could not be found"); } } else { - throw std::runtime_error(string("Class ") + field_type +" could not be found"); + throw std::runtime_error( string("Field ") + field_name + " could not be found in RNTuple: " + + m_ntupleReader->GetModel()->GetDescription() ); } - } else { - throw std::runtime_error( string("Field ") + field_name + " could not be found in RNTuple: " - + m_ntupleReader->GetModel()->GetDescription() ); } -} // Has to be a separate method because 'standalone' status is not know at construction time // Prepare all Field infos for dynamic attributes (auxids and types) -void RNTupleAuxDynReader::init( bool standalone ) -{ - if( m_initialized ) return; + void RNTupleAuxDynReader::init( bool standalone ) + { + if( m_initialized ) return; - const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); - const string field_prefix = m_storeFieldName + ':'; - REntry *entry = m_ntupleReader->GetModel()->GetDefaultEntry(); - for( auto iValue = entry->begin(); iValue != entry->end(); ++iValue ) { - string field_name = iValue->GetField()->GetName(); - if( field_name.rfind(field_prefix,0) == 0 ) { - const string attr_infile = field_name.substr(field_prefix.size()); - const string attr_name = reg.inputRename(m_key, attr_infile); - string field_type = iValue->GetField()->GetType(); + const SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + const string field_prefix = m_storeFieldName + ':'; + REntry *entry = m_ntupleReader->GetModel()->GetDefaultEntry(); + for( auto iValue = entry->begin(); iValue != entry->end(); ++iValue ) { + string field_name = iValue->GetField()->GetName(); + if( field_name.rfind(field_prefix,0) == 0 ) { + const string attr_infile = field_name.substr(field_prefix.size()); + const string attr_name = reg.inputRename(m_key, attr_infile); + string field_type = iValue->GetField()->GetType(); - SG::auxid_t auxid = getAuxIdForAttribute(attr_name, field_type, standalone); - // add AuxID to the list - // May still be null if we don't have a dictionary for the branch. - if( auxid != SG::null_auxid ) { - m_auxids.insert(auxid); - } else { - errorcheck::ReportMessage msg (MSG::WARNING, ERRORCHECK_ARGS, "RNTupleAuxDynReader::init"); - msg << "Could not find auxid for " << attr_infile << " type: " << field_type - << " standalone=" << standalone; - } - } + SG::auxid_t auxid = getAuxIdForAttribute(attr_name, field_type, standalone); + // add AuxID to the list + // May still be null if we don't have a dictionary for the branch. + if( auxid != SG::null_auxid ) { + m_auxids.insert(auxid); + } else { + errorcheck::ReportMessage msg (MSG::WARNING, ERRORCHECK_ARGS, "RNTupleAuxDynReader::init"); + msg << "Could not find auxid for " << attr_infile << " type: " << field_type + << " standalone=" << standalone; + } + } + } + m_initialized = true; } - m_initialized = true; -} // Called by the AuxStore when it is reading new attribute data from the file // All information is cached in a FieldInfo object for better performance -const RNTupleAuxDynReader::FieldInfo& -RNTupleAuxDynReader::getFieldInfo(const SG::auxid_t& auxid, const SG::AuxStoreInternal& store) -{ - FieldInfo& fieldInfo = m_fieldInfos[auxid]; - if( fieldInfo.status == FieldInfo::NotInitialized ) + const RNTupleAuxDynReader::FieldInfo& + RNTupleAuxDynReader::getFieldInfo(const SG::auxid_t& auxid, const SG::AuxStoreInternal& store) { - SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); - fieldInfo.auxid = auxid; - fieldInfo.attribName = reg.getName(auxid); - // Don't match this attribute if it's been renamed. - // For example, suppose we've renamed attribute `foo' to `foo_old', - // and someone then comes and asks for `foo'. - // `foo' will not be found in the m_fieldMap test below - // (`foo_old' will be in this map). However, in the following - // else clause, we'll recreate the field name from `foo'. - // This field exists (renaming is only in the transient store), - // so if we didn't have the condition here, then we'd then - // make a `foo' attribute from that field. - if (reg.inputRename (m_key, fieldInfo.attribName) != fieldInfo.attribName) { - fieldInfo.status = FieldInfo::NotFound; - return fieldInfo; - } + FieldInfo& fieldInfo = m_fieldInfos[auxid]; + if( fieldInfo.status == FieldInfo::NotInitialized ) + { + SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance(); + fieldInfo.auxid = auxid; + fieldInfo.attribName = reg.getName(auxid); + // Don't match this attribute if it's been renamed. + // For example, suppose we've renamed attribute `foo' to `foo_old', + // and someone then comes and asks for `foo'. + // `foo' will not be found in the m_fieldMap test below + // (`foo_old' will be in this map). However, in the following + // else clause, we'll recreate the field name from `foo'. + // This field exists (renaming is only in the transient store), + // so if we didn't have the condition here, then we'd then + // make a `foo' attribute from that field. + if (reg.inputRename (m_key, fieldInfo.attribName) != fieldInfo.attribName) { + fieldInfo.status = FieldInfo::NotFound; + return fieldInfo; + } - const string field_prefix = m_storeFieldName + ':'; - REntry *entry = m_ntupleReader->GetModel()->GetDefaultEntry(); - for( auto iValue = entry->begin(); iValue != entry->end(); ++iValue ) { - auto fieldName = iValue->GetField()->GetName(); - if( fieldName.rfind(field_prefix,0) == 0 ) { - const string attr_infile = fieldName.substr(field_prefix.size()); - const string attr_name = reg.inputRename(m_key, attr_infile); - if( attr_infile == fieldInfo.attribName ) { - fieldInfo.fieldName = fieldName; - fieldInfo.fieldType = iValue->GetField()->GetType(); - break; + const string field_prefix = m_storeFieldName + ':'; + REntry *entry = m_ntupleReader->GetModel()->GetDefaultEntry(); + for( auto iValue = entry->begin(); iValue != entry->end(); ++iValue ) { + auto fieldName = iValue->GetField()->GetName(); + if( fieldName.rfind(field_prefix,0) == 0 ) { + const string attr_infile = fieldName.substr(field_prefix.size()); + const string attr_name = reg.inputRename(m_key, attr_infile); + if( attr_infile == fieldInfo.attribName ) { + fieldInfo.fieldName = fieldName; + fieldInfo.fieldType = iValue->GetField()->GetType(); + break; + } } } - } - if( fieldInfo.fieldName.empty() ) { - // mark initialized here so it remembers this field was not found - fieldInfo.status = FieldInfo::NotFound; - return fieldInfo; - } + if( fieldInfo.fieldName.empty() ) { + // mark initialized here so it remembers this field was not found + fieldInfo.status = FieldInfo::NotFound; + return fieldInfo; + } - if( !store.standalone() and fieldInfo.fieldType.rfind("SG::PackedContainer<", 0) == 0 ) - fieldInfo.isPackedContainer = true; + if( !store.standalone() and fieldInfo.fieldType.rfind("SG::PackedContainer<", 0) == 0 ) + fieldInfo.isPackedContainer = true; - /* - string elem_tname, branch_tname; - const type_info* ti = getAuxElementType( fieldInfo.tclass, typ, store.standalone(), - elem_tname, branch_tname ); - const type_info* reg_ti = reg.getType(auxid); - if( ti && ti != reg_ti && strcmp(ti->name(), reg_ti->name()) != 0 ) - { - // type in registry is different than type in the file. - // will need to use ROOT auto schema evolution - fieldInfo.needsSE = true; - errorcheck::ReportMessage msg (MSG::INFO, ERRORCHECK_ARGS, "RNTupleAuxDynReader"); - msg << "attribute " << fieldInfo.attribName << " (id=" << auxid << - " typename=" << SG::AuxTypeRegistry::instance().getType(auxid)->name() - << ") has different type than the branch " << branch_tname; + /* + string elem_tname, branch_tname; + const type_info* ti = getAuxElementType( fieldInfo.tclass, typ, store.standalone(), + elem_tname, branch_tname ); + const type_info* reg_ti = reg.getType(auxid); + if( ti && ti != reg_ti && strcmp(ti->name(), reg_ti->name()) != 0 ) + { + // type in registry is different than type in the file. + // will need to use ROOT auto schema evolution + fieldInfo.needsSE = true; + errorcheck::ReportMessage msg (MSG::INFO, ERRORCHECK_ARGS, "RNTupleAuxDynReader"); + msg << "attribute " << fieldInfo.attribName << " (id=" << auxid << + " typename=" << SG::AuxTypeRegistry::instance().getType(auxid)->name() + << ") has different type than the branch " << branch_tname; - const std::type_info *tinf = store.getIOType(auxid); - fieldInfo.SE_tclass = TClass::GetClass(*tinf); - fieldInfo.SE_edt = kOther_t; - if( !fieldInfo.SE_tclass ) { - fieldInfo.SE_edt = TDataType::GetType(*tinf); - if( fieldInfo.SE_edt <=0 ) { - fieldInfo.status = FieldInfo::TypeError; - throw string("Error getting ROOT type for AUX branch ") + fieldInfo.branch->GetName() - + " typeinfo=" + tinf->name(); - } - } - } - */ + const std::type_info *tinf = store.getIOType(auxid); + fieldInfo.SE_tclass = TClass::GetClass(*tinf); + fieldInfo.SE_edt = kOther_t; + if( !fieldInfo.SE_tclass ) { + fieldInfo.SE_edt = TDataType::GetType(*tinf); + if( fieldInfo.SE_edt <=0 ) { + fieldInfo.status = FieldInfo::TypeError; + throw string("Error getting ROOT type for AUX branch ") + fieldInfo.branch->GetName() + + " typeinfo=" + tinf->name(); + } + } + } + */ - fieldInfo.status = FieldInfo::Initialized; + fieldInfo.status = FieldInfo::Initialized; + } + return fieldInfo; } - return fieldInfo; -} -void RNTupleAuxDynReader::addReaderToObject(void* object, size_t ttree_row, std::recursive_mutex* iomtx) -{ - auto store_holder = reinterpret_cast<SG::IAuxStoreHolder*>((char*)object + m_storeHolderOffset); - bool standalone { store_holder->getStoreType()==SG::IAuxStoreHolder::AST_ObjectStore }; - if( !m_initialized ) - init(standalone); - store_holder->setStore( new RNTupleAuxDynStore(*this, m_ntupleReader, m_storeFieldName, ttree_row, standalone, iomtx) ); -} + void RNTupleAuxDynReader::addReaderToObject(void* object, size_t ttree_row, std::recursive_mutex* iomtx) + { + auto store_holder = reinterpret_cast<SG::IAuxStoreHolder*>((char*)object + m_storeHolderOffset); + bool standalone { store_holder->getStoreType()==SG::IAuxStoreHolder::AST_ObjectStore }; + if( !m_initialized ) + init(standalone); + store_holder->setStore( new RNTupleAuxDynStore(*this, m_ntupleReader, m_storeFieldName, ttree_row, standalone, iomtx) ); + } +}// namespace diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.h b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.h index 51735376278212975177f5d9ee9b078a0cc3449d..51237d88c03b5e1fb86e96207df3f0cb48e3eece 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.h +++ b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynReader.h @@ -5,6 +5,7 @@ #ifndef RNTUPLEAUXDYNREADER_H #define RNTUPLEAUXDYNREADER_H +#include "AthenaBaseComps/AthMessaging.h" #include "AthContainers/AuxStoreInternal.h" #include "RootAuxDynIO/RootAuxDynIO.h" @@ -13,80 +14,84 @@ class TClass; -class RNTupleAuxDynReader : public RootAuxDynIO::IRootAuxDynReader +namespace RootAuxDynIO { -public : - struct FieldInfo - { - enum Status { NotInitialized, Initialized, TypeError, NotFound }; + class RNTupleAuxDynReader : public AthMessaging, public IRootAuxDynReader + { + public : - TClass* tclass = 0; - TClass* SE_tclass = 0; + struct FieldInfo + { + enum Status { NotInitialized, Initialized, TypeError, NotFound }; + + TClass* tclass = 0; + TClass* SE_tclass = 0; - bool isPackedContainer = false; - bool needsSE = false; - enum Status status = NotInitialized; + bool isPackedContainer = false; + bool needsSE = false; + enum Status status = NotInitialized; - SG::auxid_t auxid; - std::string attribName; - std::string fieldName; - std::string fieldType; - }; + SG::auxid_t auxid; + std::string attribName; + std::string fieldName; + std::string fieldType; + }; - RNTupleAuxDynReader(const std::string& store_key, RNTupleReader* rntReader); + RNTupleAuxDynReader(const std::string& store_key, RNTupleReader* rntReader); - void init(bool standalone); + void init(bool standalone); - virtual void addReaderToObject(void* object, size_t ttree_row, std::recursive_mutex* iomtx = nullptr ) override final; + virtual void addReaderToObject(void* object, size_t ttree_row, std::recursive_mutex* iomtx = nullptr ) override final; - virtual const SG::auxid_set_t& auxIDs() const override final; + virtual const SG::auxid_set_t& auxIDs() const override final; - void addBytes(size_t bytes); + void addBytes(size_t bytes); - virtual size_t getBytesRead() const override final; + virtual size_t getBytesRead() const override final; - virtual void resetBytesRead() override final; + virtual void resetBytesRead() override final; - const FieldInfo& getFieldInfo(const SG::auxid_t& auxid, const SG::AuxStoreInternal& store); + const FieldInfo& getFieldInfo(const SG::auxid_t& auxid, const SG::AuxStoreInternal& store); - virtual ~RNTupleAuxDynReader() {} + virtual ~RNTupleAuxDynReader() {} -protected: - // auxids that could be found in registry for attribute names from the file - SG::auxid_set_t m_auxids; + protected: + // auxids that could be found in registry for attribute names from the file + SG::auxid_set_t m_auxids; - std::string m_storeFieldName; - // counter for bytes read - size_t m_bytesRead = 0; - // offset of the AxuStoreHolder base class in the objects read by the Reader - int m_storeHolderOffset = -1; - bool m_initialized = false; - std::string m_key; + std::string m_storeFieldName; + // counter for bytes read + size_t m_bytesRead = 0; + // offset of the AxuStoreHolder base class in the objects read by the Reader + int m_storeHolderOffset = -1; + bool m_initialized = false; + std::string m_key; - // map auxid -> branch info. not sure if it can be different from m_branchMap - std::map<SG::auxid_t, FieldInfo> m_fieldInfos; + // map auxid -> branch info. not sure if it can be different from m_branchMap + std::map<SG::auxid_t, FieldInfo> m_fieldInfos; - RNTupleReader* m_ntupleReader; -}; + RNTupleReader* m_ntupleReader; + }; -inline void RNTupleAuxDynReader::addBytes(size_t bytes) { - m_bytesRead += bytes; -} + inline void RNTupleAuxDynReader::addBytes(size_t bytes) { + m_bytesRead += bytes; + } -inline size_t RNTupleAuxDynReader::getBytesRead() const { - return m_bytesRead; -} + inline size_t RNTupleAuxDynReader::getBytesRead() const { + return m_bytesRead; + } -inline void RNTupleAuxDynReader::resetBytesRead() { - m_bytesRead = 0; -} + inline void RNTupleAuxDynReader::resetBytesRead() { + m_bytesRead = 0; + } -inline const SG::auxid_set_t& RNTupleAuxDynReader::auxIDs() const { - return m_auxids; -} + inline const SG::auxid_set_t& RNTupleAuxDynReader::auxIDs() const { + return m_auxids; + } +} //namespace #endif diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.cxx b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.cxx index dee834e22986ca0b26f1512d9d1275978ce5ae2a..10c1bd28c7b5388100fb8655d9f269c44169c688 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.cxx +++ b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.cxx @@ -18,11 +18,13 @@ using RFieldValue = ROOT::Experimental::Detail::RFieldValue; using RNTupleReader = ROOT::Experimental::RNTupleReader; using REntry = ROOT::Experimental::REntry; +using namespace RootAuxDynIO; -RNTupleAuxDynStore::RNTupleAuxDynStore( RNTupleAuxDynReader& aux_reader, RNTupleReader* rnt_reader, - const std::string& branchName, - long long entry, bool standalone, - std::recursive_mutex* iomtx) +RNTupleAuxDynStore::RNTupleAuxDynStore( RNTupleAuxDynReader& aux_reader, + RNTupleReader* rnt_reader, + const std::string& branchName, + long long entry, bool standalone, + std::recursive_mutex* iomtx) : RootAuxDynStore( aux_reader, entry, standalone, iomtx ), m_reader( aux_reader ), m_ntupleReader( rnt_reader ), diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.h b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.h index 48caae1c74756705f3fa1aee650ef0a6c22b6c6e..7b2a872ffcd21069a501657e62c3306a77be39e6 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.h +++ b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynStore.h @@ -13,7 +13,7 @@ */ #include "RootAuxDynStore.h" -class RNTupleAuxDynReader; +namespace RootAuxDynIO { class RNTupleAuxDynReader; } namespace ROOT { namespace Experimental { class RNTupleReader; } } using RNTupleReader = ROOT::Experimental::RNTupleReader; @@ -22,7 +22,8 @@ using RNTupleReader = ROOT::Experimental::RNTupleReader; class RNTupleAuxDynStore : public RootAuxDynStore { public: - RNTupleAuxDynStore( RNTupleAuxDynReader& aux_reader, RNTupleReader *reader, + RNTupleAuxDynStore( RootAuxDynIO::RNTupleAuxDynReader& aux_reader, + RNTupleReader *reader, const std::string& base_branch, long long entry, bool standalone, std::recursive_mutex* iomtx = nullptr); @@ -33,7 +34,7 @@ protected: /// read data from ROOT and store it in m_vecs. Returns False on error virtual bool readData(SG::auxid_t auxid) override final; - RNTupleAuxDynReader& m_reader; + RootAuxDynIO::RNTupleAuxDynReader& m_reader; RNTupleReader* m_ntupleReader = nullptr; std::string m_baseBranchName; }; diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.cxx b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.cxx index 959b6d68cb7b66349f3adf3e80bc680d34706ca3..678c77359e963e58fbe12a053e3dbbf654ed67cd 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.cxx +++ b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.cxx @@ -59,26 +59,14 @@ namespace RootAuxDynIO int RNTupleAuxDynWriter::writeAuxAttributes( const std::string& base_name, SG::IAuxStoreIO* store, size_t /*rows_written*/ ) { const SG::auxid_set_t selection = store->getSelectedAuxIDs(); - ATH_MSG_VERBOSE("Writing " << base_name << " with " << selection.size() << " Dynamic attributes"); + ATH_MSG_DEBUG("Writing " << base_name << " with " << selection.size() << " Dynamic attributes"); for(SG::auxid_t id : selection) { - const std::type_info* attr_typeinfo = store->getIOType(id); - const std::string attr_type = SG::normalizedTypeinfoName( *attr_typeinfo ); + const std::string attr_type = SG::normalizedTypeinfoName( *store->getIOType(id) ); const std::string attr_name = SG::AuxTypeRegistry::instance().getName(id); - void* attr_data ATLAS_THREAD_SAFE = const_cast<void*>( store->getIOData(id) ); const std::string field_name = RootAuxDynIO::auxFieldName( attr_name, base_name ); + void* attr_data ATLAS_THREAD_SAFE = const_cast<void*>( store->getIOData(id) ); - // Ignore 'late' AuxDyn attributes until beckfilling is implemented - static std::set<std::string> goodBranches ATLAS_THREAD_SAFE, badBranches ATLAS_THREAD_SAFE; - if( m_model ) goodBranches.insert(field_name); - else { - if( goodBranches.count(field_name) == 0 ) { - if( badBranches.insert(field_name).second ) { - ATH_MSG_WARNING("ignoring late attribute " << field_name); - } - continue; - } - } addAttribute( field_name, attr_type, attr_data ); } return 0; // MN: can get bytes written only when calling Fill() at commit @@ -91,7 +79,6 @@ namespace RootAuxDynIO if( !m_entry ) makeNewEntry(); if( m_model ) { // first event - create Fields and update NTuple Model - ATH_MSG_VERBOSE( "MN: adding attribute to NTuple, name: " << field_name << " type: " << attr_type << " |ptr=" << attr_data); auto field = RFieldBase::Create(field_name, attr_type).Unwrap(); m_entry->CaptureValue( field->CaptureValue( attr_data ) ); m_ntupleFieldMap[ field_name ] = field.get(); @@ -103,34 +90,35 @@ namespace RootAuxDynIO m_entry->CaptureValue( field->CaptureValue( attr_data ) ); } #else - if( m_model ) { - // first event - only update NTuple Model and store tha data pointer locally - // fill the RNTuple entry when the entire model is defined (in writeEntry) - m_attrDataMap[ field_name ] = attr_data; - auto field = RFieldBase::Create(field_name, attr_type).Unwrap(); - m_model->AddField( std::move(field) ); - } - else { - addFieldValue(field_name, attr_data); + if( m_attrDataMap.find(field_name) == m_attrDataMap.end() ) { + addField(field_name, attr_type); } + addFieldValue(field_name, attr_data); #endif } - /// Add a new field to the RNTuple - for now only allowed before the first write + /// Used for data objects from RNTupleContainer, not for dynamic attributes void RNTupleAuxDynWriter::addField( const std::string& field_name, const std::string& attr_type ) { - if( !m_model ) { - // first write was already done, cannot add new fields any more - throw std::runtime_error( std::string("Attempt to add new field to RNTuple after the first write. name: ") - + field_name + " type: " + attr_type ); - } if( m_attrDataMap.find(field_name) != m_attrDataMap.end() ) { throw std::runtime_error( std::string("Attempt to add existing field. name: ") + field_name + "new type: " + attr_type ); } + ATH_MSG_DEBUG("Adding new object column, name="<< field_name << " of type " << attr_type); auto field = RFieldBase::Create(field_name, attr_type).Unwrap(); - m_model->AddField( std::move(field) ); + if( !m_model ) { +#if ROOT_VERSION_CODE > ROOT_VERSION( 6, 29, 0 ) + // first write was already done, need to update the model + ATH_MSG_DEBUG("Adding late attribute " << field_name); + auto updater = m_ntupleWriter->CreateModelUpdater(); + updater->BeginUpdate(); + updater->AddField( std::move(field) ); + updater->CommitUpdate(); +#endif + } else { + m_model->AddField( std::move(field) ); + } m_attrDataMap[ field_name ] = nullptr; } @@ -144,54 +132,62 @@ namespace RootAuxDynIO msg <<"Attempt to write unknown Field with name: '" << field_name << std::ends; throw std::runtime_error( msg.str() ); } - if( !m_model ) { // already started writing - if( !m_entry ) makeNewEntry(); -#if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 27, 0 ) - m_entry->CaptureValueUnsafe( field_name, attr_data ); -#else +#if ROOT_VERSION_CODE < ROOT_VERSION( 6, 27, 0 ) + if( !m_model ) { // MN: ROOT 6.26 version not tested + if( !m_entry ) makeNewEntry(); RFieldBase* field = m_ntupleFieldMap[ field_name ]; m_entry->CaptureValue( field->CaptureValue( attr_data ) ); -#endif } +#endif field_iter->second = attr_data; + m_needsCommit = true; } int RNTupleAuxDynWriter::commit() { - ATH_MSG_VERBOSE("Commit"); #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 27, 0 ) - if( m_model ) { - makeNewEntry(); - // attach the attribute values rememberd internally during model creation - for( const auto& attr: m_attrDataMap ) { - m_entry->CaptureValueUnsafe( attr.first, attr.second ); - } + // write only if there was data added, ignore empty commits + if( !needsCommit() ) { + ATH_MSG_DEBUG("Empty Commit"); + return 0; } + ATH_MSG_DEBUG("Commit"); + if( !m_entry ) makeNewEntry(); - // write only if there was data added, ignore empty commits + std::vector<RFieldValue> generatedValues; int num_bytes = 0; - if( m_entry ) { - for( auto& attr: m_attrDataMap ) { - if( !attr.second ) { - // MN: the default object created here needs to be deleted - should use REntry::AddValue() - attr.second = m_entry->GetValue(attr.first).GetField()->GenerateValue().GetRawPtr(); - m_entry->CaptureValueUnsafe( attr.first, attr.second ); - } else { - // the value here was already added in addFieldValue, now just clear the "flag" - attr.second = nullptr; - } + for( auto& attr: m_attrDataMap ) { + ATH_MSG_VERBOSE("Setting data ptr for field: " << attr.first << " data=" << std::hex << attr.second << std::dec ); + if( !attr.second ) { + ATH_MSG_DEBUG("Generating default object for field: " << attr.first ); + // MN: the default object created here needs to be deleted - should use REntry::AddValue() + generatedValues.emplace_back( m_entry->GetValue(attr.first).GetField()->GenerateValue() ); + m_entry->CaptureValueUnsafe( attr.first, generatedValues.back().GetRawPtr() ); + } else { + // attach the attribute values rememberd internally + m_entry->CaptureValueUnsafe( attr.first, attr.second ); + // set NULL so we don't try to delete it + attr.second = nullptr; } - num_bytes += m_ntupleWriter->Fill( *m_entry ); - m_entry.reset(); - for( auto& field : m_attrDataMap ) field.second = nullptr; - m_rowN++; } + num_bytes += m_ntupleWriter->Fill( *m_entry ); + ATH_MSG_DEBUG("Filled RNTuple Row, bytes written: " << num_bytes); + + // delete the generated default fields + for( auto& val : generatedValues ) { + val.GetField()->DestroyValue(val); + } + generatedValues.clear(); + m_entry.reset(); + m_needsCommit = false; + m_rowN++; return num_bytes; #else + ATH_MSG_WARNING("Commit not implemented for this ROOT version"); return 0; #endif } @@ -204,3 +200,4 @@ namespace RootAuxDynIO RNTupleAuxDynWriter::~RNTupleAuxDynWriter() {} }// namespace + diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.h b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.h index 2bd06b302a193d2b9b827fe7560baf7aeab755b5..c0b116beb547661041dd418c7e089e8dca731155 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.h +++ b/Database/AthenaRoot/RootAuxDynIO/src/RNTupleAuxDynWriter.h @@ -20,6 +20,7 @@ namespace SG { class IAuxStoreIO; } namespace RootAuxDynIO { using RFieldBase = ROOT::Experimental::Detail::RFieldBase; + using RFieldValue = ROOT::Experimental::Detail::RFieldValue; using RNTupleWriter = ROOT::Experimental::RNTupleWriter; using RNTupleModel = ROOT::Experimental::RNTupleModel; using REntry = ROOT::Experimental::REntry; @@ -46,19 +47,22 @@ namespace RootAuxDynIO int m_rowN = 0; /// Count how many APR Containers are writing to this RNTuple (more than one makes a Group) int m_clients = 0; + bool m_needsCommit = false; RNTupleAuxDynWriter(TFile* file, const std::string& ntupleName, int compression); + /// Create a new empty RNTuple row with the current model (fields) void makeNewEntry(); - /// handle writing of dynamic xAOD attributes of an object - called from RootTreeContainer::writeObject() + /// handle writing of dynamic xAOD attributes of an object - called from Container::writeObject() // throws exceptions virtual int writeAuxAttributes( const std::string& base_branch, SG::IAuxStoreIO* store, size_t /*rows_written*/ ) override final; + /// Add a new field to the RNTuple, collect the data pointer for the commit void addAttribute( const std::string& field_name, const std::string& attr_type, void* attr_data ); - /// Add a new field to the RNTuple - for now only allowed before the first write + /// Add a new field to the RNTuple virtual void addField( const std::string& field_name, const std::string& attr_type ) override; /// Supply data address for a given field @@ -70,10 +74,13 @@ namespace RootAuxDynIO virtual size_t size() const override { return m_rowN; } - virtual bool needsCommit() override final { return m_entry or m_model; } + /// Check if any data needs to be committed + virtual bool needsCommit() const override final { return m_needsCommit; } + /// Is this RNTuple used by more than one APR container? virtual bool isGrouped() const override final { return m_clients > 1; } + /// Keep track of how many APR containers are writing to this RNTuple virtual void increaseClientCount() override final { m_clients++; } virtual void close() override; diff --git a/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynIO.cxx b/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynIO.cxx index 6c92a507640b8011ad93fe314f7587070080b304..852bb18eb098976440ef8180b4d50d876d1beaca 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynIO.cxx +++ b/Database/AthenaRoot/RootAuxDynIO/src/RootAuxDynIO.cxx @@ -29,7 +29,9 @@ namespace RootAuxDynIO hasAuxStore(std::string_view fieldname, TClass *tc) { // check the name first, and only if it does not match AUX_POSTFIX ask TClass return endsWithAuxPostfix(fieldname) - or (tc and RootType(tc).Properties().HasProperty("IAuxStore")); + or ( tc and ( tc->GetBaseClass("SG::IAuxStore") + // the IAuxStore property is used in DataModelTests + or RootType(tc).Properties().HasProperty("IAuxStore") )); } @@ -83,9 +85,8 @@ namespace RootAuxDynIO msg << "GetExpectedType() failed for branch: " << bname; return false; } - if( tc and ( endsWithAuxPostfix(bname) - or (tc->GetAttributeMap() && tc->GetAttributeMap()->HasKey("IAuxStore")) ) ) { - return tc->GetBaseClass("SG::IAuxStoreHolder") != nullptr; + if( hasAuxStore(bname, tc) ) { + return tc->GetBaseClass("SG::IAuxStoreHolder") != nullptr; } return false; } diff --git a/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.cxx b/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.cxx index b86c1ad7194a3736c32b86777873015348a9aac9..df4a2d294251e06c7736583cee567452cdbfd2b8 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.cxx +++ b/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.cxx @@ -120,14 +120,23 @@ getAuxIdForAttribute(const std::string& attr, TClass *tclass, EDataType edt, boo } // anonymous namespace - void TBranchAuxDynReader::BranchInfo::setAddress(void* data) { + if( needsSE ) { + if( (edtyp == kULong_t or edtyp == kULong64_t or edtyp == kLong_t or edtyp == kLong64_t) and + (SE_edt == kULong_t or SE_edt == kULong64_t or SE_edt == kLong_t or SE_edt == kLong64_t) and + sizeof(Long_t) == sizeof(Long64_t) ) { + // There is no need to attempt ROOT schema evolution between these types (and it will not work anyhow) + needsSE = false; + } + } if( needsSE ) { // reading through the TTree - allows for schema evolution - if( branch->GetTree()->SetBranchAddress( branch->GetName(), data, - SE_tclass, SE_edt, true) < 0 ) { - throw string("SetBranchAddress() failed for ") + branch->GetName(); + int rc = branch->GetTree()->SetBranchAddress( branch->GetName(), data, SE_tclass, SE_edt, true); + if( rc < 0 ) { + std::ostringstream msg; + msg << "SetBranchAddress() failed for " << branch->GetName() << " error=" << rc; + throw msg.str(); } } else { branch->SetAddress(data); @@ -238,8 +247,7 @@ TBranchAuxDynReader::getBranchInfo(const SG::auxid_t& auxid, const SG::AuxStoreI brInfo.status = BranchInfo::NotFound; return brInfo; } - EDataType typ; - if( brInfo.branch->GetExpectedType( brInfo.tclass, typ) ) { + if( brInfo.branch->GetExpectedType( brInfo.tclass, brInfo.edtyp) ) { brInfo.status = BranchInfo::TypeError; throw string("Error getting branch type for ") + brInfo.branch->GetName(); } @@ -249,29 +257,40 @@ TBranchAuxDynReader::getBranchInfo(const SG::auxid_t& auxid, const SG::AuxStoreI brInfo.isPackedContainer = true; string elem_tname, branch_tname; - const std::type_info* ti = getAuxElementType( brInfo.tclass, typ, store.standalone(), + // AuxElement TypeID + const std::type_info* ti = getAuxElementType( brInfo.tclass, brInfo.edtyp, store.standalone(), elem_tname, branch_tname ); const std::type_info* reg_ti = r.getType(auxid); - if( ti && ti != reg_ti && strcmp(ti->name(), reg_ti->name()) != 0 ) - { + // I/O / Storage TypeID + const std::type_info *io_tinf = store.getIOType(auxid); + const std::type_info *tcls_tinf = brInfo.tclass ? brInfo.tclass->GetTypeInfo() : ti; + + if (not io_tinf){ + brInfo.status = BranchInfo::TypeError; + throw string("Error getting IO type for AUX branch ") + brInfo.branch->GetName(); + } + // if there is a TClass compare the whole storage types (usually vectors), because the Element type + // returned by CollProxy loses the pointer component and element type comparison for vector<T*> fails + brInfo.needsSE = brInfo.tclass ? + io_tinf != tcls_tinf && strcmp(io_tinf->name(), tcls_tinf->name()) != 0 + : ti && ti != reg_ti && strcmp(ti->name(), reg_ti->name()) != 0; + if( brInfo.needsSE ) { // type in registry is different than type in the file. - // will need to use ROOT auto schema evolution - brInfo.needsSE = true; + // will need to use ROOT auto schema evolution errorcheck::ReportMessage msg (MSG::INFO, ERRORCHECK_ARGS, "TBranchAuxDynReader"); - msg << "attribute " << brInfo.attribName << " (id=" << auxid << - " typename=" << SG::AuxTypeRegistry::instance().getType(auxid)->name() - << ") has different type than the branch " << branch_tname; - msg << " Attempting schema evolution."; - - const std::type_info *tinf = store.getIOType(auxid); - brInfo.SE_tclass = TClass::GetClass(*tinf); + msg << "attribute '" << brInfo.attribName << "' (id=" << auxid + << " typename=" << SG::normalizedTypeinfoName(*reg_ti) + << ") has different type than the branch: " << branch_tname; + msg << " Marking for schema evolution."; + + brInfo.SE_tclass = TClass::GetClass(*io_tinf); brInfo.SE_edt = kOther_t; if( !brInfo.SE_tclass ) { - brInfo.SE_edt = TDataType::GetType(*tinf); + brInfo.SE_edt = TDataType::GetType(*io_tinf); if( brInfo.SE_edt <=0 ) { brInfo.status = BranchInfo::TypeError; throw string("Error getting ROOT type for AUX branch ") + brInfo.branch->GetName() - + " typeinfo=" + tinf->name(); + + " typeinfo=" + io_tinf->name(); } } } diff --git a/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.h b/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.h index 092ed0171aecabb66d011066681101cc4bc4edaf..2fb03a9a0e3ec3bd505b6b3e2a02d28f153d7d0f 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.h +++ b/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynReader.h @@ -26,12 +26,14 @@ public : TBranch* branch = 0; TClass* tclass = 0; + EDataType edtyp = kOther_t; + // to handle type differences + bool needsSE = false; TClass* SE_tclass = 0; - EDataType SE_edt = kOther_t; + EDataType SE_edt = kOther_t; bool isPackedContainer = false; - bool needsSE = false; enum Status status = NotInitialized; SG::auxid_t auxid; diff --git a/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynWriter.cxx b/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynWriter.cxx index c1c16e3d6b5e98f869dfb4ab0fc83c4061b4ab69..5c707ad6f799367c630fb9235637c24a471ccf92 100644 --- a/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynWriter.cxx +++ b/Database/AthenaRoot/RootAuxDynIO/src/TBranchAuxDynWriter.cxx @@ -77,8 +77,8 @@ namespace RootAuxDynIO else if( ti == typeid(Int_t) ) createBasicAuxBranch("/I"); else if( ti == typeid(Double_t) ) createBasicAuxBranch("/D"); else if( ti == typeid(Float_t) ) createBasicAuxBranch("/F"); - else if( ti == typeid(Long64_t) ) createBasicAuxBranch("/L"); - else if( ti == typeid(ULong64_t) ) createBasicAuxBranch("/l"); + else if( ti == typeid(Long64_t) or ti == typeid(std::int64_t) ) createBasicAuxBranch("/L"); + else if( ti == typeid(ULong64_t) or ti == typeid(std::uint64_t) ) createBasicAuxBranch("/l"); else if( ti == typeid(Short_t) ) createBasicAuxBranch("/S"); else if( ti == typeid(UShort_t) ) createBasicAuxBranch("/s"); else if( ti == typeid(Char_t) ) createBasicAuxBranch("/B"); diff --git a/Database/EventIndex/EventIndexProducer/scripts/AODEventPicking.py b/Database/EventIndex/EventIndexProducer/scripts/AODEventPicking.py index eb31771bac04921db7e724767c3220832a192dae..621e6ae72db9003dc968b128e38d68ce1cc7879c 100755 --- a/Database/EventIndex/EventIndexProducer/scripts/AODEventPicking.py +++ b/Database/EventIndex/EventIndexProducer/scripts/AODEventPicking.py @@ -18,6 +18,7 @@ class PyxAODEvtFilter(Alg): kw['name'] = name super(PyxAODEvtFilter, self).__init__(**kw) self.evtList = kw.get('evtList', None) + self.isMC = kw.get('isMC', False) return # Initialize the algorithm @@ -33,10 +34,13 @@ class PyxAODEvtFilter(Alg): ei = self.sg.retrieve('xAOD::EventInfo', 'EventInfo') runNumber = ei.runNumber() eventNumber = ei.eventNumber() + mcChannelNumber = ei.mcChannelNumber() # Check to see if we should accept or reject the event if (runNumber, eventNumber) in self.evtList: self.setFilterPassed(True) + elif self.isMC and (mcChannelNumber, eventNumber) in self.evtList: + self.setFilterPassed(True) else: self.setFilterPassed(False) @@ -96,7 +100,7 @@ if '__main__' in __name__: cfg.merge(PoolReadCfg(flags)) # Setup event picking - cfg.addEventAlgo(PyxAODEvtFilter('EventFilterAlg', evtList = evtList), sequenceName = 'AthAlgSeq') + cfg.addEventAlgo(PyxAODEvtFilter('EventFilterAlg', evtList = evtList, isMC = flags.Input.isMC), sequenceName = 'AthAlgSeq') # Configure the output stream log.info('== Configuring Output Stream') diff --git a/Database/PersistentDataModelAthenaPool/src/DataHeaderCnv.cxx b/Database/PersistentDataModelAthenaPool/src/DataHeaderCnv.cxx index e4d4fb129fe8b86b66c17a64081fe6c8147e60f3..152dae630cf534ad7ec5bda90eb7f11387b4081a 100755 --- a/Database/PersistentDataModelAthenaPool/src/DataHeaderCnv.cxx +++ b/Database/PersistentDataModelAthenaPool/src/DataHeaderCnv.cxx @@ -402,16 +402,7 @@ DataHeader_p6* DataHeaderCnv::createPersistent(DataHeader* transObj, DataHeaderF //______________________________________________________________________________ void DataHeaderCnv::removeBadElements(DataHeader* dh) { - auto iter = dh->m_dataHeader.begin(); - while( iter != dh->m_dataHeader.end() ) { - if( iter->getToken()->dbID() == Guid::null() ) { - ATH_MSG_WARNING("Removed incomplete DataObject Element"); - iter = dh->m_dataHeader.erase(iter); - } else { - ++iter; - } - } - iter = dh->m_inputDataHeader.begin(); + auto iter = dh->m_inputDataHeader.begin(); while( iter != dh->m_inputDataHeader.end() ) { if( iter->getToken()->dbID() == Guid::null() ) { ATH_MSG_WARNING("Removed incomplete Input Element"); diff --git a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc index 6f0f0eca2b8982d8172da3bc012386bf5b2e58ab..84ebb18f5750283baab6e3c112636bfecb31277e 100755 --- a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc +++ b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "GeoPrimitives/CLHEPtoEigenConverter.h" @@ -53,12 +53,28 @@ inline HepGeom::Point3D<double> GeoSiHit::getGlobalPosition() const { } if (geoelement) { + if(m_hit->isHGTD()){ + // This special treatment is necessary because the localStartPosition and localEndPosition + // of the SiHit in the HGTD SD class https://gitlab.cern.ch/atlas/athena/-/blob/master/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/src/HGTDSensorGmxSD.cxx#L83-L89 + // are set with coordinates in the (y, z, x) order. + const HepGeom::Point3D<double> localHit = m_hit->localStartPosition(); + HepGeom::Point3D<double> flippedHit; + flippedHit[0]=localHit.y(); + flippedHit[1]=localHit.z(); + flippedHit[2]=localHit.x(); + const HepGeom::Point3D<double> globalStartPos = Amg::EigenTransformToCLHEP(geoelement->transformHit()) * (flippedHit); + double x=globalStartPos.x(); + double y=globalStartPos.y(); + double z=globalStartPos.z(); + return HepGeom::Point3D<double>(x,y,z); + }else{ const HepGeom::Point3D<double> globalStartPos = Amg::EigenTransformToCLHEP(geoelement->transformHit()) * HepGeom::Point3D<double>(m_hit->localStartPosition()); double x=globalStartPos.x(); double y=globalStartPos.y(); double z=globalStartPos.z(); return HepGeom::Point3D<double>(x,y,z); + } } return HepGeom::Point3D<double>(0.0,0.0,0.0); diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h index f06879ab0100d25a37b185c0f14442b18addce0b..c0c0fe9057a5ba239099f39d13797d86a61869b9 100755 --- a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h @@ -6,73 +6,57 @@ #define GEOMODELUTILITIES_GEOALIGNMENTSTORE_H /// Ensure that the extensions for the Vector3D are properly loaded -#include "GeoPrimitives/GeoPrimitives.h" +#include <stdexcept> -#include "GeoModelKernel/GeoVAlignmentStore.h" -#include "GeoModelKernel/GeoDefinitions.h" -#include "GeoModelUtilities/TransformMap.h" #include "AthenaKernel/CLASS_DEF.h" #include "AthenaKernel/CondCont.h" -#include <stdexcept> +#include "GeoModelKernel/GeoDefinitions.h" +#include "GeoModelKernel/GeoVAlignmentStore.h" +#include "GeoModelUtilities/TransformMap.h" +#include "GeoPrimitives/GeoPrimitives.h" -class GeoAlignmentStore : public GeoVAlignmentStore -{ - public: - GeoAlignmentStore() {} - virtual ~GeoAlignmentStore() override {} +class GeoAlignmentStore : public GeoVAlignmentStore { +public: + GeoAlignmentStore() = default; + virtual ~GeoAlignmentStore() override = default; - virtual void setDelta(const GeoAlignableTransform*, const GeoTrf::Transform3D&) override; - virtual const GeoTrf::Transform3D* getDelta(const GeoAlignableTransform*) const override; + virtual void setDelta(const GeoAlignableTransform*, const GeoTrf::Transform3D&) override; + virtual const GeoTrf::Transform3D* getDelta(const GeoAlignableTransform*) const override; - virtual void setAbsPosition(const GeoVFullPhysVol*, const GeoTrf::Transform3D&) override; - virtual const GeoTrf::Transform3D* getAbsPosition(const GeoVFullPhysVol*) const override; + virtual void setAbsPosition(const GeoVFullPhysVol*, const GeoTrf::Transform3D&) override; + virtual const GeoTrf::Transform3D* getAbsPosition(const GeoVFullPhysVol*) const override; - virtual void setDefAbsPosition(const GeoVFullPhysVol*, const GeoTrf::Transform3D&) override; - virtual const GeoTrf::Transform3D* getDefAbsPosition(const GeoVFullPhysVol*) const override; + virtual void setDefAbsPosition(const GeoVFullPhysVol*, const GeoTrf::Transform3D&) override; + virtual const GeoTrf::Transform3D* getDefAbsPosition(const GeoVFullPhysVol*) const override; + bool append(const GeoAlignmentStore& other); - protected: - TransformMap<GeoAlignableTransform,GeoTrf::Transform3D> m_deltas; - TransformMap<GeoVFullPhysVol,GeoTrf::Transform3D> m_absPositions; - TransformMap<GeoVFullPhysVol,GeoTrf::Transform3D> m_defAbsPositions; +protected: + TransformMap<GeoAlignableTransform, GeoTrf::Transform3D> m_deltas; + TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D> m_absPositions; + TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D> m_defAbsPositions; - public: - const TransformMap<GeoAlignableTransform,GeoTrf::Transform3D>& - getDeltas() const; +public: + const TransformMap<GeoAlignableTransform, GeoTrf::Transform3D>& getDeltas() const; - const TransformMap<GeoVFullPhysVol,GeoTrf::Transform3D>& - getAbsPositions() const; + const TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D>& getAbsPositions() const; - const TransformMap<GeoVFullPhysVol,GeoTrf::Transform3D>& - getDefAbsPositions() const; + const TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D>& getDefAbsPositions() const; }; CLASS_DEF(GeoAlignmentStore, 135648236, 1) -CONDCONT_DEF( GeoAlignmentStore , 33985726 ); +CONDCONT_DEF(GeoAlignmentStore, 33985726); class ExcAlignmentStore : public std::runtime_error { - public: - ExcAlignmentStore (const std::string& what) - : std::runtime_error (what) - {} - ExcAlignmentStore (const char* what) - : std::runtime_error (what) - {} +public: + ExcAlignmentStore(const std::string& what) : std::runtime_error(what) {} + ExcAlignmentStore(const char* what) : std::runtime_error(what) {} }; -inline -const TransformMap<GeoAlignableTransform,GeoTrf::Transform3D>& -GeoAlignmentStore::getDeltas() const { return m_deltas; } - -inline -const TransformMap<GeoVFullPhysVol,GeoTrf::Transform3D>& -GeoAlignmentStore::getAbsPositions() const { return m_absPositions; } - -inline -const TransformMap<GeoVFullPhysVol,GeoTrf::Transform3D>& -GeoAlignmentStore::getDefAbsPositions() const { return m_defAbsPositions; } - -#endif +inline const TransformMap<GeoAlignableTransform, GeoTrf::Transform3D>& GeoAlignmentStore::getDeltas() const { return m_deltas; } +inline const TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D>& GeoAlignmentStore::getAbsPositions() const { return m_absPositions; } +inline const TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D>& GeoAlignmentStore::getDefAbsPositions() const { return m_defAbsPositions; } +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransformMap.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransformMap.h index 165381f9aba014ac088f62a9ce548c5eeb227786..bd488d8611451ff7a7eff043b20920f23904a20a 100755 --- a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransformMap.h +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransformMap.h @@ -1,51 +1,47 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELUTILITIES_TRANSFORMMAP_H #define GEOMODELUTILITIES_TRANSFORMMAP_H +#include <memory> #include <unordered_map> -template<typename T, typename X> -class TransformMap { - public: - TransformMap() {}; - ~TransformMap() {}; +template <typename T, typename X> class TransformMap { +public: + TransformMap() = default; + ~TransformMap() = default; - bool setTransform(const T* obj, const X& xf); - const X* getTransform(const T* obj) const; + bool setTransform(const T *obj, const X &xf); + const X *getTransform(const T *obj) const; - const std::unordered_map<const T*, X>& container() const; + bool append(const TransformMap &other); - private: - std::unordered_map<const T*, X> m_container; +private: + std::unordered_map<const T *, std::shared_ptr<const X>> m_container; }; -template<typename T, typename X> -bool TransformMap<T,X>::setTransform(const T* obj, const X& xf) -{ - bool result = m_container.find(obj) == m_container.end(); - m_container[obj] = xf; - return result; +template <typename T, typename X> bool TransformMap<T, X>::setTransform(const T *obj, const X &xf) { + std::shared_ptr<const X> &newObj = m_container[obj]; + bool good = !newObj; + newObj = std::make_shared<X>(xf); + return good; } -template<typename T, typename X> -const X* TransformMap<T,X>::getTransform(const T* obj) const -{ - auto it = m_container.find(obj); - if(it!=m_container.end()) { - return &it->second; - } - else { +template <typename T, typename X> const X *TransformMap<T, X>::getTransform(const T *obj) const { + auto it = m_container.find(obj); + if (it != m_container.end()) return it->second.get(); return nullptr; - } } -template<typename T, typename X> -const std::unordered_map<const T*, X>& TransformMap<T,X>::container() const -{ - return m_container; +template <typename T, typename X> bool TransformMap<T, X>::append(const TransformMap &other) { + bool allGood{true}; + for (const auto &[key, value] : other.m_container) { + std::shared_ptr<const X> &newObj = m_container[key]; + allGood &= !newObj; + newObj = value; + } + return allGood; } - #endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransientConstSharedPtr.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransientConstSharedPtr.h new file mode 100644 index 0000000000000000000000000000000000000000..d5154ff24360fc54d47837b506cd87741c8772b6 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/TransientConstSharedPtr.h @@ -0,0 +1,67 @@ + +/* + * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. + */ +#ifndef GEOMODELUTILITIES_TRANSIENTCONSTSHAREDPTR_H +#define GEOMODELUTILITIES_TRANSIENTCONSTSHAREDPTR_H + +#include <memory> +namespace GeoModel { + /// The TransientConstSharedPtr allows non-const access if the pointer itself + /// is non-const but in the const case only a const pointer is returned + /// The class takes the ownership of the object using a shared_ptr + template <typename Obj> class TransientConstSharedPtr { + public: + /// Get (non-const) access to the underlying object + Obj* get() { return m_ptr.get(); } + Obj* operator->() { return get(); } + /// Get const access to the underlying object + const Obj* get() const { return m_ptr.get(); } + const Obj* operator->() const { return get(); } + + /// Constructor from unique_ptr + TransientConstSharedPtr(std::unique_ptr<Obj> ptr) : m_ptr{std::move(ptr)} {} + /// Constructor from shared_ptr + TransientConstSharedPtr(std::shared_ptr<Obj> ptr) : m_ptr{std::move(ptr)} {} + /// Constructor from raw ptr + TransientConstSharedPtr(Obj* ptr) : m_ptr{ptr} {} + + /// Standard constructor + TransientConstSharedPtr() = default; + /// Delete the copy constructor if the object is const + TransientConstSharedPtr(const TransientConstSharedPtr& other) = default; + /// Standard move constructor + TransientConstSharedPtr(TransientConstSharedPtr&& other) = default; + + /// Assignment operator + TransientConstSharedPtr& operator=(const TransientConstSharedPtr& other) = default; + TransientConstSharedPtr& operator=(const std::shared_ptr<Obj>& other) { + m_ptr = other.m_ptr; + return *this; + } + /// Move assignment operator + TransientConstSharedPtr& operator=(TransientConstSharedPtr&& other) = default; + TransientConstSharedPtr& operator=(std::unique_ptr<Obj>&& other) { + m_ptr = std::move(other); + return *this; + } + TransientConstSharedPtr& operator=(std::shared_ptr<Obj>&& other) { + m_ptr = std::move(other); + return *this; + } + /// Overload the pointer + void reset(std::unique_ptr<Obj> newObj = nullptr) { m_ptr = std::move(newObj); } + /// Release the memory + std::shared_ptr<const Obj> release() { return std::move(m_ptr); } + /// Is the pointer defined + operator bool() const { return m_ptr.get() != nullptr; } + bool operator!() const { return !m_ptr; } + + /// Smaller operator to insert the pointer into sets + bool operator<(const TransientConstSharedPtr& other) const { return m_ptr.get() < other.m_ptr.get(); } + + private: + std::shared_ptr<Obj> m_ptr{}; + }; +} // namespace GeoModel +#endif \ No newline at end of file diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx index eca439f19139c94bb488c81f2711a4ae84894c32..5a59b67a29d9c7570a04a34bd5f00973458a7c0d 100644 --- a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx @@ -4,32 +4,22 @@ #include "GeoModelUtilities/GeoAlignmentStore.h" -void GeoAlignmentStore::setDelta(const GeoAlignableTransform* axf, const GeoTrf::Transform3D& xf) -{ - m_deltas.setTransform(axf, xf); -} +void GeoAlignmentStore::setDelta(const GeoAlignableTransform* axf, const GeoTrf::Transform3D& xf) { m_deltas.setTransform(axf, xf); } -const GeoTrf::Transform3D* GeoAlignmentStore::getDelta(const GeoAlignableTransform* axf) const -{ - return m_deltas.getTransform(axf); -} +const GeoTrf::Transform3D* GeoAlignmentStore::getDelta(const GeoAlignableTransform* axf) const { return m_deltas.getTransform(axf); } -void GeoAlignmentStore::setAbsPosition(const GeoVFullPhysVol* fpv, const GeoTrf::Transform3D& xf) -{ - m_absPositions.setTransform(fpv,xf); -} - -const GeoTrf::Transform3D* GeoAlignmentStore::getAbsPosition(const GeoVFullPhysVol* fpv) const -{ - return m_absPositions.getTransform(fpv); -} +void GeoAlignmentStore::setAbsPosition(const GeoVFullPhysVol* fpv, const GeoTrf::Transform3D& xf) { m_absPositions.setTransform(fpv, xf); } + +const GeoTrf::Transform3D* GeoAlignmentStore::getAbsPosition(const GeoVFullPhysVol* fpv) const { return m_absPositions.getTransform(fpv); } -void GeoAlignmentStore::setDefAbsPosition(const GeoVFullPhysVol* fpv, const GeoTrf::Transform3D& xf) -{ - m_defAbsPositions.setTransform(fpv,xf); +void GeoAlignmentStore::setDefAbsPosition(const GeoVFullPhysVol* fpv, const GeoTrf::Transform3D& xf) { + m_defAbsPositions.setTransform(fpv, xf); } -const GeoTrf::Transform3D* GeoAlignmentStore::getDefAbsPosition(const GeoVFullPhysVol* fpv) const -{ - return m_defAbsPositions.getTransform(fpv); +const GeoTrf::Transform3D* GeoAlignmentStore::getDefAbsPosition(const GeoVFullPhysVol* fpv) const { + return m_defAbsPositions.getTransform(fpv); +} +bool GeoAlignmentStore::append(const GeoAlignmentStore& other) { + return m_absPositions.append(other.m_absPositions) && m_defAbsPositions.append(other.m_defAbsPositions) && + m_deltas.append(other.m_deltas); } diff --git a/DetectorDescription/ReadoutGeometryBase/ReadoutGeometryBase/DetectorDesign.h b/DetectorDescription/ReadoutGeometryBase/ReadoutGeometryBase/DetectorDesign.h index 3f5aefca2a7e645404c7dc6ff4f31659b6d0edea..5923200fad449c344a9faa895d195d0ac191a0fc 100644 --- a/DetectorDescription/ReadoutGeometryBase/ReadoutGeometryBase/DetectorDesign.h +++ b/DetectorDescription/ReadoutGeometryBase/ReadoutGeometryBase/DetectorDesign.h @@ -106,11 +106,6 @@ public: virtual SiIntersect inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const; - /** Test if point is in the active part of the detector with specified tolerances - allows forcing of most stringent check*/ - virtual SiIntersect inDetector(const SiLocalPosition &localPosition, double phiTol, - double etaTol, bool forceStringentCheck) const; - - /** Override default symmetries to prevent swapping of axes. NB. Flags can be changed from true to false but not false to true. */ void setSymmetry(bool phiSymmetric, bool etaSymmetric, bool depthSymmetric); diff --git a/DetectorDescription/ReadoutGeometryBase/src/DetectorDesign.cxx b/DetectorDescription/ReadoutGeometryBase/src/DetectorDesign.cxx index 5cc9810b9b9e6dd618ebcb585076f3dd6f981a8d..16685c660eda4a15defbbc43e4cf320e61c7a1f3 100644 --- a/DetectorDescription/ReadoutGeometryBase/src/DetectorDesign.cxx +++ b/DetectorDescription/ReadoutGeometryBase/src/DetectorDesign.cxx @@ -127,11 +127,6 @@ SiIntersect DetectorDesign::inDetector(const SiLocalPosition &localPosition, return state; } -SiIntersect DetectorDesign::inDetector(const SiLocalPosition &localPosition, - double phiTol, double etaTol, bool /*forceStringent*/ ) const { - return inDetector(localPosition,phiTol,etaTol); -} - const Amg::Transform3D DetectorDesign::moduleShift() const { return Amg::Transform3D::Identity(); } diff --git a/Event/DumpEventDataToJSON/CMakeLists.txt b/Event/DumpEventDataToJSON/CMakeLists.txt index 494b017597f64939389e4da808b13c68923b204f..cd9a0962727b7e0abd64fee876ae9b2d84137697 100644 --- a/Event/DumpEventDataToJSON/CMakeLists.txt +++ b/Event/DumpEventDataToJSON/CMakeLists.txt @@ -10,7 +10,7 @@ find_package( nlohmann_json ) atlas_add_component( DumpEventDataToJSON src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps CaloEvent GaudiKernel StoreGateLib TrkExInterfaces MuonPrepRawData InDetPrepRawData TrkTrack nlohmann_json::nlohmann_json xAODCaloEvent xAODEventInfo xAODJet xAODMuon xAODTracking ) + LINK_LIBRARIES ActsTrkEventLib AthenaBaseComps CaloEvent GaudiKernel StoreGateLib TrkExInterfaces MuonPrepRawData InDetPrepRawData TrkTrack nlohmann_json::nlohmann_json xAODCaloEvent xAODEventInfo xAODJet xAODMuon xAODTracking ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx b/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx index 203de515376ee03de746176b900d2289804192c7..25c9403a500b1f735a57972154e0a1663d7ed82c 100644 --- a/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx +++ b/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx @@ -2,32 +2,47 @@ Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/MsgStream.h" +#include "DumpEventDataToJsonAlg.h" + +#include <cmath> +#include <fstream> +#include <string> + +#include "Acts/EventData/TrackContainer.hpp" +#include "ActsTrkEvent/MultiTrajectory.h" #include "Gaudi/Property.h" #include "GaudiKernel/Algorithm.h" +#include "GaudiKernel/MsgStream.h" #include "GeoPrimitives/GeoPrimitivesHelpers.h" +#include "xAODTracking/TrackJacobianAuxContainer.h" +#include "xAODTracking/TrackJacobianContainer.h" +#include "xAODTracking/TrackMeasurementAuxContainer.h" +#include "xAODTracking/TrackMeasurementContainer.h" +#include "xAODTracking/TrackParametersAuxContainer.h" +#include "xAODTracking/TrackParametersContainer.h" +#include "xAODTracking/TrackStateAuxContainer.h" +#include "xAODTracking/TrackStateContainer.h" -#include "DumpEventDataToJsonAlg.h" - -#include <string> -#include <fstream> -#include <cmath> DumpEventDataToJsonAlg::DumpEventDataToJsonAlg(const std::string &name, ISvcLocator *pSvcLocator) - : AthAlgorithm(name, pSvcLocator) -{ -} + : AthAlgorithm(name, pSvcLocator) {} -StatusCode DumpEventDataToJsonAlg::initialize() -{ +StatusCode DumpEventDataToJsonAlg::initialize() { ATH_CHECK(m_eventInfoKey.initialize()); - ATH_CHECK(m_trackParticleKeys.initialize()); - ATH_CHECK(m_jetKeys.initialize()); - ATH_CHECK(m_caloClustersKeys.initialize()); - ATH_CHECK(m_caloCellKey.initialize()); - ATH_CHECK(m_muonKeys.initialize()); - ATH_CHECK(m_trackCollectionKeys.initialize()); + ATH_CHECK(m_trackParticleKeys.initialize(!m_trackParticleKeys.empty())); + ATH_CHECK(m_jetKeys.initialize(!m_jetKeys.empty())); + ATH_CHECK(m_caloClustersKeys.initialize(!m_caloClustersKeys.empty())); + ATH_CHECK(m_caloCellKey.initialize(!m_caloCellKey.empty())); + ATH_CHECK(m_muonKeys.initialize(!m_muonKeys.empty())); + ATH_CHECK(m_trackCollectionKeys.initialize(!m_trackCollectionKeys.empty())); + + // ACTS + ATH_CHECK(m_vectorTrackContainerKeys.initialize()); + ATH_CHECK(m_trackStatesKeys.initialize()); + ATH_CHECK(m_jacobiansKeys.initialize()); + ATH_CHECK(m_measurementsKeys.initialize()); + ATH_CHECK(m_parametersKeys.initialize()); if (!m_cscPrepRawDataKey.empty()) ATH_CHECK(m_cscPrepRawDataKey.initialize()); @@ -48,34 +63,53 @@ StatusCode DumpEventDataToJsonAlg::initialize() if (!m_trtPrepRawDataKey.empty()) ATH_CHECK(m_trtPrepRawDataKey.initialize()); - - if (m_extrapolateTrackParticless) - { + if (m_extrapolateTrackParticless) { ATH_CHECK(m_extrapolator.retrieve()); - } - else - { + } else { m_extrapolator.disable(); } return StatusCode::SUCCESS; } -StatusCode DumpEventDataToJsonAlg::execute() -{ +// Specialisation for TrackProxy +template <> +nlohmann::json DumpEventDataToJsonAlg::getData(const Acts::TrackProxy<Acts::ConstVectorTrackContainer, ActsTrk::MultiTrajectory<true>, Acts::detail::ConstRefHolder, true> &track) { + nlohmann::json data; + + // ACTS units are GeV, whilst ATLAS is MeV. So we need to convert. + data["dparams"] = {track.loc0(), track.loc1(), track.phi(), track.theta(), track.qOverP() * 0.001}; + + unsigned int count=0; + for ( auto tsos : track.trackStates() ) { + // Currently only converting smoothed states, but we will extend this later. + if (tsos.hasSmoothed()) { + data["pos"].push_back(tsos.smoothed().x()); + data["pos"].push_back(tsos.smoothed().y()); + data["pos"].push_back(tsos.smoothed().z()); + } + count++; + + // TODO: Add measurements etc + } + ATH_MSG_VERBOSE("Track has " << count << " states."); + + return data; +} + +StatusCode DumpEventDataToJsonAlg::execute() { SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey); - if (!eventInfo.isValid()) - { + if (!eventInfo.isValid()) { ATH_MSG_WARNING("Did not find xAOD::EventInfo at " << m_eventInfoKey); return StatusCode::SUCCESS; } - if (m_dumpTestEvent) - { + if (m_dumpTestEvent) { prependTestEvent(); m_dumpTestEvent = false; } - ATH_MSG_VERBOSE("Run num :" << eventInfo->runNumber() << " Event num: " << eventInfo->eventNumber()); + ATH_MSG_VERBOSE("Run num :" << eventInfo->runNumber() + << " Event num: " << eventInfo->eventNumber()); nlohmann::json j; j["event number"] = eventInfo->eventNumber(); @@ -88,6 +122,40 @@ StatusCode DumpEventDataToJsonAlg::execute() ATH_CHECK(getAndFillArrayOfContainers(j, m_caloCellKey, "CaloCells")); ATH_CHECK(getAndFillArrayOfContainers(j, m_trackCollectionKeys, "Tracks")); + // ACTS + auto vtcHandles = m_vectorTrackContainerKeys.makeHandles(); + auto tsHandles = m_trackStatesKeys.makeHandles(); + auto jHandles = m_jacobiansKeys.makeHandles(); + auto mHandles = m_measurementsKeys.makeHandles(); + auto pHandles = m_parametersKeys.makeHandles(); + + unsigned int i = 0; + for ( ; i < vtcHandles.size(); ++i) { + SG::ReadHandle<Acts::ConstVectorTrackContainer> vtcHandle = vtcHandles[i]; + SG::ReadHandle<xAOD::TrackStateContainer> tsHandle = tsHandles[i]; + SG::ReadHandle<xAOD::TrackJacobianContainer> jHandle = jHandles[i]; + SG::ReadHandle<xAOD::TrackMeasurementContainer> mHandle = mHandles[i]; + SG::ReadHandle<xAOD::TrackParametersContainer> pHandle = pHandles[i]; + + // Temporary debugging information + ATH_MSG_VERBOSE("TrackStateContainer has "<< tsHandle->size() << " elements"); + ATH_MSG_VERBOSE("TrackParametersContainer has "<< pHandle->size() << " elements"); + + + ATH_MSG_VERBOSE("Trying to load " << vtcHandle.key() << " with " << vtcHandle->size_impl() << " tracks"); + + auto multiTraj = std::make_unique<ActsTrk::ConstMultiTrajectory>(&(*tsHandle), &(*pHandle), &(*jHandle), &(*mHandle)); + + Acts::TrackContainer<Acts::ConstVectorTrackContainer, + ActsTrk::ConstMultiTrajectory, Acts::detail::ConstRefHolder> + tc{*vtcHandle, *multiTraj}; + ATH_MSG_VERBOSE("Found " << tc.size() << " tracks in " << vtcHandle.key()); + for (auto track : tc) { + nlohmann::json tmp = getData(track); + j["TrackContainers"][vtcHandle.key()].push_back(tmp); + } + } + // hits ATH_CHECK(getAndFillContainer(j, m_cscPrepRawDataKey, "Hits")); ATH_CHECK(getAndFillContainer(j, m_mdtPrepRawDataKey, "Hits")); @@ -97,23 +165,26 @@ StatusCode DumpEventDataToJsonAlg::execute() ATH_CHECK(getAndFillContainer(j, m_mmPrepRawDataKey, "Hits")); ATH_CHECK(getAndFillContainer(j, m_pixelPrepRawDataKey, "Hits")); ATH_CHECK(getAndFillContainer(j, m_sctPrepRawDataKey, "Hits")); - // ATH_CHECK(getAndFillContainer(j, m_trtPrepRawDataKey, "Hits")); // Need specialisation. TODO. + // ATH_CHECK(getAndFillContainer(j, m_trtPrepRawDataKey, "Hits")); // Need + // specialisation. TODO. - // For the moment the label is just the event/run number again, but can be manually overwritten in the output file - std::string label = std::to_string(eventInfo->eventNumber()) + "/" + std::to_string(eventInfo->runNumber()); + // For the moment the label is just the event/run number again, but can be + // manually overwritten in the output file + std::string label = std::to_string(eventInfo->eventNumber()) + "/" + + std::to_string(eventInfo->runNumber()); m_eventData[label] = j; return StatusCode::SUCCESS; } -void DumpEventDataToJsonAlg::prependTestEvent() -{ +void DumpEventDataToJsonAlg::prependTestEvent() { ATH_MSG_VERBOSE("Prepending a test event."); nlohmann::json j; // FIXME - this - auto writeEtaPhiLabel = [](float eta, float phi) - { return std::to_string(eta) + "/" + std::to_string(phi); }; + auto writeEtaPhiLabel = [](float eta, float phi) { + return std::to_string(eta) + "/" + std::to_string(phi); + }; j["event number"] = 999; j["run number"] = 999; @@ -122,12 +193,12 @@ void DumpEventDataToJsonAlg::prependTestEvent() unsigned int maxSteps = 3; Amg::Vector3D trackPos; float phi, eta; - for (unsigned int nPhi = 0; nPhi < maxSteps; ++nPhi) - { - phi = static_cast<float>(nPhi) / static_cast<float>(maxSteps) * M_PI; // Want to range from 0 to M_PI - for (unsigned int nEta = 0; nEta < maxSteps; ++nEta) - { - eta = static_cast<float>(nEta) / static_cast<float>(maxSteps) * 3.0; // Want to range from 0 to 3.0 + for (unsigned int nPhi = 0; nPhi < maxSteps; ++nPhi) { + phi = static_cast<float>(nPhi) / static_cast<float>(maxSteps) * + M_PI; // Want to range from 0 to M_PI + for (unsigned int nEta = 0; nEta < maxSteps; ++nEta) { + eta = static_cast<float>(nEta) / static_cast<float>(maxSteps) * + 3.0; // Want to range from 0 to 3.0 // Create a calo cluster at each value nlohmann::json cluster; @@ -154,8 +225,7 @@ void DumpEventDataToJsonAlg::prependTestEvent() // d0, z0, phi, theta, qOverP track["dparams"] = {0.0, 0.0, phi, theta, 0.0}; // Add three positions (less than this might not count as a) - for (unsigned int i = 0; i < 4; ++i) - { + for (unsigned int i = 0; i < 4; ++i) { Amg::setRThetaPhi(trackPos, i * 1000., theta, phi); track["pos"].push_back({trackPos.x(), trackPos.y(), trackPos.z()}); } @@ -167,18 +237,15 @@ void DumpEventDataToJsonAlg::prependTestEvent() } template <class TYPE> -StatusCode DumpEventDataToJsonAlg::getAndFillArrayOfContainers(nlohmann::json &event, - const SG::ReadHandleKeyArray<TYPE> &keys, - const std::string &jsonType) -{ - for (SG::ReadHandle<TYPE> handle : keys.makeHandles()) - { +StatusCode DumpEventDataToJsonAlg::getAndFillArrayOfContainers( + nlohmann::json &event, const SG::ReadHandleKeyArray<TYPE> &keys, + const std::string &jsonType) { + for (SG::ReadHandle<TYPE> handle : keys.makeHandles()) { ATH_MSG_VERBOSE("Trying to load " << handle.key()); ATH_CHECK(handle.isValid()); ATH_MSG_VERBOSE("Got back " << handle->size()); - for (auto object : *handle) - { + for (auto object : *handle) { nlohmann::json tmp = getData(*object); event[jsonType][handle.key()].push_back(tmp); } @@ -188,8 +255,7 @@ StatusCode DumpEventDataToJsonAlg::getAndFillArrayOfContainers(nlohmann::json &e // Specialisation for Jets template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::Jet &jet) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::Jet &jet) { nlohmann::json data; data["phi"] = jet.phi(); data["eta"] = jet.eta(); @@ -199,8 +265,7 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::Jet &jet) // Specialisation for CaloClusters template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::CaloCluster &clust) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::CaloCluster &clust) { nlohmann::json data; data["phi"] = clust.phi(); data["eta"] = clust.eta(); @@ -212,8 +277,7 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::CaloCluster &clust) // Specialisation for CaloCells template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const CaloCell &cell) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const CaloCell &cell) { nlohmann::json data; data["phi"] = cell.phi(); data["eta"] = cell.eta(); @@ -225,45 +289,41 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const CaloCell &cell) // Specialisation for TracksParticles template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::TrackParticle &tp) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::TrackParticle &tp) { nlohmann::json data; data["chi2"] = tp.chiSquared(); data["dof"] = tp.numberDoF(); data["dparams"] = {tp.d0(), tp.z0(), tp.phi0(), tp.theta(), tp.qOverP()}; - if (!m_extrapolateTrackParticless) - { - data["pos"] = {tp.perigeeParameters().position().x(), tp.perigeeParameters().position().y(), tp.perigeeParameters().position().z()}; - for (unsigned int i = 0; i < tp.numberOfParameters(); ++i) - { + if (!m_extrapolateTrackParticless) { + data["pos"] = {tp.perigeeParameters().position().x(), + tp.perigeeParameters().position().y(), + tp.perigeeParameters().position().z()}; + for (unsigned int i = 0; i < tp.numberOfParameters(); ++i) { data["pos"].push_back(tp.parameterX(i)); data["pos"].push_back(tp.parameterY(i)); data["pos"].push_back(tp.parameterZ(i)); } - } - else - { + } else { std::vector<Amg::Vector3D> positions; const Trk::Perigee &peri = tp.perigeeParameters(); - positions.push_back(Amg::Vector3D(peri.position().x(), peri.position().y(), peri.position().z())); + positions.push_back(Amg::Vector3D(peri.position().x(), peri.position().y(), + peri.position().z())); - Trk::CurvilinearParameters startParameters(peri.position(), peri.momentum(), peri.charge()); + Trk::CurvilinearParameters startParameters(peri.position(), peri.momentum(), + peri.charge()); Trk::ExtrapolationCell<Trk::TrackParameters> ecc(startParameters); ecc.addConfigurationMode(Trk::ExtrapolationMode::StopAtBoundary); ecc.addConfigurationMode(Trk::ExtrapolationMode::CollectPassive); ecc.addConfigurationMode(Trk::ExtrapolationMode::CollectSensitive); Trk::ExtrapolationCode eCode = m_extrapolator->extrapolate(ecc); - if (eCode.isSuccess()) - { + if (eCode.isSuccess()) { // loop over the collected information - for (auto &es : ecc.extrapolationSteps) - { + for (auto &es : ecc.extrapolationSteps) { // continue if we have parameters const Trk::TrackParameters *parameters = es.parameters; - if (parameters) - { + if (parameters) { Amg::Vector3D pos = parameters->position(); positions.push_back(pos); delete parameters; @@ -272,16 +332,15 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::TrackParticle &tp) positions.push_back(ecc.endParameters->position()); // Now add the positions to the output - for (auto pos : positions) - { + for (auto pos : positions) { data["pos"].push_back(pos.x()); data["pos"].push_back(pos.y()); data["pos"].push_back(pos.z()); } - } - else - { - ATH_MSG_WARNING("Failure in extrapolation for Track with start parameters " << startParameters); + } else { + ATH_MSG_WARNING( + "Failure in extrapolation for Track with start parameters " + << startParameters); } } return data; @@ -289,8 +348,7 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::TrackParticle &tp) // Specialisation for Tracks template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const Trk::Track &track) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const Trk::Track &track) { nlohmann::json data; const Trk::FitQuality *quality = track.fitQuality(); @@ -298,34 +356,31 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const Trk::Track &track) data["dof"] = (quality ? quality->doubleNumberDoF() : 0.0); const Trk::Perigee *peri = track.perigeeParameters(); - if (peri) - { - data["dparams"] = {peri->parameters()[Trk::d0], peri->parameters()[Trk::z0], peri->parameters()[Trk::phi0], peri->parameters()[Trk::theta], peri->parameters()[Trk::qOverP]}; - - data["pos"] = {peri->position().x(), peri->position().y(), peri->position().z()}; - } - else - { + if (peri) { + data["dparams"] = {peri->parameters()[Trk::d0], peri->parameters()[Trk::z0], + peri->parameters()[Trk::phi0], + peri->parameters()[Trk::theta], + peri->parameters()[Trk::qOverP]}; + + data["pos"] = {peri->position().x(), peri->position().y(), + peri->position().z()}; + } else { data["pos"] = {}; } - const DataVector<const Trk::TrackParameters> *parameters = track.trackParameters(); - if (parameters) - { - for (const Trk::TrackParameters *param : *parameters) - { + const DataVector<const Trk::TrackParameters> *parameters = + track.trackParameters(); + if (parameters) { + for (const Trk::TrackParameters *param : *parameters) { data["pos"].push_back(param->position().x()); data["pos"].push_back(param->position().y()); data["pos"].push_back(param->position().z()); } - } - else - { - const DataVector<const Trk::MeasurementBase> *measurements = track.measurementsOnTrack(); - if (measurements) - { - for (const Trk::MeasurementBase *meas : *measurements) - { + } else { + const DataVector<const Trk::MeasurementBase> *measurements = + track.measurementsOnTrack(); + if (measurements) { + for (const Trk::MeasurementBase *meas : *measurements) { data["pos"].push_back(meas->globalPosition().x()); data["pos"].push_back(meas->globalPosition().y()); data["pos"].push_back(meas->globalPosition().z()); @@ -338,40 +393,37 @@ nlohmann::json DumpEventDataToJsonAlg::getData(const Trk::Track &track) // Specialisation for Muons template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::Muon &muon) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const xAOD::Muon &muon) { nlohmann::json data; data["Phi"] = muon.phi(); data["Eta"] = muon.eta(); std::vector<std::string> quality = {"Tight", "Medium", "Loose", "VeryLoose"}; data["Quality"] = quality[static_cast<unsigned int>(muon.quality())]; - std::vector<std::string> type = {"Combined", "Standalone", "SegmentTagged", "CaloTagged", "SiAssociatedForward"}; + std::vector<std::string> type = {"Combined", "Standalone", "SegmentTagged", + "CaloTagged", "SiAssociatedForward"}; data["Type"] = type[static_cast<unsigned int>(muon.muonType())]; data["PassedHighPt"] = muon.passesHighPtCuts(); addLink(muon.clusterLink(), data["LinkedClusters"]); addLink(muon.inDetTrackParticleLink(), data["LinkedTracks"]); addLink(muon.muonSpectrometerTrackParticleLink(), data["LinkedTracks"]); - addLink(muon.extrapolatedMuonSpectrometerTrackParticleLink(), data["LinkedTracks"]); + addLink(muon.extrapolatedMuonSpectrometerTrackParticleLink(), + data["LinkedTracks"]); return data; } template <class TYPE> -void DumpEventDataToJsonAlg::addLink(const TYPE &link, nlohmann::json &data) -{ - if (link.isValid()) - { +void DumpEventDataToJsonAlg::addLink(const TYPE &link, nlohmann::json &data) { + if (link.isValid()) { data.push_back(link.dataID() + ":" + std::to_string(link.index())); } } -StatusCode DumpEventDataToJsonAlg::finalize() -{ +StatusCode DumpEventDataToJsonAlg::finalize() { std::ofstream outputFile(m_outputJSON_Name); - if (!outputFile.is_open()) - { + if (!outputFile.is_open()) { ATH_MSG_WARNING("Unable to open " << m_outputJSON_Name << " for writing."); return StatusCode::FAILURE; } @@ -380,10 +432,9 @@ StatusCode DumpEventDataToJsonAlg::finalize() } template <class TYPE> -StatusCode DumpEventDataToJsonAlg::getAndFillContainer(nlohmann::json &event, - const SG::ReadHandleKey<TYPE> &key, - const std::string &jsonType) -{ +StatusCode DumpEventDataToJsonAlg::getAndFillContainer( + nlohmann::json &event, const SG::ReadHandleKey<TYPE> &key, + const std::string &jsonType) { if (key.empty()) { return StatusCode::SUCCESS; } @@ -391,11 +442,13 @@ StatusCode DumpEventDataToJsonAlg::getAndFillContainer(nlohmann::json &event, ATH_MSG_VERBOSE("Trying to load " << handle.key()); ATH_CHECK(handle.isValid()); - ATH_MSG_VERBOSE("Which has "<<handle->numberOfCollections()<<" collections: " ); + ATH_MSG_VERBOSE("Which has " << handle->numberOfCollections() + << " collections: "); nlohmann::json tmp = getData(*handle); if (!tmp.is_null()) { - ATH_MSG_VERBOSE("Writing "<<jsonType<<" : "<<handle.key()<<" with"<<tmp.size()<<" elements:"); + ATH_MSG_VERBOSE("Writing " << jsonType << " : " << handle.key() << " with" + << tmp.size() << " elements:"); event[jsonType][handle.key()] = tmp; } return StatusCode::SUCCESS; @@ -403,16 +456,14 @@ StatusCode DumpEventDataToJsonAlg::getAndFillContainer(nlohmann::json &event, // Generic PRD template <class TYPE> -nlohmann::json DumpEventDataToJsonAlg::getData(const TYPE &container) -{ +nlohmann::json DumpEventDataToJsonAlg::getData(const TYPE &container) { nlohmann::json colldata = {}; - for (const auto &coll : container) - { - for (const auto &prd : *coll) - { + for (const auto &coll : container) { + for (const auto &prd : *coll) { nlohmann::json data; - data["pos"] = {prd->globalPosition().x(), prd->globalPosition().y(), prd->globalPosition().z()}; + data["pos"] = {prd->globalPosition().x(), prd->globalPosition().y(), + prd->globalPosition().z()}; Identifier id = prd->identify(); data["id"] = id.get_compact(); colldata.push_back(data); diff --git a/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.h b/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.h index b5591f772d871688b9886d875ebc5c49fc12b1c5..5e1997b4472d5bea281f4c3cf5608001816543b8 100644 --- a/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.h +++ b/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.h @@ -25,6 +25,8 @@ #include "InDetPrepRawData/PixelClusterContainer.h" #include "InDetPrepRawData/SCT_ClusterContainer.h" #include "InDetPrepRawData/TRT_DriftCircleContainer.h" +#include "ActsTrkEvent/MultiTrajectory.h" +#include "Acts/EventData/VectorTrackContainer.hpp" #include <nlohmann/json.hpp> #include <string> #include <vector> @@ -75,6 +77,14 @@ protected: SG::ReadHandleKeyArray<CaloCellContainer> m_caloCellKey{this, "CaloCellContainerKey", {"AllCalo"}, "Key for CaloCell Container"}; SG::ReadHandleKeyArray<TrackCollection> m_trackCollectionKeys{this, "TrackCollectionKeys", {"CombinedInDetTracks", "CombinedMuonTracks", "MuonSpectrometerTracks"}, "Keys for Track Containers"}; + + // ACTS TrackContainer keys + SG::ReadHandleKeyArray<Acts::ConstVectorTrackContainer> m_vectorTrackContainerKeys {this, "VectorTrackContainerKeys", {"ConvertedVectorTrackContainer"}, "Location of the converted VectorTrackContainer"}; + SG::ReadHandleKeyArray<xAOD::TrackStateContainer> m_trackStatesKeys {this, "TrackStatesLocation", {"ConvertedTrackStates"}, "Location of the converted TrackStates"}; + SG::ReadHandleKeyArray<xAOD::TrackJacobianContainer> m_jacobiansKeys {this, "TrackJacobiansLocation", {"ConvertedTrackJacobians"}, "Location of the converted TrackJacobians"}; + SG::ReadHandleKeyArray<xAOD::TrackMeasurementContainer> m_measurementsKeys {this, "TrackMeasurementsLocation", {"ConvertedTrackMeasurements"}, "Location of the converted TrackMeasurements"}; + SG::ReadHandleKeyArray<xAOD::TrackParametersContainer> m_parametersKeys {this, "TrackParametersLocation", {"ConvertedTrackParameters"}, "Location of the converted TrackParameters"}; + SG::ReadHandleKey<Muon::CscPrepDataContainer> m_cscPrepRawDataKey{this, "CscPrepRawDataKey", "CSC_Clusters", "Key for CSC PRD Container"}; SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_mdtPrepRawDataKey{this, "MdtPrepRawDataKey", "MDT_DriftCircles", "Key for MDT PRD Container"}; diff --git a/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx b/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx index 4f77d18f1ce0d5441ac4be06d322d766caf19622..8ccadad804645dc172dee3fd9da6617a584866d1 100644 --- a/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx +++ b/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx @@ -13,6 +13,7 @@ #include "CaloEvent/CaloPrefetch.h" #include <cmath> +#include <limits> namespace { @@ -29,7 +30,8 @@ struct CellAccum std::array<double,CaloSampling::Unknown>& the_posSamNorm, int& the_nBarrel, int& the_nEndcap, - double& the_timeNorm) + double& the_timeNorm, + const bool useGPUCriteria = false) : EnergyInSample(), // NCellsInSample(), // will be collected in moment maker EtaInSample(), @@ -44,12 +46,19 @@ struct CellAccum theNewEta(0), theNewPhi(0), phi0(-999), + maxCell(-1), posNorm (the_posNorm), posSamNorm (the_posSamNorm), nBarrel (the_nBarrel), nEndcap (the_nEndcap), timeNorm (the_timeNorm) - {} + { + if (useGPUCriteria) { + for (size_t i = 0; i < (size_t) CaloSampling::Unknown; ++i) { + MaxEnergyInSample[i] = std::numeric_limits<double>::lowest(); + } + } + } double EnergyInSample[CaloSampling::Unknown]; // int NCellsInSample[CaloSampling::Unknown]; double EtaInSample[CaloSampling::Unknown]; @@ -64,7 +73,8 @@ struct CellAccum double theNewEta; double theNewPhi; double phi0; - + int maxCell; + double& posNorm; std::array<double,CaloSampling::Unknown>& posSamNorm; int& nBarrel; @@ -89,7 +99,7 @@ struct AccumNoWeight //FIXME: The template-base optimizaiton might be unnecessary b/c getting the weight of cell is now CPU-cheap template <class WEIGHT> inline -void accumCell (const CaloClusterCellLink::const_iterator& cellIt, CellAccum& accum, const WEIGHT& w) +void accumCell (const CaloClusterCellLink::const_iterator& cellIt, CellAccum& accum, const WEIGHT& w, const bool useGPUCriteria = false) { const CaloCell& cell=**cellIt; const CaloDetDescrElement* dde = cell.caloDDE(); @@ -120,10 +130,20 @@ void accumCell (const CaloClusterCellLink::const_iterator& cellIt, CellAccum& ac accum.theNewEta += theAbsEnergy * cellEta; accum.theNewPhi += theAbsEnergy * thePhi; - if ( accum.MaxEnergyInSample[sam] < theEnergy ) { - accum.MaxEnergyInSample[sam] = theEnergy; - accum.EtaMaxEnergyInSample[sam] = cellEta; - accum.PhiMaxEnergyInSample[sam] = cellPhi; + if (useGPUCriteria) { + if ( accum.MaxEnergyInSample[sam] < theEnergy || (accum.MaxEnergyInSample[sam] == theEnergy && accum.maxCell < (int) cellIt.index()) ) { + accum.MaxEnergyInSample[sam] = theEnergy; + accum.EtaMaxEnergyInSample[sam] = cellEta; + accum.PhiMaxEnergyInSample[sam] = cellPhi; + accum.maxCell = (int) cellIt.index(); + } + } + else { + if ( accum.MaxEnergyInSample[sam] < theEnergy ) { + accum.MaxEnergyInSample[sam] = theEnergy; + accum.EtaMaxEnergyInSample[sam] = cellEta; + accum.PhiMaxEnergyInSample[sam] = cellPhi; + } } accum.posSamNorm[sam] += theAbsEnergy; @@ -179,7 +199,7 @@ void accumCell (const CaloClusterCellLink::const_iterator& cellIt, CellAccum& ac template <class WEIGHT> inline -void accumCells (const CaloClusterCellLink* cccl, CellAccum& accum, const WEIGHT& w) { +void accumCells (const CaloClusterCellLink* cccl, CellAccum& accum, const WEIGHT& w, const bool useGPUCriteria = false) { CaloClusterCellLink::const_iterator it=cccl->begin(); @@ -192,27 +212,15 @@ void accumCells (const CaloClusterCellLink* cccl, CellAccum& accum, const WEIGHT it=cccl->begin(); for (;it!=it_e;++it) { CaloPrefetch::nextDDE(it, it_e); - accumCell(it,accum,w); + accumCell(it,accum,w, useGPUCriteria); } - - /* - for (const CaloCell* c : cl) - CxxUtils::prefetchObj (c); - - CaloCluster::cell_iterator it = cl.begin(); - CaloCluster::cell_iterator end = cl.end(); - for (; it != end; ++it) { - CaloPrefetch::nextDDE(it, end); - accumCell (**it, accum, w); - } - */ } }//end namespace -void CaloClusterKineHelper::calculateKine(xAOD::CaloCluster* clu, const bool useweight, const bool updateLayers) { +void CaloClusterKineHelper::calculateKine(xAOD::CaloCluster* clu, const bool useweight, const bool updateLayers, const bool useGPUCriteria) { //static CaloPhiRange range; // update global kinematics @@ -236,12 +244,12 @@ void CaloClusterKineHelper::calculateKine(xAOD::CaloCluster* clu, const bool use std::array<double,CaloSampling::Unknown> posSamNorm{}; - CellAccum accum (posNorm, posSamNorm, nBarrel, nEndcap, timeNorm); + CellAccum accum (posNorm, posSamNorm, nBarrel, nEndcap, timeNorm, useGPUCriteria); //accum.theNewPhi = clu->phi(); //???? if (useweight) - accumCells (cccl, accum, AccumWeight()); + accumCells (cccl, accum, AccumWeight(), useGPUCriteria); else - accumCells (cccl, accum, AccumNoWeight()); + accumCells (cccl, accum, AccumNoWeight(), useGPUCriteria); if ( posNorm != 0. ) { double inorm = 1 / posNorm; diff --git a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterKineHelper.h b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterKineHelper.h index 63a25660c677b621686e1be08906aa2f9c1b721a..22f915e5332d4465e889afea4c1038628e4f095c 100644 --- a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterKineHelper.h +++ b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterKineHelper.h @@ -18,7 +18,7 @@ class CaloClusterKineHelper { public: ///Calculate cluster kinematics from contained cells - static void calculateKine(xAOD::CaloCluster* clu, const bool useweight=true, const bool updateLayers=true ); + static void calculateKine(xAOD::CaloCluster* clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria = false ); }; diff --git a/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml b/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml index f79951583a20b4bd3358abc89f5dfccf11027f86..2ba2ef209704eecf2d9f33a895b53a1dd41797d4 100644 --- a/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml +++ b/Event/xAOD/xAODCore/xAODCore/selectionSTL.xml @@ -1,4 +1,4 @@ -<!-- Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration --> +<!-- Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration --> <lcgdict> <!-- "Single" vector type(s). --> @@ -6,6 +6,8 @@ <class name="std::vector<signed char>" /> <class name="std::vector<unsigned char>" /> <class name="std::vector<uint32_t>" /> + <class name="std::vector<uint64_t>" /> + <class name="std::vector<unsigned long long>" /> <!-- "Double" vector type(s). --> <class name="std::vector<std::vector<bool> >" /> diff --git a/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx b/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx index 28005a385ed101e69b71bdb2c7f5cbf889be1b5c..092c2b43f0fd8777122ef6ed501f825af1a08e30 100644 --- a/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx +++ b/Event/xAOD/xAODEventInfo/Root/EventInfo_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021, 2019, 2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // System include(s): @@ -67,6 +67,12 @@ namespace xAODEventInfoPrivate { return; } + // register attributes' types early (before I/O) for schema evolution + static const SG::AuxElement::Accessor< uint64_t > accEvNum( "eventNumber" ); + static const SG::AuxElement::Accessor< uint64_t > accMcEvNum( "mcEventNumber" ); + static const SG::AuxElement::Accessor< uint64_t > accLow( "pileUpMixtureIDLowBits" ); + static const SG::AuxElement::Accessor< uint64_t > accHigh( "pileUpMixtureIDHighBits" ); + } // private namespace namespace xAOD { @@ -114,7 +120,7 @@ namespace xAOD { AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint32_t, runNumber, setRunNumber ) - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, unsigned long long, + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint64_t, eventNumber, setEventNumber ) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint32_t, lumiBlock, setLumiBlock ) @@ -189,7 +195,7 @@ namespace xAOD { detDescrTags, setDetDescrTags ) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint32_t, mcChannelNumber, setMCChannelNumber ) - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, unsigned long long, + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint64_t, mcEventNumber, setMCEventNumber ) AUXSTORE_OBJECT_SETTER_AND_GETTER( EventInfo_v1, std::vector< float >, mcEventWeights, setMCEventWeights ) @@ -405,22 +411,20 @@ namespace xAOD { return; } - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, unsigned long long, + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint64_t, pileUpMixtureIDLowBits, setPileUpMixtureIDLowBits ) - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, unsigned long long, + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( EventInfo_v1, uint64_t, pileUpMixtureIDHighBits, setPileUpMixtureIDHighBits ) EventInfo_v1::PileUpMixtureID EventInfo_v1::pileUpMixtureID() const { - static const Accessor< unsigned long long > accLow( "pileUpMixtureIDLowBits" ); - static const Accessor< unsigned long long > accHigh( "pileUpMixtureIDHighBits" ); - PileUpMixtureID id{}; // We need to check if the values are actually stored - if ( accLow.isAvailable( *this ) && accHigh.isAvailable( *this ) ) { + if ( xAODEventInfoPrivate::accLow.isAvailable( *this ) + && xAODEventInfoPrivate::accHigh.isAvailable( *this ) ) { id.lowBits = pileUpMixtureIDLowBits(); id.highBits = pileUpMixtureIDHighBits(); } diff --git a/Event/xAOD/xAODEventInfo/Root/dict/ContainerProxies.cxx b/Event/xAOD/xAODEventInfo/Root/dict/ContainerProxies.cxx index a8d4ed58d41ea3becb2563b3b27c06d760fc23ee..296f5db4aa5f687db365701dc131a5e9c03934a7 100644 --- a/Event/xAOD/xAODEventInfo/Root/dict/ContainerProxies.cxx +++ b/Event/xAOD/xAODEventInfo/Root/dict/ContainerProxies.cxx @@ -2,8 +2,6 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -// $Id: ContainerProxies.cxx 680052 2015-07-03 10:45:40Z krasznaa $ - // EDM include(s): #include "xAODCore/AddDVProxy.h" diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v1.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v1.h index 4e0cdd40ff570ba225868e4b096b3542a8eb5e48..14c39a93d666dfebc7be80173ae5f65bc7e4aeeb 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v1.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v1.h @@ -1,17 +1,14 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -// $Id: EventAuxInfo_v1.h 636390 2014-12-16 21:52:18Z cranshaw $ #ifndef XAODEVENTINFO_VERSIONS_EVENTAUXINFO_V1_H #define XAODEVENTINFO_VERSIONS_EVENTAUXINFO_V1_H // System include(s): -extern "C" { -# include <stdint.h> -} +#include <stdint.h> #include <vector> #include <string> @@ -76,7 +73,7 @@ namespace xAOD { /// @name Basic event information /// @{ uint32_t runNumber; - unsigned long long eventNumber; + uint64_t eventNumber; uint32_t lumiBlock; uint32_t timeStamp; uint32_t timeStampNSOffset; diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v2.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v2.h index e44e8d505e9de690f7f36b5cf41f258718ca8a3a..4d4ef5ee86deec3103bf50c91beead62442d95a9 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v2.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v2.h @@ -1,16 +1,14 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODEVENTINFO_VERSIONS_EVENTAUXINFO_V2_H #define XAODEVENTINFO_VERSIONS_EVENTAUXINFO_V2_H // System include(s): -extern "C" { -# include <stdint.h> -} +#include <stdint.h> #include <vector> #include <string> @@ -72,7 +70,7 @@ namespace xAOD { /// @name Basic event information /// @{ uint32_t runNumber; - unsigned long long eventNumber; + uint64_t eventNumber; uint32_t lumiBlock; uint32_t timeStamp; uint32_t timeStampNSOffset; diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v3.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v3.h index fed284029ceaf728cef01d80342a8a83a74fa556..311fe3951b6eb1868229bf61ca99f910a7b4ab8e 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v3.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventAuxInfo_v3.h @@ -1,16 +1,14 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODEVENTINFO_VERSIONS_EVENTAUXINFO_V3_H #define XAODEVENTINFO_VERSIONS_EVENTAUXINFO_V3_H // System include(s): -extern "C" { -# include <stdint.h> -} +#include <stdint.h> #include <vector> #include <string> @@ -72,7 +70,7 @@ namespace xAOD { /// @name Basic event information /// @{ uint32_t runNumber; - unsigned long long eventNumber; + uint64_t eventNumber; uint32_t lumiBlock; uint32_t timeStamp; uint32_t timeStampNSOffset; diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h index cbae095f29c357c1103555d169d9081dad19f752..dd1ce40fdb35092b3fcf4e9cebd8f2ece820272d 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfoAuxContainer_v1.h @@ -1,17 +1,14 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -// $Id: EventInfoAuxContainer_v1.h 636390 2014-12-16 21:52:18Z cranshaw $ #ifndef XAODEVENTINFO_VERSIONS_EVENTINFOAUXCONTAINER_V1_H #define XAODEVENTINFO_VERSIONS_EVENTINFOAUXCONTAINER_V1_H // System include(s): -extern "C" { -# include <stdint.h> -} +#include <stdint.h> #include <vector> #include <string> @@ -76,7 +73,7 @@ namespace xAOD { /// @name Basic event information /// @{ std::vector< uint32_t > runNumber; - std::vector< unsigned long long > eventNumber; + std::vector< uint64_t > eventNumber; std::vector< uint32_t > lumiBlock; std::vector< uint32_t > timeStamp; std::vector< uint32_t > timeStampNSOffset; @@ -111,14 +108,14 @@ namespace xAOD { /// @name Monte-Carlo information /// @{ std::vector< uint32_t > mcChannelNumber; - std::vector< unsigned long long > mcEventNumber; + std::vector< uint64_t > mcEventNumber; std::vector< std::vector< float > > mcEventWeights; /// @} /// @name Pileup information /// @{ - std::vector< unsigned long long > pileUpMixtureIDLowBits; - std::vector< unsigned long long > pileUpMixtureIDHighBits; + std::vector< uint64_t > pileUpMixtureIDLowBits; + std::vector< uint64_t > pileUpMixtureIDHighBits; /// @} /// Keep track of the event status flags. diff --git a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h index db1d921290be6a0da928f40ecf7bad7f181aa647..e80cb634cac00bde74cb03d8730c922412e3403f 100644 --- a/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h +++ b/Event/xAOD/xAODEventInfo/xAODEventInfo/versions/EventInfo_v1.h @@ -1,17 +1,14 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -// $Id: EventInfo_v1.h 727083 2016-03-01 15:20:50Z krasznaa $ #ifndef XAODEVENTINFO_VERSIONS_EVENTINFO_V1_H #define XAODEVENTINFO_VERSIONS_EVENTINFO_V1_H // System include(s): -extern "C" { -# include <stdint.h> -} +#include <stdint.h> // global namespace typenames #include <set> #include <vector> #include <string> @@ -43,9 +40,6 @@ namespace xAOD { /// /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> /// - /// $Revision: 727083 $ - /// $Date: 2016-03-01 16:20:50 +0100 (Tue, 01 Mar 2016) $ - /// class EventInfo_v1 : public SG::AuxElement { public: @@ -66,9 +60,9 @@ namespace xAOD { void setRunNumber( uint32_t value ); /// The current event's event number - unsigned long long eventNumber() const; + uint64_t eventNumber() const; /// Set the current event's event number - void setEventNumber( unsigned long long value ); + void setEventNumber( uint64_t value ); /// The current event's luminosity block number uint32_t lumiBlock() const; @@ -140,9 +134,9 @@ namespace xAOD { void setMCChannelNumber( uint32_t value ); /// The MC generator's event number - unsigned long long mcEventNumber() const; + uint64_t mcEventNumber() const; /// Set the MC generator's event number - void setMCEventNumber( unsigned long long value ); + void setMCEventNumber( uint64_t value ); /// The weights of all the MC events used in the simulation const std::vector< float >& mcEventWeights() const; @@ -247,8 +241,8 @@ namespace xAOD { /// Unique pile-up mixture identifier definition struct PileUpMixtureID { - unsigned long long lowBits{}; - unsigned long long highBits{}; + uint64_t lowBits{}; + uint64_t highBits{}; }; /// Unique pile-up mixture identifier @@ -257,14 +251,14 @@ namespace xAOD { void setPileUpMixtureID( const PileUpMixtureID &value ); /// Unique pile-up mixture identifier low bits - unsigned long long pileUpMixtureIDLowBits() const; + uint64_t pileUpMixtureIDLowBits() const; /// Set unique pile-up mixture identifier low bits - void setPileUpMixtureIDLowBits( unsigned long long value ); + void setPileUpMixtureIDLowBits( uint64_t value ); /// Unique pile-up mixture identifier high bits - unsigned long long pileUpMixtureIDHighBits() const; + uint64_t pileUpMixtureIDHighBits() const; /// Set unique pile-up mixture identifier high bits - void setPileUpMixtureIDHighBits( unsigned long long value ); + void setPileUpMixtureIDHighBits( uint64_t value ); /// Enumerator describing the types of pileup events enum PileUpType { diff --git a/Event/xAOD/xAODInDetMeasurement/Root/PixelClusterAuxContainer_v1.cxx b/Event/xAOD/xAODInDetMeasurement/Root/PixelClusterAuxContainer_v1.cxx index e1ec94a7e1f8a67b1631e575b3b91492ef123944..cd30d4e3c37e812895518ed07d6d89920fbe74b8 100644 --- a/Event/xAOD/xAODInDetMeasurement/Root/PixelClusterAuxContainer_v1.cxx +++ b/Event/xAOD/xAODInDetMeasurement/Root/PixelClusterAuxContainer_v1.cxx @@ -1,29 +1,31 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "xAODInDetMeasurement/versions/PixelClusterAuxContainer_v1.h" namespace xAOD { - PixelClusterAuxContainer_v1::PixelClusterAuxContainer_v1() +PixelClusterAuxContainer_v1::PixelClusterAuxContainer_v1() : AuxContainerBase() { - AUX_VARIABLE(identifierHash); - AUX_VARIABLE(localPosition); - AUX_VARIABLE(localCovariance); - AUX_VARIABLE(globalPosition); - AUX_VARIABLE(rdoList); - AUX_VARIABLE(channelsInPhi); - AUX_VARIABLE(channelsInEta); - AUX_VARIABLE(omegaX); - AUX_VARIABLE(omegaY); - AUX_VARIABLE(totList); - AUX_VARIABLE(totalToT); - AUX_VARIABLE(chargeList); - AUX_VARIABLE(totalCharge); - AUX_VARIABLE(energyLoss); - AUX_VARIABLE(isSplit); - AUX_VARIABLE(splitProbability1); - AUX_VARIABLE(splitProbability2); - AUX_VARIABLE(lvl1a); - } + AUX_VARIABLE(identifier); + AUX_VARIABLE(identifierHash); + AUX_MEASUREMENTVAR(localPosition, 2); + AUX_MEASUREMENTVAR(localCovariance, 2); + AUX_VARIABLE(globalPosition); + AUX_VARIABLE(rdoList); + AUX_VARIABLE(channelsInPhi); + AUX_VARIABLE(channelsInEta); + AUX_VARIABLE(widthInEta); + AUX_VARIABLE(omegaX); + AUX_VARIABLE(omegaY); + AUX_VARIABLE(totList); + AUX_VARIABLE(totalToT); + AUX_VARIABLE(chargeList); + AUX_VARIABLE(totalCharge); + AUX_VARIABLE(energyLoss); + AUX_VARIABLE(isSplit); + AUX_VARIABLE(splitProbability1); + AUX_VARIABLE(splitProbability2); + AUX_VARIABLE(lvl1a); } +} // namespace xAOD diff --git a/Event/xAOD/xAODInDetMeasurement/Root/PixelCluster_v1.cxx b/Event/xAOD/xAODInDetMeasurement/Root/PixelCluster_v1.cxx index 237dc0e80269e0dc9b820190f33fc8863e71154f..003e15507bd2dbcc64642d408bd100a5d35bf678 100644 --- a/Event/xAOD/xAODInDetMeasurement/Root/PixelCluster_v1.cxx +++ b/Event/xAOD/xAODInDetMeasurement/Root/PixelCluster_v1.cxx @@ -7,98 +7,107 @@ // Local include(s): #include "xAODInDetMeasurement/versions/PixelCluster_v1.h" -static const SG::AuxElement::Accessor< std::array< float, 3 > > globalPosAcc( "globalPosition" ); -static const SG::AuxElement::Accessor< std::vector< Identifier::value_type > > rdoListAcc( "rdoList" ); +static const SG::AuxElement::Accessor<std::array<float, 3> > globalPosAcc( + "globalPosition"); +static const SG::AuxElement::Accessor<std::vector<Identifier::value_type> > + rdoListAcc("rdoList"); -xAOD::PixelCluster_v1::ConstVectorMap xAOD::PixelCluster_v1::globalPosition() const { +xAOD::ConstVectorMap<3> xAOD::PixelCluster_v1::globalPosition() const { const auto& values = globalPosAcc(*this); - return ConstVectorMap{values.data()}; + return ConstVectorMap<3>{values.data()}; } -xAOD::PixelCluster_v1::VectorMap xAOD::PixelCluster_v1::globalPosition() { +xAOD::VectorMap<3> xAOD::PixelCluster_v1::globalPosition() { auto& values = globalPosAcc(*this); - return VectorMap{values.data()}; + return VectorMap<3>{values.data()}; } -void xAOD::PixelCluster_v1::setRDOlist(const std::vector< Identifier >& rdoList) { - std::vector< Identifier::value_type > rdos; - rdos.reserve(rdoList.size()); - for (auto& rdo : rdoList) - rdos.push_back(rdo.get_compact()); +void xAOD::PixelCluster_v1::setRDOlist(const std::vector<Identifier>& rdoList) { + std::vector<Identifier::value_type> rdos(rdoList.size()); + for (std::size_t i(0); i < rdos.size(); ++i) { + rdos[i] = rdoList[i].get_compact(); + } rdoListAcc(*this) = rdos; } -const std::vector< Identifier > xAOD::PixelCluster_v1::rdoList() const { - std::vector< Identifier::value_type > values = rdoListAcc(*this); - std::vector< Identifier > rdos; - rdos.reserve(values.size()); - for (auto& value : values) - rdos.push_back(Identifier(value)); +const std::vector<Identifier> xAOD::PixelCluster_v1::rdoList() const { + const std::vector<Identifier::value_type>& values = rdoListAcc(*this); + std::vector<Identifier> rdos(values.size()); + for (std::size_t i(0); i < rdos.size(); ++i) { + rdos[i].set_literal(values[i]); + } return rdos; } -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, int, channelsInPhi) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, int, channelsInPhi) -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, int, channelsInEta) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, int, channelsInEta) -void xAOD::PixelCluster_v1::setChannelsInPhiEta(int channelsInPhi, int channelsInEta) { - static const SG::AuxElement::Accessor< int > chanPhiAcc( "channelsInPhi" ); +void xAOD::PixelCluster_v1::setChannelsInPhiEta(int channelsInPhi, + int channelsInEta) { + static const SG::AuxElement::Accessor<int> chanPhiAcc("channelsInPhi"); chanPhiAcc(*this) = channelsInPhi; - static const SG::AuxElement::Accessor< int > chanEtaAcc( "channelsInEta" ); + static const SG::AuxElement::Accessor<int> chanEtaAcc("channelsInEta"); chanEtaAcc(*this) = channelsInEta; } +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(xAOD::PixelCluster_v1, float, widthInEta, + setWidthInEta) + void xAOD::PixelCluster_v1::setOmegas(float omegaX, float omegaY) { - static const SG::AuxElement::Accessor< float > omegaXAcc( "omegaX" ); + static const SG::AuxElement::Accessor<float> omegaXAcc("omegaX"); omegaXAcc(*this) = omegaX; - static const SG::AuxElement::Accessor< float > omegaYAcc( "omegaY" ); + static const SG::AuxElement::Accessor<float> omegaYAcc("omegaY"); omegaYAcc(*this) = omegaY; } -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, float, omegaX) -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, float, omegaY) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, float, omegaX) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, float, omegaY) -void xAOD::PixelCluster_v1::setToTlist(const std::vector< int >& tots) { - static const SG::AuxElement::Accessor< std::vector< int > > totsAcc( "totList" ); +void xAOD::PixelCluster_v1::setToTlist(const std::vector<int>& tots) { + static const SG::AuxElement::Accessor<std::vector<int> > totsAcc("totList"); totsAcc(*this) = tots; int totalToT = 0; for (auto& tot : tots) - totalToT+=tot; - static const SG::AuxElement::Accessor< int > totalToTAcc( "totalToT" ); + totalToT += tot; + static const SG::AuxElement::Accessor<int> totalToTAcc("totalToT"); totalToTAcc(*this) = totalToT; } -AUXSTORE_OBJECT_GETTER( xAOD::PixelCluster_v1, std::vector< int >, totList) -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, int, totalToT) +AUXSTORE_OBJECT_GETTER(xAOD::PixelCluster_v1, std::vector<int>, totList) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, int, totalToT) -void xAOD::PixelCluster_v1::setChargelist(const std::vector< float >& charges) { - static const SG::AuxElement::Accessor< std::vector< float > > chargesAcc( "chargeList" ); +void xAOD::PixelCluster_v1::setChargelist(const std::vector<float>& charges) { + static const SG::AuxElement::Accessor<std::vector<float> > chargesAcc( + "chargeList"); chargesAcc(*this) = charges; float totalCharge = 0; for (auto& charge : charges) - totalCharge+=charge; - static const SG::AuxElement::Accessor< float > totalChargeAcc( "totalCharge" ); + totalCharge += charge; + static const SG::AuxElement::Accessor<float> totalChargeAcc("totalCharge"); totalChargeAcc(*this) = totalCharge; } -AUXSTORE_OBJECT_GETTER( xAOD::PixelCluster_v1, std::vector< float >, chargeList) -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, float, totalCharge) +AUXSTORE_OBJECT_GETTER(xAOD::PixelCluster_v1, std::vector<float>, chargeList) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, float, totalCharge) -AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( xAOD::PixelCluster_v1, float, - energyLoss, setEnergyLoss ) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(xAOD::PixelCluster_v1, float, energyLoss, + setEnergyLoss) -AUXSTORE_PRIMITIVE_GETTER_WITH_CAST( xAOD::PixelCluster_v1, char, bool, isSplit) -AUXSTORE_PRIMITIVE_SETTER_WITH_CAST( xAOD::PixelCluster_v1, char, bool, isSplit, setIsSplit) +AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(xAOD::PixelCluster_v1, char, bool, isSplit) +AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(xAOD::PixelCluster_v1, char, bool, isSplit, + setIsSplit) void xAOD::PixelCluster_v1::setSplitProbabilities(float prob1, float prob2) { - static const SG::AuxElement::Accessor< float > prob1Acc( "splitProbability1" ); + static const SG::AuxElement::Accessor<float> prob1Acc("splitProbability1"); prob1Acc(*this) = prob1; - static const SG::AuxElement::Accessor< float > prob2Acc( "splitProbability2" ); + static const SG::AuxElement::Accessor<float> prob2Acc("splitProbability2"); prob2Acc(*this) = prob2; } -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, float, splitProbability1) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, float, splitProbability1) -AUXSTORE_PRIMITIVE_GETTER( xAOD::PixelCluster_v1, float, splitProbability2) +AUXSTORE_PRIMITIVE_GETTER(xAOD::PixelCluster_v1, float, splitProbability2) -AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( xAOD::PixelCluster_v1, int, lvl1a, setLVL1A) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(xAOD::PixelCluster_v1, int, lvl1a, + setLVL1A) diff --git a/Event/xAOD/xAODInDetMeasurement/Root/StripClusterAuxContainer_v1.cxx b/Event/xAOD/xAODInDetMeasurement/Root/StripClusterAuxContainer_v1.cxx index fc5ce0bd0087b2a5ec5406e450ccd2e7c2db1e26..21d6e51fae2e28ad7f4a1c6379f3da58140922bc 100644 --- a/Event/xAOD/xAODInDetMeasurement/Root/StripClusterAuxContainer_v1.cxx +++ b/Event/xAOD/xAODInDetMeasurement/Root/StripClusterAuxContainer_v1.cxx @@ -1,18 +1,18 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "xAODInDetMeasurement/versions/StripClusterAuxContainer_v1.h" namespace xAOD { - StripClusterAuxContainer_v1::StripClusterAuxContainer_v1() +StripClusterAuxContainer_v1::StripClusterAuxContainer_v1() : AuxContainerBase() { - AUX_VARIABLE(identifierHash); - AUX_VARIABLE(localPosition); - AUX_VARIABLE(localCovariance); - AUX_VARIABLE(globalPosition); - AUX_VARIABLE(rdoList); - AUX_VARIABLE(channelsInPhi); - AUX_VARIABLE(hitsInThirdTimeBin); - } + AUX_VARIABLE(identifierHash); + AUX_VARIABLE(identifier); + AUX_MEASUREMENTVAR(localPosition, 1); + AUX_MEASUREMENTVAR(localCovariance, 1); + AUX_VARIABLE(globalPosition); + AUX_VARIABLE(rdoList); + AUX_VARIABLE(channelsInPhi); } +} // namespace xAOD diff --git a/Event/xAOD/xAODInDetMeasurement/Root/StripCluster_v1.cxx b/Event/xAOD/xAODInDetMeasurement/Root/StripCluster_v1.cxx index 30ac819b10f2afd94655cc8b41a6aea31c083672..32904c339f636ec572ae89bc8648ddd37bd41a67 100644 --- a/Event/xAOD/xAODInDetMeasurement/Root/StripCluster_v1.cxx +++ b/Event/xAOD/xAODInDetMeasurement/Root/StripCluster_v1.cxx @@ -7,38 +7,37 @@ // Local include(s): #include "xAODInDetMeasurement/versions/StripCluster_v1.h" -static const SG::AuxElement::Accessor< std::array< float, 3 > > globalPosAcc( "globalPosition" ); -static const SG::AuxElement::Accessor< std::vector< Identifier::value_type > > rdoListAcc( "rdoList" ); +static const SG::AuxElement::Accessor<std::array<float, 3> > globalPosAcc( + "globalPosition"); +static const SG::AuxElement::Accessor<std::vector<Identifier::value_type> > + rdoListAcc("rdoList"); -xAOD::StripCluster_v1::ConstVectorMap xAOD::StripCluster_v1::globalPosition() const { +xAOD::ConstVectorMap<3> xAOD::StripCluster_v1::globalPosition() const { const auto& values = globalPosAcc(*this); - return ConstVectorMap{values.data()}; + return ConstVectorMap<3>{values.data()}; } -xAOD::StripCluster_v1::VectorMap xAOD::StripCluster_v1::globalPosition() { +xAOD::VectorMap<3> xAOD::StripCluster_v1::globalPosition() { auto& values = globalPosAcc(*this); - return VectorMap{values.data()}; + return VectorMap<3>{values.data()}; } -void xAOD::StripCluster_v1::setRDOlist(const std::vector< Identifier >& rdoList) { - std::vector< Identifier::value_type > rdos; - rdos.reserve(rdoList.size()); - for (auto& rdo : rdoList) - rdos.push_back(rdo.get_compact()); +void xAOD::StripCluster_v1::setRDOlist(const std::vector<Identifier>& rdoList) { + std::vector<Identifier::value_type> rdos(rdoList.size()); + for (std::size_t i(0); i < rdos.size(); ++i) { + rdos[i] = rdoList[i].get_compact(); + } rdoListAcc(*this) = rdos; } -const std::vector< Identifier > xAOD::StripCluster_v1::rdoList() const { - std::vector< Identifier::value_type > values = rdoListAcc(*this); - std::vector< Identifier > rdos; - rdos.reserve(values.size()); - for (auto& value : values) - rdos.push_back(Identifier(value)); +const std::vector<Identifier> xAOD::StripCluster_v1::rdoList() const { + const std::vector<Identifier::value_type>& values = rdoListAcc(*this); + std::vector<Identifier> rdos(values.size()); + for (std::size_t i(0); i < rdos.size(); ++i) { + rdos[i].set_literal(values[i]); + } return rdos; } -AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( xAOD::StripCluster_v1, int, - channelsInPhi, setChannelsInPhi) - -AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( xAOD::StripCluster_v1, uint16_t, - hitsInThirdTimeBin, setHitsInThirdTimeBin) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(xAOD::StripCluster_v1, int, channelsInPhi, + setChannelsInPhi) diff --git a/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_PixelCluster_test.ref b/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_PixelCluster_test.ref index f3e4ac6a7332ebee38c84cb8932a03c9aebbe32c..daa479c1401591a21e60a283d7e6e3a89dfcd4a3 100644 --- a/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_PixelCluster_test.ref +++ b/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_PixelCluster_test.ref @@ -11,3 +11,4 @@ Global Position = 10 RDOs = [0x200921680c00000, 0x298094737200000, 0x24e105292800000, 0x298094737200000, 0xaa1cdd0d200000, 0x200921680c00000] ToTs = [1, 2, 3, 4, 5, 6] with total ToT = 21 Dimensions = 3, 2 +Width = 0.05 diff --git a/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_StripCluster_test.ref b/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_StripCluster_test.ref index bb320615a21413715817d2bb2df3f2980452299a..26afd90b9d24f7a2b86e808031ae70021a5c05d2 100644 --- a/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_StripCluster_test.ref +++ b/Event/xAOD/xAODInDetMeasurement/share/xAODInDetMeasurement_StripCluster_test.ref @@ -8,4 +8,3 @@ Global Position = 10 10 RDOs = [0x200921680c00000, 0x298094737200000, 0x24e105292800000] Number of strips = 3 -hits In Third Time Bin = 2 diff --git a/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_PixelCluster_test.cxx b/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_PixelCluster_test.cxx index 028000672986d252d9a3a99df4a0f88be6e349af..b36599c3210c42f168a5496320d1add0d59db6e8 100644 --- a/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_PixelCluster_test.cxx +++ b/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_PixelCluster_test.cxx @@ -58,6 +58,7 @@ void fill( xAOD::PixelCluster& pixelCluster) { pixelCluster.globalPosition() = globalPosition; pixelCluster.setToTlist(tots); pixelCluster.setChannelsInPhiEta(3, 2); + pixelCluster.setWidthInEta(0.05); return; } @@ -72,6 +73,7 @@ void print ( const xAOD::PixelCluster& pixelCluster) { std::cout << "RDOs = " << pixelCluster.rdoList() << std::endl; std::cout << "ToTs = " << pixelCluster.totList() << " with total ToT = " << pixelCluster.totalToT() << std::endl; std::cout << "Dimensions = " << pixelCluster.channelsInPhi() << ", " << pixelCluster.channelsInEta() << std::endl; + std::cout << "Width = " << pixelCluster.widthInEta() << std::endl; return; } diff --git a/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_StripCluster_test.cxx b/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_StripCluster_test.cxx index 525c3d9da3bf6e30b0b9cf3479c66dfe67bf7a29..80fedff8434017adbfba327e4ebcf0d941f689bc 100644 --- a/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_StripCluster_test.cxx +++ b/Event/xAOD/xAODInDetMeasurement/test/xAODInDetMeasurement_StripCluster_test.cxx @@ -52,17 +52,6 @@ void fill( xAOD::StripCluster& stripCluster) { stripCluster.globalPosition() = globalPosition; stripCluster.setChannelsInPhi(3); - - uint16_t hitsInThirdTimeBin = 0; - std::vector < std::bitset<3> > timePatterns = { std::bitset<3>("010"), - std::bitset<3>("011"), - std::bitset<3>("010") }; - for (unsigned int iStrip=0; iStrip<timePatterns.size(); iStrip++) { - if (iStrip < 16) hitsInThirdTimeBin |= (timePatterns.at(iStrip).test(0) << iStrip); - } - stripCluster.setHitsInThirdTimeBin(hitsInThirdTimeBin); - - return; } void print ( const xAOD::StripCluster& stripCluster) { @@ -74,9 +63,6 @@ void print ( const xAOD::StripCluster& stripCluster) { std::cout << "Global Position = " << stripCluster.globalPosition() << std::endl; std::cout << "RDOs = " << stripCluster.rdoList() << std::endl; std::cout << "Number of strips = " << stripCluster.channelsInPhi() << std::endl; - std::cout << "hits In Third Time Bin = " << stripCluster.hitsInThirdTimeBin() << std::endl; - - return; } int main() { diff --git a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelClusterAuxContainer_v1.h b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelClusterAuxContainer_v1.h index 10993e7bca48f220f799707df8d6987589b18472..da29adc3ad69b8ec4bf01174204a630f288a3f48 100644 --- a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelClusterAuxContainer_v1.h +++ b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelClusterAuxContainer_v1.h @@ -7,49 +7,52 @@ #include <vector> -#include "xAODCore/AuxContainerBase.h" -#include "Identifier/IdentifierHash.h" #include "Identifier/Identifier.h" +#include "Identifier/IdentifierHash.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODMeasurementBase/MeasurementDefs.h" namespace xAOD { - /// Auxiliary store for pixel clusters - /// - class PixelClusterAuxContainer_v1 : public AuxContainerBase { - public: - /// Default constructor - PixelClusterAuxContainer_v1(); - - private: - /// @name Defining uncalibrated measurement parameters - /// @{ - std::vector < IdentifierHash::value_type > identifierHash; - std::vector < std::array < float, 3 > > localPosition; - std::vector < std::array < float, 9 > > localCovariance; - /// @} - - /// @name Defining pixel cluster parameters - /// @{ - std::vector < std::array < float, 3 > > globalPosition; - std::vector < std::vector < Identifier::value_type > > rdoList; - std::vector < int > channelsInPhi; - std::vector < int > channelsInEta; - std::vector < float > omegaX; - std::vector < float > omegaY; - std::vector < std::vector < int > > totList; - std::vector < int > totalToT; - std::vector < std::vector < float > > chargeList; - std::vector < float > totalCharge; - std::vector < float > energyLoss; - std::vector < char > isSplit; - std::vector < float > splitProbability1; - std::vector < float > splitProbability2; - std::vector < int > lvl1a; - /// @} - }; -} +/// Auxiliary store for pixel clusters +/// +class PixelClusterAuxContainer_v1 : public AuxContainerBase { + public: + /// Default constructor + PixelClusterAuxContainer_v1(); + + private: + /// @name Defining uncalibrated measurement parameters + /// @{ + std::vector<Identifier::value_type> identifier; + std::vector<IdentifierHash::value_type> identifierHash; + std::vector<PosAccessor<2>::element_type> localPosition; + std::vector<CovAccessor<2>::element_type> localCovariance; + /// @} + + /// @name Defining pixel cluster parameters + /// @{ + std::vector<PosAccessor<3>::element_type> globalPosition; + std::vector<std::vector<Identifier::value_type> > rdoList; + std::vector<int> channelsInPhi; + std::vector<int> channelsInEta; + std::vector<float> widthInEta; + std::vector<float> omegaX; + std::vector<float> omegaY; + std::vector<std::vector<int> > totList; + std::vector<int> totalToT; + std::vector<std::vector<float> > chargeList; + std::vector<float> totalCharge; + std::vector<float> energyLoss; + std::vector<char> isSplit; + std::vector<float> splitProbability1; + std::vector<float> splitProbability2; + std::vector<int> lvl1a; + /// @} +}; +} // namespace xAOD // Set up the StoreGate inheritance for the class: #include "xAODCore/BaseInfo.h" -SG_BASE( xAOD::PixelClusterAuxContainer_v1, xAOD::AuxContainerBase ); +SG_BASE(xAOD::PixelClusterAuxContainer_v1, xAOD::AuxContainerBase); -#endif // XAODINDETMEASUREMENT_VERSIONS_PIXELCLUSTERAUXCONTAINER_V1_H +#endif // XAODINDETMEASUREMENT_VERSIONS_PIXELCLUSTERAUXCONTAINER_V1_H diff --git a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelCluster_v1.h b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelCluster_v1.h index 06f5e278a7fb5993872355c9c0abb1c3b38abdd5..70dbbb2dbfbdfb784f00385fa19406fa34ed8535 100644 --- a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelCluster_v1.h +++ b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelCluster_v1.h @@ -5,113 +5,119 @@ #ifndef XAODINDETMEASUREMENT_VERSION_PIXELCLUSTER_V1_H #define XAODINDETMEASUREMENT_VERSION_PIXELCLUSTER_V1_H -#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" -#include "Identifier/Identifier.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "Identifier/Identifier.h" +#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" namespace xAOD { - /// @class PixelCluster_v1 - /// Class describing pixel clusters +/// @class PixelCluster_v1 +/// Class describing pixel clusters - class PixelCluster_v1 : public UncalibratedMeasurement_v1 { +class PixelCluster_v1 : public UncalibratedMeasurement_v1 { - public: - using ConstVectorMap = Eigen::Map<const Eigen::Matrix<float, 3, 1>>; - using VectorMap = Eigen::Map<Eigen::Matrix<float, 3, 1>>; + public: + /// Default constructor + PixelCluster_v1() = default; + /// Virtual destructor + virtual ~PixelCluster_v1() = default; - /// Default constructor - PixelCluster_v1() = default; - /// Virtual destructor - virtual ~PixelCluster_v1() = default; + /// @name Functions to get pixel cluster properties + /// @{ - /// @name Functions to get pixel cluster properties - /// @{ + /// Returns the type of the pixel cluster as a simple enumeration + xAOD::UncalibMeasType type() const override final { + return xAOD::UncalibMeasType::PixelClusterType; + } + unsigned int numDimensions() const override final { return 2; } - /// Returns the type of the pixel cluster as a simple enumeration - xAOD::UncalibMeasType type() const final { - return xAOD::UncalibMeasType::PixelClusterType; - } + /// Returns the global position of the pixel cluster + ConstVectorMap<3> globalPosition() const; + VectorMap<3> globalPosition(); - /// Returns the global position of the pixel cluster - ConstVectorMap globalPosition() const; - VectorMap globalPosition(); + /// Returns the list of identifiers of the channels building the cluster + const std::vector<Identifier> rdoList() const; - /// Returns the list of identifiers of the channels building the cluster - const std::vector< Identifier > rdoList() const; + /// Returns the dimensions of the cluster in numbers of channels in phi (x) + /// and eta (y) directions, respectively + int channelsInPhi() const; + int channelsInEta() const; - /// Returns the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions, respectively - int channelsInPhi() const; - int channelsInEta() const; + /// Returns the width of the cluster in phi (x) and eta (y) directions, + /// respectively + float widthInEta() const; - /// Returns omegax and omegay, i.e. the charge - /// balance between the first and last rows and colums, respectively, - /// building the cluster, and are numbers between 0 and 1. - float omegaX() const; - float omegaY() const; + /// Returns omegax and omegay, i.e. the charge + /// balance between the first and last rows and colums, respectively, + /// building the cluster, and are numbers between 0 and 1. + float omegaX() const; + float omegaY() const; - /// Returns the list of ToT of the channels building the cluster - const std::vector< int >& totList() const; - /// Returns the sum of the ToTs of the channels building the cluster - int totalToT() const; + /// Returns the list of ToT of the channels building the cluster + const std::vector<int>& totList() const; + /// Returns the sum of the ToTs of the channels building the cluster + int totalToT() const; - /// Returns the list of charges of the channels building the cluster - const std::vector< float >& chargeList() const; - /// Returns the sum of the charges of the channels building the cluster - float totalCharge() const; + /// Returns the list of charges of the channels building the cluster + const std::vector<float>& chargeList() const; + /// Returns the sum of the charges of the channels building the cluster + float totalCharge() const; - /// Return the energy loss in the cluster in MeV - float energyLoss() const; + /// Return the energy loss in the cluster in MeV + float energyLoss() const; - /// Returns if the cluster is split or not - bool isSplit() const; + /// Returns if the cluster is split or not + bool isSplit() const; - /// Returns the splitting probabilities for the cluster - float splitProbability1() const; - float splitProbability2() const; + /// Returns the splitting probabilities for the cluster + float splitProbability1() const; + float splitProbability2() const; - /// Return the LVL1 accept - int lvl1a() const; + /// Return the LVL1 accept + int lvl1a() const; - /// @} + /// @} - /// @name Functions to set pixel cluster properties - /// @{ + /// @name Functions to set pixel cluster properties + /// @{ - /// Sets the list of identifiers of the channels building the cluster - void setRDOlist(const std::vector< Identifier >& rdolist); + /// Sets the list of identifiers of the channels building the cluster + void setRDOlist(const std::vector<Identifier>& rdolist); - /// Sets the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions - void setChannelsInPhiEta(int channelsInPhi, int channelsInEta); + /// Sets the dimensions of the cluster in numbers of channels in phi (x) and + /// eta (y) directions + void setChannelsInPhiEta(int channelsInPhi, int channelsInEta); - /// Sets omegax and omegay, i.e. the charge - /// balance between the first and last rows and colums, respectively, - /// building the cluster, and are numbers between 0 and 1. - void setOmegas(float omegax, float omegay); + /// Sets the width of the cluster in eta (y) direction + void setWidthInEta(float widthInEta); - /// Sets the list of ToT of the channels building the cluster - void setToTlist(const std::vector< int >& tots); + /// Sets omegax and omegay, i.e. the charge + /// balance between the first and last rows and colums, respectively, + /// building the cluster, and are numbers between 0 and 1. + void setOmegas(float omegax, float omegay); - /// Sets the list of charges of the channels building the cluster - void setChargelist(const std::vector< float >& charges); + /// Sets the list of ToT of the channels building the cluster + void setToTlist(const std::vector<int>& tots); - /// Sets the energy loss in the cluster in MeV - void setEnergyLoss(float dEdX); + /// Sets the list of charges of the channels building the cluster + void setChargelist(const std::vector<float>& charges); - /// Sets if the cluster is split or not - void setIsSplit(bool isSplit); + /// Sets the energy loss in the cluster in MeV + void setEnergyLoss(float dEdX); - /// Sets the splitting probabilities for the cluster - void setSplitProbabilities(float prob1, float prob2); + /// Sets if the cluster is split or not + void setIsSplit(bool isSplit); - /// Sets the LVL1 accept - void setLVL1A(int lvl1a); + /// Sets the splitting probabilities for the cluster + void setSplitProbabilities(float prob1, float prob2); - /// @} + /// Sets the LVL1 accept + void setLVL1A(int lvl1a); - }; + /// @} +}; -} +} // namespace xAOD #include "AthContainers/DataVector.h" -DATAVECTOR_BASE( xAOD::PixelCluster_v1, xAOD::UncalibratedMeasurement_v1); +DATAVECTOR_BASE(xAOD::PixelCluster_v1, xAOD::UncalibratedMeasurement_v1); #endif diff --git a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripClusterAuxContainer_v1.h b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripClusterAuxContainer_v1.h index 640878a8d5df69246a298b16f7c7108f250582d9..a9312e2d354f0fb39764a4238162b8fb3bb0ddeb 100644 --- a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripClusterAuxContainer_v1.h +++ b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripClusterAuxContainer_v1.h @@ -7,38 +7,39 @@ #include <vector> -#include "xAODCore/AuxContainerBase.h" -#include "Identifier/IdentifierHash.h" #include "Identifier/Identifier.h" +#include "Identifier/IdentifierHash.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODMeasurementBase/MeasurementDefs.h" namespace xAOD { - /// Auxiliary store for strip clusters - /// - class StripClusterAuxContainer_v1 : public AuxContainerBase { - public: - /// Default constructor - StripClusterAuxContainer_v1(); - - private: - /// @name Defining uncalibrated measurement parameters - /// @{ - std::vector < IdentifierHash::value_type > identifierHash; - std::vector < std::array < float, 3 > > localPosition; - std::vector < std::array < float, 9 > > localCovariance; - /// @} - - /// @name Defining strip cluster parameters - /// @{ - std::vector < std::array < float, 3 > > globalPosition; - std::vector < std::vector < Identifier::value_type > > rdoList; - std::vector < int > channelsInPhi; - std::vector < uint16_t > hitsInThirdTimeBin; - /// @} - }; -} +/// Auxiliary store for strip clusters +/// +class StripClusterAuxContainer_v1 : public AuxContainerBase { + public: + /// Default constructor + StripClusterAuxContainer_v1(); + + private: + /// @name Defining uncalibrated measurement parameters + /// @{ + std::vector<Identifier::value_type> identifier; + std::vector<IdentifierHash::value_type> identifierHash; + std::vector<PosAccessor<1>::element_type> localPosition; + std::vector<CovAccessor<1>::element_type> localCovariance; + /// @} + + /// @name Defining strip cluster parameters + /// @{ + std::vector<PosAccessor<3>::element_type> globalPosition; + std::vector<std::vector<Identifier::value_type> > rdoList; + std::vector<int> channelsInPhi; + /// @} +}; +} // namespace xAOD // Set up the StoreGate inheritance for the class: #include "xAODCore/BaseInfo.h" -SG_BASE( xAOD::StripClusterAuxContainer_v1, xAOD::AuxContainerBase ); +SG_BASE(xAOD::StripClusterAuxContainer_v1, xAOD::AuxContainerBase); -#endif // XAODINDETMEASUREMENT_VERSIONS_STRIPCLUSTERAUXCONTAINER_V1_H +#endif // XAODINDETMEASUREMENT_VERSIONS_STRIPCLUSTERAUXCONTAINER_V1_H diff --git a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripCluster_v1.h b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripCluster_v1.h index 70613c7063e2a63d9b7be72e89207980a33f079c..77aa4b276dbd627bd10f4c4dfd716cbd443d4300 100644 --- a/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripCluster_v1.h +++ b/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripCluster_v1.h @@ -5,67 +5,59 @@ #ifndef XAODINDETMEASUREMENT_VERSION_STRIPCLUSTER_V1_H #define XAODINDETMEASUREMENT_VERSION_STRIPCLUSTER_V1_H -#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" -#include "Identifier/Identifier.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "Identifier/Identifier.h" +#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" namespace xAOD { - /// @class StripCluster_v1 - /// Class describing strip clusters - - class StripCluster_v1 : public UncalibratedMeasurement_v1 { - - public: - using ConstVectorMap = Eigen::Map<const Eigen::Matrix<float, 3, 1>>; - using VectorMap = Eigen::Map<Eigen::Matrix<float, 3, 1>>; - - /// Default constructor - StripCluster_v1() = default; - /// Virtual destructor - virtual ~StripCluster_v1() = default; - - /// @name Functions to get strip cluster properties - /// @{ +/// @class StripCluster_v1 +/// Class describing strip clusters - /// Returns the type of the strip cluster as a simple enumeration - xAOD::UncalibMeasType type() const final { - return xAOD::UncalibMeasType::StripClusterType; - } +class StripCluster_v1 : public UncalibratedMeasurement_v1 { - /// Returns the global position of the strip cluster - ConstVectorMap globalPosition() const; - VectorMap globalPosition(); + public: + /// Default constructor + StripCluster_v1() = default; + /// Virtual destructor + virtual ~StripCluster_v1() = default; - /// Returns the list of identifiers of the channels building the cluster - const std::vector< Identifier > rdoList() const; + /// @name Functions to get strip cluster properties + /// @{ - /// Returns the dimensions of the cluster in numbers of channels in phi (x), respectively - int channelsInPhi() const; + /// Returns the type of the strip cluster as a simple enumeration + xAOD::UncalibMeasType type() const override final { + return xAOD::UncalibMeasType::StripClusterType; + } + unsigned int numDimensions() const override final { return 1; } - /// Returns the third time bin, referring to which strips had 010 and which 011 for first 16 strips in a cluster. Gets up to 16 strips. - uint16_t hitsInThirdTimeBin() const; + /// Returns the global position of the strip cluster + ConstVectorMap<3> globalPosition() const; + VectorMap<3> globalPosition(); - /// @} + /// Returns the list of identifiers of the channels building the cluster + const std::vector<Identifier> rdoList() const; - /// @name Functions to set pixel cluster properties - /// @{ + /// Returns the dimensions of the cluster in numbers of channels in phi (x), + /// respectively + int channelsInPhi() const; - /// Sets the list of identifiers of the channels building the cluster - void setRDOlist(const std::vector< Identifier >& rdolist); + /// @} - /// Sets the dimensions of the cluster in numbers of channels in phi (x) - void setChannelsInPhi(int channelsInPhi); + /// @name Functions to set pixel cluster properties + /// @{ - /// Sets the third time bin, referring to which strips had 010 and which 011 for first 16 strips in a cluster. Sets up to 16 strips. - void setHitsInThirdTimeBin(uint16_t hitsInThirdTimeBin); + /// Sets the list of identifiers of the channels building the cluster + void setRDOlist(const std::vector<Identifier>& rdolist); - /// @} + /// Sets the dimensions of the cluster in numbers of channels in phi (x) + void setChannelsInPhi(int channelsInPhi); - }; + /// @} +}; -} +} // namespace xAOD #include "AthContainers/DataVector.h" -DATAVECTOR_BASE( xAOD::StripCluster_v1, xAOD::UncalibratedMeasurement_v1); +DATAVECTOR_BASE(xAOD::StripCluster_v1, xAOD::UncalibratedMeasurement_v1); #endif diff --git a/Event/xAOD/xAODMeasurementBase/Root/UncalibratedMeasurement_v1.cxx b/Event/xAOD/xAODMeasurementBase/Root/UncalibratedMeasurement_v1.cxx index 884ea197cc604bb8341d26a4e3d46b2a76057406..23094c29736f6a86da67c524d095dcd1b188a20b 100644 --- a/Event/xAOD/xAODMeasurementBase/Root/UncalibratedMeasurement_v1.cxx +++ b/Event/xAOD/xAODMeasurementBase/Root/UncalibratedMeasurement_v1.cxx @@ -7,13 +7,11 @@ // Local include(s): #include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" -static const SG::AuxElement::Accessor< xAOD::DetectorIDHashType > identifierHashAcc( "identifierHash" ); - -void xAOD::UncalibratedMeasurement_v1::setIdentifierHash(const xAOD::DetectorIDHashType id) { - identifierHashAcc(*this) = id; -} - -xAOD::DetectorIDHashType xAOD::UncalibratedMeasurement_v1::identifierHash() const { - return identifierHashAcc(*this); -} - +namespace xAOD { +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(UncalibratedMeasurement_v1, + DetectorIDHashType, identifierHash, + setIdentifierHash) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(UncalibratedMeasurement_v1, + DetectorIdentType, identifier, + setIdentifier) +} // namespace xAOD diff --git a/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/MeasurementDefs.h b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/MeasurementDefs.h new file mode 100644 index 0000000000000000000000000000000000000000..a7b0f0506fa64a7c3a9d36421e031f0379892658 --- /dev/null +++ b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/MeasurementDefs.h @@ -0,0 +1,60 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMEASUREMENTBASE_MEASUREMENTDEFS_H +#define XAODMEASUREMENTBASE_MEASUREMENTDEFS_H +// EDM include(s): +#include <array> + +#include "AthContainers/AuxElement.h" +#include "EventPrimitives/EventPrimitives.h" + +#define AUX_MEASUREMENTVAR(VAR, DIM) \ + do { \ + static const std::string varName = \ + std::string{#VAR} + "Dim" + std::to_string(DIM); \ + static const auxid_t auxId = getAuxID(varName, VAR); \ + regAuxVar(auxId, varName, VAR); \ + } while (false); + +namespace xAOD { + +/// Define the type of the uncalibrated measurement +/// Wondering whether we should just +enum class UncalibMeasType { + Other = 0, + // InDet + PixelClusterType = 1, + StripClusterType = 2, + // Muon + MdtDriftCircleType = 3, +}; + +/// @ detector ID element hash +using DetectorIDHashType = unsigned int; +using DetectorIdentType = long unsigned int; +/// xAOD Accessor to the position +template <size_t N> +using PosAccessor = SG::AuxElement::Accessor<std::array<float, N>>; +/// xAOD Accessor to the covariance +template <size_t N> +using CovAccessor = SG::AuxElement::Accessor<std::array<float, N * N>>; +/// Abrivation of the Matrix & Covariance definitions +template <size_t N> +using MeasVector = Eigen::Matrix<float, N, 1>; +template <size_t N> +using MeasMatrix = Eigen::Matrix<float, N, N>; + +template <size_t N> +using VectorMap = Eigen::Map<MeasVector<N>>; +template <size_t N> +using ConstVectorMap = Eigen::Map<const MeasVector<N>>; + +template <size_t N> +using MatrixMap = Eigen::Map<MeasMatrix<N>>; +template <size_t N> +using ConstMatrixMap = Eigen::Map<const MeasMatrix<N>>; + +} // namespace xAOD +#endif \ No newline at end of file diff --git a/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h index e09948bb3c6271e53e00e01dd3dc29572f90c647..a40a65bae2599b7354c5007c4300762b95278f32 100644 --- a/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h +++ b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h @@ -1,135 +1,86 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODMEASUREMENTBASE_VERSION_UNCALIBRATEDMEASUREMENT_V1_H #define XAODMEASUREMENTBASE_VERSION_UNCALIBRATEDMEASUREMENT_V1_H // EDM include(s): -#include "AthContainers/AuxElement.h" - -#include "EventPrimitives/EventPrimitives.h" - -#include <array> +#include "xAODMeasurementBase/MeasurementDefs.h" namespace xAOD { - /// Define the type of the uncalibrated measurement - enum class UncalibMeasType { - Other = 0, - // InDet - PixelClusterType = 1, - StripClusterType = 2 - }; - /// @ detector ID element hash - using DetectorIDHashType = unsigned int; - /// @class UncalibratedMeasurement_v1 - /// Class describing uncalibrated measurements - class UncalibratedMeasurement_v1 : public SG::AuxElement { - - public: - - /// Default constructor - UncalibratedMeasurement_v1() = default; - /// Default copy constructors - UncalibratedMeasurement_v1(const UncalibratedMeasurement_v1&) = default; - UncalibratedMeasurement_v1& operator=(const UncalibratedMeasurement_v1&) = default; - - /// Virtual destructor - virtual ~UncalibratedMeasurement_v1() = default; - - UncalibratedMeasurement_v1(UncalibratedMeasurement_v1&&) = delete; - UncalibratedMeasurement_v1& operator=(UncalibratedMeasurement_v1&&) = delete; - - /// @name Functions to get measurement properties - /// @{ - - /// Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash) - DetectorIDHashType identifierHash() const; - - using PosAccessor = const SG::AuxElement::Accessor< std::array< float, 3 > >; - using CovAccessor = const SG::AuxElement::Accessor< std::array< float, 9 > >; - - /// Returns the local position of the measurement - template < int N > - Eigen::Map<const Eigen::Matrix<float,N,1>> localPosition() const { - static PosAccessor locPosAcc( "localPosition" ); - const auto& values = locPosAcc(*this); - if(values.size() < N) { - throw std::runtime_error{"Storage does not have sufficient size"}; - } - assert(values.data() != nullptr); - return Eigen::Map<const Eigen::Matrix<float,N,1>>{values.data()}; - } - - /// Returns the local position as mutable eigen map which can be assigned as well - template < int N > - Eigen::Map<Eigen::Matrix<float,N,1>> localPosition() { - static PosAccessor locPosAcc( "localPosition" ); - auto& values = locPosAcc(*this); - if(values.size() < N) { - throw std::runtime_error{"Storage does not have sufficient size. Used size not allowed. Maximum size is 3."}; - } - assert(values.data() != nullptr); - return Eigen::Map<Eigen::Matrix<float,N,1>>{values.data()}; - } - - /// Returns the local covariance of the measurement - template < int N > - Eigen::Map<const Eigen::Matrix<float,N,N>> localCovariance() const { - static CovAccessor locCovAcc( "localCovariance" ); - const auto& values = locCovAcc(*this); - if(values.size() < N*N) { - throw std::runtime_error{"Storage does not have sufficient size"}; - } - assert(values.data() != nullptr); - return Eigen::Map<const Eigen::Matrix<float,N,N>>{values.data()}; - } - - /// Returns the local covariance as mutable eigen map which can be assigned as well - template < int N > - Eigen::Map<Eigen::Matrix<float,N,N>> localCovariance() { - static CovAccessor locCovAcc( "localCovariance" ); - auto& values = locCovAcc(*this); - if(values.size() < N*N) { - throw std::runtime_error{"Storage does not have sufficient size. Used size not allowed. Maximum size is 9."}; - } - assert(values.data() != nullptr); - return Eigen::Map<Eigen::Matrix<float,N,N>>{values.data()}; - } - - - /// Returns the type of the measurement type as a simple enumeration - virtual xAOD::UncalibMeasType type() const =0 ; - - /// @} - - /// @name Functions to set measurement properties - /// @{ - - /// Sets the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash) - void setIdentifierHash(const DetectorIDHashType idHash); - - - /// @} - - /// @name Direct method to set measurement properties - /// @{ - - /// Sets IdentifierHash, local position and local covariance of the measurement - template < int N > - void setMeasurement(DetectorIDHashType idHash, - Eigen::Matrix<float,N,1>& locPos, - Eigen::Matrix<float,N,N>& locCov) { - setIdentifierHash(idHash); - localPosition<N>() = locPos; - localCovariance<N>() = locCov; - } - /// @} - - }; - -} - - -#endif // XAODMEASUREMENTBASE_VERSION_UNCALIBRATEDMEASUREMENT_V1_H +class UncalibratedMeasurement_v1 : public SG::AuxElement { + + public: + /// Default constructor + UncalibratedMeasurement_v1() = default; + /// Default copy constructors + UncalibratedMeasurement_v1(const UncalibratedMeasurement_v1&) = default; + UncalibratedMeasurement_v1& operator=(const UncalibratedMeasurement_v1&) = + default; + + /// Virtual destructor + virtual ~UncalibratedMeasurement_v1() = default; + + UncalibratedMeasurement_v1(UncalibratedMeasurement_v1&&) = delete; + UncalibratedMeasurement_v1& operator=(UncalibratedMeasurement_v1&&) = + delete; + + /// @name Functions to get measurement properties + /// @{ + + /// Returns the IdentifierHash of the measurement (corresponds to the + /// detector element IdentifierHash) + DetectorIDHashType identifierHash() const; + /// Returns the full Identifier of the measurement + DetectorIdentType identifier() const; + + /// Returns the local position of the measurement + template <int N> + ConstVectorMap<N> localPosition() const; + /// Returns the local position as mutable eigen map which can be assigned as + /// well + template <int N> + VectorMap<N> localPosition(); + /// Returns the local covariance of the measurement + template <int N> + ConstMatrixMap<N> localCovariance() const; + + /// Returns the local covariance as mutable eigen map which can be assigned + /// as well + template <int N> + MatrixMap<N> localCovariance(); + /// Returns the type of the measurement type as a simple enumeration + virtual xAOD::UncalibMeasType type() const = 0; + /// Returns the number of dimensions of the measurement + virtual unsigned int numDimensions() const = 0; + + /// @} + + /// @name Functions to set measurement properties + /// @{ + + /// Sets the IdentifierHash of the measurement (corresponds to the detector + /// element IdentifierHash) + void setIdentifierHash(const DetectorIDHashType idHash); + /// Sets the full Identifier of the measurement + void setIdentifier(const DetectorIdentType measId); + + /// @} + + /// @name Direct method to set measurement properties + /// @{ + + /// Sets IdentifierHash, local position and local covariance of the + /// measurement + template <int N> + void setMeasurement(const DetectorIDHashType idHash, MeasVector<N> locPos, + MeasMatrix<N> locCov); + /// @} +}; + +} // namespace xAOD + +#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.icc" +#endif // XAODMEASUREMENTBASE_VERSION_UNCALIBRATEDMEASUREMENT_V1_H diff --git a/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.icc b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.icc new file mode 100644 index 0000000000000000000000000000000000000000..dc6377f06ca5fefcccee96863ea18bcdde827a58 --- /dev/null +++ b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/versions/UncalibratedMeasurement_v1.icc @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMEASUREMENTBASE_VERSION_UNCALIBRATEDMEASUREMENT_V1_ICC +#define XAODMEASUREMENTBASE_VERSION_UNCALIBRATEDMEASUREMENT_V1_ICC + +namespace xAOD { +/// Returns the local position of the measurement +template <int N> +ConstVectorMap<N> UncalibratedMeasurement_v1::localPosition() const { + static const PosAccessor<N> acc{"localPositionDim" + std::to_string(N)}; + const auto& values = acc(*this); + assert(values.data() != nullptr); + return ConstVectorMap<N>{values.data()}; +} +template <int N> +VectorMap<N> UncalibratedMeasurement_v1::localPosition() { + static const PosAccessor<N> acc{"localPositionDim" + std::to_string(N)}; + auto& values = acc(*this); + assert(values.data() != nullptr); + return VectorMap<N>{values.data()}; +} +template <int N> +ConstMatrixMap<N> UncalibratedMeasurement_v1::localCovariance() const { + static const CovAccessor<N> acc{"localCovarianceDim" + std::to_string(N)}; + const auto& values = acc(*this); + assert(values.data() != nullptr); + return ConstMatrixMap<N>{values.data()}; +} +template <int N> +MatrixMap<N> UncalibratedMeasurement_v1::localCovariance() { + static const CovAccessor<N> acc{"localCovarianceDim" + std::to_string(N)}; + auto& values = acc(*this); + assert(values.data() != nullptr); + return MatrixMap<N>{values.data()}; +} + +template <int N> +void UncalibratedMeasurement_v1::setMeasurement(const DetectorIDHashType idHash, + MeasVector<N> locPos, + MeasMatrix<N> locCov) { + setIdentifierHash(idHash); + localPosition<N>() = std::move(locPos); + localCovariance<N>() = std::move(locCov); +} +} // namespace xAOD +#endif diff --git a/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/xAODMeasurementBaseDict.h b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/xAODMeasurementBaseDict.h index a49df35fa71cfd284ba25eb48972db633bf2597c..ba92466171236cd6206cbaf5220911063a8e909c 100644 --- a/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/xAODMeasurementBaseDict.h +++ b/Event/xAOD/xAODMeasurementBase/xAODMeasurementBase/xAODMeasurementBaseDict.h @@ -1,24 +1,23 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODMEASUREMENTBASE_DICT_H #define XAODMEASUREMENTBASE_DICT_H +#include "xAODCore/tools/DictHelpers.h" #include "xAODMeasurementBase/UncalibratedMeasurement.h" #include "xAODMeasurementBase/UncalibratedMeasurementContainer.h" -#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" #include "xAODMeasurementBase/versions/UncalibratedMeasurementContainer_v1.h" - -#include "xAODCore/tools/DictHelpers.h" +#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" // Instantiate all necessary types for the dictionary. namespace { - struct GCCXML_DUMMY_INSTANTIATION_XAODMEASUREMENTBASE { - // Type(s) needed for the dictionary generation to succeed. - XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, UncalibratedMeasurementContainer_v1 ); - }; -} - +struct GCCXML_DUMMY_INSTANTIATION_XAODMEASUREMENTBASE { + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES(xAOD, + UncalibratedMeasurementContainer_v1); +}; +} // namespace -#endif // XAODMEASUREMENTBASE_DICT_H +#endif // XAODMEASUREMENTBASE_DICT_H diff --git a/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx b/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx index 9ac409a18f513d8c99e69b96969620fb30dc82b5..21bc0cb6addfde504ab87c681a1f3edfbfe757e0 100644 --- a/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx +++ b/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx @@ -12,6 +12,10 @@ using namespace xAOD; const SG::AuxElement::Accessor<float> MissingET_v1::m_acc_mpx("mpx"); const SG::AuxElement::Accessor<float> MissingET_v1::m_acc_mpy("mpy"); const SG::AuxElement::Accessor<float> MissingET_v1::m_acc_sumet("sumet"); +namespace { + // register attributes' types early (before I/O) for schema evolution + static const SG::AuxElement::Accessor<MissingETBase::Types::bitmask_t> dummy("source"); +} MissingET_v1::MissingET_v1( bool createStore ) : SG::AuxElement() { diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETBase.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETBase.h index 9418ce44958650161c5e4ac8a91b080c951f288e..06920083ab69c5f80f1752c3b035b35510e5e9ab 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETBase.h +++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETBase.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODMISSINGET_VERSIONS_MISSINGETBASE_H @@ -33,7 +33,7 @@ namespace MissingETBase /*! @brief Namespace for generally used type definitions */ namespace Types { - typedef unsigned long long bitmask_t; /*!< @brief Type for status word bit mask */ + typedef uint64_t bitmask_t; /*!< @brief Type for status word bit mask */ typedef std::vector<bitmask_t> bitmask_vector_t; /*!< @brief Type for vector of status word bit masks */ typedef boost::tuples::tuple<size_t,size_t> indexedlink_t; /*!< @brief Type for links defined as index pairs */ } // namespace MissingETBase::Types diff --git a/Event/xAOD/xAODTracking/Root/TrackMeasurementAuxContainer_v1.cxx b/Event/xAOD/xAODTracking/Root/TrackMeasurementAuxContainer_v1.cxx index bed3067c86601844eaf29e78db2e2f60726381e9..0bc92cf535ee19b6d201099de10fcec1fe6ba423 100644 --- a/Event/xAOD/xAODTracking/Root/TrackMeasurementAuxContainer_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackMeasurementAuxContainer_v1.cxx @@ -9,6 +9,6 @@ namespace xAOD { AUX_VARIABLE(meas); AUX_VARIABLE(covMatrix); AUX_VARIABLE(uncalibratedMeasurementLink); - + AUX_VARIABLE(projector); } } diff --git a/Event/xAOD/xAODTracking/Root/TrackMeasurement_v1.cxx b/Event/xAOD/xAODTracking/Root/TrackMeasurement_v1.cxx index 84c17797751bdd56d273d858623d50579d03ea95..b7247010432059032ce809ceddf7be542a7f2a7f 100644 --- a/Event/xAOD/xAODTracking/Root/TrackMeasurement_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackMeasurement_v1.cxx @@ -22,6 +22,21 @@ namespace xAOD { uncalibratedMeasurementLink, setUncalibratedMeasurementLink) + AUXSTORE_OBJECT_SETTER_AND_GETTER(TrackMeasurement_v1, + std::uint64_t, + projector, + setProjector) + + const std::uint64_t* TrackMeasurement_v1::projectorPtr() const { + static const ConstAccessor<std::uint64_t> acc("projector"); + return &(acc(*this)); + } + std::uint64_t* TrackMeasurement_v1::projectorPtr() { + static const Accessor<std::uint64_t> acc("projector"); + return &(acc(*this)); + } + + const UncalibratedMeasurement* TrackMeasurement_v1::uncalibratedMeasurement() const { static const ConstAccessor<ElementLink<UncalibratedMeasurementContainer> > acc("uncalibratedMeasurementLink"); diff --git a/Event/xAOD/xAODTracking/Root/TrackState.cxx b/Event/xAOD/xAODTracking/Root/TrackState.cxx index 9c33ac0ef6fddf98f5894ab6f94ed598be9ec57c..2f307dbab5e8d94f37ded78fd438f34532c1ada1 100644 --- a/Event/xAOD/xAODTracking/Root/TrackState.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackState.cxx @@ -25,7 +25,6 @@ namespace xAOD { DEFINE_API(TrackStateIndexType, filtered, setFiltered) DEFINE_API(TrackStateIndexType, smoothed, setSmoothed) DEFINE_API(TrackStateIndexType, jacobian, setJacobian) - DEFINE_API(TrackStateIndexType, projector, setProjector) DEFINE_API(TrackStateIndexType, calibrated, setCalibrated) DEFINE_API(TrackStateIndexType, measDim, setMeasDim) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(TrackState_v1, ElementLink<xAOD::UncalibratedMeasurementContainer>, uncalibratedMeasurementLink, setUncalibratedMeasurementLink); diff --git a/Event/xAOD/xAODTracking/Root/TrackStateAuxContainer_v1.cxx b/Event/xAOD/xAODTracking/Root/TrackStateAuxContainer_v1.cxx index e6c0014fc8440def7621978d6e3e59386ab8a05a..e9d98f297e890db9c1232cc444088226748f81ec 100644 --- a/Event/xAOD/xAODTracking/Root/TrackStateAuxContainer_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackStateAuxContainer_v1.cxx @@ -13,7 +13,6 @@ namespace xAOD { AUX_VARIABLE(filtered); AUX_VARIABLE(smoothed); AUX_VARIABLE(jacobian); - AUX_VARIABLE(projector); AUX_VARIABLE(calibrated); AUX_VARIABLE(measDim); AUX_VARIABLE(uncalibratedMeasurementLink); diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurementAuxContainer_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurementAuxContainer_v1.h index 5d5321c6bf4d74979c50c4f7498d29dba9f90b15..0d32247f273db11375e454fca3eddca1ba37dc90 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurementAuxContainer_v1.h +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurementAuxContainer_v1.h @@ -18,6 +18,7 @@ namespace xAOD { std::vector<Storage> meas; std::vector<Storage> covMatrix; std::vector< ElementLink<xAOD::UncalibratedMeasurementContainer> > uncalibratedMeasurementLink; + std::vector<std::uint64_t> projector; }; } diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurement_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurement_v1.h index 3a4305c8d947157cde2e92f3074ffc9b06aa094a..e82fe9afc0f0e4577cde46f5a6e2eba5f7fc8fdf 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurement_v1.h +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackMeasurement_v1.h @@ -92,7 +92,19 @@ namespace xAOD { void setUncalibratedMeasurementLink( const ElementLink<UncalibratedMeasurementContainer>& link); - // TODO projectors + /** + The quantities measured by detector, are functions of the state vector, corrupted by a measurement noise. + However the state vector is normally not observed directly. The projector is mapping from the state + vector to the mesured quantities. In our case the projector is linear, i.e. represented by a matrix of ‘ones’. + The projector matrix is coded by the bits of "unsigned long long" variable and the conversion to/from + matrix is done in Acts. + + * Define projector access + **/ + const std::uint64_t& projector() const; + const std::uint64_t* projectorPtr() const; + std::uint64_t* projectorPtr(); + void setProjector( const std::uint64_t& m); /** * @brief expands sizes of internal vectors for the data storage diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackStateAuxContainer_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackStateAuxContainer_v1.h index 92c71f32caac11c94f0df75648bbeab8e14d6401..a08cff3dd1eef68227bdecf9449ee2d9ce81356c 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackStateAuxContainer_v1.h +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackStateAuxContainer_v1.h @@ -23,7 +23,6 @@ namespace xAOD { std::vector<TrackStateIndexType> filtered; std::vector<TrackStateIndexType> smoothed; std::vector<TrackStateIndexType> jacobian; - std::vector<TrackStateIndexType> projector; std::vector<TrackStateIndexType> calibrated; std::vector<TrackStateIndexType> measDim; std::vector< ElementLink<xAOD::UncalibratedMeasurementContainer> > uncalibratedMeasurementLink; diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackState_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackState_v1.h index 61bf3bded3fbe72a0eed2161a0c0eabc36820d55..c82417815437aa58263c99096df0a052a9cfab0f 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackState_v1.h +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackState_v1.h @@ -151,19 +151,7 @@ namespace xAOD { * * @return index, invalid if identical to max possible value of this type */ - TrackStateIndexType projector() const; - /** - * @brief Set the Projector index - * @see projector() - */ - void setProjector(TrackStateIndexType); - - /** - * @brief pointers API needed by MTJ - */ - const TrackStateIndexType* projectorPtr() const; - TrackStateIndexType* projectorPtr(); - + /** * @brief index in TrackMeasurementContainer corresponding to this TracksTate * Points to calibrated measurement diff --git a/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt b/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt index de3f338d3359b554551fecc25f01eeaf79c49330..8d41a51595d26c46424796c7f9438c26887c45d6 100644 --- a/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt +++ b/Event/xAOD/xAODTrackingAthenaPool/CMakeLists.txt @@ -19,6 +19,14 @@ atlas_add_poolcnv_library( xAODTrackingAthenaPoolPoolCnv xAODTracking/TrackMeasurementValidationAuxContainer.h xAODTracking/TrackStateValidationContainer.h xAODTracking/TrackStateValidationAuxContainer.h + xAODTracking/TrackStateContainer.h + xAODTracking/TrackStateAuxContainer.h + xAODTracking/TrackJacobianContainer.h + xAODTracking/TrackJacobianAuxContainer.h + xAODTracking/TrackMeasurementContainer.h + xAODTracking/TrackMeasurementAuxContainer.h + xAODTracking/TrackParametersContainer.h + xAODTracking/TrackParametersAuxContainer.h TYPES_WITH_NAMESPACE xAOD::TrackParticleContainer xAOD::TrackParticleAuxContainer xAOD::NeutralParticleContainer xAOD::NeutralParticleAuxContainer xAOD::VertexContainer @@ -27,6 +35,10 @@ atlas_add_poolcnv_library( xAODTrackingAthenaPoolPoolCnv xAOD::TrackMeasurementValidationContainer xAOD::TrackMeasurementValidationAuxContainer xAOD::TrackStateValidationContainer xAOD::TrackStateValidationAuxContainer + xAOD::TrackStateContainer xAOD::TrackStateAuxContainer + xAOD::TrackJacobianContainer xAOD::TrackJacobianAuxContainer + xAOD::TrackMeasurementContainer xAOD::TrackMeasurementAuxContainer + xAOD::TrackParametersContainer xAOD::TrackParametersAuxContainer CNV_PFX xAOD INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaKernel diff --git a/ForwardDetectors/AFP/AFP_Calibration/AFP_Calibration/AFP_PixelHistoFiller.h b/ForwardDetectors/AFP/AFP_Calibration/AFP_Calibration/AFP_PixelHistoFiller.h index 5ffe1d505b8110bec16d5aee68b74a93a2983e1c..7595163e8888d94b93f3196013e2b315ad29bd02 100644 --- a/ForwardDetectors/AFP/AFP_Calibration/AFP_Calibration/AFP_PixelHistoFiller.h +++ b/ForwardDetectors/AFP/AFP_Calibration/AFP_Calibration/AFP_PixelHistoFiller.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef AFP_CALIBRATION_AFP_PIXELHISTOFILLER_H @@ -10,17 +10,16 @@ #include "StoreGate/ReadHandleKey.h" #include "xAODEventInfo/EventInfo.h" #include "xAODForward/AFPSiHitContainer.h" -#include "xAODForward/AFPSiHit.h" -#include "AFP_Geometry/AFP_constants.h" + +#include "xAODForward/AFPTrackContainer.h" // STL includes #include <string> #include <vector> -#include <memory> - -// ROOT includes -#include "TFile.h" +//ROOT includes #include "TH2F.h" +#include "TProfile.h" +#include "TProfile2D.h" /** * @class AFP_PixelHistoFiller @@ -35,18 +34,34 @@ public: virtual StatusCode execute() override; virtual StatusCode finalize() override; -private: - static const int m_nStations=4; - static const int m_nLayers=4; - int m_nPixelsX; - int m_nPixelsY; - - std::vector<TH2F> m_pixelHits[m_nStations][m_nLayers]; - - Gaudi::Property<int> m_LBRangeLength{this, "LBRangeLength",5, "How many lumiblocks should be merged together to have reasonable statistics"}; - - SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey { this, "EventInfoKey", "EventInfo", "name of EventInfo container" }; - SG::ReadHandleKey<xAOD::AFPSiHitContainer> m_afpHitContainerKey{ this ,"AFPHitContainerKey", "AFPSiHitContainer", "name of AFPSiHitContainer" }; +private: + static const int m_nStations=4; + static const int m_nLayers=4; + int m_nPixelsX=0; + int m_nPixelsY=0; + + std::vector<TH2F> m_pixelHits[m_nStations][m_nLayers]; // 2D map of hits + std::vector<TH2F> m_pixelCluster[m_nStations][m_nLayers]; // 2D map of clusters + + TProfile m_lb_xDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs x-dist(track, cluster) + TProfile m_lb_yDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs y-dist(track, cluster) + TProfile2D m_lb_xCluster_yDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs x-cluster vs y-dist(track, cluster) + TProfile2D m_lb_yCluster_xDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs y-cluster vs x-dist(track, cluster) + TProfile2D m_lb_zCluster_xDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs z-cluster vs x-dist(track, cluster) + TProfile2D m_lb_zCluster_yDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs z-cluster vs y-dist(track, cluster) + + TProfile2D m_lb_yCluster_yDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs cluster y-pos vs y-dist(track, cluster) + TProfile2D m_lb_xCluster_xDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs cluster x-pos vs x-dist(track, cluster) + TProfile2D m_lb_sxTrack_xDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs track x-slope vs x-dist(track, cluster) + TProfile2D m_lb_syTrack_yDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs track y-slope vs y-dist(track, cluster) + TProfile2D m_lb_syTrack_xDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs track y-slope vs x-dist(track, cluster) + TProfile2D m_lb_sxTrack_yDistSiTrackCluster[m_nStations][m_nLayers]; // lumi block vs track x-slope vs y-dist(track, cluster) + + Gaudi::Property<int> m_LBRangeLength{this, "LBRangeLength",5, "How many lumiblocks should be merged together to have reasonable statistics"}; + + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey { this, "EventInfoKey", "EventInfo", "name of EventInfo container" }; + SG::ReadHandleKey<xAOD::AFPSiHitContainer> m_afpHitContainerKey{ this ,"AFPHitContainerKey", "AFPSiHitContainer", "name of AFPSiHitContainer" }; + SG::ReadHandleKey<xAOD::AFPTrackContainer> m_afpTrackContainerKey{ this, "AFPTrackContainerKey", "AFPTrackContainer", "name of AFPTrackContainer" }; }; #ifndef __CINT__ diff --git a/ForwardDetectors/AFP/AFP_Calibration/src/AFP_PixelHistoFiller.cxx b/ForwardDetectors/AFP/AFP_Calibration/src/AFP_PixelHistoFiller.cxx index 0c5c78e2a2728327c27ad0365fa50ba5e25a9655..148d700a118bf5d71195899ef6818339e854d901 100644 --- a/ForwardDetectors/AFP/AFP_Calibration/src/AFP_PixelHistoFiller.cxx +++ b/ForwardDetectors/AFP/AFP_Calibration/src/AFP_PixelHistoFiller.cxx @@ -1,9 +1,22 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "AFP_Calibration/AFP_PixelHistoFiller.h" +//local object includes +#include "xAODForward/AFPSiHit.h" +#include "xAODForward/AFPTrack.h" +#include "xAODForward/AFPSiHitsClusterContainer.h" +#include "xAODForward/AFPSiHitsCluster.h" +#include "AFP_Geometry/AFP_constants.h" + +//STL +#include <memory> //for unique_ptr + +//ROOT +#include "TFile.h" +#include "TH1I.h" AFP_PixelHistoFiller::AFP_PixelHistoFiller(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) @@ -13,113 +26,261 @@ AFP_PixelHistoFiller::AFP_PixelHistoFiller(const std::string& name, ISvcLocator* StatusCode AFP_PixelHistoFiller::initialize() { - ATH_CHECK( m_eventInfoKey.initialize() ); - ATH_CHECK( m_afpHitContainerKey.initialize() ); - - m_nPixelsX=AFP_CONSTANTS::SiT_Pixel_amount_x; - m_nPixelsY=AFP_CONSTANTS::SiT_Pixel_amount_y; - - for(int st=0;st<m_nStations;++st) - { - for(int la=0;la<m_nLayers;++la) - { - m_pixelHits[st][la].clear(); - } - } - - return StatusCode::SUCCESS; + ATH_CHECK( m_eventInfoKey.initialize() ); + ATH_CHECK( m_afpHitContainerKey.initialize() ); + ATH_CHECK( m_afpTrackContainerKey.initialize() ); + + m_nPixelsX=AFP_CONSTANTS::SiT_Pixel_amount_x; + m_nPixelsY=AFP_CONSTANTS::SiT_Pixel_amount_y; + + for(int st=0;st<m_nStations;++st) + { + for(int la=0;la<m_nLayers;++la) + { + m_pixelHits[st][la].clear(); + m_pixelCluster[st][la].clear(); + + + TProfile lb_dx(Form("lb_dx_station_%d_layer_%d", st,la), Form("lb_dx, station %d, layer %d", st,la), 100, 0, 1000); + m_lb_xDistSiTrackCluster[st][la] = lb_dx; + + TProfile lb_dy(Form("lb_dy_station_%d_layer_%d", st,la), Form("lb_dy, station %d, layer %d", st,la), 100, 0, 1000); + m_lb_yDistSiTrackCluster[st][la] = lb_dy; + + TProfile2D lb_yc_dy(Form("lb_yCluster_dy_station_%d_layer_%d", st,la), Form("lb_yCluster_dy, station %d, layer %d", st,la), 100, 0, 1000, 40, -20., 20.); + m_lb_yCluster_yDistSiTrackCluster[st][la] = lb_yc_dy; + + TProfile2D lb_xc_dx(Form("lb_xCluster_dx_station_%d_layer_%d", st,la), Form("lb_xCluster_dx, station %d, layer %d", st,la), 100, 0, 1000, 40, -20., 20.); + m_lb_xCluster_xDistSiTrackCluster[st][la] = lb_xc_dx; + + TProfile2D lb_xC_dy(Form("lb_xCluster_dy_station_%d_layer_%d", st, la), Form("lb_xCluster_dy, station %d, layer %d", st, la), 100, 0, 1000, 40, -20, 20); + m_lb_xCluster_yDistSiTrackCluster[st][la] = lb_xC_dy; + + TProfile2D lb_yC_dx(Form("lb_yCluster_dx_station_%d_layer_%d", st, la), Form("lb_yCluster_dx, station %d, layer %d", st, la), 100, 0, 1000, 40, -20, 20); + m_lb_yCluster_xDistSiTrackCluster[st][la] = lb_yC_dx; + + TProfile2D lb_zC_dx(Form("lb_zCluster_dx_station_%d_layer_%d", st, la), Form("lb_zCluster_dx, station %d, layer %d", st, la), 100, 0, 1000, 100, 9*la - 3, 9*(la+1)); + m_lb_zCluster_xDistSiTrackCluster[st][la] = lb_zC_dx; + + TProfile2D lb_zC_dy(Form("lb_zCluster_dy_station_%d_layer_%d", st, la), Form("lb_zCluster_dy, station %d, layer %d", st, la), 100, 0, 1000, 100, 9*la - 3, 9*(la+1)); + m_lb_zCluster_yDistSiTrackCluster[st][la] = lb_zC_dy; + + TProfile2D lb_sx_dx(Form("lb_xSlopeTrack_dx_station_%d_layer_%d",st,la), Form("xSlopeTrack_dx, station %d, layer %d", st,la), 100, 0, 1000, 100, -1., 1.); + m_lb_sxTrack_xDistSiTrackCluster[st][la] = lb_sx_dx; + + TProfile2D lb_sy_dy(Form("lb_ySlopeTrack_dy_station_%d_layer_%d", st,la), Form("lb_ySlopeTrack_dy, station %d, layer %d", st,la), 100, 0, 1000, 100, -1., 1.); + m_lb_syTrack_yDistSiTrackCluster[st][la] = lb_sy_dy; + + TProfile2D lb_sy_dx(Form("lb_ySlopeTrack_dx_station_%d_layer_%d", st,la), Form("lb_ySlopeTrack_dx, station %d, layer %d", st,la), 100, 0, 1000, 100, -1., 1.); + m_lb_syTrack_xDistSiTrackCluster[st][la] = lb_sy_dx; + + TProfile2D lb_sx_dy(Form("lb_xSlopeTrack_dy_station_%d_layer_%d", st,la), Form("lb_xSlopeTrack_dy, station %d, layer %d", st,la), 100, 0, 1000, 100, -1., 1.); + m_lb_sxTrack_yDistSiTrackCluster[st][la] = lb_sx_dy; + + } + } + + return StatusCode::SUCCESS; } StatusCode AFP_PixelHistoFiller::execute() { - const EventContext& ctx = Gaudi::Hive::currentContext(); - - // get event info - SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx); - if (!eventInfo.isValid()) - { - ATH_MSG_WARNING("cannot get eventInfo"); - return StatusCode::SUCCESS; - } - else ATH_MSG_DEBUG("successfully got eventInfo"); - - // make sure all the histograms are defined - int current_lb=eventInfo->lumiBlock(); - - if(static_cast<int>(m_pixelHits[0][0].size())-1<current_lb/m_LBRangeLength) - { - for(int st=0;st<m_nStations;++st) - { - for(int la=0;la<m_nLayers;++la) - { - for(int add=static_cast<int>(m_pixelHits[st][la].size());add<=current_lb/m_LBRangeLength;++add) - { - TH2F hist(Form("pixel_hits_lb_%d_%d_station_%d_layer_%d", add*m_LBRangeLength,(add+1)*m_LBRangeLength-1,st,la), - Form("pixel hits, lb %d-%d, station %d, layer %d", add*m_LBRangeLength,(add+1)*m_LBRangeLength-1,st,la), - m_nPixelsX,0.5,m_nPixelsX+0.5, m_nPixelsY,0.5,m_nPixelsY+1); - - m_pixelHits[st][la].push_back(hist); - } - } - } - } - - int lb_index=current_lb/m_LBRangeLength; - - SG::ReadHandle<xAOD::AFPSiHitContainer> afpHitContainer (m_afpHitContainerKey, ctx); - if (!afpHitContainer.isValid()) - { - ATH_MSG_WARNING("cannot get AFPSiHitContainer"); - return StatusCode::SUCCESS; - } - else ATH_MSG_DEBUG("successfully got AFPSiHitContainer"); - - for (const xAOD::AFPSiHit* hit : *afpHitContainer) - { - int st=hit->stationID(); - int la=hit->pixelLayerID(); - - if(st<0 || m_nStations<=st) - { - ATH_MSG_INFO("stationID = " <<st<<", but expected values are from 0 to "<<m_nStations-1 ); - continue; - } - if(la<0 || m_nLayers<=la) - { - ATH_MSG_INFO("pixelLayerID = " <<la<<", but expected values are from 0 to "<<m_nLayers-1 ); - continue; - } - - m_pixelHits[st][la].at(lb_index).Fill(hit->pixelRowIDChip(),hit->pixelColIDChip()); - } - - return StatusCode::SUCCESS; + const EventContext& ctx = Gaudi::Hive::currentContext(); + + // get event info + SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey, ctx); + if (!eventInfo.isValid()) + { + ATH_MSG_WARNING("cannot get eventInfo"); + return StatusCode::SUCCESS; + } + else ATH_MSG_DEBUG("successfully got eventInfo"); + + // make sure all the histograms are defined + int current_lb=eventInfo->lumiBlock(); + + if(static_cast<int>(m_pixelHits[0][0].size())-1<current_lb/m_LBRangeLength) + { + for(int st=0;st<m_nStations;++st) + { + for(int la=0;la<m_nLayers;++la) + { + for(int add=static_cast<int>(m_pixelHits[st][la].size());add<=current_lb/m_LBRangeLength;++add) + { + TH2F p_hist(Form("pixel_hits_lb_%d_%d_station_%d_layer_%d", add*m_LBRangeLength,(add+1)*m_LBRangeLength-1,st,la), + Form("pixel hits, lb %d-%d, station %d, layer %d", add*m_LBRangeLength,(add+1)*m_LBRangeLength-1,st,la), + m_nPixelsX,0.5,m_nPixelsX+0.5, m_nPixelsY,0.5,m_nPixelsY+1); + + m_pixelHits[st][la].push_back(p_hist); + + TH2F c_hist(Form("pixel_clusters_lb_%d_%d_station_%d_layer_%d", add*m_LBRangeLength,(add+1)*m_LBRangeLength-1,st,la), + Form("pixel_clusters, lb %d-%d, station %d, layer %d", add*m_LBRangeLength,(add+1)*m_LBRangeLength-1,st,la), + 400,-20, 20, 400, -20, 20); + + m_pixelCluster[st][la].push_back(c_hist); + + + } + + } + } + } + + int lb_index=current_lb/m_LBRangeLength; + + // Get containers: + + SG::ReadHandle<xAOD::AFPSiHitContainer> afpHitContainer (m_afpHitContainerKey, ctx); + if (!afpHitContainer.isValid()) + { + ATH_MSG_WARNING("cannot get AFPSiHitContainer"); + return StatusCode::SUCCESS; + } + else ATH_MSG_DEBUG("successfully got AFPSiHitContainer"); + + SG::ReadHandle<xAOD::AFPTrackContainer> afpTrackContainer (m_afpTrackContainerKey, ctx); + if(!afpTrackContainer.isValid()){ + ATH_MSG_WARNING("cannot get AFPTrackContainer"); + return StatusCode::SUCCESS; + }else{ + ATH_MSG_DEBUG("successfully got AFPTrackContainer"); + } + + +// Fill histograms: +// Pixel hit histograms: + + for (const xAOD::AFPSiHit* hit : *afpHitContainer) + { + int st=hit->stationID(); + int la=hit->pixelLayerID(); + + if(st<0 || m_nStations<=st) + { + ATH_MSG_INFO("stationID = " <<st<<", but expected values are from 0 to "<<m_nStations-1 ); + continue; + } + if(la<0 || m_nLayers<=la) + { + ATH_MSG_INFO("pixelLayerID = " <<la<<", but expected values are from 0 to "<<m_nLayers-1 ); + continue; + } + + m_pixelHits[st][la].at(lb_index).Fill(hit->pixelRowIDChip(),hit->pixelColIDChip()); + } + +// Histograms for local alignment: + + // determining numbers for good track selection + + int nTrks[m_nStations]={0}; + int nClusterHits[m_nStations]={0}; + int nClusterHistPerPlane[m_nStations][m_nLayers]={{0}}; + + for(const xAOD::AFPTrack* track: *afpTrackContainer){ + nTrks[track->stationID()]++; + for(const auto& cluster : track->clusters()){ + nClusterHits[(*cluster)->stationID()]++; + nClusterHistPerPlane[(*cluster)->stationID()][(*cluster)->pixelLayerID()]++; + } + } + + // looping over tracks + + for(const xAOD::AFPTrack* track: *afpTrackContainer){ + + if(nTrks[track->stationID()] != 1) continue; //exactly 1 track per station + + for (const auto& cluster : track->clusters()) + { + int st=(*cluster)->stationID(); + int la=(*cluster)->pixelLayerID(); + + + + if(st<0 || m_nStations<=st) + { + ATH_MSG_INFO("stationID = " <<st<<", but expected values are from 0 to "<<m_nStations-1 ); + continue; + } + + if(la<0 || m_nLayers<=la) + { + ATH_MSG_INFO("pixelLayerID = " <<la<<", but expected values are from 0 to "<<m_nLayers-1 ); + continue; + } + + if(nClusterHits[st]<3 || nClusterHits[st]>4) continue; // 3 or 4 cluster hits per track + if(nClusterHistPerPlane[st][la]>1) continue; // 1 cluster hit per plane + + m_pixelCluster[st][la].at(lb_index).Fill((*cluster)->xLocal(),(*cluster)->yLocal()); + + double dx = 1e3*(track->xLocal() + (*cluster)->zLocal()*track->xSlope() - (*cluster)->xLocal()); + double dy = 1e3*(track->yLocal() + (*cluster)->zLocal()*track->ySlope() - (*cluster)->yLocal()); + + m_lb_yCluster_yDistSiTrackCluster[st][la].Fill(current_lb, (*cluster)->yLocal(), dy); + m_lb_xCluster_xDistSiTrackCluster[st][la].Fill(current_lb, (*cluster)->xLocal(), dx); + m_lb_sxTrack_xDistSiTrackCluster[st][la].Fill(current_lb, track->xSlope(), dx); + m_lb_syTrack_yDistSiTrackCluster[st][la].Fill(current_lb, track->ySlope(), dy); + m_lb_syTrack_xDistSiTrackCluster[st][la].Fill(current_lb, track->ySlope(), dx); + m_lb_sxTrack_yDistSiTrackCluster[st][la].Fill(current_lb, track->xSlope(), dy); + + m_lb_xDistSiTrackCluster[st][la].Fill(current_lb, dx); + m_lb_yDistSiTrackCluster[st][la].Fill(current_lb, dy); + + m_lb_xCluster_yDistSiTrackCluster[st][la].Fill(current_lb, (*cluster)->xLocal(), dy); + m_lb_yCluster_xDistSiTrackCluster[st][la].Fill(current_lb, (*cluster)->yLocal(), dx); + m_lb_zCluster_xDistSiTrackCluster[st][la].Fill(current_lb, (*cluster)->zLocal(), dx); + m_lb_zCluster_yDistSiTrackCluster[st][la].Fill(current_lb, (*cluster)->zLocal(), dy); + + } + + } + + return StatusCode::SUCCESS; } StatusCode AFP_PixelHistoFiller::finalize() -{ - std::unique_ptr<TFile> output_file(new TFile("AFP_PixelHistoFiller.root","recreate")); - - TH1I lb("LBRangeLength","LBRangeLength",2,0,2); - lb.Fill(0.5); - lb.Fill(1.5,m_LBRangeLength); - lb.Write(); - - for(int st=0;st<m_nStations;++st) - { - for(int la=0;la<m_nLayers;++la) - { - for(TH2F& hist: m_pixelHits[st][la]) - { - hist.Write(); - } - } - } - - output_file->Close(); - - return StatusCode::SUCCESS; +{ + std::unique_ptr<TFile> output_file(new TFile("AFP_PixelHistoFiller.root","recreate")); + + TH1I lb("LBRangeLength","LBRangeLength",2,0,2); + lb.Fill(0.5); + lb.Fill(1.5,m_LBRangeLength); + lb.Write(); + + for(int st=0;st<m_nStations;++st) + { + for(int la=0;la<m_nLayers;++la) + { + m_lb_xDistSiTrackCluster[st][la].Write(); + m_lb_yDistSiTrackCluster[st][la].Write(); + m_lb_xCluster_yDistSiTrackCluster[st][la].Write(); + m_lb_yCluster_xDistSiTrackCluster[st][la].Write(); + m_lb_zCluster_xDistSiTrackCluster[st][la].Write(); + m_lb_zCluster_yDistSiTrackCluster[st][la].Write(); + m_lb_yCluster_yDistSiTrackCluster[st][la].Write(); + m_lb_xCluster_xDistSiTrackCluster[st][la].Write(); + m_lb_sxTrack_xDistSiTrackCluster[st][la].Write(); + m_lb_syTrack_yDistSiTrackCluster[st][la].Write(); + m_lb_syTrack_xDistSiTrackCluster[st][la].Write(); + m_lb_sxTrack_yDistSiTrackCluster[st][la].Write(); + + for(TH2F& p_hist: m_pixelHits[st][la]) + { + p_hist.Write(); + } + for(TH2F& c_hist: m_pixelCluster[st][la]){ + c_hist.Write(); + } + + } + } + + output_file->Close(); + + return StatusCode::SUCCESS; } diff --git a/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py b/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py index 3b68b1f3c2e30eee9c46a2ef1c3cfe566c0a4a1a..f7ef911b5d75cf824db7df5e12621dbc3aebd173 100644 --- a/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py +++ b/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # """Functionality core of the Gen_tf transform""" @@ -143,6 +143,10 @@ from EvgenProdTools.EvgenProdToolsConf import CopyEventWeight if not hasattr(postSeq, "CopyEventWeight"): postSeq += CopyEventWeight(mcEventWeightsKey="TMPEvtInfo.mcEventWeights") +from EvgenProdTools.EvgenProdToolsConf import FillFilterValues +if not hasattr(postSeq, "FillFilterValues"): + postSeq += FillFilterValues(mcFilterHTKey="TMPEvtInfo.mcFilterHT") + ## Configure the event counting (AFTER all filters) # TODO: Rewrite in Python? from EvgenProdTools.EvgenProdToolsConf import CountHepMC @@ -188,6 +192,13 @@ if hasattr(runArgs, "rivetAnas"): if hasattr(runArgs, "outputYODAFile"): anaSeq.Rivet_i.HistoFile = runArgs.outputYODAFile +# in case of mc23 protect against changing run number in McEventSelector +rel = os.popen("echo $AtlasVersion").read() +rel = rel.strip() +if (int(rel[:2]) > 22 ): + from AthenaCommon.AppMgr import ServiceMgr + ServiceMgr.EventSelector.EventsPerRun = int(2**63 - 1) #sys.maxint on a 64-bit machine + ##============================================================== ## Pre- and main config parsing ##============================================================== @@ -581,8 +592,6 @@ def checkPurpleList(relFlavour,cache,generatorName) : ## Announce start of JO checkingrelease number checking evgenLog.debug("****************** CHECKING RELEASE IS NOT BLACKLISTED *****************") -rel = os.popen("echo $AtlasVersion").read() -rel = rel.strip() errorBL = checkBlackList("AthGeneration",rel,gennames) if (errorBL): if (hasattr( runArgs, "ignoreBlackList") and runArgs.ignoreBlackList): diff --git a/Generators/EvgenProdTools/CMakeLists.txt b/Generators/EvgenProdTools/CMakeLists.txt index 1cde6037440e4223cd3e13f0ba2e4f440367cff1..ed742385bebc545194acc96d32daee4312f2618a 100644 --- a/Generators/EvgenProdTools/CMakeLists.txt +++ b/Generators/EvgenProdTools/CMakeLists.txt @@ -22,4 +22,4 @@ atlas_add_component( EvgenProdTools atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/common/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 ) atlas_install_runtime( share/file/*.txt ) -atlas_install_scripts( scripts/simple_lhe_plotter.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_scripts( scripts/simple_lhe_plotter.py scripts/lhe_splitter.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Generators/EvgenProdTools/EvgenProdTools/FillFilterValues.h b/Generators/EvgenProdTools/EvgenProdTools/FillFilterValues.h new file mode 100644 index 0000000000000000000000000000000000000000..fd3a8140465230bdcb82f812189e19d999db9b79 --- /dev/null +++ b/Generators/EvgenProdTools/EvgenProdTools/FillFilterValues.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAOD_ANALYSIS + +#ifndef EVGENPRODTOOLS_FILLFILTERVALUES_H +#define EVGENPRODTOOLS_FILLFILTERVALUES_H + +#include "GeneratorModules/GenBase.h" +#include "StoreGate/WriteDecorHandleKey.h" +#include "xAODEventInfo/EventInfo.h" + +/** + * @class FillFilterValues + * @brief Copy MC gen values we filter on into the event info store + * + * @author E.M. Lobodzinska <ewelina.maria.lobodzinska@cern.ch> + * @author Andy Buckley <andy.buckley@cern.ch> + * + **/ + +class FillFilterValues : public GenBase { +public: + + /// Constructor + FillFilterValues(const std::string& name, ISvcLocator* svcLoc); + + /// Copy the filter values for each event + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + +private: + +SG::WriteDecorHandleKey<xAOD::EventInfo> m_mcFilterHTKey {this + , "mcFilterHTKey" + , "TMPEvtInfo.mcFilterHT" + , "Decoration for MC Filter HT"}; + +SG::WriteDecorHandleKey<xAOD::EventInfo> m_mcFilterMETKey {this + , "mcFilterMETKey" + , "TMPEvtInfo.mcFilterMET" + , "Decoration for MC Filter MET"}; + + +}; + + +#endif + +#endif diff --git a/Generators/EvgenProdTools/scripts/lhe_splitter.py b/Generators/EvgenProdTools/scripts/lhe_splitter.py new file mode 100755 index 0000000000000000000000000000000000000000..5cdd6f13509abb5a7251c76d09303cf5d10cdb2b --- /dev/null +++ b/Generators/EvgenProdTools/scripts/lhe_splitter.py @@ -0,0 +1,95 @@ +#! /usr/bin/env python3 + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# +## Simple script to split LHE files (XML, but not always correctly formatted) + +import sys +import argparse +import math +import os + +def main(): + # Grab and parse the arguments for the script + parser = argparse.ArgumentParser(description="Split an LHE file into chunks") + parser.add_argument('inputFile', help="Input file") + parser.add_argument('--events', '-e', type=int, required=True, + help="Number of events per output file") + parser.add_argument('--directory', '-d', help='Output directory (optional; default ".")') + args = vars(parser.parse_args(sys.argv[1:])) + + # Pop open the input file + if not os.access( args['inputFile'] , os.R_OK ): + print(f'Error: cannot access input file {args["inputFile"][0]}') + return 1 + in_file = open( args['inputFile'] , 'r' ) + + # Do a little name parsing to figure out the name of the output file(s) + last_dot = os.path.basename( args['inputFile'] ).rfind('.') + out_stem = os.path.basename( args['inputFile'] )[ : last_dot ] + if 'directory' in args and args['directory'] is not None: + out_stem = args['directory']+'/'+out_stem + out_ext = '' if last_dot < 0 else os.path.basename( args['inputFile'] )[ last_dot : ] + + # Count the number of events in the file + n_events = 0 + for line in in_file: + if '<event>' in line or '<event ' in line: + n_events+=1 + + # Do a little error checking + print(f'Attempting to split file of {n_events} events into files of {args["events"]} events each') + if n_events < args['events']: + print(f'Fewer events than requested {args["events"]} in input file. No action needed.') + return 0 + if not (n_events/args['events']).is_integer(): + print(f'Warning: the final file will only have {n_events%args["events"]} events') + + # Reset to the beginning of the file + in_file.seek(0,0) + + # Pop open all our output files + n_files = math.ceil(n_events/args['events']) + out_files = [] + for i in range(n_files): + if os.access( f'{out_stem}_{i}{out_ext}' , os.R_OK ): + print(f'Error: output file {out_stem}_{i}{out_ext} exists. Please cleanup and try again') + sys.exit(1) + out_files += [ open( f'{out_stem}_{i}{out_ext}', 'w' ) ] + + # Read back through the file, and let's parse! + # Keep track of which event in the file we've reached + this_event = -1 + for line in in_file: + # See if we're in the header or the footer + # If we are, it goes into ALL the files + if (this_event==-1 and '<event>' not in line and '<event ' not in line) or this_event==n_events: + for i in range(n_files): + out_files[i].write(line) + # Use a continue just to tidy up the next conditions + continue + + # See if we're reading an event + if '<event>' in line or '<event ' in line: + this_event += 1 + + # Which output file do we want? + my_file = math.floor(this_event/args['events']) + if my_file==n_files: + print(f'Uh oh. {this_event} {args["events"]} {my_file}') + out_files[my_file].write(line) + + # Special condition: we've reached the end + if '</event>' in line and this_event==n_events-1: + this_event += 1 + + # Close up + for i in range(n_files): + out_files[i].close() + in_file.close() + + # All done + return 0 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/Generators/EvgenProdTools/scripts/simple_lhe_plotter.py b/Generators/EvgenProdTools/scripts/simple_lhe_plotter.py index 4d650a6bb040509d501c6c20f8b89b2fb60cc27d..90671f286f31441d55b7344b8bcb8c1e01436ac5 100755 --- a/Generators/EvgenProdTools/scripts/simple_lhe_plotter.py +++ b/Generators/EvgenProdTools/scripts/simple_lhe_plotter.py @@ -1,122 +1,136 @@ -#!/usr/bin/env python -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +#!/usr/bin/env python3 +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function +import sys +import argparse +import glob +import math -# Basic ROOT setup -import ROOT,sys,math,glob -ROOT.gROOT.SetBatch(True) -ROOT.gErrorIgnoreLevel = ROOT.kError +def main(): -# Check for the right input files -if len(sys.argv)>1: + # Grab and parse the arguments for the script + parser = argparse.ArgumentParser(description="Make simple plots of an LHE file") + parser.add_argument('inputFiles', help='Comma-separated list of input files to sum in plots') + args = vars(parser.parse_args(sys.argv[1:])) + + # Allow people to either separate by commas or with spaces inputfilenames = [] - for a in sys.argv[1].split(','): + for a in args['inputFiles'].split(','): inputfilenames+=glob.glob(a) -else: - print ('Please specify an input LHE file (or comma-separated lists of them)') - sys.exit(1) + if len(inputfilenames)==0: + print('You must specify at least one input file') + return 1 + + # Basic ROOT setup; leave import to here so we've dealt with inputs etc + import ROOT + ROOT.gROOT.SetBatch(True) + ROOT.gErrorIgnoreLevel = ROOT.kError + + # Set up histograms + # Energy and PDG ID of incoming partons + e_init_0 = ROOT.TH1D('e_init_0','',100,0,2000) + e_init_1 = ROOT.TH1D('e_init_1','',100,0,2000) + pdg_init = ROOT.TH1D('pdg_init','',25,0,25) + # Hard outgoing partons, just plot pTs + pt_hard_0 = ROOT.TH1D('pt_hard_0','',100,0,1000) + pt_hard_1 = ROOT.TH1D('pt_hard_1','',100,0,1000) + # Generally after the first two, we're into extra partons + pt_extra_0 = ROOT.TH1D('pt_extra_0','',100,0,1000) + pt_extra_1 = ROOT.TH1D('pt_extra_1','',100,0,1000) + pt_extra_2 = ROOT.TH1D('pt_extra_2','',100,0,1000) + pt_extra_3 = ROOT.TH1D('pt_extra_3','',100,0,1000) + pt_extra_4 = ROOT.TH1D('pt_extra_4','',100,0,1000) + pt_extra_5 = ROOT.TH1D('pt_extra_5','',100,0,1000) + pdg_extras = ROOT.TH1D('pdg_extras','',100,0,1000) + # And LHE multiplicity + multip = ROOT.TH1D('mult','',20,0,20) + weights = ROOT.TH1D('weights','',100,0,1000) + # Array of all the histograms for later writing + histograms = [e_init_0,e_init_1,pdg_init,pt_hard_0,pt_hard_1,pt_extra_0,pt_extra_1,pt_extra_2,pt_extra_3,pt_extra_4,pt_extra_5,pdg_extras,multip,weights] + + # Now loop through input file + for inputfilename in inputfilenames: + # LHE format documented in https://arxiv.org/pdf/1405.1067.pdf + with open(inputfilename,'r') as inputfile: + event = False + npartons = -1 + extras = 0 + for line in inputfile: + # Check for the ktdurham cut + if 'ktdurham' in line and '=' in line: + # Print the matching cut for info + print ('Matching cut:',float(line.split()[0])) + continue + # Check for a comment + if len(line.split('#')[0].strip())==0: + continue + # Check if we have entered an event + if not event and '<event>' not in line: + continue + # Check if we are just starting an event + if not event and '<event>' in line: + event = True + continue + # Check if we have finished and are doing something else + if '<' in line or '>' in line: + event = False + npartons = -1 + continue + # Check to parse the first line of the event + if npartons<0: + npartons = int(line.split()[0]) + multip.Fill(npartons-2) # Final state multiplicity + weight = float(line.split()[2]) + weights.Fill(weight) + extras = npartons-4 + continue + # Deal with the inital state partons first + if npartons>extras+2: + if npartons>extras+3: + e_init_0.Fill( float(line.split()[9]) ) + else: + e_init_1.Fill( float(line.split()[9]) ) + pdg_init.Fill( abs(int(line.split()[0])) ) + npartons -= 1 + continue + momentum_x = float(line.split()[6]) + momentum_y = float(line.split()[7]) + pt = math.sqrt(momentum_x*momentum_x+momentum_y*momentum_y) + # Now deal with hard scatter partons + if npartons>extras: + if npartons>extras+1: + pt_hard_0.Fill(pt) + else: + pt_hard_1.Fill(pt) + npartons -= 1 + continue + # Now we are into the extras + if extras==npartons: + pt_extra_0.Fill(pt) + elif extras-1==npartons: + pt_extra_1.Fill(pt) + elif extras-2==npartons: + pt_extra_2.Fill(pt) + elif extras-3==npartons: + pt_extra_3.Fill(pt) + elif extras-4==npartons: + pt_extra_4.Fill(pt) + elif extras-5==npartons: + pt_extra_5.Fill(pt) + pdg_extras.Fill( abs(int(line.split()[0])) ) + npartons-=1 + # End of loop over input file lines + # Done holding open LHE file + + # Write all the histograms for future use + output_hists = ROOT.TFile.Open('output_hists.root','RECREATE') + output_hists.cd() + for h in histograms: + h.Write(h.GetName()) + output_hists.Close() -# Set up histograms -# Energy and PDG ID of incoming partons -e_init_0 = ROOT.TH1D('e_init_0','',100,0,2000) -e_init_1 = ROOT.TH1D('e_init_1','',100,0,2000) -pdg_init = ROOT.TH1D('pdg_init','',25,0,25) -# Hard outgoing partons, just plot pTs -pt_hard_0 = ROOT.TH1D('pt_hard_0','',100,0,1000) -pt_hard_1 = ROOT.TH1D('pt_hard_1','',100,0,1000) -# Generally after the first two, we're into extra partons -pt_extra_0 = ROOT.TH1D('pt_extra_0','',100,0,1000) -pt_extra_1 = ROOT.TH1D('pt_extra_1','',100,0,1000) -pt_extra_2 = ROOT.TH1D('pt_extra_2','',100,0,1000) -pt_extra_3 = ROOT.TH1D('pt_extra_3','',100,0,1000) -pt_extra_4 = ROOT.TH1D('pt_extra_4','',100,0,1000) -pt_extra_5 = ROOT.TH1D('pt_extra_5','',100,0,1000) -pdg_extras = ROOT.TH1D('pdg_extras','',100,0,1000) -# And LHE multiplicity -multip = ROOT.TH1D('mult','',20,0,20) -weights = ROOT.TH1D('weights','',100,0,1000) -# Array of all the histograms for later writing -histograms = [e_init_0,e_init_1,pdg_init,pt_hard_0,pt_hard_1,pt_extra_0,pt_extra_1,pt_extra_2,pt_extra_3,pt_extra_4,pt_extra_5,pdg_extras,multip,weights] + return 0 -# Now loop through input file -for inputfilename in inputfilenames: - # LHE format documented in https://arxiv.org/pdf/1405.1067.pdf - with open(inputfilename,'r') as inputfile: - event = False - npartons = -1 - extras = 0 - ep_pt = 0. - for line in inputfile: - # Check for the ktdurham cut - if 'ktdurham' in line and '=' in line: - # Print the matching cut for info - print ('Matching cut:',float(line.split()[0])) - continue - # Check for a comment - if len(line.split('#')[0].strip())==0: - continue - # Check if we have entered an event - if not event and '<event>' not in line: - continue - # Check if we are just starting an event - if not event and '<event>' in line: - event = True - continue - # Check if we have finished and are doing something else - if '<' in line or '>' in line: - event = False - npartons = -1 - continue - # Check to parse the first line of the event - if npartons<0: - npartons = int(line.split()[0]) - multip.Fill(npartons-2) # Final state multiplicity - weight = float(line.split()[2]) - weights.Fill(weight) - extras = npartons-4 - continue - # Deal with the inital state partons first - if npartons>extras+2: - if npartons>extras+3: - e_init_0.Fill( float(line.split()[9]) ) - else: - e_init_1.Fill( float(line.split()[9]) ) - pdg_init.Fill( abs(int(line.split()[0])) ) - npartons -= 1 - continue - momentum_x = float(line.split()[6]) - momentum_y = float(line.split()[7]) - pt = math.sqrt(momentum_x*momentum_x+momentum_y*momentum_y) - # Now deal with hard scatter partons - if npartons>extras: - if npartons>extras+1: - pt_hard_0.Fill(pt) - else: - pt_hard_1.Fill(pt) - npartons -= 1 - continue - # Now we are into the extras - if extras==npartons: - pt_extra_0.Fill(pt) - elif extras-1==npartons: - pt_extra_1.Fill(pt) - elif extras-2==npartons: - pt_extra_2.Fill(pt) - elif extras-3==npartons: - pt_extra_3.Fill(pt) - elif extras-4==npartons: - pt_extra_4.Fill(pt) - elif extras-5==npartons: - pt_extra_5.Fill(pt) - pdg_extras.Fill( abs(int(line.split()[0])) ) - npartons-=1 - # End of loop over input file lines -# Done holding open LHE file +if __name__ == "__main__": + sys.exit(main()) -# Write all the histograms for future use -output_hists = ROOT.TFile.Open('output_hists.root','RECREATE') -output_hists.cd() -for h in histograms: - h.Write(h.GetName()) -output_hists.Close() diff --git a/Generators/EvgenProdTools/src/CountHepMC.cxx b/Generators/EvgenProdTools/src/CountHepMC.cxx index 3eb2b930cbaf279957162dc423f5ab8b1d955c7d..7c6b9edb91218e6b7e15e9d62999483d68f18f95 100644 --- a/Generators/EvgenProdTools/src/CountHepMC.cxx +++ b/Generators/EvgenProdTools/src/CountHepMC.cxx @@ -65,6 +65,15 @@ StatusCode CountHepMC::execute() { return StatusCode::FAILURE; } +#ifndef HEPMC3 + /// crash the run if event number gets above 32bit int. + constexpr long long int max32 = std::pow(2, 31) - 1; + if (newnum >= max32) { + ATH_MSG_ERROR("Event number " << newnum << " exceeds 32bit limit. In HepMC2 it is not allowed."); + return StatusCode::FAILURE; + } +#endif + if (m_corHepMC) { std::string key = m_inputKeyName; // retrieve event from Transient Store (Storegate) diff --git a/Generators/EvgenProdTools/src/FillFilterValues.cxx b/Generators/EvgenProdTools/src/FillFilterValues.cxx new file mode 100644 index 0000000000000000000000000000000000000000..540afd08facdcdc16e9ddf4ad07539ad28725cd2 --- /dev/null +++ b/Generators/EvgenProdTools/src/FillFilterValues.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAOD_ANALYSIS + +#include "EvgenProdTools/FillFilterValues.h" +#include "StoreGate/WriteDecorHandle.h" +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventType.h" + +FillFilterValues::FillFilterValues(const std::string& name, ISvcLocator* svcLoc) + : GenBase(name, svcLoc) +{ +} + +StatusCode FillFilterValues::initialize() +{ + ATH_CHECK(GenBase::initialize()); + ATH_CHECK(m_mcFilterHTKey.initialize()); + ATH_CHECK(m_mcFilterMETKey.initialize()); + return StatusCode::SUCCESS; +} + +StatusCode FillFilterValues::execute() { +#ifdef HEPMC3 + // Check that the collection isn't empty + const size_t nEvents = events_const()->size(); + if (nEvents == 0) { + ATH_MSG_WARNING("McEventCollection is empty"); + return StatusCode::SUCCESS; + } + // Get the event info/type object to be filled + const EventInfo* pInputEvt(nullptr); + CHECK(evtStore()->retrieve(pInputEvt)); + assert(pInputEvt); + + // write filter values into xAOD::EventInfo + + SG::WriteDecorHandle<xAOD::EventInfo,float> dec_filtHT(m_mcFilterHTKey); + if (event_const()->attribute<HepMC3::DoubleAttribute>("filterHT") != NULL){ + std::shared_ptr<HepMC3::DoubleAttribute> fHT = event_const()->attribute<HepMC3::DoubleAttribute>("filterHT"); + double fHT_double = fHT->value(); + dec_filtHT(0) = fHT_double; + } + + SG::WriteDecorHandle<xAOD::EventInfo,float> dec_filtMET(m_mcFilterMETKey); + if (event_const()->attribute<HepMC3::DoubleAttribute>("filterMET") != NULL){ + std::shared_ptr<HepMC3::DoubleAttribute> fMET = event_const()->attribute<HepMC3::DoubleAttribute>("filterMET"); + double fMET_double = fMET->value(); + dec_filtMET(0) = fMET_double; + } + + // Post-hoc debug printouts + ATH_MSG_DEBUG("Copied HepMC filter values to EventInfo"); + +#endif + return StatusCode::SUCCESS; +} + +#endif + diff --git a/Generators/EvgenProdTools/src/components/EvgenProdTools_entries.cxx b/Generators/EvgenProdTools/src/components/EvgenProdTools_entries.cxx index eed57fac101c244a24958e2c0b66bf54a7212c08..8ff656843f1e8ca49c465c261e8744b8d638df07 100644 --- a/Generators/EvgenProdTools/src/components/EvgenProdTools_entries.cxx +++ b/Generators/EvgenProdTools/src/components/EvgenProdTools_entries.cxx @@ -1,5 +1,6 @@ #include "EvgenProdTools/CopyEventWeight.h" #include "EvgenProdTools/CountHepMC.h" +#include "EvgenProdTools/FillFilterValues.h" #include "EvgenProdTools/FixHepMC.h" #include "EvgenProdTools/TestHepMC.h" #include "EvgenProdTools/EvgenOTFTopUpSvc.h" @@ -7,6 +8,7 @@ DECLARE_COMPONENT( CopyEventWeight ) DECLARE_COMPONENT( CountHepMC ) +DECLARE_COMPONENT( FillFilterValues ) DECLARE_COMPONENT( FixHepMC ) DECLARE_COMPONENT( TestHepMC ) DECLARE_COMPONENT( EvgenOTFTopUpSvc ) diff --git a/Generators/GeneratorFilters/GeneratorFilters/ParentChildFilter.h b/Generators/GeneratorFilters/GeneratorFilters/ParentChildFilter.h index 5015bf33cc045b4f2b68ea35b9a2ed8cd289e372..11194ddecfbe9c15910d97252da59a01ea0f1ed7 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/ParentChildFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/ParentChildFilter.h @@ -30,8 +30,11 @@ private: double m_PtMinChild; double m_EtaRangeChild; +#ifdef HEPMC3 + +#else /** calculate the rapidity of a particle */ - inline double getRapidity(HepMC::GenParticle*& p) const { + inline double getRapidity(const HepMC::GenParticle* p) const { double e = (p)->momentum().e(); double pz = (p)->momentum().pz(); if (e == pz) return 9999.; @@ -39,6 +42,7 @@ private: double rapidity = 0.5 * log((e + pz) / (e - pz)); return rapidity; }; +#endif }; #endif diff --git a/Generators/GeneratorFilters/GeneratorFilters/ParticleDecayFilter.h b/Generators/GeneratorFilters/GeneratorFilters/ParticleDecayFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..cca427efdbb013763f475048650ed19714f1d1c7 --- /dev/null +++ b/Generators/GeneratorFilters/GeneratorFilters/ParticleDecayFilter.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODPARTICLEDECAYFILTER_H +#define XAODPARTICLEDECAYFILTER_H + +#include "GeneratorModules/GenFilter.h" +#include "xAODTruth/TruthEventContainer.h" + +/** +Class to filter events based on the decay of a parent particle into a set of children particles. +User specifies the parent particle pdg ID and a list of children particle pdg IDs to filter on. +It was designed with the single particle gun generator in mind, but should in principle +work in any sample. +It has been tested, when generating 10k events, to give filter efficiencies consistent with +the expected branching ratios from the PDG in the cases of w(782)->pi+pi-pi0, w(782)->pi0 + gamma +*/ + +class ParticleDecayFilter : public GenFilter { + +public: + + ParticleDecayFilter(const std::string& name, ISvcLocator* pSvcLocator); + StatusCode filterInitialize(); + StatusCode filterFinalize(); + StatusCode filterEvent(); + +private: + +/** ReadHandle for the TruthEvents */ +SG::ReadHandleKey<xAOD::TruthEventContainer> m_truthEventsKey{this, "TruthEventsKey", "TruthEvents", "ReadHandleKey for the TruthEvents"}; + +/** Particle ID of parent particle */ +Gaudi::Property<unsigned int> m_pdgIdParent{this,"ParentPdgId",0,"Particle ID of parent particle"}; + +/** Particle IDs of children of parent particle */ +Gaudi::Property<std::vector<int> > m_pdgIdChildren{this,"ChildrenPdgIds",std::vector<int>(),"Particle IDs of children of parent particle"}; + +/** Toggle whether we check the charge of children particles */ +Gaudi::Property<bool> m_checkCharge{this,"CheckCharge",true,"Toggle whether we check the charge of children particles"}; + +}; +#endif diff --git a/Generators/GeneratorFilters/GeneratorFilters/xAODHTFilter.h b/Generators/GeneratorFilters/GeneratorFilters/xAODHTFilter.h index b14ade1219a31157f633cdb13fbcec3077143143..f4d0e52d0a456c1323fa76a6ce9d8a799878e5c8 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/xAODHTFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/xAODHTFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GENERATORFILTERS_XAODHTFilter_H @@ -11,10 +11,16 @@ #include "xAODTruth/TruthEvent.h" #include "xAODTruth/TruthEventContainer.h" #include "xAODTruth/TruthMetaDataContainer.h" +// Defs for the particle origin +#include "MCTruthClassifier/IMCTruthClassifier.h" + +#include "StoreGate/WriteDecorHandleKey.h" +#include "xAODEventInfo/EventInfo.h" class MsgStream; class StoreGateSvc; + class xAODHTFilter:public GenFilter { public: @@ -25,9 +31,7 @@ public: virtual StatusCode filterFinalize(); virtual StatusCode filterEvent(); - bool fromTau( const xAOD::TruthParticle* tp ) const; - bool fromWZ( const xAOD::TruthParticle* tp ) const; - + bool isPrompt( const xAOD::TruthParticle* tp ) const; private: double m_MinJetPt; //!< Min pT for the truth jets @@ -40,11 +44,19 @@ private: bool m_UseLep; //!< Use leptons in HT std::string m_TruthJetContainerName; //!< Name of the truth jet container + std::string m_eventInfoName; long m_total; //!< Total number of events tested long m_passed; //!< Number of events passing all cuts long m_ptfailed; //!< Number of events failing the pT cuts + ToolHandle<IMCTruthClassifier> m_classif; + + SG::WriteDecorHandleKey<xAOD::EventInfo> m_mcFilterHTKey {this + , "mcFilterHTKey" + , "TMPEvtInfo.mcFilterHTKey" + , "Decoration for MC Filter HT"}; + }; #endif diff --git a/Generators/GeneratorFilters/GeneratorFilters/xAODParticleFilter.h b/Generators/GeneratorFilters/GeneratorFilters/xAODParticleFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..02431fbd767c918f1ddf09e0476751f13ef4dafa --- /dev/null +++ b/Generators/GeneratorFilters/GeneratorFilters/xAODParticleFilter.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GENERATORFILTERS_xAODParticleFilter_H +#define GENERATORFILTERS_xAODParticleFilter_H + +#include "GeneratorModules/GenFilter.h" + +/// The filter will pass only if it finds a particle with the specified properties +/// @author I Hinchliffe, May 2004 +/// @author B K Gjelsten, March 2006 +/// @author R Bruneliere, Aug 2008 +class xAODParticleFilter : public GenFilter { +public: + + xAODParticleFilter(const std::string& name, ISvcLocator* pSvcLocator); + virtual StatusCode filterInitialize() override; + virtual StatusCode filterEvent() override; + +private: + + Gaudi::Property<double> m_Ptmin{this, "Ptcut", 10000.}; + Gaudi::Property<double> m_EtaRange{this, "Etacut", 10.0}; + Gaudi::Property<double> m_EnergyRange{this, "Energycut", 100000000.0}; + Gaudi::Property<int> m_PDGID{this, "PDG", 11}; + Gaudi::Property<int> m_StatusReq{this, "StatusReq", 1}; + Gaudi::Property<int> m_MinParts{this, "MinParts", 1}; + Gaudi::Property<bool> m_Exclusive{this, "Exclusive", false}; +}; + +#endif diff --git a/Generators/GeneratorFilters/GeneratorFilters/xAODTruthParticleSlimmerMET.h b/Generators/GeneratorFilters/GeneratorFilters/xAODTruthParticleSlimmerMET.h index e66d7612d04d770da96ab942068f56d2777e00c6..176b277b31d374f9779457c40602cbb870ecfcfd 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/xAODTruthParticleSlimmerMET.h +++ b/Generators/GeneratorFilters/GeneratorFilters/xAODTruthParticleSlimmerMET.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GENERATORFILTERS_XAODTRUTHPARTICLESLIMMERPHOMET_H @@ -10,6 +10,7 @@ #include "xAODTruth/TruthEvent.h" #include "xAODTruth/TruthEventContainer.h" #include "xAODTruth/TruthMetaDataContainer.h" +#include "MCTruthClassifier/IMCTruthClassifier.h" /// @brief Algorithm to skim the xAOD truth particle container for xAOD MET filter /// @@ -37,9 +38,9 @@ private: /// Selection values for keeping METs //double m_MET_pt_selection; //in GeV - bool fromTau( const xAOD::TruthParticle* tp ) const; - bool fromWZ( const xAOD::TruthParticle* tp ) const; + bool prompt( const xAOD::TruthParticle* tp ) const; + ToolHandle<IMCTruthClassifier> m_classif; }; // class xAODTruthParticleSlimmerMET -#endif //GENERATORFILTERS_XAODTRUTHPARTICLESLIMMERPHOMET_H \ No newline at end of file +#endif //GENERATORFILTERS_XAODTRUTHPARTICLESLIMMERPHOMET_H diff --git a/Generators/GeneratorFilters/share/common/xAODDecaysFinalStateFilter_Common.py b/Generators/GeneratorFilters/share/common/xAODDecaysFinalStateFilter_Common.py index 95a4cd0db34f18c61db1df15d0f45a97801246d4..721b68db076dec3b39603bf8c13373b9f83e9745 100644 --- a/Generators/GeneratorFilters/share/common/xAODDecaysFinalStateFilter_Common.py +++ b/Generators/GeneratorFilters/share/common/xAODDecaysFinalStateFilter_Common.py @@ -6,7 +6,7 @@ include ("GeneratorFilters/CreatexAODSlimContainers.py") from GeneratorFilters.GeneratorFiltersConf import xAODDecaysFinalStateFilter -xAODDecaysFinalState = xAODDecaysFinalState("xAODDecaysFinalStateFilter") +xAODDecaysFinalStateFilter = xAODDecaysFinalStateFilter("xAODDecaysFinalStateFilter") filtSeq += xAODDecaysFinalStateFilter # to modify cuts put into JOs e.g.: diff --git a/Generators/GeneratorFilters/share/common/xAODJetFilter_Common.py b/Generators/GeneratorFilters/share/common/xAODJetFilter_Common.py index fae8a893365c27fe8307c9803bf8ca0c4e501828..1ee2cdcec7fd366c2627c15be90b711556d15889 100644 --- a/Generators/GeneratorFilters/share/common/xAODJetFilter_Common.py +++ b/Generators/GeneratorFilters/share/common/xAODJetFilter_Common.py @@ -1,4 +1,3 @@ - # conversion to XAOD, # connecting the filter @@ -9,4 +8,11 @@ prefiltSeq.xAODCnv.AODContainerName = 'GEN_EVENT' from GeneratorFilters.GeneratorFiltersConf import xAODJetFilter xAODJetFilter = xAODJetFilter("xAODJetFilter") -filtSeq += xAODJetFilter \ No newline at end of file +filtSeq += xAODJetFilter +# example setup of parameters (to use in JOs) +#filtSeq.xAODJetFilter.JetNumber = 1 +#filtSeq.xAODJetFilter.EtaRange = 2.7 +#filtSeq.xAODJetFilter.JetType = False # True = cone, False = grid +#filtSeq.xAODJetFilter.GridSizeEta = 2 # Number of (approx 0.06 size) eta cells +#filtSeq.xAODJetFilter.GridSizePhi = 2 # Number of (approx 0.06 size) phi cells +#filtSeq.xAODJetFilter.JetThreshold = 35000. diff --git a/Generators/GeneratorFilters/share/common/xAODParticleFilter_Common.py b/Generators/GeneratorFilters/share/common/xAODParticleFilter_Common.py new file mode 100644 index 0000000000000000000000000000000000000000..738093c8ada517a7947452f7207acd3254443f10 --- /dev/null +++ b/Generators/GeneratorFilters/share/common/xAODParticleFilter_Common.py @@ -0,0 +1,11 @@ +if not hasattr(filtSeq, "xAODParticleFilter"): + from GeneratorFilters.GeneratorFiltersConf import xAODParticleFilter + filtSeq += xAODParticleFilter("xAODParticleFilter") + +# Example usage of this filter +#xAODParticleFilter = filtSeq.xAODParticleFilter +#xAODParticleFilter.Ptcut = 0.0 +#xAODParticleFilter.Etacut = 10.0 +#xAODParticleFilter.PDG = 1000022 +#xAODParticleFilter.MinParts = 2 +#xAODParticleFilter.StatusReq = 11 diff --git a/Generators/GeneratorFilters/src/HTFilter.cxx b/Generators/GeneratorFilters/src/HTFilter.cxx index 9f75b0a8ecfb9435138ee66fa39577b3b31e06b2..9f6c159858d7411f8508d2d425aefdb969ba909f 100644 --- a/Generators/GeneratorFilters/src/HTFilter.cxx +++ b/Generators/GeneratorFilters/src/HTFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // Header for this module @@ -75,6 +75,14 @@ StatusCode HTFilter::filterFinalize() { StatusCode HTFilter::filterEvent() { m_total++; // Book keeping +#ifdef HEPMC3 + + +ATH_MSG_ERROR(" For HEPMC3 releases xAOD filters should be used. Exiting with ERROR. "); +return StatusCode::FAILURE; + +#endif + // Get jet container out const xAOD::JetContainer* truthjetTES = 0; if ( !evtStore()->contains<xAOD::JetContainer>( m_TruthJetContainerName ) || diff --git a/Generators/GeneratorFilters/src/MissingEtFilter.cxx b/Generators/GeneratorFilters/src/MissingEtFilter.cxx index e6a9ee0e36fb447a7044f3090ea9439c0e56d4d1..2ad7543f5c9cb2187fe24deeb271a0012f5270ac 100644 --- a/Generators/GeneratorFilters/src/MissingEtFilter.cxx +++ b/Generators/GeneratorFilters/src/MissingEtFilter.cxx @@ -19,6 +19,14 @@ MissingEtFilter::MissingEtFilter(const std::string& name, ISvcLocator* pSvcLocat StatusCode MissingEtFilter::filterEvent() { double sumx(0), sumy(0); + +#ifdef HEPMC3 + +ATH_MSG_ERROR(" For HEPMC3 releases xAOD filters should be used. Exiting with ERROR. "); +return StatusCode::FAILURE; + +#endif + McEventCollection::const_iterator itr; for (itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); diff --git a/Generators/GeneratorFilters/src/ParentChildFilter.cxx b/Generators/GeneratorFilters/src/ParentChildFilter.cxx index 8323c6064e21e1a4b038adb7b5eef7a57807a5c0..0e8e84619c1817b91f5039bbb31b3042d00e7d65 100644 --- a/Generators/GeneratorFilters/src/ParentChildFilter.cxx +++ b/Generators/GeneratorFilters/src/ParentChildFilter.cxx @@ -59,7 +59,7 @@ StatusCode ParentChildFilter::filterEvent() { && (std::abs(pitr->momentum().rap()) > m_RapidityMinParent) && (std::abs(pitr->momentum().rap()) < m_RapidityRangeParent))) { #else - && (std::abs(getRapidity(pitr)) > m_RapidityMinParent) + && (std::abs(getRapidity(pitr)) > m_RapidityMinParent) && (std::abs(getRapidity(pitr)) < m_RapidityRangeParent))) { #endif // Check if has end_vertex (skips initial protons) diff --git a/Generators/GeneratorFilters/src/ParticleDecayFilter.cxx b/Generators/GeneratorFilters/src/ParticleDecayFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8c907228bcabdd837be60682a97eed774f31cbe9 --- /dev/null +++ b/Generators/GeneratorFilters/src/ParticleDecayFilter.cxx @@ -0,0 +1,97 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeneratorFilters/ParticleDecayFilter.h" + +ParticleDecayFilter::ParticleDecayFilter(const std::string& name, ISvcLocator* pSvcLocator) + : GenFilter(name, pSvcLocator) +{ + +} + +StatusCode ParticleDecayFilter::filterInitialize() +{ + ATH_MSG_INFO("ParticleDecayFilter::filterInitialize()"); + + // initialize the ReadHandleKey + ATH_CHECK( m_truthEventsKey.initialize() ); + + return StatusCode::SUCCESS; +} + +StatusCode ParticleDecayFilter::filterFinalize() +{ + ATH_MSG_INFO("ParticleDecayFilter::filterFinalize()"); + return StatusCode::SUCCESS; +} + + +StatusCode ParticleDecayFilter::filterEvent(){ + + ATH_MSG_DEBUG("ParticleDecayFilter::filterEvent()"); + //loop over truth events + McEventCollection::const_iterator truthEvent; + for (truthEvent = events()->begin(); truthEvent != events()->end(); ++truthEvent){ + + // get the truth particles + const HepMC::GenEvent* genEvent = (*truthEvent); + + // loop over all particles + for (auto particle : *genEvent){ + ATH_MSG_DEBUG("pdg code of this particle in the event is " << particle->pdg_id() << " with status " << particle->status()); + + //maps with key pdgId and value of number of particles with that pdgId + std::map<int, unsigned int> childTargets; + std::map<int, unsigned int> childCounters; + //counter for any children not in the specified list of children + int nonListValue = -999; + childCounters[nonListValue]= 0; + + //loop over children pdgId and setup counters for each particle type + for (auto childPdgId : m_pdgIdChildren.value()){ + //for charged parents we don't check the charge of children, in order to support both possible conjugate decay modes + if (!m_checkCharge) childPdgId = std::abs(childPdgId); + if (childTargets.end() != childTargets.find(childPdgId)) childTargets[childPdgId] +=1; + else { + childTargets[childPdgId] = 1; + childCounters[childPdgId] = 0; + } + } + + // check if the parent particle id is found + if (std::abs(particle->pdg_id()) == m_pdgIdParent){ + const HepMC::ConstGenVertexPtr& decayVtx = particle->end_vertex(); +#ifdef HEPMC3 + ATH_MSG_DEBUG("Number of children is " << decayVtx->particles_out().size()); +#else + ATH_MSG_DEBUG("Number of children is " << decayVtx->particles_out_size()); +#endif + + //loop over children and count number of particles with each pdgId + for(auto thisChild: *decayVtx) { + int childPdgId = thisChild->pdg_id(); + if (!m_checkCharge) childPdgId = std::abs(childPdgId); + ATH_MSG_DEBUG("Child with id and status " << childPdgId << " " << thisChild->status()); + if (childTargets.end() != childTargets.find(childPdgId)) childCounters[childPdgId] += 1; + else childCounters[nonListValue] += 1; + } + + //check if the targeted number of children of each type have been found + if (std::all_of(childTargets.begin(), childTargets.end(), [&](const std::pair<unsigned int, unsigned int>& p) { return p.second == childCounters[p.first]; }) && childCounters[nonListValue] == 0){ + ATH_MSG_DEBUG("Filter passed"); + setFilterPassed(true); + return StatusCode::SUCCESS; + } + }// end if particle has parent pdg id + }// end loop over particles + + + + + } + + // if we get here, no particle was found with the required set of children + setFilterPassed(false); + return StatusCode::SUCCESS; +} diff --git a/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx b/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx index ca03525f7a0dd5a2759e7c5e727e214229e8dca1..c1b570fd2b761c8ad798ee289183c2181107b2d6 100644 --- a/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx +++ b/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/XtoVVDecayFilterExtended.h" @@ -126,7 +126,7 @@ bool XtoVVDecayFilterExtended::RunHistory(const HepMC::ConstGenParticlePtr& inpu if(std::abs(pitr->pdg_id()) != m_PDGGrandParent && std::abs(pitr->pdg_id()) != m_PDGParent) return false; if (result == m_PDGGrandParent) return true; - const HepMC::ConstGenParticlePtr& pitr_current = (*firstMother); + HepMC::ConstGenParticlePtr pitr_current = (*firstMother); while ( result >= 0 ) { pitr_current = CheckGrandparent(pitr_current, result); ATH_MSG_DEBUG("Pointer PDG ID: " << pitr->pdg_id()); @@ -194,7 +194,6 @@ HepMC::ConstGenParticlePtr XtoVVDecayFilterExtended::CheckGrandparent(const He n_mothers++; } - if (isGrandParentOK) { result = m_PDGGrandParent; } diff --git a/Generators/GeneratorFilters/src/components/GeneratorFilters_entries.cxx b/Generators/GeneratorFilters/src/components/GeneratorFilters_entries.cxx index a99b388f3a63a432761ef7d110f1221d697fed98..87179695d1c72b2c3c8706b00e9dd36dc446f16c 100644 --- a/Generators/GeneratorFilters/src/components/GeneratorFilters_entries.cxx +++ b/Generators/GeneratorFilters/src/components/GeneratorFilters_entries.cxx @@ -34,9 +34,7 @@ #include "GeneratorFilters/xAODHTFilter.h" #include "GeneratorFilters/xAODFourLeptonMassFilter.h" #include "GeneratorFilters/xAODJetFilter.h" - - - +#include "GeneratorFilters/xAODParticleFilter.h" // slimmers for 22.6 @@ -101,7 +99,7 @@ #include "GeneratorFilters/TruthJetFilter.h" #include "GeneratorFilters/VBFHbbEtaSortingFilter.h" #include "GeneratorFilters/ZtoLeptonFilter.h" - +#include "GeneratorFilters/ParticleDecayFilter.h" //filters accepted for 22.6 (xAOD format) DECLARE_COMPONENT( QCDTruthJetFilter ) @@ -139,9 +137,7 @@ DECLARE_COMPONENT( xAODXtoVVDecayFilterExtended ) DECLARE_COMPONENT( xAODHTFilter ) DECLARE_COMPONENT( xAODFourLeptonMassFilter) DECLARE_COMPONENT( xAODJetFilter) - - - +DECLARE_COMPONENT( xAODParticleFilter) //slimmers accepted for 22.6 DECLARE_COMPONENT( PileupTruthParticleSlimmer ) @@ -205,3 +201,4 @@ DECLARE_COMPONENT( TrimuMassRangeFilter ) DECLARE_COMPONENT( TruthJetFilter ) DECLARE_COMPONENT( VBFHbbEtaSortingFilter ) DECLARE_COMPONENT( ZtoLeptonFilter ) +DECLARE_COMPONENT( ParticleDecayFilter ) diff --git a/Generators/GeneratorFilters/src/xAODHTFilter.cxx b/Generators/GeneratorFilters/src/xAODHTFilter.cxx index 1c63b005c05dc6ea83e787b31082f6518f4d68ad..973cb9949992c4b50f2adf32db284076661cb090 100644 --- a/Generators/GeneratorFilters/src/xAODHTFilter.cxx +++ b/Generators/GeneratorFilters/src/xAODHTFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // Header for this module @@ -9,11 +9,15 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" +// EDM includes +#include "xAODEventInfo/EventInfo.h" + // Used for retrieving the collection #include "xAODJet/JetContainer.h" #include "xAODTruth/TruthParticle.h" #include "xAODTruth/TruthVertex.h" #include "StoreGate/StoreGateSvc.h" +#include "StoreGate/WriteDecorHandle.h" // Other classes used by this class #include "TruthUtils/HepMCHelpers.h" @@ -24,11 +28,14 @@ #include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthParticleAuxContainer.h" #include "GeneratorObjects/xAODTruthParticleLink.h" +// Tool handle interface +#include "MCTruthClassifier/IMCTruthClassifier.h" //-------------------------------------------------------------------------- xAODHTFilter::xAODHTFilter(const std::string &name, ISvcLocator *pSvcLocator) : GenFilter(name, pSvcLocator), m_total(0), m_passed(0), m_ptfailed(0) + , m_classif("MCTruthClassifier/DFCommonTruthClassifier") { declareProperty("MinJetPt", m_MinJetPt = 0 * Gaudi::Units::GeV); declareProperty("MaxJetEta", m_MaxJetEta = 10.0); @@ -39,6 +46,7 @@ xAODHTFilter::xAODHTFilter(const std::string &name, ISvcLocator *pSvcLocator) declareProperty("UseLeptonsFromWZTau", m_UseLep = false, "Include e/mu from W/Z/tau decays in the HT"); declareProperty("MinLeptonPt", m_MinLepPt = 0 * Gaudi::Units::GeV); declareProperty("MaxLeptonEta", m_MaxLepEta = 10.0); + declareProperty("EventInfoName",m_eventInfoName="EventInfo"); } //-------------------------------------------------------------------------- @@ -65,6 +73,9 @@ StatusCode xAODHTFilter::filterInitialize() if (m_UseLep) ATH_MSG_INFO(" including W/Z/tau leptons in range " << m_MinLepPt << "<p_T GeV and abs(eta)<" << m_MaxLepEta); + ATH_CHECK(m_mcFilterHTKey.initialize()); + ATH_CHECK(m_classif.retrieve()); + return StatusCode::SUCCESS; } @@ -89,7 +100,11 @@ StatusCode xAODHTFilter::filterEvent() evtStore()->retrieve(truthjetTES, m_TruthJetContainerName).isFailure() || !truthjetTES) { ATH_MSG_INFO("No xAOD::JetContainer found in StoreGate with key " << m_TruthJetContainerName); +#ifdef HEPMC3 + setFilterPassed(m_MinHT < 1. || keepAll()); +#else setFilterPassed(m_MinHT < 1.); +#endif return StatusCode::SUCCESS; } @@ -140,23 +155,17 @@ StatusCode xAODHTFilter::filterEvent() if (m_UseNu && MC::PID::isNeutrino(pdgid) && (theParticle->isGenStable())) { - if (fromWZ(theParticle) || fromTau(theParticle)) + if (isPrompt(theParticle)) { HT += theParticle->pt(); } } // pick muons and electrons specifically -- isLepton selects both charged leptons and neutrinos - if (m_UseLep && (std::abs(pdgid) == 11 || std::abs(pdgid) == 13) && theParticle->isGenStable() && (theParticle)->pt() > m_MinLepPt * Gaudi::Units::GeV && std::abs(theParticle->eta()) < m_MaxLepEta) + if ( m_UseLep && (std::abs(pdgid) == 11 || std::abs(pdgid) == 13) && theParticle->isGenStable() && (theParticle)->pt() > m_MinLepPt * Gaudi::Units::GeV && std::abs(theParticle->eta()) < m_MaxLepEta) { - bool isFromWZ = fromWZ(theParticle); - if (isFromWZ || fromTau(theParticle)) + if (isPrompt(theParticle)) { - ATH_MSG_VERBOSE("Adding W/Z/tau lepton with pt " << theParticle->pt() - << ", eta " << theParticle->eta() - << ", phi " << theParticle->phi() - << ", status " << theParticle->status() - << ", pdgId " << pdgid); HT += theParticle->pt(); } } @@ -167,78 +176,70 @@ StatusCode xAODHTFilter::filterEvent() HT /= Gaudi::Units::GeV; // Make sure we're in GeV ATH_MSG_DEBUG("HT: " << HT); - if (HT < m_MinHT || HT >= m_MaxHT) +#ifdef HEPMC3 + // fill the HT value + // Event passed. Will add HT to xAOD::EventInfo + // Get MC event collection for setting weight + const McEventCollection* mecc = 0; + if ( evtStore()->retrieve( mecc ).isFailure() || !mecc ){ + setFilterPassed(false); + ATH_MSG_ERROR("Could not retrieve MC Event Collection - might not work"); + return StatusCode::SUCCESS; + } + + McEventCollection* mec = const_cast<McEventCollection*> (&(*mecc)); + for (unsigned int i = 0; i < mec->size(); ++i) { + if (!(*mec)[i]) continue; + + (*mec)[i]->add_attribute("filterHT", std::make_shared<HepMC3::DoubleAttribute>(HT)); + } + + if ((HT < m_MinHT || HT >= m_MaxHT) && (!keepAll())) +#else + if ((HT < m_MinHT || HT >= m_MaxHT) ) +#endif { ATH_MSG_DEBUG("Failed filter on HT: " << HT << " is not between " << m_MinHT << " and " << m_MaxHT); setFilterPassed(false); } else { - // Made it to the end - success! + // Made it to the end - success! m_passed++; setFilterPassed(true); - } - + } return StatusCode::SUCCESS; } -bool xAODHTFilter::fromWZ(const xAOD::TruthParticle *part) const -{ - // !!! IMPORTANT !!! This is a TEMPORARY function - // it's used in place of code in MCTruthClassifier as long as this package is not dual-use - // when MCTruthClassifier is made dual-use, this function should be discarded. - // see ATLJETMET-26 - // - // Loop through parents - // Hit a hadron -> return false - // Hit a parton -> return true - // This catch is important - we *cannot* look explicitly for the W or Z, because some - // generators do not include the W or Z in the truth record (like Sherpa) - // This code, like the code before it, really assumes one incoming particle per vertex... - if (!part->hasProdVtx()) - return false; - - unsigned int nIncomingParticles = part->prodVtx()->nIncomingParticles(); - for (unsigned int iPart = 0; iPart < nIncomingParticles; iPart++) - { - const xAOD::TruthParticle *incoming_particle = part->prodVtx()->incomingParticle(iPart); - int parent_pdgid = incoming_particle->pdgId(); - if (MC::PID::isW(parent_pdgid) || MC::PID::isZ(parent_pdgid)) - return true; - if (MC::PID::isHadron(parent_pdgid)) - return false; - if (std::abs(parent_pdgid) < 9) - return true; - if (parent_pdgid == part->pdgId()) - return fromWZ(incoming_particle); - } - return false; -} -bool xAODHTFilter::fromTau(const xAOD::TruthParticle *part) const -{ - // !!! IMPORTANT !!! This is a TEMPORARY function - // it's used in place of code in MCTruthClassifier as long as this package is not dual-use - // when MCTruthClassifier is made dual-use, this function should be discarded. - // see ATLJETMET-26 - // - // Loop through parents - // Find a tau -> return true - // Find a hadron or parton -> return false - // This code, like the code before it, really assumes one incoming particle per vertex... - if (!part->hasProdVtx()) - return false; - - unsigned int nIncomingParticles = part->prodVtx()->nIncomingParticles(); - for (unsigned int iPart = 0; iPart < nIncomingParticles; iPart++) +bool xAODHTFilter::isPrompt( const xAOD::TruthParticle *part ) const { - const xAOD::TruthParticle *incoming_particle = part->prodVtx()->incomingParticle(iPart); - int parent_pdgid = incoming_particle->pdgId(); - if (std::abs(parent_pdgid) == 15 && fromWZ(incoming_particle)) - return true; - if (MC::PID::isHadron(parent_pdgid) || std::abs(parent_pdgid) < 9) + MCTruthPartClassifier::ParticleOrigin orig = m_classif->particleTruthClassifier( part ).second; + ATH_MSG_DEBUG("Particle has origin " << orig); + + switch(orig) { + case MCTruthPartClassifier::NonDefined: + case MCTruthPartClassifier::PhotonConv: + case MCTruthPartClassifier::DalitzDec: + case MCTruthPartClassifier::ElMagProc: + case MCTruthPartClassifier::Mu: + case MCTruthPartClassifier::LightMeson: + case MCTruthPartClassifier::StrangeMeson: + case MCTruthPartClassifier::CharmedMeson: + case MCTruthPartClassifier::BottomMeson: + case MCTruthPartClassifier::CCbarMeson: + case MCTruthPartClassifier::JPsi: + case MCTruthPartClassifier::BBbarMeson: + case MCTruthPartClassifier::LightBaryon: + case MCTruthPartClassifier::StrangeBaryon: + case MCTruthPartClassifier::CharmedBaryon: + case MCTruthPartClassifier::BottomBaryon: + case MCTruthPartClassifier::PionDecay: + case MCTruthPartClassifier::KaonDecay: return false; - if (parent_pdgid == incoming_particle->pdgId()) - return fromTau(incoming_particle); + default: + break; + } + + return true; } - return false; -} + diff --git a/Generators/GeneratorFilters/src/xAODMETFilter.cxx b/Generators/GeneratorFilters/src/xAODMETFilter.cxx index 7f39f5d68c67ecb70d722f4f639e8ff56bbd3c83..f1a5723a9d3a8634c2372ff461a7cf328dcb4c9e 100644 --- a/Generators/GeneratorFilters/src/xAODMETFilter.cxx +++ b/Generators/GeneratorFilters/src/xAODMETFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorFilters/xAODMETFilter.h" @@ -29,13 +29,36 @@ StatusCode xAODMETFilter::filterEvent() { for (unsigned int iPart=0; iPart<nParticles; ++iPart) { const xAOD::TruthParticle* missingETparticle = (*xTruthParticleContainer)[iPart]; if (!m_useHadronicNu && MC::PID::isNeutrino(missingETparticle->pdgId()) && - !(missingETparticle->auxdata<bool>("isFromWZ") || missingETparticle->auxdata<bool>("isFromTau")) ) continue; - sumx += missingETparticle->px(); - sumy += missingETparticle->py(); + !(missingETparticle->auxdata<bool>("isPrompt"))) continue; // ignore neutrinos from hadron decays + + sumx += missingETparticle->px(); + sumy += missingETparticle->py(); + } double met = std::sqrt(sumx*sumx + sumy*sumy); +#ifdef HEPMC3 + const McEventCollection* mecc = 0; + if ( evtStore()->retrieve( mecc ).isFailure() || !mecc ){ + setFilterPassed(false); + ATH_MSG_ERROR("Could not retrieve MC Event Collection - might not work"); + return StatusCode::SUCCESS; + } + + McEventCollection* mec = const_cast<McEventCollection*> (&(*mecc)); + for (unsigned int i = 0; i < mec->size(); ++i) { + if (!(*mec)[i]) continue; + + //for test filterHT->filterWeight + (*mec)[i]->add_attribute("filterMET", std::make_shared<HepMC3::DoubleAttribute>(met/1000.)); + } + + setFilterPassed(met >= m_METmin || keepAll()); +#else setFilterPassed(met >= m_METmin); +#endif return StatusCode::SUCCESS; } + + diff --git a/Generators/GeneratorFilters/src/xAODParticleFilter.cxx b/Generators/GeneratorFilters/src/xAODParticleFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a9a0b0f6e94ac706d8e5ac5ebd199f80e40b0f3d --- /dev/null +++ b/Generators/GeneratorFilters/src/xAODParticleFilter.cxx @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +// Allows the user to search for particles with specified kinematics. +// It will pass if there is an particle with pT and eta or E in the specified +// range +#include "GeneratorFilters/xAODParticleFilter.h" + +#include "xAODTruth/TruthEvent.h" +#include "xAODTruth/TruthEventContainer.h" + +xAODParticleFilter::xAODParticleFilter(const std::string &name, + ISvcLocator *pSvcLocator) + : GenFilter(name, pSvcLocator) {} + +StatusCode xAODParticleFilter::filterInitialize() +{ + ATH_MSG_INFO("Ptcut=" << m_Ptmin); + ATH_MSG_INFO("Etacut=" << m_EtaRange); + ATH_MSG_INFO("Energycut=" << m_EnergyRange); + ATH_MSG_INFO("PDG=" << m_PDGID); + ATH_MSG_INFO("StatusReq=" << m_StatusReq); + ATH_MSG_INFO("MinParts=" << m_MinParts); + ATH_MSG_INFO("Exclusive=" << m_Exclusive); + return StatusCode::SUCCESS; +} + +StatusCode xAODParticleFilter::filterEvent() +{ + int nParts = 0; + + // Retrieve full TruthEventContainer container + const xAOD::TruthEventContainer *xTruthEventContainer = NULL; + ATH_CHECK(evtStore()->retrieve(xTruthEventContainer, "TruthEvents")); + + // Loop over all particles in the event and build up the grid + + for (const xAOD::TruthEvent *genEvt : *xTruthEventContainer) + { + unsigned int nPart = genEvt->nTruthParticles(); + for (unsigned int iPart = 0; iPart < nPart; ++iPart) + { + const xAOD::TruthParticle *pitr = genEvt->truthParticle(iPart); + if (std::abs(pitr->pdgId()) != m_PDGID || + !(m_StatusReq == -1 || pitr->status() == m_StatusReq)) + continue; + if (pitr->pt() >= m_Ptmin && std::abs(pitr->eta()) <= m_EtaRange && + pitr->e() <= m_EnergyRange) + { + if ((!m_Exclusive) && (m_MinParts == 1)) + return StatusCode::SUCCESS; // Found at least one particle and we have an inclusive requirement + + // Count only particles not decaying to themselves + bool notSelfDecay = true; + if (pitr->decayVtx()) + { + const xAOD::TruthVertex *decayVertex = pitr->decayVtx(); + int outgoing_particles = decayVertex->nOutgoingParticles(); + for (int part = 0; part < outgoing_particles; + part++) + { + const xAOD::TruthParticle *child = + decayVertex->outgoingParticle(part); + if (child->pdgId() != pitr->pdgId()) + continue; + if (child == pitr) + continue; + if (HepMC::is_simulation_particle(part)) + continue; + notSelfDecay = false; + break; + } + } + if (notSelfDecay) + nParts++; + } + } + } + if (m_Exclusive) + { + setFilterPassed(nParts == m_MinParts); + } + else + { + setFilterPassed(nParts >= m_MinParts); + } + return StatusCode::SUCCESS; +} diff --git a/Generators/GeneratorFilters/src/xAODTruthParticleSlimmerMET.cxx b/Generators/GeneratorFilters/src/xAODTruthParticleSlimmerMET.cxx index 49cfb9db8acf6488e11568ad19fb87b95f70c769..c1cadbbfbdf7dec27de8c1b6cafe4e0dfb30ac3a 100644 --- a/Generators/GeneratorFilters/src/xAODTruthParticleSlimmerMET.cxx +++ b/Generators/GeneratorFilters/src/xAODTruthParticleSlimmerMET.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "AthenaKernel/errorcheck.h" @@ -20,9 +20,11 @@ #include "GeneratorFilters/xAODTruthParticleSlimmerMET.h" +#include "MCTruthClassifier/IMCTruthClassifier.h" xAODTruthParticleSlimmerMET::xAODTruthParticleSlimmerMET(const std::string &name, ISvcLocator *svcLoc) : AthAlgorithm(name, svcLoc) + , m_classif("MCTruthClassifier/DFCommonTruthClassifier") { declareProperty("xAODTruthParticleContainerName", m_xaodTruthParticleContainerName = "TruthParticles"); declareProperty("xAODTruthParticleContainerNameMET", m_xaodTruthParticleContainerNameMET = "TruthMET"); @@ -33,6 +35,9 @@ StatusCode xAODTruthParticleSlimmerMET::initialize() { ATH_MSG_INFO("xAOD input TruthParticleContainer name = " << m_xaodTruthParticleContainerName); ATH_MSG_INFO("xAOD output TruthParticleContainerMET name = " << m_xaodTruthParticleContainerNameMET); + + ATH_CHECK(m_classif.retrieve()); + return StatusCode::SUCCESS; } @@ -69,8 +74,7 @@ StatusCode xAODTruthParticleSlimmerMET::execute() } // Set up decorators if needed - const static SG::AuxElement::Decorator<bool> isFromWZDecorator("isFromWZ"); - const static SG::AuxElement::Decorator<bool> isFromTauDecorator("isFromTau"); + const static SG::AuxElement::Decorator<bool> isPrompt("isPrompt"); // Loop over full TruthParticle container xAOD::TruthEventContainer::const_iterator itr; @@ -102,64 +106,43 @@ StatusCode xAODTruthParticleSlimmerMET::execute() xTruthParticle->setE(theParticle->e()); //Decorate - isFromWZDecorator(*xTruthParticle) = fromWZ(theParticle); - isFromTauDecorator(*xTruthParticle) = fromTau(theParticle); - + isPrompt(*xTruthParticle) = prompt(theParticle); } } return StatusCode::SUCCESS; } -bool xAODTruthParticleSlimmerMET::fromWZ( const xAOD::TruthParticle* part ) const +bool xAODTruthParticleSlimmerMET::prompt( const xAOD::TruthParticle* part ) const { - // !!! IMPORTANT !!! This is a TEMPORARY function - // it's used in place of code in MCTruthClassifier as long as this package is not dual-use - // when MCTruthClassifier is made dual-use, this function should be discarded. - // see ATLJETMET-26 - // - // Loop through parents - // Hit a hadron -> return false - // Hit a parton -> return true - // This catch is important - we *cannot* look explicitly for the W or Z, because some - // generators do not include the W or Z in the truth record (like Sherpa) - // This code, like the code before it, really assumes one incoming particle per vertex... - if (!part->hasProdVtx()) return false; - - unsigned int nIncomingParticles = part->prodVtx()->nIncomingParticles(); - for (unsigned int iPart = 0; iPart<nIncomingParticles; iPart++) - { - const xAOD::TruthParticle* incoming_particle = part->prodVtx()->incomingParticle(iPart); - int parent_pdgid = incoming_particle->pdgId(); - if (MC::PID::isW(parent_pdgid) || MC::PID::isZ(parent_pdgid)) return true; - if (MC::PID::isHadron( parent_pdgid ) ) return false; - if ( std::abs( parent_pdgid ) < 9 ) return true; - if ( parent_pdgid == part->pdgId() ) return fromWZ( incoming_particle ); - } - return false; -} -bool xAODTruthParticleSlimmerMET::fromTau( const xAOD::TruthParticle* part ) const -{ - // !!! IMPORTANT !!! This is a TEMPORARY function - // it's used in place of code in MCTruthClassifier as long as this package is not dual-use - // when MCTruthClassifier is made dual-use, this function should be discarded. - // see ATLJETMET-26 - // - // Loop through parents - // Find a tau -> return true - // Find a hadron or parton -> return false - // This code, like the code before it, really assumes one incoming particle per vertex... - if (!part->hasProdVtx()) return false; - - unsigned int nIncomingParticles = part->prodVtx()->nIncomingParticles(); - for (unsigned int iPart = 0; iPart<nIncomingParticles; iPart++) - { - const xAOD::TruthParticle* incoming_particle = part->prodVtx()->incomingParticle(iPart); - int parent_pdgid = incoming_particle->pdgId(); - if ( std::abs( parent_pdgid ) == 15 && fromWZ(incoming_particle)) return true; - if (MC::PID::isHadron( parent_pdgid ) || std::abs( parent_pdgid ) < 9 ) return false; - if ( parent_pdgid == incoming_particle->pdgId() ) return fromTau( incoming_particle ); + MCTruthPartClassifier::ParticleOrigin orig = m_classif->particleTruthClassifier( part ).second; + ATH_MSG_DEBUG("Particle has origin " << orig); + + switch(orig) { + case MCTruthPartClassifier::NonDefined: + case MCTruthPartClassifier::PhotonConv: + case MCTruthPartClassifier::DalitzDec: + case MCTruthPartClassifier::ElMagProc: + case MCTruthPartClassifier::Mu: + case MCTruthPartClassifier::LightMeson: + case MCTruthPartClassifier::StrangeMeson: + case MCTruthPartClassifier::CharmedMeson: + case MCTruthPartClassifier::BottomMeson: + case MCTruthPartClassifier::CCbarMeson: + case MCTruthPartClassifier::JPsi: + case MCTruthPartClassifier::BBbarMeson: + case MCTruthPartClassifier::LightBaryon: + case MCTruthPartClassifier::StrangeBaryon: + case MCTruthPartClassifier::CharmedBaryon: + case MCTruthPartClassifier::BottomBaryon: + case MCTruthPartClassifier::PionDecay: + case MCTruthPartClassifier::KaonDecay: + return false; + default: + break; + } + + return true; } - return false; -} + diff --git a/Generators/GeneratorModules/GeneratorModules/GenFilter.h b/Generators/GeneratorModules/GeneratorModules/GenFilter.h index a295116656a36e0c25f59510b2d0bbb035334281..64eb12a0f3a3c538647d85812a000abd5aff1a49 100644 --- a/Generators/GeneratorModules/GeneratorModules/GenFilter.h +++ b/Generators/GeneratorModules/GeneratorModules/GenFilter.h @@ -52,6 +52,9 @@ public: int nPassed() const { return m_nPass; } int nFailed() const { return m_nFail; } int nNeeded() const { return m_nNeeded; } +#ifdef HEPMC3 + bool keepAll() const {return m_keepAll; } +#endif //@} @@ -62,6 +65,9 @@ protected: int m_nPass; int m_nFail; int m_nNeeded; +#ifdef HEPMC3 + bool m_keepAll; +#endif //@} }; diff --git a/Generators/GeneratorModules/src/GenFilter.cxx b/Generators/GeneratorModules/src/GenFilter.cxx index c1e708ae9ce3510d374a5ae536c29696f83600d5..6e5ac035a4c2f7ba12822b0c2112a43fbb5ad96f 100644 --- a/Generators/GeneratorModules/src/GenFilter.cxx +++ b/Generators/GeneratorModules/src/GenFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "GeneratorModules/GenFilter.h" @@ -9,6 +9,9 @@ GenFilter::GenFilter(const std::string& name, ISvcLocator* pSvcLocator) : GenBase(name, pSvcLocator) { declareProperty("TotalPassed", m_nNeeded=-1); +#ifdef HEPMC3 + declareProperty("KeepAllEvents", m_keepAll=false); +#endif m_nPass = 0; m_nFail = 0; } @@ -32,7 +35,11 @@ StatusCode GenFilter::execute() { ATH_MSG_WARNING("More than one event in current McEventCollection -- which is valid?"); } StatusCode sc = filterEvent(); - if (filterPassed()) { +#ifdef HEPMC3 + if (filterPassed() || m_keepAll ) { +#else + if (filterPassed() ) { +#endif ATH_MSG_DEBUG("Event passed filter"); m_nPass += 1; } else { diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEvent_p6.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEvent_p6.h index 102bffcdb27da0707316de0c9250b1cc83de1f76..fd6ef58119a2bb059badae9d0741b1fb44abf21c 100755 --- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEvent_p6.h +++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEvent_p6.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // GenEvent_p6.h @@ -46,6 +46,10 @@ public: double alphaQCD, double alphaQED, double filterWeight, +#ifdef HEPMC3 + double filterHT, + double filterMET, +#endif int signalProcessVtx, int beamParticle1, int beamParticle2, @@ -96,10 +100,13 @@ protected: */ double m_alphaQED; - /** value of the extra weight introduced during reweighting events in filter + /** value of the extra weight introduced during reweighting events in filter and value of some variables we filter on */ double m_filterWeight; - +#ifdef HEPMC3 + double m_filterHT; + double m_filterMET; +#endif /** Barcode of the GenVertex holding the signal process. * 0 means that no signal process vertex has been written out. * This may come from upstream limitations (like HEPEVT) @@ -179,6 +186,10 @@ inline GenEvent_p6::GenEvent_p6(): m_alphaQCD ( -1 ), m_alphaQED ( -1 ), m_filterWeight ( 1 ), +#ifdef HEPMC3 + m_filterHT ( -13 ), + m_filterMET ( -13 ), +#endif m_signalProcessVtx ( 0 ), m_beamParticle1 ( 0 ), m_beamParticle2 ( 0 ), @@ -207,6 +218,10 @@ inline GenEvent_p6::GenEvent_p6( int signalProcessId, double alphaQCD, double alphaQED, double filterWeight, +#ifdef HEPMC3 + double filterHT, + double filterMET, +#endif int signalProcessVtx, int beamParticle1, int beamParticle2, @@ -234,6 +249,10 @@ inline GenEvent_p6::GenEvent_p6( int signalProcessId, m_alphaQCD ( alphaQCD ), m_alphaQED ( alphaQED ), m_filterWeight ( filterWeight ), +#ifdef HEPMC3 + m_filterHT ( filterHT ), + m_filterMET ( filterMET ), +#endif m_signalProcessVtx ( signalProcessVtx ), m_beamParticle1 ( beamParticle1 ), m_beamParticle2 ( beamParticle2 ), diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p6.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p6.cxx index d4a89bc1f4e049447edb287fc9b43c45466c1fe6..b9ddb581955f369d6cea2e3228694c04c42c8ac9 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p6.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p6.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // McEventCollectionCnv_p6.cxx @@ -104,6 +104,8 @@ void McEventCollectionCnv_p6::persToTrans( const McEventCollection_p6* persObj, if (persEvt.m_e_attribute_name[i] == "signal_process_id") continue; if (persEvt.m_e_attribute_name[i] == "signal_vertex_id") continue; if (persEvt.m_e_attribute_name[i] == "filterWeight") continue; + if (persEvt.m_e_attribute_name[i] == "filterHT") continue; + if (persEvt.m_e_attribute_name[i] == "filterMET") continue; if (persEvt.m_e_attribute_name[i] == "event_scale") continue; if (persEvt.m_e_attribute_name[i] == "alphaQCD") continue; if (persEvt.m_e_attribute_name[i] == "alphaQED") continue; @@ -123,6 +125,8 @@ void McEventCollectionCnv_p6::persToTrans( const McEventCollection_p6* persObj, genEvt->add_attribute("alphaQCD", std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQCD)); genEvt->add_attribute("alphaQED", std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_alphaQED)); genEvt->add_attribute("filterWeight", std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_filterWeight)); + genEvt->add_attribute("filterHT", std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_filterHT)); + genEvt->add_attribute("filterMET", std::make_shared<HepMC3::DoubleAttribute>(persEvt.m_filterMET)); genEvt->weights()= persEvt.m_weights; genEvt->add_attribute("random_states", std::make_shared<HepMC3::VectorLongIntAttribute>(persEvt.m_randomStates)); @@ -400,6 +404,8 @@ void McEventCollectionCnv_p6::transToPers( const McEventCollection* transObj, auto A_alphaQCD=genEvt->attribute<HepMC3::DoubleAttribute>("alphaQCD"); auto A_alphaQED=genEvt->attribute<HepMC3::DoubleAttribute>("alphaQED"); auto A_filterWeight=genEvt->attribute<HepMC3::DoubleAttribute>("filterWeight"); + auto A_filterHT=genEvt->attribute<HepMC3::DoubleAttribute>("filterHT"); + auto A_filterMET=genEvt->attribute<HepMC3::DoubleAttribute>("filterMET"); auto signal_process_vertex = HepMC::signal_process_vertex(genEvt); auto A_random_states=genEvt->attribute<HepMC3::VectorLongIntAttribute>("random_states"); auto beams=genEvt->beams(); @@ -411,6 +417,8 @@ void McEventCollectionCnv_p6::transToPers( const McEventCollection* transObj, A_alphaQCD?(A_alphaQCD->value()):0.0, A_alphaQED?(A_alphaQED->value()):0.0, A_filterWeight?(A_filterWeight->value()):1.0, + A_filterHT?(A_filterHT->value()):-13., + A_filterMET?(A_filterMET->value()):-13.0, signal_process_vertex?HepMC::barcode(signal_process_vertex):0, !beams.empty()?HepMC::barcode(beams[0]):0, beams.size()>1?HepMC::barcode(beams[1]):0, @@ -444,6 +452,8 @@ void McEventCollectionCnv_p6::transToPers( const McEventCollection* transObj, if (attmap.first == "signal_process_id") continue; if (attmap.first == "signal_vertex_id") continue; if (attmap.first == "filterWeight") continue; + if (attmap.first == "filterHT") continue; + if (attmap.first == "filterMET") continue; if (attmap.first == "event_scale") continue; if (attmap.first == "alphaQCD") continue; if (attmap.first == "alphaQED") continue; diff --git a/Generators/MadGraphControl/python/MadGraphUtils.py b/Generators/MadGraphControl/python/MadGraphUtils.py index bb6c92252ff6179c3fd29606c20e70b6d9852152..b85961981289352df1ab952a388ba945940ac929 100755 --- a/Generators/MadGraphControl/python/MadGraphUtils.py +++ b/Generators/MadGraphControl/python/MadGraphUtils.py @@ -100,7 +100,7 @@ def generate_prep(process_dir): mglog.warning('Way too many Cards_bkup* directories found. Giving up -- standalone script may not work.') -def error_check(errors_a): +def error_check(errors_a, return_code): global MADGRAPH_CATCH_ERRORS if not MADGRAPH_CATCH_ERRORS: return @@ -178,6 +178,11 @@ def error_check(errors_a): mglog.warning('Appeared to detect variables in your run card that MadGraph did not understand:') mglog.warning(' Check your run card / JO settings for %s',bad_variables) + # Check the return code + if return_code!=0: + mglog.error(f'Detected a bad return code: {return_code}') + unmasked_error = True + # Now raise an error if we were in either of the error states if unmasked_error or my_debug_file is not None: write_test_script() @@ -270,7 +275,7 @@ def new_process(process='generate p p > t t~\noutput -f', plugin=None, keepJpegs global MADGRAPH_CATCH_ERRORS generate = subprocess.Popen([python,madpath+'/bin/mg5_aMC',plugin_cmd,card_loc],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) mglog.info('Finished process generation at '+str(time.asctime())) @@ -513,7 +518,7 @@ def generate(process_dir='PROC_mssm_0', grid_pack=False, gridpack_compile=False, global MADGRAPH_CATCH_ERRORS generate = stack_subprocess(command,stdin=subprocess.PIPE, stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) # Get back to where we came from os.chdir(currdir) @@ -541,17 +546,17 @@ def generate(process_dir='PROC_mssm_0', grid_pack=False, gridpack_compile=False, os.chdir('madevent/') compilep = stack_subprocess(['./bin/compile'],stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = compilep.communicate() - error_check(err) + error_check(err,compilep.returncode) clean = stack_subprocess(['./bin/clean4grid'],stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = clean.communicate() - error_check(err) + error_check(err,clean.returncode) clean.wait() MADGRAPH_COMMAND_STACK += ['cd ..','rm ../'+gridpack_name] os.chdir('../') mglog.info('remove old tarball') os.unlink('../'+gridpack_name) mglog.info('Package up new tarball') - tar = stack_subprocess(['tar','cvzf','../'+gridpack_name,'--exclude=lib/PDFsets','--exclude=SubProcesses/P*/G*/*_results.dat','--exclude=SubProcesses/P*/G*/*.log','--exclude=SubProcesses/P*/G*/*.txt','.']) + tar = stack_subprocess(['tar','cvzf','../'+gridpack_name,'--exclude=SubProcesses/P*/G*/*_results.dat','--exclude=SubProcesses/P*/G*/*.log','--exclude=SubProcesses/P*/G*/*.txt','.']) tar.wait() MADGRAPH_COMMAND_STACK += ['cd ..','rm -r tmp%i/'%os.getpid()] os.chdir('../') @@ -565,7 +570,7 @@ def generate(process_dir='PROC_mssm_0', grid_pack=False, gridpack_compile=False, mglog.info('Package up process_dir') MADGRAPH_COMMAND_STACK += ['mv '+process_dir+' '+MADGRAPH_GRIDPACK_LOCATION] os.rename(process_dir,MADGRAPH_GRIDPACK_LOCATION) - tar = stack_subprocess(['tar','czf',gridpack_name,MADGRAPH_GRIDPACK_LOCATION,'--exclude=lib/PDFsets','--exclude=Events/*/*events*gz','--exclude=SubProcesses/P*/G*/log*txt','--exclude=SubProcesses/P*/G*/events.lhe*','--exclude=*/*.o','--exclude=*/*/*.o','--exclude=*/*/*/*.o','--exclude=*/*/*/*/*.o']) + tar = stack_subprocess(['tar','czf',gridpack_name,MADGRAPH_GRIDPACK_LOCATION,'--exclude=Events/*/*events*gz','--exclude=SubProcesses/P*/G*/log*txt','--exclude=SubProcesses/P*/G*/events.lhe*','--exclude=*/*.o','--exclude=*/*/*.o','--exclude=*/*/*/*.o','--exclude=*/*/*/*/*.o']) tar.wait() MADGRAPH_COMMAND_STACK += ['mv '+MADGRAPH_GRIDPACK_LOCATION+' '+process_dir] os.rename(MADGRAPH_GRIDPACK_LOCATION,process_dir) @@ -680,7 +685,7 @@ def generate_from_gridpack(runArgs=None, extlhapath=None, gridpack_compile=None, MADGRAPH_COMMAND_STACK+=["export LD_LIBRARY_PATH="+":".join(['${LD_LIBRARY_PATH}',new_ld_path])] generate = stack_subprocess([python,MADGRAPH_GRIDPACK_LOCATION+'/bin/gridrun',str(int(nevents)),str(int(random_seed)),str(granularity)],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) gp_events=MADGRAPH_GRIDPACK_LOCATION+"/Events/GridRun_{}/unweighted_events.lhe.gz".format(int(random_seed)) if not os.path.exists(gp_events): mglog.error('Error in gp generation, did not find events at '+gp_events) @@ -724,7 +729,7 @@ def generate_from_gridpack(runArgs=None, extlhapath=None, gridpack_compile=None, generate_prep(MADGRAPH_GRIDPACK_LOCATION) generate = stack_subprocess([python,MADGRAPH_GRIDPACK_LOCATION+'/bin/generate_events','--parton','--nocompile','--only_generation','-f','--name='+gridpack_run_name],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) else: mglog.info('Allowing recompilation of gridpack') if os.path.islink(MADGRAPH_GRIDPACK_LOCATION+'/lib/libLHAPDF.a'): @@ -734,7 +739,7 @@ def generate_from_gridpack(runArgs=None, extlhapath=None, gridpack_compile=None, generate_prep(MADGRAPH_GRIDPACK_LOCATION) generate = stack_subprocess([python,MADGRAPH_GRIDPACK_LOCATION+'/bin/generate_events','--parton','--only_generation','-f','--name='+gridpack_run_name],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) if isNLO and systematics_settings is not None: # run systematics mglog.info('Running systematics standalone') @@ -1069,7 +1074,7 @@ add_time_of_flight '''+run+((' --threshold='+str(threshold)) if threshold is not global MADGRAPH_CATCH_ERRORS generate = stack_subprocess([python,me_exec,'time_of_flight_exec_card'],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) mglog.info('Finished adding time of flight information at '+str(time.asctime())) @@ -1125,7 +1130,7 @@ decay_events '''+run) global MADGRAPH_CATCH_ERRORS generate = stack_subprocess([python,me_exec,'madspin_exec_card'],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) if len(glob.glob(process_dir+'/Events/'+run+'_decayed_*/')) == 0: mglog.error('No '+process_dir+'/Events/'+run+'_decayed_*/ can be found') raise RuntimeError('Problem while running MadSpin') @@ -1183,7 +1188,7 @@ def madspin_on_lhe(input_LHE,madspin_card,runArgs=None,keep_original=False): global MADGRAPH_CATCH_ERRORS generate = stack_subprocess([python,madpath+'/MadSpin/madspin','madspin_exec_card'],stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = generate.communicate() - error_check(err) + error_check(err,generate.returncode) mglog.info('Done with madspin at '+str(time.asctime())) # Should now have a re-zipped LHE file # We now have to do a shortened version of arrange_output below @@ -2486,7 +2491,7 @@ def add_reweighting(run_name,reweight_card=None,process_dir=MADGRAPH_GRIDPACK_LO global MADGRAPH_CATCH_ERRORS reweight = stack_subprocess([python]+reweight_cmd.split(),stdin=subprocess.PIPE,stderr=subprocess.PIPE if MADGRAPH_CATCH_ERRORS else None) (out,err) = reweight.communicate() - error_check(err) + error_check(err,reweight.returncode) mglog.info('Finished reweighting') def check_reset_proc_number(opts): diff --git a/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PostInclude.py b/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PostInclude.py index 0b5b8ebfcdf8c127b146ff2ce70a26311a8a76c8..4118b18436f6a042ea6f0dc87b7628bb25a394ea 100644 --- a/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PostInclude.py +++ b/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PostInclude.py @@ -37,6 +37,20 @@ else: 'maxjetflavor': 5 }) _nQuarksMerge = 5 + if define_pj_5FS: + # Add the 5FS p and j definition to the beginning of the process string + process = "define p = g u c d s b u~ c~ d~ s~ b~\ndefine j = g u c d s b u~ c~ d~ s~ b~\n" + process + # Check that if p and j get redefined that it is consistent with 5FS otherwise raise error + for l in process.split('\n'): + l_nocomment = l.split('#')[0] + if ("define p" in l_nocomment or "define j" in l_nocomment) and l_nocomment.count("=") == 1: + l_equals = (l_nocomment.split("=")[-1]).split(" ") + if not set(['g', 'u', 'c', 'd', 's', 'b', 'u~', 'c~', 'd~', 's~', 'b~']) <= set(l_equals): + raise RuntimeError('Invalid definition found for p or j in process string while using 5FS') + if force_nobmass_5FS: + if masses.get('5',0.0) != 0.0: + raise RuntimeError('Non-zero mass found for b while using 5FS') + masses['5'] = 0.0 # systematic variation if 'scup' in phys_short: diff --git a/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PreInclude.py b/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PreInclude.py index 0184993188b26065c12283e6407aab867a72bbae..06cf8af52121d0e65108451a1091a6cf971ac90b 100644 --- a/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PreInclude.py +++ b/Generators/MadGraphControl/share/common/SUSY_SimplifiedModel_PreInclude.py @@ -63,14 +63,16 @@ usePMGSettings = True # Do we need to use a custom plugin? plugin = None -# Do we want 4FS or 5FS? 4 is default +# Do we want 4FS or 5FS? 5 is now default # * 5-flavor scheme always should use nQuarksMerge=5 [5FS -> nQuarksMerge=5] # * 4-flavor scheme with light-flavor MEs (p p > go go j , with j = g d u s c) # should use nQuarksMerge=4 [4FS -> nQuarksMerge=4] # * 4-flavor scheme with HF MEs (p p > go go j, with j = g d u s c b) should # use nQuarksMerge=5 [4FS + final state b -> nQuarksMerge=5] -flavourScheme = 4 -finalStateB = False +flavourScheme = 5 +define_pj_5FS = True # Defines p and j to include b in process string with 5FS +force_nobmass_5FS = True # Forces massless b with 5FS +finalStateB = False # Used with 4FS from MadGraphControl.MadGraphUtilsHelpers import get_physics_short phys_short = get_physics_short() @@ -98,3 +100,86 @@ else: include("Pythia8_i/Pythia8_A14_NNPDF23LO_EvtGen_Common.py") include("Pythia8_i/Pythia8_MadGraph.py") + +# Helper function that can be called from control file to use common mixing matrices +def common_mixing_matrix(mtype): + param_blocks = {} + # Include various cases for common mixing matrices here + if mtype == 'higgsino': + # Off-diagonal chargino mixing matrix V + param_blocks['VMIX']={} + param_blocks['VMIX']['1 1']='0.00E+00' + param_blocks['VMIX']['1 2']='1.00E+00' + param_blocks['VMIX']['2 1']='1.00E+00' + param_blocks['VMIX']['2 2']='0.00E+00' + # Off-diagonal chargino mixing matrix U + param_blocks['UMIX']={} + param_blocks['UMIX']['1 1']='0.00E+00' + param_blocks['UMIX']['1 2']='1.00E+00' + param_blocks['UMIX']['2 1']='1.00E+00' + param_blocks['UMIX']['2 2']='0.00E+00' + # Neutralino mixing matrix chi_i0 = N_ij (B,W,H_d,H_u)_j + param_blocks['NMIX']={} + param_blocks['NMIX']['1 1']=' 0.00E+00' # N_11 bino + param_blocks['NMIX']['1 2']=' 0.00E+00' # N_12 + param_blocks['NMIX']['1 3']=' 7.07E-01' # N_13 + param_blocks['NMIX']['1 4']='-7.07E-01' # N_14 + param_blocks['NMIX']['2 1']=' 0.00E+00' # N_21 + param_blocks['NMIX']['2 2']=' 0.00E+00' # N_22 + param_blocks['NMIX']['2 3']='-7.07E-01' # N_23 higgsino + param_blocks['NMIX']['2 4']='-7.07E-01' # N_24 higgsino + param_blocks['NMIX']['3 1']=' 1.00E+00' # N_31 + param_blocks['NMIX']['3 2']=' 0.00E+00' # N_32 + param_blocks['NMIX']['3 3']=' 0.00E+00' # N_33 higgsino + param_blocks['NMIX']['3 4']=' 0.00E+00' # N_34 higgsino + param_blocks['NMIX']['4 1']=' 0.00E+00' # N_41 + param_blocks['NMIX']['4 2']='-1.00E+00' # N_42 wino + param_blocks['NMIX']['4 3']=' 0.00E+00' # N_43 + param_blocks['NMIX']['4 4']=' 0.00E+00' # N_44 + elif mtype == 'winobino': + # Chargino mixing matrix V + param_blocks['VMIX']={} + param_blocks['VMIX']['1 1']='9.72557835E-01' # V_11 + param_blocks['VMIX']['1 2']='-2.32661249E-01' # V_12 + param_blocks['VMIX']['2 1']='2.32661249E-01' # V_21 + param_blocks['VMIX']['2 2']='9.72557835E-01' # V_22 + # Chargino mixing matrix U + param_blocks['UMIX']={} + param_blocks['UMIX']['1 1']='9.16834859E-01' # U_11 + param_blocks['UMIX']['1 2']='-3.99266629E-01' # U_12 + param_blocks['UMIX']['2 1']='3.99266629E-01' # U_21 + param_blocks['UMIX']['2 2']='9.16834859E-01' # U_22 + # Neutralino mixing matrix + param_blocks['NMIX']={} + param_blocks['NMIX']['1 1']='9.86364430E-01' # N_11 + param_blocks['NMIX']['1 2']='-5.31103553E-02' # N_12 + param_blocks['NMIX']['1 3']='1.46433995E-01' # N_13 + param_blocks['NMIX']['1 4']='-5.31186117E-02' # N_14 + param_blocks['NMIX']['2 1']='9.93505358E-02' # N_21 + param_blocks['NMIX']['2 2']='9.44949299E-01' # N_22 + param_blocks['NMIX']['2 3']='-2.69846720E-01' # N_23 + param_blocks['NMIX']['2 4']='1.56150698E-01' # N_24 + param_blocks['NMIX']['3 1']='-6.03388002E-02' # N_31 + param_blocks['NMIX']['3 2']='8.77004854E-02' # N_32 + param_blocks['NMIX']['3 3']='6.95877493E-01' # N_33 + param_blocks['NMIX']['3 4']='7.10226984E-01' # N_34 + param_blocks['NMIX']['4 1']='-1.16507132E-01' # N_41 + param_blocks['NMIX']['4 2']='3.10739017E-01' # N_42 + param_blocks['NMIX']['4 3']='6.49225960E-01' # N_43 + param_blocks['NMIX']['4 4']='-6.84377823E-01' # N_44 + elif mtype == 'stau_maxmix': + param_blocks['selmix'] = {} + # use maximally mixed staus + param_blocks['selmix'][ '3 3' ] = '0.70710678118' # # RRl3x3 + param_blocks['selmix'][ '3 6' ] = '0.70710678118' # # RRl3x6 + param_blocks['selmix'][ '6 3' ] = '-0.70710678118' # # RRl6x3 + param_blocks['selmix'][ '6 6' ] = '0.70710678118' # # RRl6x6 + elif mtype == 'stau_nomix': + param_blocks['selmix'] = {} + # No mixing + param_blocks['selmix'][ '3 3' ] = '1.0' # # RRl3x3 + param_blocks['selmix'][ '3 6' ] = '0.0' # # RRl3x6 + param_blocks['selmix'][ '6 3' ] = '0.0' # # RRl6x3 + param_blocks['selmix'][ '6 6' ] = '1.0' # # RRl6x6 + + return param_blocks diff --git a/Generators/PowhegControl/cmake/PowhegEnvironmentConfig.cmake.in b/Generators/PowhegControl/cmake/PowhegEnvironmentConfig.cmake.in index 1188681fef42ee349a89153de5250da98caa9fdd..b72f42cffb0b3c77ccea6c3ffa65fa375b5c77fc 100644 --- a/Generators/PowhegControl/cmake/PowhegEnvironmentConfig.cmake.in +++ b/Generators/PowhegControl/cmake/PowhegEnvironmentConfig.cmake.in @@ -6,7 +6,7 @@ # Set the environment variable(s): -set( ATLAS_POWHEGVER "05-05" CACHE STRING +set( ATLAS_POWHEGVER "06-01" CACHE STRING "Version of the Powheg configuration files" ) set( ATLAS_POWHEGPATH "/cvmfs/atlas.cern.ch/repo/sw/Generators/powheg/ATLASOTF-${ATLAS_POWHEGVER}" CACHE PATH "Path to the Powheg configuration files" ) diff --git a/Generators/PowhegControl/doc/beyond_vanilla.md b/Generators/PowhegControl/doc/beyond_vanilla.md index a59593b8ffb430c9b2638a9b97e4b14c4c27ebdf..cd58e04279962c6caf6838bc98a3a6f5968da08e 100644 --- a/Generators/PowhegControl/doc/beyond_vanilla.md +++ b/Generators/PowhegControl/doc/beyond_vanilla.md @@ -145,6 +145,7 @@ be enabled by setting the tops as undecayed (for example | `PowhegConfig.MadSpin_nFlavours` | 4 | which flavour scheme to use | | `PowhegConfig.MadSpin_process` | process-dependent | process that MadSpin is operating on | | `PowhegConfig.MadSpin_taus_are_leptons` | True | whether lepton definitions should include taus | +| `PowhegConfig.MadSpin_paramcard` | an empty string | if not empty, dump the param card from the string into the lhe file | **You** are responsible for ensuring that the options passed to MadSpin are correct. A common error is requesting `MadSpin_decays` or diff --git a/Generators/PowhegControl/python/algorithms/postprocessors/__init__.py b/Generators/PowhegControl/python/algorithms/postprocessors/__init__.py index b26d3a6787789da9edfa5482c6a736980c3c6c79..1e98d68f06eb41756fd66e5cdf3494b51d9bb80f 100644 --- a/Generators/PowhegControl/python/algorithms/postprocessors/__init__.py +++ b/Generators/PowhegControl/python/algorithms/postprocessors/__init__.py @@ -8,6 +8,9 @@ from .integration_gridpack_creator import integration_gridpack_creator from .integration_grid_tester import integration_grid_tester from .madspin import MadSpin from .mu2tau import mu2tau +from .mu2e import mu2e +from .e2mu import e2mu +from .e2tau import e2tau from .nnlo_reweighter import NNLO_reweighter from .output_file_renamer import output_file_renamer from .output_tarball_preparer import output_tarball_preparer diff --git a/Generators/PowhegControl/python/algorithms/postprocessors/e2mu.py b/Generators/PowhegControl/python/algorithms/postprocessors/e2mu.py new file mode 100644 index 0000000000000000000000000000000000000000..a2d7bd6c22d3eaafe6b399d799227b9b4170710e --- /dev/null +++ b/Generators/PowhegControl/python/algorithms/postprocessors/e2mu.py @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon import Logging +from ...decorators import timed +from ...utility import LHE +import shutil + +## Get handle to Athena logging +logger = Logging.logging.getLogger("PowhegControl") + + +@timed("e2mu") +def e2mu(powheg_LHE_output): + """! Post-process existing events from electrons to muons + + @param powheg_LHE_output Name of LHE file produced by PowhegBox. + + @author Jan Kretzschmar <jan.kretzschmar@cern.ch> + """ + logger.warning("Converting LHE events from electron to muon decays.") + + # Get opening and closing strings + preamble = LHE.preamble(powheg_LHE_output) + postamble = LHE.postamble(powheg_LHE_output) + + n_events = 0 + powheg_LHE_mu = "{}.mu".format(powheg_LHE_output) + with open(powheg_LHE_mu, "w") as f_output: + f_output.write("{}\n".format(preamble)) + for input_event in LHE.event_iterator(powheg_LHE_output): + is_event_changed, output_event = LHE.e2mu(input_event) + f_output.write(output_event) + n_events += [0, 1][is_event_changed] + f_output.write(postamble) + logger.info("Changed e->mu in {} events!".format(n_events)) + + # Make a backup of the original events + shutil.move(powheg_LHE_output, "{}.e2mu_backup".format(powheg_LHE_output)) + shutil.move(powheg_LHE_mu, powheg_LHE_output) diff --git a/Generators/PowhegControl/python/algorithms/postprocessors/e2tau.py b/Generators/PowhegControl/python/algorithms/postprocessors/e2tau.py new file mode 100644 index 0000000000000000000000000000000000000000..fcc96e0e49058c7a78d15aebda0483d27bcf2b10 --- /dev/null +++ b/Generators/PowhegControl/python/algorithms/postprocessors/e2tau.py @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon import Logging +from ...decorators import timed +from ...utility import LHE +import shutil + +## Get handle to Athena logging +logger = Logging.logging.getLogger("PowhegControl") + + +@timed("e2tau") +def e2tau(powheg_LHE_output): + """! Post-process existing events from electrons to taus + + @param powheg_LHE_output Name of LHE file produced by PowhegBox. + + @author Jan Kretzschmar <jan.kretzschmar@cern.ch> + """ + logger.warning("Converting LHE events from electron to tau decays. Tau mass must be restored by showering program, ensure to validate physics.") + + # Get opening and closing strings + preamble = LHE.preamble(powheg_LHE_output) + postamble = LHE.postamble(powheg_LHE_output) + + n_events = 0 + powheg_LHE_tau = "{}.tau".format(powheg_LHE_output) + with open(powheg_LHE_tau, "w") as f_output: + f_output.write("{}\n".format(preamble)) + for input_event in LHE.event_iterator(powheg_LHE_output): + is_event_changed, output_event = LHE.e2tau(input_event) + f_output.write(output_event) + n_events += [0, 1][is_event_changed] + f_output.write(postamble) + logger.info("Changed mu->tau in {} events!".format(n_events)) + + # Make a backup of the original events + shutil.move(powheg_LHE_output, "{}.e2tau_backup".format(powheg_LHE_output)) + shutil.move(powheg_LHE_tau, powheg_LHE_output) diff --git a/Generators/PowhegControl/python/algorithms/postprocessors/madspin.py b/Generators/PowhegControl/python/algorithms/postprocessors/madspin.py index 2af27bced7e51503bb0990e1f6ddc4cf9822da52..f559ab26d82d5e8977a603df295327abf7ace86d 100644 --- a/Generators/PowhegControl/python/algorithms/postprocessors/madspin.py +++ b/Generators/PowhegControl/python/algorithms/postprocessors/madspin.py @@ -83,152 +83,157 @@ def __construct_inputs(input_LHE_events, process): f_madspin_LHE.write("{} = bwcutoff\n".format(process.bwcutoff)) f_madspin_LHE.write("</mgruncard>\n") f_madspin_LHE.write("<slha>\n") - f_madspin_LHE.write("######################################################################\n") - f_madspin_LHE.write("## PARAM_CARD AUTOMATICALY GENERATED BY MG5 ####\n") - f_madspin_LHE.write("######################################################################\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("## INFORMATION FOR LOOP\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("BLOCK LOOP #\n") - f_madspin_LHE.write(" 1 {:e} # mu_r\n".format(process.mass_Z)) - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("## INFORMATION FOR MASS\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("BLOCK MASS #\n") - f_madspin_LHE.write(" 1 0.000000e+00 # d : 0.0\n") - f_madspin_LHE.write(" 2 0.000000e+00 # u : 0.0\n") - f_madspin_LHE.write(" 3 0.000000e+00 # s : 0.0\n") - f_madspin_LHE.write(" 4 0.000000e+00 # c : 0.0\n") - f_madspin_LHE.write(" 5 {:e} # mb\n".format(process.mass_b)) - f_madspin_LHE.write(" 6 {:e} # mt\n".format(process.mass_t)) - f_madspin_LHE.write(" 11 0.000000e+00 # e- : 0.0\n") - f_madspin_LHE.write(" 12 0.000000e+00 # ve : 0.0\n") - f_madspin_LHE.write(" 13 0.000000e+00 # mu- : 0.0\n") - f_madspin_LHE.write(" 14 0.000000e+00 # vm : 0.0\n") - f_madspin_LHE.write(" 15 {:e} # mta\n".format(process.mass_tau)) - f_madspin_LHE.write(" 16 0.000000e+00 # vt : 0.0\n") - f_madspin_LHE.write(" 21 0.000000e+00 # g : 0.0\n") - f_madspin_LHE.write(" 22 0.000000e+00 # a : 0.0\n") - f_madspin_LHE.write(" 23 {:e} # mz\n".format(process.mass_Z)) - f_madspin_LHE.write(" 24 {:e} # w+\n".format(process.mass_W)) - f_madspin_LHE.write(" 25 {:e} # mh\n".format(process.mass_H)) - f_madspin_LHE.write(" 82 0.000000e+00 # gh : 0.0\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("## INFORMATION FOR SMINPUTS\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("BLOCK SMINPUTS #\n") - f_madspin_LHE.write(" 1 {:e} # aewm1\n".format(process.alphaem_inv)) - f_madspin_LHE.write(" 2 {:e} # gf\n".format(process.G_F)) - f_madspin_LHE.write(" 3 {:e} # as\n".format(process.alphaqcd)) - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("## INFORMATION FOR YUKAWA\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("BLOCK YUKAWA #\n") - f_madspin_LHE.write(" 5 {:e} # ymb\n".format(process.mass_b)) - f_madspin_LHE.write(" 6 {:e} # ymt\n".format(process.mass_t)) - f_madspin_LHE.write(" 15 {:e} # ymtau\n".format(process.mass_tau)) - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("## INFORMATION FOR QNUMBERS 82\n") - f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("BLOCK QNUMBERS 82 # gh\n") - f_madspin_LHE.write(" 1 0 # 3 times electric charge\n") - f_madspin_LHE.write(" 2 1 # number of spin states (2s+1)\n") - f_madspin_LHE.write(" 3 8 # colour rep (1: singlet, 3: triplet, 8: octet)\n") - f_madspin_LHE.write(" 4 1 # particle/antiparticle distinction (0=own anti)\n") - if "ckm" in process.MadSpin_model or "CKM" in process.MadSpin_model: - logger.info("Adding Wolfenstein parameters in param_card for model {}".format(process.MadSpin_model)) + if process.MadSpin_paramcard != "": + with open(process.MadSpin_paramcard) as file: + for line in file: + f_madspin_LHE.write(line) + else: + f_madspin_LHE.write("######################################################################\n") + f_madspin_LHE.write("## PARAM_CARD AUTOMATICALY GENERATED BY MG5 ####\n") + f_madspin_LHE.write("######################################################################\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("## INFORMATION FOR LOOP\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("BLOCK LOOP #\n") + f_madspin_LHE.write(" 1 {:e} # mu_r\n".format(process.mass_Z)) + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("## INFORMATION FOR MASS\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("BLOCK MASS #\n") + f_madspin_LHE.write(" 1 0.000000e+00 # d : 0.0\n") + f_madspin_LHE.write(" 2 0.000000e+00 # u : 0.0\n") + f_madspin_LHE.write(" 3 0.000000e+00 # s : 0.0\n") + f_madspin_LHE.write(" 4 0.000000e+00 # c : 0.0\n") + f_madspin_LHE.write(" 5 {:e} # mb\n".format(process.mass_b)) + f_madspin_LHE.write(" 6 {:e} # mt\n".format(process.mass_t)) + f_madspin_LHE.write(" 11 0.000000e+00 # e- : 0.0\n") + f_madspin_LHE.write(" 12 0.000000e+00 # ve : 0.0\n") + f_madspin_LHE.write(" 13 0.000000e+00 # mu- : 0.0\n") + f_madspin_LHE.write(" 14 0.000000e+00 # vm : 0.0\n") + f_madspin_LHE.write(" 15 {:e} # mta\n".format(process.mass_tau)) + f_madspin_LHE.write(" 16 0.000000e+00 # vt : 0.0\n") + f_madspin_LHE.write(" 21 0.000000e+00 # g : 0.0\n") + f_madspin_LHE.write(" 22 0.000000e+00 # a : 0.0\n") + f_madspin_LHE.write(" 23 {:e} # mz\n".format(process.mass_Z)) + f_madspin_LHE.write(" 24 {:e} # w+\n".format(process.mass_W)) + f_madspin_LHE.write(" 25 {:e} # mh\n".format(process.mass_H)) + f_madspin_LHE.write(" 82 0.000000e+00 # gh : 0.0\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("## INFORMATION FOR SMINPUTS\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("BLOCK SMINPUTS #\n") + f_madspin_LHE.write(" 1 {:e} # aewm1\n".format(process.alphaem_inv)) + f_madspin_LHE.write(" 2 {:e} # gf\n".format(process.G_F)) + f_madspin_LHE.write(" 3 {:e} # as\n".format(process.alphaqcd)) + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("## INFORMATION FOR YUKAWA\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("BLOCK YUKAWA #\n") + f_madspin_LHE.write(" 5 {:e} # ymb\n".format(process.mass_b)) + f_madspin_LHE.write(" 6 {:e} # ymt\n".format(process.mass_t)) + f_madspin_LHE.write(" 15 {:e} # ymtau\n".format(process.mass_tau)) f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("INFORMATION FOR WOLFENSTEIN\n") + f_madspin_LHE.write("## INFORMATION FOR QNUMBERS 82\n") f_madspin_LHE.write("###################################\n") - f_madspin_LHE.write("Block wolfenstein\n") - f_madspin_LHE.write(" 1 {:e} # lamWS\n".format(process.Wolfenstein_lambda)) - f_madspin_LHE.write(" 2 {:e} # AWS\n".format(process.Wolfenstein_A)) - f_madspin_LHE.write(" 3 {:e} # rhoWS\n".format(process.Wolfenstein_rho)) - f_madspin_LHE.write(" 4 {:e} # etaWS\n".format(process.Wolfenstein_eta)) - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("#*************************\n") - f_madspin_LHE.write("# Decay widths *\n") - f_madspin_LHE.write("#*************************\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 1 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 2 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 3 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 4 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 5 0.000000e+00\n") - f_madspin_LHE.write("#\n") - if "ckm" in process.MadSpin_model or "CKM" in process.MadSpin_model: - logger.info("Top decay modes not set in param_card for model {} - BRs will be calculated at LO by MadSpin".format(process.MadSpin_model)) + f_madspin_LHE.write("BLOCK QNUMBERS 82 # gh\n") + f_madspin_LHE.write(" 1 0 # 3 times electric charge\n") + f_madspin_LHE.write(" 2 1 # number of spin states (2s+1)\n") + f_madspin_LHE.write(" 3 8 # colour rep (1: singlet, 3: triplet, 8: octet)\n") + f_madspin_LHE.write(" 4 1 # particle/antiparticle distinction (0=own anti)\n") + if "ckm" in process.MadSpin_model or "CKM" in process.MadSpin_model: + logger.info("Adding Wolfenstein parameters in param_card for model {}".format(process.MadSpin_model)) + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("INFORMATION FOR WOLFENSTEIN\n") + f_madspin_LHE.write("###################################\n") + f_madspin_LHE.write("Block wolfenstein\n") + f_madspin_LHE.write(" 1 {:e} # lamWS\n".format(process.Wolfenstein_lambda)) + f_madspin_LHE.write(" 2 {:e} # AWS\n".format(process.Wolfenstein_A)) + f_madspin_LHE.write(" 3 {:e} # rhoWS\n".format(process.Wolfenstein_rho)) + f_madspin_LHE.write(" 4 {:e} # etaWS\n".format(process.Wolfenstein_eta)) + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("#*************************\n") + f_madspin_LHE.write("# Decay widths *\n") + f_madspin_LHE.write("#*************************\n") + f_madspin_LHE.write("#\n") f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 6 {:e}\n".format(process.width_t)) + f_madspin_LHE.write("DECAY 1 0.000000e+00\n") f_madspin_LHE.write("#\n") - else: - # Scale t BRs down so that sum is 1.0 - BR_t_to_any = process.BR_t_to_Wb + process.BR_t_to_Ws + process.BR_t_to_Wd f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 6 {:e}\n".format(process.width_t)) - f_madspin_LHE.write("# BR NDA ID1 ID2 ...\n") - f_madspin_LHE.write(" {:e} 2 5 24 # 1.32\n".format(process.BR_t_to_Wb / BR_t_to_any)) - f_madspin_LHE.write(" {:e} 2 3 24 # 1.32\n".format(process.BR_t_to_Ws / BR_t_to_any)) - f_madspin_LHE.write(" {:e} 2 1 24 # 1.32\n".format(process.BR_t_to_Wd / BR_t_to_any)) + f_madspin_LHE.write("DECAY 2 0.000000e+00\n") f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 11 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 12 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 13 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 14 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 15 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 16 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 21 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 22 0.000000e+00\n") - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 23 {:e}\n".format(process.width_Z)) - f_madspin_LHE.write("#\n") - if "ckm" in process.MadSpin_model or "CKM" in process.MadSpin_model: - logger.info("W decay modes not set in param_card for model {} - BRs will be calculated at LO by MadSpin".format(process.MadSpin_model)) f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 24 {}\n".format(process.width_W)) + f_madspin_LHE.write("DECAY 3 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 4 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 5 0.000000e+00\n") + f_madspin_LHE.write("#\n") + if "ckm" in process.MadSpin_model or "CKM" in process.MadSpin_model: + logger.info("Top decay modes not set in param_card for model {} - BRs will be calculated at LO by MadSpin".format(process.MadSpin_model)) + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 6 {:e}\n".format(process.width_t)) + f_madspin_LHE.write("#\n") + else: + # Scale t BRs down so that sum is 1.0 + BR_t_to_any = process.BR_t_to_Wb + process.BR_t_to_Ws + process.BR_t_to_Wd + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 6 {:e}\n".format(process.width_t)) + f_madspin_LHE.write("# BR NDA ID1 ID2 ...\n") + f_madspin_LHE.write(" {:e} 2 5 24 # 1.32\n".format(process.BR_t_to_Wb / BR_t_to_any)) + f_madspin_LHE.write(" {:e} 2 3 24 # 1.32\n".format(process.BR_t_to_Ws / BR_t_to_any)) + f_madspin_LHE.write(" {:e} 2 1 24 # 1.32\n".format(process.BR_t_to_Wd / BR_t_to_any)) + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 11 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 12 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 13 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 14 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 15 0.000000e+00\n") f_madspin_LHE.write("#\n") - else: - # Scale W BRs down so that sum is 1.0 - BR_W_to_any = process.BR_W_to_hadrons + process.BR_W_to_leptons f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 24 {}\n".format(process.width_W)) - f_madspin_LHE.write("# BR NDA ID1 ID2 ...\n") - f_madspin_LHE.write(" {:e} 2 -1 2\n".format((process.BR_W_to_hadrons / 2.) / BR_W_to_any)) - f_madspin_LHE.write(" {:e} 2 -3 4\n".format((process.BR_W_to_hadrons / 2.) / BR_W_to_any)) - f_madspin_LHE.write(" {:e} 2 -11 12\n".format((process.BR_W_to_leptons / 3.) / BR_W_to_any)) - f_madspin_LHE.write(" {:e} 2 -13 14\n".format((process.BR_W_to_leptons / 3.) / BR_W_to_any)) - f_madspin_LHE.write(" {:e} 2 -15 16\n".format((process.BR_W_to_leptons / 3.) / BR_W_to_any)) + f_madspin_LHE.write("DECAY 16 0.000000e+00\n") f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 25 {:e}\n".format(process.width_H)) - f_madspin_LHE.write("#\n") - f_madspin_LHE.write("# PDG Width\n") - f_madspin_LHE.write("DECAY 82 0.000000e+00\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 21 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 22 0.000000e+00\n") + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 23 {:e}\n".format(process.width_Z)) + f_madspin_LHE.write("#\n") + if "ckm" in process.MadSpin_model or "CKM" in process.MadSpin_model: + logger.info("W decay modes not set in param_card for model {} - BRs will be calculated at LO by MadSpin".format(process.MadSpin_model)) + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 24 {}\n".format(process.width_W)) + f_madspin_LHE.write("#\n") + else: + # Scale W BRs down so that sum is 1.0 + BR_W_to_any = process.BR_W_to_hadrons + process.BR_W_to_leptons + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 24 {}\n".format(process.width_W)) + f_madspin_LHE.write("# BR NDA ID1 ID2 ...\n") + f_madspin_LHE.write(" {:e} 2 -1 2\n".format((process.BR_W_to_hadrons / 2.) / BR_W_to_any)) + f_madspin_LHE.write(" {:e} 2 -3 4\n".format((process.BR_W_to_hadrons / 2.) / BR_W_to_any)) + f_madspin_LHE.write(" {:e} 2 -11 12\n".format((process.BR_W_to_leptons / 3.) / BR_W_to_any)) + f_madspin_LHE.write(" {:e} 2 -13 14\n".format((process.BR_W_to_leptons / 3.) / BR_W_to_any)) + f_madspin_LHE.write(" {:e} 2 -15 16\n".format((process.BR_W_to_leptons / 3.) / BR_W_to_any)) + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 25 {:e}\n".format(process.width_H)) + f_madspin_LHE.write("#\n") + f_madspin_LHE.write("# PDG Width\n") + f_madspin_LHE.write("DECAY 82 0.000000e+00\n") f_madspin_LHE.write("</slha>\n") f_madspin_LHE.write("{}\n".format(header_contents)) f_madspin_LHE.write("</header>\n") diff --git a/Generators/PowhegControl/python/algorithms/postprocessors/mu2e.py b/Generators/PowhegControl/python/algorithms/postprocessors/mu2e.py new file mode 100644 index 0000000000000000000000000000000000000000..10cbca0021830cac2dcfcbd163f748df547da293 --- /dev/null +++ b/Generators/PowhegControl/python/algorithms/postprocessors/mu2e.py @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon import Logging +from ...decorators import timed +from ...utility import LHE +import shutil + +## Get handle to Athena logging +logger = Logging.logging.getLogger("PowhegControl") + + +@timed("mu2e") +def mu2e(powheg_LHE_output): + """! Post-process existing events from muons to electrons + + @param powheg_LHE_output Name of LHE file produced by PowhegBox. + + @author Jan Kretzschmar <jan.kretzschmar@cern.ch> + """ + logger.warning("Converting LHE events from muon to electron decays.") + + # Get opening and closing strings + preamble = LHE.preamble(powheg_LHE_output) + postamble = LHE.postamble(powheg_LHE_output) + + n_events = 0 + powheg_LHE_e = "{}.e".format(powheg_LHE_output) + with open(powheg_LHE_e, "w") as f_output: + f_output.write("{}\n".format(preamble)) + for input_event in LHE.event_iterator(powheg_LHE_output): + is_event_changed, output_event = LHE.mu2e(input_event) + f_output.write(output_event) + n_events += [0, 1][is_event_changed] + f_output.write(postamble) + logger.info("Changed mu->e in {} events!".format(n_events)) + + # Make a backup of the original events + shutil.move(powheg_LHE_output, "{}.mu2e_backup".format(powheg_LHE_output)) + shutil.move(powheg_LHE_e, powheg_LHE_output) diff --git a/Generators/PowhegControl/python/algorithms/postprocessors/mu2tau.py b/Generators/PowhegControl/python/algorithms/postprocessors/mu2tau.py index f6fe9432f9279756602b6e16d25e3ab8a2448e58..f93092ff5c5b5fe4bcd1b1747b05fde307afe43c 100644 --- a/Generators/PowhegControl/python/algorithms/postprocessors/mu2tau.py +++ b/Generators/PowhegControl/python/algorithms/postprocessors/mu2tau.py @@ -25,7 +25,7 @@ def mu2tau(powheg_LHE_output): n_events = 0 powheg_LHE_tau = "{}.tau".format(powheg_LHE_output) - with open(powheg_LHE_tau, "wb") as f_output: + with open(powheg_LHE_tau, "w") as f_output: f_output.write("{}\n".format(preamble)) for input_event in LHE.event_iterator(powheg_LHE_output): is_event_changed, output_event = LHE.mu2tau(input_event) diff --git a/Generators/PowhegControl/python/algorithms/scheduler.py b/Generators/PowhegControl/python/algorithms/scheduler.py index ab56d7e115f34ef34e40159a020f099e5f31501b..23b47aa2a1389b38b7df8413b24da533b176e34d 100644 --- a/Generators/PowhegControl/python/algorithms/scheduler.py +++ b/Generators/PowhegControl/python/algorithms/scheduler.py @@ -33,6 +33,9 @@ class Scheduler(object): "NNLO reweighter", "LHE file nominal weight updater", "mu2tau", + "mu2e", + "e2tau", + "e2mu", "MadSpin", "integration grid tester", "cross section calculator", @@ -71,6 +74,9 @@ class Scheduler(object): "reweighter": partial(postprocessors.reweighter, powheg_LHE_output=powheg_LHE_output), "quark colour fixer": partial(postprocessors.quark_colour_fixer, powheg_LHE_output=powheg_LHE_output), "mu2tau": partial(postprocessors.mu2tau, powheg_LHE_output=powheg_LHE_output), + "mu2e": partial(postprocessors.mu2e, powheg_LHE_output=powheg_LHE_output), + "e2tau": partial(postprocessors.e2tau, powheg_LHE_output=powheg_LHE_output), + "e2mu": partial(postprocessors.e2mu, powheg_LHE_output=powheg_LHE_output), "LHE file cleaner": partial(postprocessors.lhe_cleaner, powheg_LHE_output=powheg_LHE_output), "LHE file nominal weight updater": partial(postprocessors.lhe_nominal_weight_updater, powheg_LHE_output=powheg_LHE_output), } diff --git a/Generators/PowhegControl/python/parameters/registry.py b/Generators/PowhegControl/python/parameters/registry.py index e95be21b32c42dc97993eecb3cb16f1f705fc83e..e6d3e2b1a6023663731d7518f43edf31d8587f63 100644 --- a/Generators/PowhegControl/python/parameters/registry.py +++ b/Generators/PowhegControl/python/parameters/registry.py @@ -31,9 +31,12 @@ class Registry(metaclass=Singleton): self.add_default("alphaspdf", powheg_atlas_common.EW_parameters.alphaqcd, description="strong coupling") self.add_default("altmap", 0, description="mapping that preserves the relative kinematics of the emitter where possible. [1:enabled]") self.add_default("always_quad", 1, description="compute always using quadruple precision [1:enabled]") + self.add_default("angcorr_damp", 0, description="using angular correlations aware damp function [1:enabled]") self.add_default("arXiv:1207.5018", -1, frozen=True, description="compare to arXiv:1207.5018. [>0:enabled]") self.add_default("atlas_scale", -1, description="[-1:use Powheg default]") self.add_default("bcut", -1, description="[-1:use Powheg default]") + self.add_default("betaL3x3", 1., description="Relative coupling strength to left-handed fermions (3rd generation) in Drell-Yan Vector LeptoQuark production.") + self.add_default("betaR3x3", 1., description="Relative coupling strength to right-handed fermions (3rd generation) in Drell-Yan Vector LeptoQuark production.") self.add_default("Bmass", powheg_atlas_common.mass.b, name="mass_b", description="b-quark mass in GeV") self.add_default("bmass", powheg_atlas_common.mass.b, name="mass_b", description="b-quark mass in GeV") self.add_default("bmass_in_minlo", 0, description="use non-zero b-mass in MiNLO. [0:disabled; 1:enabled]") @@ -185,6 +188,7 @@ class Registry(metaclass=Singleton): self.add_default("fullrwgt", -1, description="experimental! Must ONLY be used for processes with no Born-level parton radiation. [1:enabled]") self.add_default("fullrwgtmode", -1, description="[1:MiNLO style; 2:Simplified (HERWIG); 3:Simplified (Sjostrand); -1,4:Exact]") self.add_default("gamcut", 60, description="gg4l: gamma cut") + self.add_default("g4", 0, description="SU(4) coupling strength g4 in Drell-Yan Vector LeptoQuark production.") self.add_default("G_F", powheg_atlas_common.EW_parameters.G_F, description="Fermi coupling") self.add_default("G_mu", powheg_atlas_common.EW_parameters.G_F, description="Fermi coupling") self.add_default("gfermi", powheg_atlas_common.EW_parameters.G_F, name="G_F", description="Fermi constant") @@ -200,6 +204,7 @@ class Registry(metaclass=Singleton): self.add_default("higgsfixedwidth", 0, description="[0:running width; 1:fixed width in Breit-Wigner]") self.add_default("Hmass", powheg_atlas_common.mass.H, name="mass_H", description="Higgs boson mass in GeV") self.add_default("hmass", powheg_atlas_common.mass.H, name="mass_H", description="Higgs boson mass in GeV") + self.add_default("hnew_damp", -1, description="apply damping factor when new_damp is also enabled. [>0:enabled]") self.add_default("Hwidth", powheg_atlas_common.width.H, name="width_H", description="Higgs boson width in GeV") self.add_default("hwidth", powheg_atlas_common.width.H, name="width_H", description="Higgs boson width in GeV") self.add_default("HWJsudakov", -1, description="[-1:use Powheg default]") @@ -262,6 +267,9 @@ class Registry(metaclass=Singleton): self.add_default("lhrwgt_group_name", "nominal", frozen=True, description="group description.") self.add_default("lhrwgt_id", 0, frozen=True, description="weight ID.") self.add_default("LOevents", 0, description="produce LOPS events (scalup=ptj); in this case bornonly should also be enabled. [0:disabled; 1:enabled]") + self.add_default("LQ", 0, description="Include basic LQ contributions in Drell-Yan LeptoQuark production. [0:disabled; 1:enabled]") + self.add_default("LQ-EW", 0, name="LQ_EW", description="Include LQ corrections to photon/Z couplings in Drell-Yan LeptoQuark production. [0:disabled; 1:enabled]") + self.add_default("LQ-Int", 0, name="LQ_Int", description="Include the interference between the SM and the LQ contributions in Drell-Yan LeptoQuark production. [0:disabled; 1:enabled]") self.add_default("LQmasslow", 0, description="Lepto Quarks low mass") self.add_default("LQmasshigh", 0, description="Lepto Quarks high mass") self.add_default("m2bb", -1, description="[-1:use Powheg default]") @@ -274,6 +282,7 @@ class Registry(metaclass=Singleton): self.add_default("MadSpin_taus_are_leptons", True, description="whether lepton definitions should include taus. [False: do not include taus, True: include taus]") self.add_default("MadSpin_max_weight_ps_point", -1, description="max_weight_ps_point parameter for MadSpin card to improve madspin integration. [-1: would use MadSpin default; any positive value: include it in the MadSpin run card]") self.add_default("MadSpin_Nevents_for_max_weight", -1, description="Nevents_for_max_weight parameter for MadSpin card to improve madspin integration. [-1: would use MadSpin default; any positive value: include it in the MadSpin run card]") + self.add_default("MadSpin_paramcard", "", description="If not an empty string, use the specified paramcard in the runDir to mimic the MadGraph output by Powheg.") self.add_default("m4lmax", 100) self.add_default("m4lmin", 1) self.add_default("m4l_sampling", 2, description="gg4l: 0: flat 1: exponential 2:Breit-Wigner") @@ -333,8 +342,13 @@ class Registry(metaclass=Singleton): self.add_default("modlog_p", -1, description="activate MINNLO modified logs and set the exponent") self.add_default("msbar", 1, description="1 MSbar renormalization; 0 On-Shell renormalization" ) self.add_default("MSbarscheme", 1, description="use five-flavour-scheme unless specified otherwise. [0:four-flavour-scheme]") + self.add_default("mt", powheg_atlas_common.mass.t, name="mass_t", description="(running) top-quark mass in GeV") self.add_default("mtdep", 0, description="ggHH production: [0:Higgs effective field theory (HEFT); 1:Born improved HEFT; 2:approximated full theory (FTapprox); 3:full theory]") self.add_default("mt_expansion", 1, description="") + self.add_default("MU1", 1e4, description="Mass of vector leptoquark U1 in Drell-Yan Vector LeptoQuark production.") + self.add_default("MGp", 1e4, description="Mass of the coloron Gp in Drell-Yan Vector LeptoQuark production.") + self.add_default("MSD", 1e4, description="Mass of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("MSU", 1e4, description="Mass of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") self.add_default("mu+e-", 0, hidden=True, description="WWj decay mode [1:enabled]") self.add_default("mu+mu-", 0, hidden=True, description="WWj decay mode [1:enabled]") self.add_default("Mumass", powheg_atlas_common.mass.mu, name="mass_mu", description="mass of muon in GeV") @@ -476,7 +490,8 @@ class Registry(metaclass=Singleton): self.add_default("skipextratests", -1, description="[-1:use Powheg default]") self.add_default("skiprmngrid", 0, hidden=True, description="skip calculation of rmngrid. [1:enabled]") self.add_default("SLHA", "'input_parameters.slha'", frozen=True, description="name of the SLHA input-file") - self.add_default("smartsig", 1, frozen=True, description="remember equal amplitudes. [0:disabled]") + self.add_default("SM", 1, description="Include SM contribution in Drell-Yan LeptoQuark production. [0:disabled; 1:enabled]") + self.add_default("smartsig", 1, description="remember equal amplitudes. [0:disabled]") self.add_default("smear", 0, frozen=True, description="LQ-s-chan smearing [0:disabled]") self.add_default("Smass", powheg_atlas_common.mass.s, description="s-quark mass in GeV") self.add_default("smincuts", -1, description="[-1:use Powheg default]") @@ -624,6 +639,24 @@ class Registry(metaclass=Singleton): self.add_default("WZtauvtautau", 0, hidden=True, description="WZ decay mode: Z->tau(+)tau(-) W->tau(+/-). [1:enabled]") self.add_default("xgriditeration", 1, frozen=True, description="iteration level for the calculation of the importance sampling grid (only relevant when parallelstage=1).") self.add_default("xupbound", 1, description="increase upper bound for radiation generation by this factor") + self.add_default("YSD1x1", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD1x2", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD1x3", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD2x1", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD2x2", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD2x3", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD3x1", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD3x2", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSD3x3", 0., description="Yukawa coupling of the down-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU1x1", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU1x2", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU1x3", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU2x1", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU2x2", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU2x3", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU3x1", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU3x2", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") + self.add_default("YSU3x3", 0., description="Yukawa coupling of the up-type leptoquark in Drell-Yan Scalar LeptoQuark production.") self.add_default("y_1e", 0, description="LQ-s-chan: coupling of the lepto-quark.") self.add_default("y_2e", 0, description="LQ-s-chan: coupling of the lepto-quark.") self.add_default("y_3e", 0, description="LQ-s-chan: coupling of the lepto-quark.") diff --git a/Generators/PowhegControl/python/processes/external/external_madspin.py b/Generators/PowhegControl/python/processes/external/external_madspin.py index 7bddaa0323de4c032c48be2bdf9247b71eb43d0b..0217bbe0a70a5d61149428c69ff86e4d756a20a4 100644 --- a/Generators/PowhegControl/python/processes/external/external_madspin.py +++ b/Generators/PowhegControl/python/processes/external/external_madspin.py @@ -41,6 +41,7 @@ class ExternalMadSpin(ExternalBase): self.add_keyword("MadSpin_taus_are_leptons") self.add_keyword("MadSpin_max_weight_ps_point") self.add_keyword("MadSpin_Nevents_for_max_weight") + self.add_keyword("MadSpin_paramcard") self.add_keyword("mass_b") self.add_keyword("mass_H") self.add_keyword("mass_t") diff --git a/Generators/PowhegControl/python/processes/powheg/DY_SLQ.py b/Generators/PowhegControl/python/processes/powheg/DY_SLQ.py new file mode 100644 index 0000000000000000000000000000000000000000..18326d7bfcf6328fbb0544dc497f82fc56338bf1 --- /dev/null +++ b/Generators/PowhegControl/python/processes/powheg/DY_SLQ.py @@ -0,0 +1,172 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon import Logging +from ...parameters import powheg_atlas_common +from ..powheg_V2 import PowhegV2 + +## Get handle to Athena logging +logger = Logging.logging.getLogger("PowhegControl") + + +class DY_SLQ(PowhegV2): + """! Default Powheg configuration for Vector LeptoQuark production. + + https://arxiv.org/abs/2207.00356 + + Create a configurable object with all applicable Powheg options. + + @author Timothee Theveneaux-Pelzer <tpelzer@cern.ch> + """ + + def __init__(self, base_directory, **kwargs): + """! Constructor: all process options are set here. + + @param base_directory: path to PowhegBox code. + @param kwargs dictionary of arguments from Generate_tf. + """ + super(DY_SLQ, self).__init__(base_directory, "DY_SLQ_NLO", **kwargs) + + # Add parameter validation functions + self.validation_functions.append("validate_decays") + + ## List of allowed decay modes + self.allowed_decay_modes = ["ta+ ta-", "e+ e-", "mu+ mu-"] + + # Add all keywords for this process, overriding defaults if required + self.add_keyword("angcorr_damp") # using angular correlations aware damp function + self.add_keyword("bornktmin") + self.add_keyword("bornonly") + self.add_keyword("bornsuppfact") + self.add_keyword("bornzerodamp") + self.add_keyword("bottommass") + self.add_keyword("bottomthr") + self.add_keyword("bottomthrpdf") + self.add_keyword("btildeborn") + self.add_keyword("btildecoll") + self.add_keyword("btildereal") + self.add_keyword("btildevirt") + self.add_keyword("btlscalect") + self.add_keyword("btlscalereal") + self.add_keyword("charmmass") + self.add_keyword("charmthr") + self.add_keyword("charmthrpdf") + self.add_keyword("check_bad_st2") + self.add_keyword("clobberlhe") + self.add_keyword("colltest") + self.add_keyword("compress_lhe") + self.add_keyword("compress_upb") + self.add_keyword("compute_rwgt") + self.add_keyword("doublefsr") + self.add_keyword("evenmaxrat",0) + self.add_keyword("ew") + self.add_keyword("facscfact", self.default_scales[0]) + self.add_keyword("fastbtlbound") + self.add_keyword("fixedgrid") + self.add_keyword("flg_debug") + self.add_keyword("foldcsi") + self.add_keyword("foldphi") + self.add_keyword("foldy") + self.add_keyword("fullrwgt") + self.add_keyword("fullrwgtmode") + self.add_keyword("gfermi") + self.add_keyword("hdamp") + self.add_keyword("hdecaymode") + self.add_keyword("hdecaywidth") + self.add_keyword("hfact", 104.16) + self.add_keyword("hmass") + self.add_keyword("hnew_damp") + self.add_keyword("hwidth") + self.add_keyword("icsimax") + self.add_keyword("ih1") + self.add_keyword("ih2") + self.add_keyword("itmx1", 2) + self.add_keyword("itmx1rm") + self.add_keyword("itmx2", 2) + self.add_keyword("itmx2rm") + self.add_keyword("iupperfsr") + self.add_keyword("iupperisr") + self.add_keyword("iymax") + self.add_keyword("lhans1", self.default_PDFs) + self.add_keyword("lhans2", self.default_PDFs) + self.add_keyword("lhapdf6maxsets") + self.add_keyword("lhrwgt_descr") + self.add_keyword("lhrwgt_group_combine") + self.add_keyword("lhrwgt_group_name") + self.add_keyword("lhrwgt_id") + self.add_keyword("manyseeds") + self.add_keyword("maxseeds") + self.add_keyword("mass_low") # lower limit for dilepton mass + self.add_keyword("mass_high") # upper limit for dilepton mass + self.add_keyword("mt", powheg_atlas_common.mass.t, name="mass_t", description="top quark mass in GeV") + self.add_keyword("ncall1", 30000) + self.add_keyword("ncall1rm") + self.add_keyword("ncall2", 50000) + self.add_keyword("ncall2rm") + self.add_keyword("ncallfrominput") + self.add_keyword("new_damp") # using new, better default damp function + self.add_keyword("nubound", 50000) + self.add_keyword("parallelstage") + self.add_keyword("pdfreweight") + self.add_keyword("rand1") + self.add_keyword("rand2") + self.add_keyword("renscfact", self.default_scales[1]) + self.add_keyword("runningscale") + self.add_keyword("rwl_add") + self.add_keyword("rwl_file") + self.add_keyword("rwl_format_rwgt") + self.add_keyword("rwl_group_events") + self.add_keyword("smartsig") + self.add_keyword("softtest") + self.add_keyword("stage2init") + self.add_keyword("storeinfo_rwgt") + self.add_keyword("storemintupb") + self.add_keyword("testplots") + self.add_keyword("testsuda") + self.add_keyword("use-old-grid") + self.add_keyword("use-old-ubound") + self.add_keyword("vdecaymode", self.allowed_decay_modes[0], name="decay_mode") + self.add_keyword("withbtilde",1) + self.add_keyword("withdamp") + self.add_keyword("withremnants",1) + self.add_keyword("withnegweights") + self.add_keyword("withsubtr") + self.add_keyword("xgriditeration") + self.add_keyword("xupbound") + # General Leptoquark (LQ) Parameters + self.add_keyword("SM", 1) # Include SM contribution + self.add_keyword("LQ", 0) # Include basic LQ contributions + self.add_keyword("LQ-EW", 0, "LQ_EW") # Include LQ corrections to photon/Z couplings + self.add_keyword("LQ-Int", 0, "LQ_Int") # Include the interference between the SM and the LQ contributions + # Yukawa couplings to down-type quarks (S1t RR) + self.add_keyword("YSD1x1") + self.add_keyword("YSD1x2") + self.add_keyword("YSD1x3") + self.add_keyword("YSD2x1") + self.add_keyword("YSD2x2") + self.add_keyword("YSD2x3") + self.add_keyword("YSD3x1") + self.add_keyword("YSD3x2") + self.add_keyword("YSD3x3") + self.add_keyword("MSD") # mass + # Yukawa couplings to up-type quarks (S1 RR) + self.add_keyword("YSU1x1") + self.add_keyword("YSU1x2") + self.add_keyword("YSU1x3") + self.add_keyword("YSU2x1") + self.add_keyword("YSU2x2") + self.add_keyword("YSU2x3") + self.add_keyword("YSU3x1") + self.add_keyword("YSU3x2") + self.add_keyword("YSU3x3") + self.add_keyword("MSU") # mass + + + def validate_decays(self): + """! Validate semileptonic and topdecaymode keywords.""" + self.expose() # convenience call to simplify syntax + if self.decay_mode not in self.allowed_decay_modes: + logger.warning("Decay mode {} not recognised!".format(self.decay_mode)) + raise ValueError("Decay mode {} not recognised!".format(self.decay_mode)) + # Calculate appropriate decay mode numbers + __decay_mode_lookup = { "ta+ ta-": "3", "e+ e-": "1", "mu+ mu-": "2"} + self.parameters_by_keyword("vdecaymode")[0].value = __decay_mode_lookup[self.decay_mode] diff --git a/Generators/PowhegControl/python/processes/powheg/DY_VLQ.py b/Generators/PowhegControl/python/processes/powheg/DY_VLQ.py new file mode 100644 index 0000000000000000000000000000000000000000..31690ed9268327ebfdeea8b8c1421b724b05b911 --- /dev/null +++ b/Generators/PowhegControl/python/processes/powheg/DY_VLQ.py @@ -0,0 +1,155 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon import Logging +from ...parameters import powheg_atlas_common +from ..powheg_V2 import PowhegV2 + +## Get handle to Athena logging +logger = Logging.logging.getLogger("PowhegControl") + + +class DY_VLQ(PowhegV2): + """! Default Powheg configuration for Vector LeptoQuark production. + + https://arxiv.org/abs/2209.12780 + + Create a configurable object with all applicable Powheg options. + + @author Timothee Theveneaux-Pelzer <tpelzer@cern.ch> + """ + + def __init__(self, base_directory, **kwargs): + """! Constructor: all process options are set here. + + @param base_directory: path to PowhegBox code. + @param kwargs dictionary of arguments from Generate_tf. + """ + super(DY_VLQ, self).__init__(base_directory, "DY_VLQ_NLO", **kwargs) + + # Add parameter validation functions + self.validation_functions.append("validate_decays") + + ## List of allowed decay modes + self.allowed_decay_modes = ["ta+ ta-", "e+ e-", "mu+ mu-"] + + # Add all keywords for this process, overriding defaults if required + self.add_keyword("angcorr_damp") # using angular correlations aware damp function + self.add_keyword("bornktmin") + self.add_keyword("bornonly") + self.add_keyword("bornsuppfact") + self.add_keyword("bornzerodamp") + self.add_keyword("bottommass") + self.add_keyword("bottomthr") + self.add_keyword("bottomthrpdf") + self.add_keyword("btildeborn") + self.add_keyword("btildecoll") + self.add_keyword("btildereal") + self.add_keyword("btildevirt") + self.add_keyword("btlscalect") + self.add_keyword("btlscalereal") + self.add_keyword("charmmass") + self.add_keyword("charmthr") + self.add_keyword("charmthrpdf") + self.add_keyword("check_bad_st2") + self.add_keyword("clobberlhe") + self.add_keyword("colltest") + self.add_keyword("compress_lhe") + self.add_keyword("compress_upb") + self.add_keyword("compute_rwgt") + self.add_keyword("doublefsr") + self.add_keyword("evenmaxrat",0) + self.add_keyword("ew") + self.add_keyword("facscfact", self.default_scales[0]) + self.add_keyword("fastbtlbound") + self.add_keyword("fixedgrid") + self.add_keyword("flg_debug") + self.add_keyword("foldcsi") + self.add_keyword("foldphi") + self.add_keyword("foldy") + self.add_keyword("fullrwgt") + self.add_keyword("fullrwgtmode") + self.add_keyword("gfermi") + self.add_keyword("hdamp") + self.add_keyword("hdecaymode") + self.add_keyword("hdecaywidth") + self.add_keyword("hfact", 104.16) + self.add_keyword("hmass") + self.add_keyword("hnew_damp") + self.add_keyword("hwidth") + self.add_keyword("icsimax") + self.add_keyword("ih1") + self.add_keyword("ih2") + self.add_keyword("itmx1", 2) + self.add_keyword("itmx1rm") + self.add_keyword("itmx2", 2) + self.add_keyword("itmx2rm") + self.add_keyword("iupperfsr") + self.add_keyword("iupperisr") + self.add_keyword("iymax") + self.add_keyword("lhans1", self.default_PDFs) + self.add_keyword("lhans2", self.default_PDFs) + self.add_keyword("lhapdf6maxsets") + self.add_keyword("lhrwgt_descr") + self.add_keyword("lhrwgt_group_combine") + self.add_keyword("lhrwgt_group_name") + self.add_keyword("lhrwgt_id") + self.add_keyword("manyseeds") + self.add_keyword("maxseeds") + self.add_keyword("mass_low") # lower limit for dilepton mass + self.add_keyword("mass_high") # upper limit for dilepton mass + self.add_keyword("mt", powheg_atlas_common.mass.t, name="mass_t", description="top quark mass in GeV") + self.add_keyword("ncall1", 30000) + self.add_keyword("ncall1rm") + self.add_keyword("ncall2", 50000) + self.add_keyword("ncall2rm") + self.add_keyword("ncallfrominput") + self.add_keyword("new_damp") # using new, better default damp function + self.add_keyword("nubound", 50000) + self.add_keyword("parallelstage") + self.add_keyword("pdfreweight") + self.add_keyword("rand1") + self.add_keyword("rand2") + self.add_keyword("renscfact", self.default_scales[1]) + self.add_keyword("runningscale") + self.add_keyword("rwl_add") + self.add_keyword("rwl_file") + self.add_keyword("rwl_format_rwgt") + self.add_keyword("rwl_group_events") + self.add_keyword("smartsig") + self.add_keyword("softtest") + self.add_keyword("stage2init") + self.add_keyword("storeinfo_rwgt") + self.add_keyword("storemintupb") + self.add_keyword("testplots") + self.add_keyword("testsuda") + self.add_keyword("use-old-grid") + self.add_keyword("use-old-ubound") + self.add_keyword("vdecaymode", self.allowed_decay_modes[0], name="decay_mode") + self.add_keyword("withbtilde",1) + self.add_keyword("withdamp") + self.add_keyword("withremnants",1) + self.add_keyword("withnegweights") + self.add_keyword("withsubtr") + self.add_keyword("xgriditeration") + self.add_keyword("xupbound") + # General Leptoquark (LQ) Parameters + self.add_keyword("SM", 1) # Include SM contribution + self.add_keyword("LQ", 0) # Include basic LQ contributions + self.add_keyword("LQ-Int", 0, "LQ_Int") # Include the interference between the SM and the LQ contributions + # 4321 Model Parameters + self.add_keyword("g4", 0.) # SU(4) coupling strength g4 + self.add_keyword("betaL3x3", 1.) # Relative coupling strength to left-handed fermions (3rd generation) + self.add_keyword("betaR3x3", 1.) # Relative coupling strength to right-handed fermions (3rd generation) + self.add_keyword("MU1", 1e4) # Mass of vector leptoquark U1 + self.add_keyword("MGp", 1e4) # Mass of the coloron Gp + + + def validate_decays(self): + """! Validate semileptonic and topdecaymode keywords.""" + self.expose() # convenience call to simplify syntax + if self.decay_mode not in self.allowed_decay_modes: + logger.warning("Decay mode {} not recognised!".format(self.decay_mode)) + raise ValueError("Decay mode {} not recognised!".format(self.decay_mode)) + # Calculate appropriate decay mode numbers + __decay_mode_lookup = { "ta+ ta-": "3", "e+ e-": "1", "mu+ mu-": "2"} + self.parameters_by_keyword("vdecaymode")[0].value = __decay_mode_lookup[self.decay_mode] diff --git a/Generators/PowhegControl/python/processes/powheg/W_EW.py b/Generators/PowhegControl/python/processes/powheg/W_EW.py index f8c52dbd3b10065fdb292009fc93337849fc1ac5..019b2b560cbb0f48845afec89ad7566548baeffa 100644 --- a/Generators/PowhegControl/python/processes/powheg/W_EW.py +++ b/Generators/PowhegControl/python/processes/powheg/W_EW.py @@ -133,7 +133,7 @@ class W_EW(PowhegV2): self.add_keyword("par_diexp") self.add_keyword("par_dijexp") self.add_keyword("parallelstage") - self.add_keyword("pdfreweight") + self.add_keyword("pdfreweight", 0) self.add_keyword("phsp_Wm") self.add_keyword("phsp_Ww") self.add_keyword("powhegv2opt") diff --git a/Generators/PowhegControl/python/processes/powheg/Z_EW.py b/Generators/PowhegControl/python/processes/powheg/Z_EW.py index fdb9498c6232c773b70adae87b89f0d41c14693f..5a58ca76b744456458cb51b9c16718777cbe9c4f 100644 --- a/Generators/PowhegControl/python/processes/powheg/Z_EW.py +++ b/Generators/PowhegControl/python/processes/powheg/Z_EW.py @@ -130,7 +130,7 @@ class Z_EW(PowhegV2): self.add_keyword("par_diexp") self.add_keyword("par_dijexp") self.add_keyword("parallelstage") - self.add_keyword("pdfreweight") + self.add_keyword("pdfreweight", 0) self.add_keyword("photoninduced") self.add_keyword("phsp_Zm") self.add_keyword("phsp_Zw") diff --git a/Generators/PowhegControl/python/processes/powheg/__init__.py b/Generators/PowhegControl/python/processes/powheg/__init__.py index a495901634e31345b53a1940648027df65699537..ad3ce1887fa7394e05cdc4d5f30497073469cf06 100644 --- a/Generators/PowhegControl/python/processes/powheg/__init__.py +++ b/Generators/PowhegControl/python/processes/powheg/__init__.py @@ -10,6 +10,8 @@ from .chi1chi1 import chi1chi1 from .DMGG import DMGG from .DMS_tloop import DMS_tloop from .DMV import DMV +from .DY_VLQ import DY_VLQ +from .DY_SLQ import DY_SLQ from .fourtops import fourtops from .gg4l import gg4l from .ggF_H import ggF_H diff --git a/Generators/PowhegControl/python/processes/powheg/fourtops.py b/Generators/PowhegControl/python/processes/powheg/fourtops.py index bd2bb8afbe00e3a9bdcc0a14bf2157446eb7d142..94054b9c202c3d0a8d924df92fe2edeeb10e64ea 100644 --- a/Generators/PowhegControl/python/processes/powheg/fourtops.py +++ b/Generators/PowhegControl/python/processes/powheg/fourtops.py @@ -81,6 +81,7 @@ class fourtops(PowhegV2): self.add_keyword("compress_lhe") self.add_keyword("compress_upb") self.add_keyword("compute_rwgt") + self.add_keyword("correlations", 1) self.add_keyword("dampscfact", 1.0) self.add_keyword("decay_signature", "0") self.add_keyword("doublefsr") diff --git a/Generators/PowhegControl/python/processes/powheg/gg4l.py b/Generators/PowhegControl/python/processes/powheg/gg4l.py index 98f5dc8c4a81d9520c1d1d4274ec8609259373f2..1a64f40d10e1a71912185d612d9617795c2f7634 100644 --- a/Generators/PowhegControl/python/processes/powheg/gg4l.py +++ b/Generators/PowhegControl/python/processes/powheg/gg4l.py @@ -221,6 +221,31 @@ class gg4l(PowhegRES): if "\'" not in self.contr: self.contr = "\'"+self.contr+"\'" + #Modify unsupported decay configuration in ZZ production + if (self.proc == "'ZZ'" and ((self.vdecaymodeV1 == self.vdecaymodeV2) or self.vdecaymodeV1 == 15 or self.vdecaymodeV2 == 15)): + logger.warning("Powheg/gg4l does support directly 4e, 4mu or tau final states.") + if(self.vdecaymodeV1 == 11 and self.vdecaymodeV2 == 11): + logger.warning("Ask to generate 2e2mu decays and hack the LHE files to have 4e final states - make sure to validate!") + self.add_algorithm("mu2e") + elif(self.vdecaymodeV1 == 13 and self.vdecaymodeV2 == 13): + logger.warning("Ask to generate 2e2mu decays and hack the LHE files to have 4mu final states - make sure to validate!") + self.add_algorithm("e2mu") + elif(self.vdecaymodeV1 == 15 and self.vdecaymodeV2 == 15): + logger.warning("Ask to generate 2e2mu decays and hack the LHE files to have 4tau final states - make sure to validate!") + self.add_algorithm("e2tau") + self.add_algorithm("mu2tau") + elif(self.vdecaymodeV1 == 11 and self.vdecaymodeV2 == 15) or (self.vdecaymodeV1 == 15 and self.vdecaymodeV2 == 11): + logger.warning("Ask to generate 2e2mu decays and hack the LHE files to have 2e2tau final states - make sure to validate!") + self.add_algorithm("mu2tau") + elif(self.vdecaymodeV1 == 13 and self.vdecaymodeV2 == 15) or (self.vdecaymodeV1 == 15 and self.vdecaymodeV2 == 13): + logger.warning("Ask to generate 2e2mu decays and hack the LHE files to have 2mu2tau final states - make sure to validate!") + self.add_algorithm("e2tau") + + self.vdecaymodeV1 = 11 + self.vdecaymodeV2 = 13 + self.parameters_by_keyword("vdecaymodeV1")[0].value = self.vdecaymodeV1 + self.parameters_by_keyword("vdecaymodeV2")[0].value = self.vdecaymodeV2 + #check if the setting is allowed if self.proc not in self.allowed_process_modes: logger.warning("Process mode {} not recognised!".format(self.proc)) diff --git a/Generators/PowhegControl/python/utility/LHE.py b/Generators/PowhegControl/python/utility/LHE.py index 3659234c7b48b37b95113f58fba3b7471071da82..ae27f5eb23c185f804a3f3dc2001340959163097 100644 --- a/Generators/PowhegControl/python/utility/LHE.py +++ b/Generators/PowhegControl/python/utility/LHE.py @@ -222,6 +222,81 @@ def mu2tau(input_event): event_lines += output_line if output_line is not None else input_line return (is_event_changed, event_lines) +def e2tau(input_event): + """! + Swap out electrons for taus, and electron neutrinos for tau neutrinos. + Note no momentum reshuffling is done, but Pythia appears to restore the correct tau mass. + """ + is_event_changed = False + event_lines = "" + for input_line in input_event.splitlines(True): + output_line = None + try: # interpret line as a particle + tokens = re.split(r"(\s+)", input_line) + if len(tokens) < 25: raise ValueError + IDUP = int(tokens[2]) + if abs(IDUP) == 11 or abs(IDUP) == 12: # this is a electron or electron neutrino + if IDUP > 0: + IDUP += 4 + else: + IDUP -= 4 + is_event_changed = True + output_line = "".join("".join(tokens[:2])+str(IDUP)+"".join(tokens[3:])) + except ValueError: # this is not a particle line + pass + event_lines += output_line if output_line is not None else input_line + return (is_event_changed, event_lines) + +def mu2e(input_event): + """! + Swap out muons for electrons, and muon neutrinos for electron neutrinos. + Note no momentum reshuffling is done. + """ + is_event_changed = False + event_lines = "" + for input_line in input_event.splitlines(True): + output_line = None + try: # interpret line as a particle + tokens = re.split(r"(\s+)", input_line) + if len(tokens) < 25: raise ValueError + IDUP = int(tokens[2]) + if abs(IDUP) == 13 or abs(IDUP) == 14: # this is a muon or muon neutrino + if IDUP > 0: + IDUP -= 2 + else: + IDUP += 2 + is_event_changed = True + output_line = "".join("".join(tokens[:2])+str(IDUP)+"".join(tokens[3:])) + except ValueError: # this is not a particle line + pass + event_lines += output_line if output_line is not None else input_line + return (is_event_changed, event_lines) + +def e2mu(input_event): + """! + Swap out electrons for muons, and electron neutrinos for muon neutrinos. + Note no momentum reshuffling is done. + """ + is_event_changed = False + event_lines = "" + for input_line in input_event.splitlines(True): + output_line = None + try: # interpret line as a particle + tokens = re.split(r"(\s+)", input_line) + if len(tokens) < 25: raise ValueError + IDUP = int(tokens[2]) + if abs(IDUP) == 11 or abs(IDUP) == 12: # this is an electron or electron neutrino + if IDUP > 0: + IDUP += 2 + else: + IDUP -= 2 + is_event_changed = True + output_line = "".join("".join(tokens[:2])+str(IDUP)+"".join(tokens[3:])) + except ValueError: # this is not a particle line + pass + event_lines += output_line if output_line is not None else input_line + return (is_event_changed, event_lines) + def update_XWGTUP_with_reweighted_nominal(input_event, wgtid_for_old_XWGTUP_value = None): """! Ensure that XWGTUP is equal to the reweighted nominal.""" diff --git a/Generators/PowhegControl/share/control/PowhegControl_DY_SLQ_Common.py b/Generators/PowhegControl/share/control/PowhegControl_DY_SLQ_Common.py new file mode 100644 index 0000000000000000000000000000000000000000..0a4223ab54d973bce29b560876221c63336aed76 --- /dev/null +++ b/Generators/PowhegControl/share/control/PowhegControl_DY_SLQ_Common.py @@ -0,0 +1,4 @@ +import PowhegControl +transform_runArgs = runArgs if "runArgs" in dir() else None +transform_opts = opts if "opts" in dir() else None +PowhegConfig = PowhegControl.PowhegControl(process_name="DY_SLQ", run_args=transform_runArgs, run_opts=transform_opts) diff --git a/Generators/PowhegControl/share/control/PowhegControl_DY_VLQ_Common.py b/Generators/PowhegControl/share/control/PowhegControl_DY_VLQ_Common.py new file mode 100644 index 0000000000000000000000000000000000000000..80a8fee22a8efa3b068fe29a7822c0cc49178071 --- /dev/null +++ b/Generators/PowhegControl/share/control/PowhegControl_DY_VLQ_Common.py @@ -0,0 +1,4 @@ +import PowhegControl +transform_runArgs = runArgs if "runArgs" in dir() else None +transform_opts = opts if "opts" in dir() else None +PowhegConfig = PowhegControl.PowhegControl(process_name="DY_VLQ", run_args=transform_runArgs, run_opts=transform_opts) diff --git a/Generators/PowhegControl/share/example/processes/DY_SLQ/mc.PhPy8EG_A14NNPDF23_DY_SLQ_example.py b/Generators/PowhegControl/share/example/processes/DY_SLQ/mc.PhPy8EG_A14NNPDF23_DY_SLQ_example.py new file mode 100644 index 0000000000000000000000000000000000000000..c2f8370d5da6ea1fd366099aa47a6a9b06db7617 --- /dev/null +++ b/Generators/PowhegControl/share/example/processes/DY_SLQ/mc.PhPy8EG_A14NNPDF23_DY_SLQ_example.py @@ -0,0 +1,78 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#-------------------------------------------------------------- +# This is an example joboption to generate events with Powheg +# using ATLAS' interface. Users should optimise and carefully +# validate the settings before making an official sample request. +#-------------------------------------------------------------- + +#-------------------------------------------------------------- +# EVGEN configuration +#-------------------------------------------------------------- +evgenConfig.description = "POWHEG+Pythia8 Drell-Yan Scalar LeptoQuark production with A14 NNPDF2.3 tune." +evgenConfig.keywords = ["BSM", "leptoquark"] +evgenConfig.contact = ["tpelzer@cern.ch"] + +# -------------------------------------------------------------- +# Load ATLAS defaults for the Powheg Drell-Yan Scalar LeptoQuark process +# -------------------------------------------------------------- +include("PowhegControl/PowhegControl_DY_SLQ_Common.py") + +# -------------------------------------------------------------- +# Relevant parameters for this process +# -------------------------------------------------------------- +# Yukawa couplings to down-type quarks (S1t RR) +PowhegConfig.YSD1x1 = 0. +PowhegConfig.YSD1x2 = 0. +PowhegConfig.YSD1x3 = 0. +PowhegConfig.YSD2x1 = 0. +PowhegConfig.YSD2x2 = 0. +PowhegConfig.YSD2x3 = 0. +PowhegConfig.YSD3x1 = 0. +PowhegConfig.YSD3x2 = 0. +PowhegConfig.YSD3x3 = 2.5 +PowhegConfig.MSD = 2e3 # mass +# Yukawa couplings to up-type quarks (S1 RR) +PowhegConfig.YSU1x1 = 0. +PowhegConfig.YSU1x2 = 0. +PowhegConfig.YSU1x3 = 0. +PowhegConfig.YSU2x1 = 0. +PowhegConfig.YSU2x2 = 0. +PowhegConfig.YSU2x3 = 0. +PowhegConfig.YSU3x1 = 0. +PowhegConfig.YSU3x2 = 0. +PowhegConfig.YSU3x3 = 0. +PowhegConfig.MSU = 2e3 # mass +# General Leptoquark (LQ) Parameters +PowhegConfig.SM = 1 # Include SM contribution +PowhegConfig.LQ = 0 # Include basic LQ contributions +PowhegConfig.LQ_EW = 0 # Include LQ corrections to photon/Z couplings +PowhegConfig.LQ_Int = 0 # Include the interference between the SM and the LQ contributions +PowhegConfig.mass_t = 172.5 # top-quark (running) mass +PowhegConfig.mass_low = 2000 # lower limit for dilepton mass +PowhegConfig.mass_high = 2100 # upper limit for dilepton mass +#PowhegConfig.runningscale = 1 +#PowhegConfig.new_damp = 1 +#PowhegConfig.hnew_damp = 0.5 +#PowhegConfig.hdamp = 1.0 + +# -------------------------------------------------------------- +# Integration settings +# -------------------------------------------------------------- +PowhegConfig.ncall1 = 10000 +PowhegConfig.ncall2 = 10000 +PowhegConfig.nubound = 10000 + + +# -------------------------------------------------------------- +# Generate events +# -------------------------------------------------------------- +PowhegConfig.generate() + +#-------------------------------------------------------------- +# Pythia8 showering with the A14 NNPDF2.3 tune, main31 routine +#-------------------------------------------------------------- +include("Pythia8_i/Pythia8_A14_NNPDF23LO_EvtGen_Common.py") +include("Pythia8_i/Pythia8_Powheg_Main31.py") +# Setting the appropriate number of final state particles for the main31 routine +genSeq.Pythia8.Commands += [ 'Powheg:NFinal = 2' ] diff --git a/Generators/PowhegControl/share/example/processes/DY_VLQ/mc.PhPy8EG_A14NNPDF23_DY_VLQ_example.py b/Generators/PowhegControl/share/example/processes/DY_VLQ/mc.PhPy8EG_A14NNPDF23_DY_VLQ_example.py new file mode 100644 index 0000000000000000000000000000000000000000..0f7b3d12defedb7a1067fca2d23fe18883d95d79 --- /dev/null +++ b/Generators/PowhegControl/share/example/processes/DY_VLQ/mc.PhPy8EG_A14NNPDF23_DY_VLQ_example.py @@ -0,0 +1,61 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#-------------------------------------------------------------- +# This is an example joboption to generate events with Powheg +# using ATLAS' interface. Users should optimise and carefully +# validate the settings before making an official sample request. +#-------------------------------------------------------------- + +#-------------------------------------------------------------- +# EVGEN configuration +#-------------------------------------------------------------- +evgenConfig.description = "POWHEG+Pythia8 Drell-Yan Vector LeptoQuark production with A14 NNPDF2.3 tune." +evgenConfig.keywords = ["BSM", "leptoquark"] +evgenConfig.contact = ["tpelzer@cern.ch"] + +# -------------------------------------------------------------- +# Load ATLAS defaults for the Powheg Drell-Yan Vector LeptoQuark process +# -------------------------------------------------------------- +include("PowhegControl/PowhegControl_DY_VLQ_Common.py") + +# -------------------------------------------------------------- +# Relevant parameters for this process +# -------------------------------------------------------------- +# 4321 Model Parameters +PowhegConfig.g4 = 1.0 # SU(4) coupling strength g4 +PowhegConfig.betaL3x3 = 1.0 # Relative coupling strength to left-handed fermions (3rd generation) +PowhegConfig.betaR3x3 = 1.0 # Relative coupling strength to right-handed fermions (3rd generation) +PowhegConfig.MU1 = 2e3 # Mass of vector leptoquark U1 +PowhegConfig.MGp = 2e3 # Mass of the coloron Gp +# General Leptoquark (LQ) Parameters +PowhegConfig.SM = 1 # Include SM contribution +PowhegConfig.LQ = 0 # Include basic LQ contributions +PowhegConfig.LQ_Int = 0 # Include the interference between the SM and the LQ contributions +PowhegConfig.mass_t = 172.5 # top-quark (running) mass +PowhegConfig.mass_low = 2000 # lower limit for dilepton mass +PowhegConfig.mass_high = 2100 # upper limit for dilepton mass +#PowhegConfig.runningscale = 1 +#PowhegConfig.new_damp = 1 +#PowhegConfig.hnew_damp = 0.5 +#PowhegConfig.hdamp = 1.0 + +# -------------------------------------------------------------- +# Integration settings +# -------------------------------------------------------------- +PowhegConfig.ncall1 = 10000 +PowhegConfig.ncall2 = 10000 +PowhegConfig.nubound = 10000 + + +# -------------------------------------------------------------- +# Generate events +# -------------------------------------------------------------- +PowhegConfig.generate() + +#-------------------------------------------------------------- +# Pythia8 showering with the A14 NNPDF2.3 tune, main31 routine +#-------------------------------------------------------------- +include("Pythia8_i/Pythia8_A14_NNPDF23LO_EvtGen_Common.py") +include("Pythia8_i/Pythia8_Powheg_Main31.py") +# Setting the appropriate number of final state particles for the main31 routine +genSeq.Pythia8.Commands += [ 'Powheg:NFinal = 2' ] diff --git a/Generators/Pythia8B_i/src/Pythia8B_i.cxx b/Generators/Pythia8B_i/src/Pythia8B_i.cxx index 62818d85e6c9c13f0c71270b0b57dc19cfe0d59f..f56954ce7acbcd8eff6510e62a1d7dadd2194e96 100644 --- a/Generators/Pythia8B_i/src/Pythia8B_i.cxx +++ b/Generators/Pythia8B_i/src/Pythia8B_i.cxx @@ -396,9 +396,9 @@ StatusCode Pythia8B_i::fillEvt(HepMC::GenEvent *evt){ #ifdef HEPMC3 if (!evt->run_info()) evt->set_run_info(m_runinfo); evt->set_units(HepMC3::Units::MEV, HepMC3::Units::MM); -#endif +#else evt->weights().push_back(m_pythia->info.weight()); - +#endif //uncomment to list HepMC events //#ifdef HEPMC3 diff --git a/Generators/Rivet_i/CMakeLists.txt b/Generators/Rivet_i/CMakeLists.txt index 40d7f61a0fc93b12e93d6f22960cde4264a54988..c30548ff1b5b831cae9b3b840c5e2864902126d9 100644 --- a/Generators/Rivet_i/CMakeLists.txt +++ b/Generators/Rivet_i/CMakeLists.txt @@ -19,7 +19,7 @@ atlas_add_component( Rivet_i INCLUDE_DIRS ${FASTJET_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${RIVET_INCLUDE_DIRS} ${YODA_INCLUDE_DIRS} LINK_LIBRARIES ${FASTJET_LIBRARIES} ${ROOT_LIBRARIES} AtlasHepMCLib - ${RIVET_LIBRARIES} ${YODA_LIBRARIES} AthenaBaseComps CxxUtils GaudiKernel + ${RIVET_LIBRARIES} ${YODA_LIBRARIES} AthenaBaseComps CxxUtils GaudiKernel GenInterfacesLib AthenaKernel GeneratorObjects PathResolver xAODEventInfo ) # Install file(s) from the package. diff --git a/Generators/Rivet_i/README.md b/Generators/Rivet_i/README.md index 1ecfb054062a2a596d94a859578149a6d55b4036..e58858f524c2b998abd3a1ccc4b9527ab3f004e1 100644 --- a/Generators/Rivet_i/README.md +++ b/Generators/Rivet_i/README.md @@ -1,17 +1,17 @@ **For support: [Mailing list](mailto:atlas-phys-pmg-rivet@cern.ch)** Rivet contact persons in ATLAS: [Deepak Kar](mailto:deepak.kar@cern.ch) -and [Neil Warrack](mailto:neil.warrack@cern.ch). +and [Christian Gütschow ](mailto:chris.g@cern.ch). -For adding your awesome analysis in the official Rivet framework -[see here](https://twiki.cern.ch/twiki/bin/view/AtlasProtected/RivetMCValidation). +For adding your awesome analysis in the official Rivet framework +[see here](https://gitlab.cern.ch/atlas-physics/pmg/rivet-routines). Finally, if all else fails, you can contact the [Rivet developers](mailto:rivet-support@cern.ch), but remember that this is an external address and that you should not discuss anything ATLAS Internal! [[_TOC_]] -# How to use Rivet +# How to use Rivet Rivet has a growing [wiki](https://gitlab.com/hepcedar/rivet/-/wikis/home) of its own with many useful examples for using standalone Rivet. This tutorial will focus on the Athena wrapper around Rivet. @@ -21,11 +21,11 @@ for using standalone Rivet. This tutorial will focus on the Athena wrapper aroun In general, the latest 22.0/22.6 releases should have the latest Rivet release supported by ATLAS. ```bash -asetup 22.6.1,AthGeneration # or later +asetup 22.6.1,AthGeneration # or later source setupRivet ``` -The last line is necessary to have the main Rivet executable +The last line is necessary to have the main Rivet executable as well as useful helper scripts (e.g. `yodamerge`, `rivet-mkhtml`, etc.) available on the command line. @@ -37,12 +37,12 @@ asetup master,latest,AthGeneration source setupRivet ``` -That's all. +That's all. _Please note this also allow you to run all native Rivet/Yoda commands without the wrapper as well._ -The Rivet3 series comes with automatic handling of multiweights as well as couple of syntax changes. -For a quick tutorial on how to make a Rivet2-style routine compatible with Rivet3, +The Rivet3 series comes with automatic handling of multiweights as well as couple of syntax changes. +For a quick tutorial on how to make a Rivet2-style routine compatible with Rivet3, [check this out](https://gitlab.com/hepcedar/rivet/blob/release-3-1-x/doc/tutorials/mig2to3.md). @@ -55,6 +55,9 @@ If for some reason, you do need to revert back to an older Rivet version, feel f | Rivet version | Athena release | Comments | | :----: | :-------:| :----- | +| v3.1.7 | `22.6.26,AthGeneration` | | +| v3.1.6 | `22.6.20,AthGeneration` | | +| v3.1.5 | `22.6.14,AthGeneration` | | | v3.1.2 | `22.6.1,AthGeneration` | | | v3.1.2 | `22.6.0,AthGeneration` | `Rivet_i` disabled by accident | @@ -63,7 +66,7 @@ If for some reason, you do need to revert back to an older Rivet version, feel f # Running Rivet over a local EVNT file Standalone Rivet cannot deal with EVNT files, but that's why we have a `Rivet_i` wrapper in Athena. -As with everything in Athena, this requires some JOs. We've added an [example](share/example/local_jO.py) to this repo. +As with everything in Athena, this requires some JOs. We've added an [example](share/example/local_jO.py) to this repo. These JOs are very simple. Take a look: ```python @@ -103,9 +106,9 @@ Rivet3 will produce one histogram per variation weight in the EVNT file. If you you can suppress the extra histograms in the output file by setting the `SkipWeights` flag to `True`. -Hint: In the example above, the output files will be zipped since the additional variation weights can -increase the file size significantly. You do not need to unzip the files, since all of the other -Rivet scripts (`yodamerge`, `rivet-mkhtml`, etc.) happily read in zipped yodas! +Hint: In the example above, the output files will be zipped since the additional variation weights can +increase the file size significantly. You do not need to unzip the files, since all of the other +Rivet scripts (`yodamerge`, `rivet-mkhtml`, etc.) happily read in zipped yodas! More `Rivet_i` options are defined [here](src/Rivet_i.cxx). @@ -123,7 +126,7 @@ athena local_jO.py In the previous example, we assumed that you downloaded an EVNT file from the grid. If you generated the EVNT files locally, you typically have the generator cross-section stored in the `log.generate` -file in each run. In that case you can extend the JobOption as follows to feed the correct cross-section +file in each run. In that case you can extend the JobOption as follows to feed the correct cross-section directly into Rivet: ```python @@ -225,12 +228,12 @@ If you are autobooking histograms from data yoda file, that file need to be sent as well. -If the container is large and you know the jobs are fast, +If the container is large and you know the jobs are fast, it might be more efficient to tweak the number of input files per jobs using the `--nFilesPerJob` flag. -This can also be done by the +This can also be done by the [PMG systemtics tool](https://gitlab.cern.ch/atlas-physics/pmg/tools/systematics-tools/tree/master#installation-on-afs), which can also combine the outputs. @@ -240,10 +243,10 @@ which can also combine the outputs. **Note that due to a bug in HepMC, this feature did not work with Rivet3 until release 21.6.46,AthGeneration or later.** -Rivet jobs can be run in the same job as a `Gen_tf` run, -without needing to modify the standard production jO fragment. -The easiest and the recommended way is to use `--rivetAnas` -option followed by the list of rivet analysis separated by commas. One example is shown below. +Rivet jobs can be run in the same job as a `Gen_tf` run, +without needing to modify the standard production jO fragment. +The easiest and the recommended way is to use `--rivetAnas` +option followed by the list of rivet analysis separated by commas. One example is shown below. ```bash Gen_tf.py --ecmEnergy=13000.0 --randomSeed=1234 --jobConfig=830011 --outputEVNTFile=tmp.EVNT.root --maxEvents=10 --rivetAnas=MC_GENERIC,ATLAS_2020_I1790256.cc @@ -252,21 +255,21 @@ Gen_tf.py --ecmEnergy=13000.0 --randomSeed=1234 --jobConfig=830011 --outputEVNTF _More details about the new generation setup is [here](https://twiki.cern.ch/twiki/bin/view/AtlasProtected/PmgMcSoftware#Production_transforms_and_job_op)._ -The other possibility is to use a `--postInclude=local_jO.py`, where `local_jO.py` +The other possibility is to use a `--postInclude=local_jO.py`, where `local_jO.py` are some after-burner-like JOs to configure Rivet, similar to the standalone JOs mentioned above, -but without the following lines (or equivalent): +but without the following lines (or equivalent): ```python import AthenaPoolCnvSvc.ReadAthenaPool svcMgr.EventSelector.InputCollections = [ 'EVNT.root' ] ``` -Also note that when Rivet is run using a `--postInclude` instead of with `--rivetAnas`, +Also note that when Rivet is run using a `--postInclude` instead of with `--rivetAnas`, the YODA output file should be specified on the command line using the `--outputYODAFile` arument of `Gen_tf`. -In this way it is also possible to run custom routines on the fly (i.e. as part of running `Gen_tf`). +In this way it is also possible to run custom routines on the fly (i.e. as part of running `Gen_tf`). If the (possibly large) EVNT output is not needed to be saved, then the `--outputEVNTFile` argument can simply -be omitted, but the `--outputYODAFile` would still need to be kept of course, so that the YODA file +be omitted, but the `--outputYODAFile` would still need to be kept of course, so that the YODA file will be kept as an output. @@ -285,7 +288,7 @@ can disable the extra histograms by setting `rivet.SkipWeights=True` in the JOs. ## Where to start -Rivet has a huge library of existing routines. Chances are that there is already a routine +Rivet has a huge library of existing routines. Chances are that there is already a routine which is similar enough to your phase space of interest that it's worth copying it and using it as a starting point. @@ -296,7 +299,7 @@ rivet-mkanalysis MY_ANALYSIS ``` The routine will have familiar `init()`, `analyze()` and `finalize()` methods. -Check out the [Rivet wiki](https://gitlab.com/hepcedar/rivet/-/blob/master/doc/tutorials) +Check out the [Rivet wiki](https://gitlab.com/hepcedar/rivet/-/blob/master/doc/tutorials) for more information. Note: To enable the Rivet commands for merging and plotting to work with your new local routine, @@ -305,7 +308,7 @@ you will have to set an enviroment variable as e.g.: export RIVET_ANALYSIS_PATH=$PWD ``` -It's worth reading the +It's worth reading the [physics tips and pitfalls](https://gitlab.com/hepcedar/rivet/-/blob/release-3-1-x/doc/tutorials/tips-pitfalls.md) as well. @@ -331,26 +334,40 @@ over a grid container. # How to merge output files -Rivet provides a handy script that can be used to merge yoda files: +Rivet provides multiple handy scripts that can be used to merge yoda files: +`rivet-merge` and `yodamerge` and `yodastack`. The `rivet-merge` script is +more sophisticated in the sense that it is Rivet-based and so has access +to the original routine (and actually re-runs the `finalize` method over +the merged result, provided the routine is reentrant safe). +The other two scripts are YODA-based and so know nothing about the routines +and just blindly merge (or stack) YODA objects with the same path. + +See this [page](https://gitlab.com/hepcedar/rivet/-/blob/release-3-1-x/doc/tutorials/merging.md) +for a more extensive discussion of the differences between them, including +short tutorials. + +As a rule of thumb, use `rivet-merge` if you can, otherwise fall back to the others. +Equivalent merging (e.g. multiple grid outputs from a parallelised run over the same setup): -```bash -yodamerge -o my_merged_output.yoda MY_GRID_OUTPUT/* +``` +rivet-merge -e -o my_merged_output.yoda.gz MY_GRID_OUTPUT/* +yodamerge -o my_merged_output.yoda.gz MY_GRID_OUTPUT/* ``` -If you have to run Rivet over several processes, you want -to merge the grid output as shown above for each process. -The you can stack the resulting files into a combined output +When you have to run Rivet over several processes and you want +to merge the grid output as shown above for each process, +you can stack the resulting files to yield the combined output file like so: -```bash -yodamerge --add -o my_stacked_outpyt.yoda process1.yoda:12.34 process2.yoda:4.56 +``` +rivet-merge -o my_stacked_outpyt.yoda.gz process1.yoda.gz:12.34 process2.yoda.gz:4.56 +yodastack -o my_stacked_outpyt.yoda.gz process1.yoda.gz:12.34 process2.yoda.gz:4.56 ``` -where the optional multipliers at the end of the input files could be the sample -cross-sections from the PMG Central Page, thereby scaling the yoda files on the fly +where the optional multipliers at the end of the input files could be the sample +cross-sections from the PMG Central Page, thereby scaling the YODA files on the fly to the relevant generator cross-section. - # How to plot the output There are several options, but our favourite way is the following: @@ -361,9 +378,9 @@ rivet-mkhtml --errs -o my_plots prediction1.yoda:"Title=MC 1" prediction2.yoda:" This will create a nice little html booklet that you can stare at in your favourite browser. -Several other options are available with `rivet-mkhtml --help`. +Several other options are available with `rivet-mkhtml --help`. For example, one can select the analyses' plot to run with the option `-a`. -One can also customize the cosmetic of the plots with the +One can also customize the cosmetic of the plots with the help of a `.plot` file that. Check the rivet documentation for `make-plots` for more information. @@ -383,7 +400,7 @@ This section will be populated from the mailing list questions/answers. ## Converting YODA files to ROOT format To first order YODA can do what ROOT can, minus all the ROOT bugs, -but if you _really_ need the data in ROOT format, it is +but if you _really_ need the data in ROOT format, it is straightforward to convert them using Python, e.g. @@ -425,9 +442,9 @@ We've added this as a script to the repo too. The cross-section can be set in the jOs or it can be set to unity and then the resulting yoda file(s) can be scaled after the run. The advantage of the latter approach is, the user does not have modify the joboption for (say) every jet slice. -If the user does not set the cross-section in the JOs at all, +If the user does not set the cross-section in the JOs at all, then I believe in the old version of Rivet_i, then the default value is unity. -Athena expects cross-sections in pb, so if the user is scaling the histograms +Athena expects cross-sections in pb, so if the user is scaling the histograms using the "/femtobarn" in the routine, it assumes that the value coming out of "crossSections()" is in pb. @@ -439,7 +456,7 @@ The correct syntax for user-defined histograms is: book(_h_myhisto,"_h_myhisto",10,0,200); ``` -Omitting the `"_h_myhisto"` part will result in it being interpreted as an autobooked histogram +Omitting the `"_h_myhisto"` part will result in it being interpreted as an autobooked histogram from a reference yoda file, with the numbers corresponding to `d`, `x` and `y` from the usual `d01-x01-y01` names assigened by HepData. @@ -448,35 +465,31 @@ from a reference yoda file, with the numbers corresponding to `d`, `x` and `y` f ### AntiKt4TruthJets -```cpp -FinalState fs(Cuts::abseta < 5.0); -FastJets(fs, 0.4, ANTIKT, JetAlg::Muons::NONE, JetAlg::Invisibles::NONE) +``` +FinalState fs(Cuts::abseta < 4.5); +FastJets(fs, 0.4, ANTIKT, JetAlg::Muons::NONE, JetAlg::Invisibles::NONE) ``` -### AntiKt4TruthDressedWZJets +### AntiKt4TruthWZJets -```cpp +``` // Photons -FinalState photons(Cuts::abspid == PID::PHOTON, true, true); +FinalState photons(Cuts::abspid == PID::PHOTON); // Muons PromptFinalState bare_mu(Cuts::abspid == PID::MUON, true); // true = use muons from prompt tau decays -DressedLeptons all_dressed_mu(photons, bare_mu, 0.1); +DressedLeptons all_dressed_mu(photons, bare_mu, 0.1, Cuts::abseta < 2.5, true); // Electrons PromptFinalState bare_el(Cuts::abspid == PID::ELECTRON, true); // true = use electrons from prompt tau decays -DressedLeptons all_dressed_el(photons, bare_el, 0.1); - -// Prompt invisibles -InvisibleFinalState prompt_invis(true, true); +DressedLeptons all_dressed_el(photons, bare_el, 0.1, Cuts::abseta < 2.5, true); //Jet forming -VetoedFinalState vfs(FinalState(Cuts::abseta < 5.0)); +VetoedFinalState vfs(FinalState(Cuts::abseta < 4.5)); vfs.addVetoOnThisFinalState(all_dressed_el); vfs.addVetoOnThisFinalState(all_dressed_mu); -vfs.addVetoOnThisFinalState(prompt_invis); - -FastJets jet(vfs, FastJets::ANTIKT, 0.4, JetAlg::Muons::ALL, JetAlg::Invisibles::ALL); + +FastJets jet(vfs, FastJets::ANTIKT, 0.4, JetAlg::Muons::ALL, JetAlg::Invisibles::DECAY); ``` @@ -493,27 +506,27 @@ Same as AntiKt4TruthWZJets, just change the radius from 0.4 to 1.0 ### AntiKt10TruthTrimmedPtFrac5SmallR20Jets Declare in `init`: -```cpp +``` _trimmer = fastjet::Filter(fastjet::JetDefinition(fastjet::kt_algorithm, 0.2), fastjet::SelectorPtFractionMin(0.05)); ``` Then in `execute`: -```cpp +``` PseudoJets tr_ljets; for (const Jet& fjet : fjets) { tr_ljets += _trimmer(fjet); } ``` where `fjets` are obtained from AntiKt10TruthJets. - + ### AntiKt10TruthSoftDropBeta100Zcut10Jets Include the following header: -```cpp +``` #include "fastjet/contrib/SoftDrop.hh" ``` In `execute`: -```cpp +``` fastjet::contrib::SoftDrop sd(1.0, 0.1); for (const Jet& fjet : fjets) { sd_ljets += sd(fjet); @@ -525,22 +538,22 @@ where `fjets` are obtained from AntiKt10TruthJets. ### AntiKt10TruthBottomUpSoftDropBeta100Zcut5Jets Include the following header: -```cpp +``` #include "fastjet/contrib/BottomUpSoftDrop.hh" ``` As above, but: -```cpp +``` fastjet::contrib::BottomUpSoftDrop busd(1.0, 0.05); ``` ### AntiKt10TruthRecursiveSoftDropBeta100Zcut5NinfJets Include the following header: -```cpp +``` #include "fastjet/contrib/RecursiveSoftDrop.hh" ``` As above, but: -```cpp +``` fastjet::contrib::RecursiveSoftDrop rsd(1.0, 0.05); ``` @@ -549,9 +562,9 @@ fastjet::contrib::RecursiveSoftDrop rsd(1.0, 0.05); ### Where is my histogram? -histograms with a leading `_` -in their name are interpreted as auxiliary objects and -hence skipped by the plotting scripts, similar to the `_EVTCOUNT` and `_XSEC` +histograms with a leading `_` +in their name are interpreted as auxiliary objects and +hence skipped by the plotting scripts, similar to the `_EVTCOUNT` and `_XSEC` objects in the output file. ### How to plot with/without weights? @@ -588,22 +601,17 @@ For left-aligned text in the top left corner, something like the following shoul ## How to scale a yoda file? -````bash +```` yodascale -c '.* 10x' file.yoda ```` will create a `file-scaled.yoda`, where every histogram will be scaled by a factor of 10. + ### "Can I run over (D)AOD files?" -Yes! AODs and TRUTH1 DAOD can be read in and passed onto Rivet (Unfortunately TRUTH3 DAOD cannot, because the full truth record is not -retained for TRUTH3). For AOD files specifically, some of the events may be missing beam protons, causing Rivet to complain about a beam -mismatch. If you encounter this problem, you can ask Rivet_i to add some dummy protons to the reconstructed GenEvent by setting the -following flag in the JobOptions: -```python -rivet.AddMissingBeamParticles = True +Yes! AODs and TRUTH1 DAOD can be read in and passed onto Rivet (Unfortunately TRUTH3 DAOD cannot, because the full truth record is not retained for TRUTH3). For AOD files specifically, some of the events may be missing beam protons, causing Rivet to complain about a beam mismatch. If you encounter this problem, you can ask Rivet_i to add some dummy protons to the reconstructed GenEvent by setting the following flag in the JobOptions: +``` +rivet.AddMissingBeamParticles = True ``` - this will inject the necessary protons in the targeted events (those missing beam protons) with the appropriate centre of mass energy. - - diff --git a/Generators/Rivet_i/src/Rivet_i.cxx b/Generators/Rivet_i/src/Rivet_i.cxx index b1ea3a5b848b757e1a81b893e9b86bd376f02381..e795ceb335cd173e2654524eaaa154c04d3c74b5 100644 --- a/Generators/Rivet_i/src/Rivet_i.cxx +++ b/Generators/Rivet_i/src/Rivet_i.cxx @@ -52,6 +52,7 @@ Rivet_i::Rivet_i(const std::string& name, ISvcLocator* pSvcLocator) : declareProperty("UnmatchWeights", m_unmatchWeights=""); declareProperty("NominalWeightName", m_nominalWeightName=""); declareProperty("WeightCap", m_weightcap=-1.0); + declareProperty("AddMissingBeamParticles",m_patchBeams=false); } std::string getenv_str(const std::string& key) { @@ -66,6 +67,10 @@ StatusCode Rivet_i::initialize ATLAS_NOT_THREAD_SAFE () { ATH_CHECK(m_evtInfoKey.initialize()); + // Get tool for xAOD::Truth to HepMC::GenEvent conversion + ATH_CHECK(m_xAODtoHepMCTool.retrieve()); + + // Set RIVET_ANALYSIS_PATH based on alg setup // First set (overwrite, if necessary) the RIVET_ANALYSIS_PATH variable @@ -160,30 +165,51 @@ StatusCode Rivet_i::execute() { const EventContext& ctx = getContext(); - // Get the event collection - /// @todo Replace with new GenBase functionality - const McEventCollection* eventCollection; - StatusCode sc = evtStore()->retrieve(eventCollection, m_genEventKey); - if (sc.isFailure() || eventCollection == 0) { - ATH_MSG_ERROR("Unable to retrieve event collection from StoreGate with key " << m_genEventKey); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG("Retrieved event collection from StoreGate with key " << m_genEventKey); - } + m_needsConversion = !evtStore()->contains<McEventCollection>(m_genEventKey); + ATH_MSG_DEBUG("Rivet_i needs xAOD::Truth to HepMC::GenEvent conversion? " << m_needsConversion); - // Get the first event in the event collection - /// @todo Actually use back(), for the most recent event, or throw an exception if more than one event found? - /// @todo Replace with new GenBase const_event() functionality - const HepMC::GenEvent* event = eventCollection->front(); - if (event == nullptr) { - ATH_MSG_ERROR("Rivet_i received a null HepMC event"); - return StatusCode::FAILURE; + const HepMC::GenEvent* checkedEvent; + if (m_needsConversion) { + const xAOD::TruthEventContainer* truthCollection; + if (evtStore()->retrieve(truthCollection, "TruthEvents").isFailure()) { + ATH_MSG_ERROR("Could not retrieve TruthEvents collection, aborting."); + return StatusCode::FAILURE; + } + + SG::ReadHandle<xAOD::EventInfo> eventInfo(m_evtInfoKey, ctx); + ATH_MSG_DEBUG("Attempt xAOD::Truth to HepMC::GenEvent conversion."); + std::vector<HepMC::GenEvent>&& hepmc_evts = m_xAODtoHepMCTool->getHepMCEvents(truthCollection, eventInfo.cptr()); + + if (hepmc_evts.empty()) { + ATH_MSG_ERROR("Conversion didn't yield HepMC::GenEvent, aborting."); + return StatusCode::FAILURE; + } + checkedEvent = checkEvent(std::move(hepmc_evts[0]), ctx); } + else { + // Get the event collection + /// @todo Replace with new GenBase functionality + const McEventCollection* eventCollection; + StatusCode sc = evtStore()->retrieve(eventCollection, m_genEventKey); + if (sc.isFailure() || eventCollection == 0) { + ATH_MSG_ERROR("Unable to retrieve event collection from StoreGate with key " << m_genEventKey); + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG("Retrieved event collection from StoreGate with key " << m_genEventKey); + } - // Modify the event units etc. if necessary - const HepMC::GenEvent* checkedEvent = checkEvent(event, ctx); - // ATH_MSG_ALWAYS("CHK1 BEAM ENERGY = " << checkedEvent->beam_particles().first->momentum().e()); - // ATH_MSG_ALWAYS("CHK1 UNITS == MEV = " << std::boolalpha << (checkedEvent->momentum_unit() == HepMC::Units::MEV)); + // Get the first event in the event collection + /// @todo Actually use back(), for the most recent event, or throw an exception if more than one event found? + /// @todo Replace with new GenBase const_event() functionality + const HepMC::GenEvent* event = eventCollection->front(); + if (event == nullptr) { + ATH_MSG_ERROR("Rivet_i received a null HepMC event"); + return StatusCode::FAILURE; + } + + // Modify the event units etc. if necessary + checkedEvent = checkEvent(*event, ctx); + } if(!checkedEvent) { ATH_MSG_ERROR("Check on HepMC event failed!"); @@ -229,11 +255,11 @@ StatusCode Rivet_i::finalize() { m_analysisHandler->writeData(m_file.substr(0, pos)+".gz"); // then rename it as the requested output filename if (std::rename((m_file.substr(0, pos)+".gz").c_str(), m_file.c_str()) !=0) { - std::string error_msg = "Impossible to rename "; - error_msg += m_file.substr(0, pos)+".gz"; - error_msg += " as "; - error_msg += m_file; - ATH_MSG_ERROR(error_msg.c_str()); + std::string error_msg = "Impossible to rename "; + error_msg += m_file.substr(0, pos)+".gz"; + error_msg += " as "; + error_msg += m_file; + ATH_MSG_ERROR(error_msg.c_str()); return StatusCode::FAILURE; } } @@ -257,33 +283,30 @@ inline std::vector<std::string> split(const std::string& input, const std::strin return {first, last}; } -const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event, const EventContext& ctx) { +const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent& event, const EventContext& ctx) { std::vector<HepMC::GenParticlePtr> beams; - HepMC::GenEvent* modEvent = new HepMC::GenEvent(*event); + HepMC::GenEvent* modEvent = new HepMC::GenEvent(event); - // overwrite the HEPMC dummy event number with the proper ATLAS event number - SG::ReadHandle<xAOD::EventInfo> evtInfo(m_evtInfoKey, ctx); - modEvent->set_event_number(static_cast<int>(evtInfo->eventNumber())); + if (!m_needsConversion) { + // overwrite the HEPMC dummy event number with the proper ATLAS event number + SG::ReadHandle<xAOD::EventInfo> evtInfo(m_evtInfoKey, ctx); + modEvent->set_event_number(static_cast<int>(evtInfo->eventNumber())); + } // weight-name cleaning #ifdef HEPMC3 std::shared_ptr<HepMC3::GenRunInfo> modRunInfo; - if (event->run_info()) { - modRunInfo = std::make_shared<HepMC3::GenRunInfo>(*(event->run_info().get())); - try { - event->weight_names(); - } - catch (std::runtime_error &e) { - // most likely a HepMC2-style GenEvent - if (event->weights().size() != 1) throw e; - modRunInfo->set_weight_names({"Default"}); + if (event.run_info()) { + modRunInfo = std::make_shared<HepMC3::GenRunInfo>(*(event.run_info().get())); + if (event.run_info()->weight_names().empty() && event.weights().size() == 1) { + modRunInfo->set_weight_names({"Default"}); } } else { - ATH_MSG_DEBUG("No run info, event weights size is " << event->weights().size() ); + ATH_MSG_DEBUG("No run info, event weights size is " << event.weights().size() ); modRunInfo = std::make_shared<HepMC3::GenRunInfo>(); std::vector<std::string> w_names; - for (size_t i = 0; i < event->weights().size(); i++) { w_names.push_back(std::string("badweight") + std::to_string(i)); } + for (size_t i = 0; i < event.weights().size(); i++) { w_names.push_back(std::string("badweight") + std::to_string(i)); } modRunInfo->set_weight_names(w_names); } modEvent->set_run_info(modRunInfo); @@ -314,7 +337,7 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event, const E modEvent->run_info()->set_weight_names(w_names); } #else - const HepMC::WeightContainer& old_wc = event->weights(); + const HepMC::WeightContainer& old_wc = event.weights(); std::vector<std::string> old_wnames = old_wc.weight_names(); if (old_wnames.size()) { HepMC::WeightContainer& new_wc = modEvent->weights(); @@ -360,6 +383,28 @@ const HepMC::GenEvent* Rivet_i::checkEvent(const HepMC::GenEvent* event, const E #ifdef HEPMC3 modEvent->set_units(HepMC3::Units::GEV, HepMC3::Units::MM); if (modEvent->particles().size() == 1) modEvent->set_beam_particles(modEvent->particles().front(), modEvent->particles().front()); + if (m_patchBeams) { + // workaround in case beam particles were missing in xAOD::Truth + // first work out centre-of-mass energy + double etotal = 0; + for (const auto& p : modEvent->particles()) { + if (p->status() != 1) continue; + etotal += p->momentum().e(); + } + const double ebeam = 0.5*etotal; + // create dummy beam particles + HepMC::GenParticlePtr b1 = std::make_shared<HepMC::GenParticle>(HepMC::FourVector(0,0,ebeam,ebeam),2212,4); + HepMC::GenParticlePtr b2 = std::make_shared<HepMC::GenParticle>(HepMC::FourVector(0,0,-1*ebeam,ebeam),2212,4); + // remove particles incorrectly labelled as beam particles + std::vector<HepMC::GenParticlePtr> notBeams; + for (const HepMC::GenParticlePtr& p : modEvent->beams()) { + if (p->status() != 4) notBeams.push_back(p); + } + //AV: the loop is over shared pointers! Should be const auto& + for (const auto& bp : notBeams) bp->production_vertex()->remove_particle_out(bp); + // add dummy beam particles + modEvent->set_beam_particles(b1, b2); + } #else modEvent->use_units(HepMC::Units::GEV, HepMC::Units::MM); if (modEvent->particles_size() == 1) modEvent->set_beam_particles(*modEvent->particles_begin(), *modEvent->particles_begin()); diff --git a/Generators/Rivet_i/src/Rivet_i.h b/Generators/Rivet_i/src/Rivet_i.h index e071fb85fdf9d92b4a03b16b1eca817b64d00ad5..ff80ffb206b35d6170c69eb837d3045db1b0472d 100644 --- a/Generators/Rivet_i/src/Rivet_i.h +++ b/Generators/Rivet_i/src/Rivet_i.h @@ -8,6 +8,8 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "CxxUtils/checker_macros.h" #include "xAODEventInfo/EventInfo.h" +#include "GaudiKernel/ToolHandle.h" +#include "GenInterfaces/IxAODtoHepMCTool.h" #include "Rivet/AnalysisHandler.hh" @@ -17,6 +19,7 @@ #include <string> class ISvcLocator; +class IxAODtoHepMCTool; //class ITHistSvc; @@ -53,7 +56,7 @@ private: // StatusCode regGraph(const AIDA::IDataPointSet& dps, const std::string& path); // Check and potentially modify events for correct units, beam particles, ... - const HepMC::GenEvent* checkEvent(const HepMC::GenEvent* event, const EventContext& ctx); + const HepMC::GenEvent* checkEvent(const HepMC::GenEvent& event, const EventContext& ctx); /// A pointer to the THistSvc //ServiceHandle<ITHistSvc> m_histSvc; @@ -78,6 +81,17 @@ private: /// events have beams of the sort that the analysis was written to expect. bool m_ignorebeams; + /// @brief Do we need to convert xAOD::Truth back to HepMC::GenEvemt? + /// + /// Default is false: assume user runs on EVNT files + bool m_needsConversion; + + /// Flag to insert beam protons when they are unavailable in the event + bool m_patchBeams; + + /// A tool to convert xAOD::Truth to HepMC::GenEvent + ToolHandle<IxAODtoHepMCTool> m_xAODtoHepMCTool{this, "HepMCTool", "xAODtoHepMCTool"}; + /// @brief Will we convert Rivet's internal histo format into a ROOT histo for streaming with THistSvc? /// /// The default is yes @@ -102,7 +116,7 @@ private: /// The uncertainity of the cross section for this run of events, set from the job properties. double m_crossSection_uncert; - + /// Flag to determine whether Rivet init has already happened (in execute()) bool m_init; @@ -118,7 +132,7 @@ private: /// String to specify non-standard nominal weight std::string m_nominalWeightName; - ///Weight cap to set allowed maximum for weights + ///Weight cap to set allowed maximum for weights double m_weightcap; SG::ReadHandleKey<xAOD::EventInfo> m_evtInfoKey{this diff --git a/Generators/Superchic_i/SuperchicEnvironmentConfig.cmake b/Generators/Superchic_i/SuperchicEnvironmentConfig.cmake index 5521df4e97cf332e081553fbc55abb450eff8e52..e41a4c936ac925bdb3d876609ad9223a0b29db4c 100644 --- a/Generators/Superchic_i/SuperchicEnvironmentConfig.cmake +++ b/Generators/Superchic_i/SuperchicEnvironmentConfig.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # # This module is used to set up the environment for Superchic # @@ -9,8 +9,12 @@ find_package( Superchic ) if( SUPERCHIC_FOUND ) set( SUPERCHICENVIRONMENT_ENVIRONMENT - FORCESET SUPERCHICVER ${SUPERCHIC_LCGVERSION} - FORCESET SUPERCHICPATH ${SUPERCHIC_LCGROOT} ) + FORCESET SUPERCHICVER ${SUPERCHIC_LCGVERSION} + FORCESET SUPERCHICPATH ${SUPERCHIC_LCGROOT} + APPEND LHAPATH + /cvmfs/atlas.cern.ch/repo/sw/Generators/lhapdfsets/current + APPEND LHAPDF_DATA_PATH + /cvmfs/atlas.cern.ch/repo/sw/Generators/lhapdfsets/current ) endif() diff --git a/Generators/Superchic_i/python/EventFiller.py b/Generators/Superchic_i/python/EventFiller.py index 39a1f6ce4651daf3cb3c54827df2f6e9e798ec7b..ab0efd347df23efd5a82353ec5a78e105f090db9 100644 --- a/Generators/Superchic_i/python/EventFiller.py +++ b/Generators/Superchic_i/python/EventFiller.py @@ -85,7 +85,7 @@ class LheEVNTFiller(EvgenAlg): evt.add_vertex(gv) mom = HepMC.FourVector(0., 0., init_pz(self.beamEnergyMeV), self.beamEnergyMeV) gp = HepMC.GenParticle() - gp.set_status( 2 ) + gp.set_status( 4 ) gp.set_pdg_id( 2212 ) gp.set_momentum(mom) gp.set_generated_mass(938.272046) @@ -98,7 +98,7 @@ class LheEVNTFiller(EvgenAlg): evt.add_vertex(gv) mom = HepMC.FourVector(0., 0., -init_pz(self.beamEnergyMeV), self.beamEnergyMeV) gp = HepMC.GenParticle() - gp.set_status( 2 ) + gp.set_status( 4 ) gp.set_pdg_id( 2212 ) gp.set_momentum(mom) gp.set_generated_mass(938.272046) diff --git a/Generators/Superchic_i/python/SuperChicUtils.py b/Generators/Superchic_i/python/SuperChicUtils.py index 0e9106e93a7149cd567958187eb1133b40447cbe..5fb3de67d7efe9284226f74fc596416338a46086 100644 --- a/Generators/Superchic_i/python/SuperChicUtils.py +++ b/Generators/Superchic_i/python/SuperChicUtils.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration import subprocess, os, shlex, re @@ -35,6 +35,9 @@ class SuperChicConfig: self.rn = 6.7 self.dn = 0.55 self.ionqcd = 'coh' + self.ionbreakup = True + self.fAA = '00' + self.fracsigX = 1 self.ncall = 10000 self.itmx = 10 self.prec = 0.5 @@ -97,7 +100,8 @@ class SuperChicConfig: self.mneut = 80 self.wlp = 'el' self.wlm = 'el' - + self.tau = 0.04 + self.mxs = 100 def toFortran(self): @@ -138,6 +142,9 @@ class SuperChicConfig: conf+=fortDouble(self.rn) + " ! [rn] : Ion neutron density - radius \n" conf+=fortDouble(self.dn) + " ! [dn] : Ion neutron density - skin thickness \n" conf+=fortStr(self.ionqcd) + " ! [ionqcd] : Coherent ('coh') or incoherent ('incoh') for QCD-induced processes \n" + conf+=fortBool(self.ionbreakup) + " ! [ionbreakup] \n" + conf+=fortStr(self.fAA) + " ! [fAA] \n" + conf+=fortDouble(self.fracsigX) + " ! [fracsigX] : multiply sig_(gamA) by this factor (1d0 - default) \n" conf+="***********************************************************************************\n" conf+="*************Integration parameters************************************************\n" conf+="***********************************************************************************\n" @@ -207,7 +214,7 @@ class SuperChicConfig: conf+=fortDouble(self.etabmax) + " ! [etabmax] \n" conf+=fortDouble(self.etacmin) + " ! [etacmin] \n" conf+=fortDouble(self.etacmax) + " ! [etacmax] \n" - conf+=fortDouble(self.etadmin) + " ! [etacmin] \n" + conf+=fortDouble(self.etadmin) + " ! [etadmin] \n" conf+=fortDouble(self.etadmax) + " ! [etadmax] \n" conf+="***********************************************************************************\n" conf+="****** 6 body final states : p(a) + p(b) + p(c) + p(d) + p(e) + p(f) **************\n" @@ -264,6 +271,12 @@ class SuperChicConfig: conf+=fortStr(self.wlp) + " ! [wlp] : leptonic decay (either 'mu' or 'el') for Wplus \n" conf+=fortStr(self.wlm) + " ! [wlm] : leptonic decay (either 'mu' or 'el') for Wminus \n" + conf+="****************************************************************************************\n" + conf+="****** V+X simplified model \n" + conf+="****************************************************************************************\n" + conf+=fortDouble(self.tau) + " ! [tau] : mass distribution decay constant (GeV^-1) \n" + conf+=fortDouble(self.mxs) + " ! [mxs] : mass of MX \n" + return conf diff --git a/Generators/TruthConverters/CMakeLists.txt b/Generators/TruthConverters/CMakeLists.txt index 14e0bedec85a5d6f17ee438aa5f4061031295741..4437c101daf56791eee528175ec22d358a1aabc5 100644 --- a/Generators/TruthConverters/CMakeLists.txt +++ b/Generators/TruthConverters/CMakeLists.txt @@ -3,16 +3,20 @@ # Package: TruthConverters ################################################################################ +set( extra_libs ) +if( NOT XAOD_STANDALONE ) + set( extra_libs AthAnalysisBaseCompsLib ) +endif() + # Set the name of the package: atlas_subdir( TruthConverters ) - # Component(s) in the package: atlas_add_library( TruthConvertersLib TruthConverters/*.h Root/*.cxx SHARED PUBLIC_HEADERS TruthConverters - LINK_LIBRARIES AsgTools xAODEventInfo xAODTruth GenInterfacesLib ) + LINK_LIBRARIES AsgTools xAODEventInfo xAODTruth GenInterfacesLib ${extra_libs} ) atlas_add_component( TruthConverters src/components/*.cxx @@ -22,4 +26,4 @@ atlas_add_dictionary( TruthConvertersDict TruthConverters/xAODtoHepMCDict.h TruthConverters/selection.xml LINK_LIBRARIES TruthConvertersLib ) -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) \ No newline at end of file +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Generators/TruthConverters/Root/xAODtoHepMCTool.cxx b/Generators/TruthConverters/Root/xAODtoHepMCTool.cxx index 17428724d9008dae207fe585cd2632752c4a0394..c19061a163e78f50c000691984ae76947fcc1bcf 100644 --- a/Generators/TruthConverters/Root/xAODtoHepMCTool.cxx +++ b/Generators/TruthConverters/Root/xAODtoHepMCTool.cxx @@ -3,6 +3,9 @@ */ #include "TruthConverters/xAODtoHepMCTool.h" +#ifndef XAOD_STANDALONE +#include "AthAnalysisBaseComps/AthAnalysisHelper.h" +#endif #include "AtlasHepMC/MagicNumbers.h" xAODtoHepMCTool::xAODtoHepMCTool(const std::string &name) @@ -80,9 +83,15 @@ std::vector<HepMC::GenEvent> xAODtoHepMCTool ::getHepMCEvents(const xAOD::TruthE printxAODEvent(xAODEvent, eventInfo); // Create GenEvent for each xAOD truth event ATH_MSG_DEBUG("Create new GenEvent"); - HepMC::GenEvent hepmcEvent = createHepMCEvent(xAODEvent, eventInfo); + HepMC::GenEvent&& hepmcEvent = createHepMCEvent(xAODEvent, eventInfo); + #ifdef HEPMC3 + std::shared_ptr<HepMC3::GenRunInfo> runinfo = std::make_shared<HepMC3::GenRunInfo>(*(hepmcEvent.run_info().get())); + #endif // Insert into McEventCollection mcEventCollection.push_back(std::move(hepmcEvent)); + #ifdef HEPMC3 + mcEventCollection[mcEventCollection.size()-1].set_run_info(runinfo); + #endif if (doPrint) ATH_MSG_DEBUG("XXX Printing HepMC Event"); if (doPrint) @@ -99,11 +108,59 @@ HepMC::GenEvent xAODtoHepMCTool::createHepMCEvent(const xAOD::TruthEvent *xEvt, /// EVENT LEVEL HepMC::GenEvent genEvt; + #ifdef HEPMC3 + genEvt.set_units(HepMC3::Units::MEV, HepMC3::Units::MM); + #endif long long int evtNum = eventInfo->eventNumber(); genEvt.set_event_number(evtNum); ATH_MSG_DEBUG("Start createHepMCEvent for event " << evtNum); + //Weights + #ifndef XAOD_STANDALONE + const std::vector<float> weights = xEvt->weights(); + std::map<std::string, int> weightNameMap; + if (AthAnalysisHelper::retrieveMetadata("/Generation/Parameters","HepMCWeightNames", weightNameMap).isFailure()) { + ATH_MSG_DEBUG("Couldn't find meta-data for weight names."); + } + #ifdef HEPMC3 + std::shared_ptr<HepMC3::GenRunInfo> runinfo = std::make_shared<HepMC3::GenRunInfo>(); + genEvt.set_run_info(runinfo); + std::vector<std::string> wnames; + wnames.reserve(weights.size()); + for (int idx = 0; idx < int(weights.size()); ++idx) { + for (const auto& it : weightNameMap) { + if (it.second == idx) { + wnames.push_back(it.first); + break; + } + } + } + genEvt.run_info()->set_weight_names(wnames); + for ( std::vector<float>::const_iterator wgt = weights.begin(); wgt != weights.end(); ++wgt ) { + genEvt.weights().push_back(*wgt); + } + #else + if (weightNameMap.size()) { + HepMC::WeightContainer& wc = genEvt.weights(); + wc.clear(); + for (int idx = 0; idx < int(weights.size()); ++idx) { + for (const auto& it : weightNameMap) { + if (it.second == idx) { + wc[ it.first ] = weights[idx]; + break; + } + } + } + } + else { + for ( std::vector<float>::const_iterator wgt = weights.begin(); wgt != weights.end(); ++wgt ) { + genEvt.weights().push_back(*wgt); + } + } + #endif + #endif + // PARTICLES AND VERTICES // Map of existing vertices - needed for the tree linking std::map<const xAOD::TruthVertex *, HepMC::GenVertexPtr> vertexMap; diff --git a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h index 689a2a56df3912f43d1187be390dc2c7d9238fb5..d089efe7cb751200de68e9f3ed3693bc89a26f27 100644 --- a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h +++ b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "AthenaBaseComps/AthAlgorithm.h" -#include "AtlasHepMC/IO_GenEvent.h" +#include <fstream> class StoreGateSvc; diff --git a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx index 2bbe4de185969639d46a8d834019e0133aa93905..2fc88789818ed7cacbf2cb66c09d340d56989d1f 100644 --- a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx +++ b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx @@ -1,6 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ +#ifndef HEPMC3 +/// This class is only needed for HepMC2-based builds #include <set> @@ -168,3 +170,4 @@ StatusCode ReadHepEvtFromAscii::finalize() { return StatusCode::SUCCESS; } +#endif diff --git a/Generators/TruthIO/src/components/TruthIO_entries.cxx b/Generators/TruthIO/src/components/TruthIO_entries.cxx index 340a779dd12cfeb78b82f700774bc302bd896b8d..7345a828e82079078ebf6484ec4c84af6ff84a3c 100644 --- a/Generators/TruthIO/src/components/TruthIO_entries.cxx +++ b/Generators/TruthIO/src/components/TruthIO_entries.cxx @@ -3,12 +3,15 @@ #include "TruthIO/WriteHepMC.h" #include "TruthIO/PrintMC.h" #include "TruthIO/PrintHijingPars.h" +#ifndef HEPMC3 #include "TruthIO/ReadHepEvtFromAscii.h" +#endif DECLARE_COMPONENT( DumpMC ) DECLARE_COMPONENT( HepMCReadFromFile ) DECLARE_COMPONENT( PrintMC ) DECLARE_COMPONENT( WriteHepMC ) DECLARE_COMPONENT( PrintHijingPars ) +#ifndef HEPMC3 DECLARE_COMPONENT( ReadHepEvtFromAscii ) - +#endif diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/python/InDetAlignAlgsConfig.py b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/python/InDetAlignAlgsConfig.py index ee053533ff0d1548bf0e3448169c0f8a35e5f3b5..ef4a6c443ca82bba0e8ba52cb2bafc368d84de6f 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/python/InDetAlignAlgsConfig.py +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/python/InDetAlignAlgsConfig.py @@ -3,7 +3,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def CreateITkMisalignAlgCfg(flags, name="CreateITkMisalignAlg",SetITkPixelAlignable=False,SetITkStripAlignable=False, **kwargs): +def CreateITkMisalignAlgCfg(flags, name="CreateITkMisalignAlg",SetITkPixelAlignable=False,SetITkStripAlignable=False,setAlignmentFolderName="/Indet/AlignITk", **kwargs): kwargs.setdefault("MisalignmentX",0.0) kwargs.setdefault("MisalignmentY",0.0) kwargs.setdefault("MisalignmentZ",0.0) @@ -21,20 +21,20 @@ def CreateITkMisalignAlgCfg(flags, name="CreateITkMisalignAlg",SetITkPixelAligna if flags.Detector.EnableITkPixel: from PixelGeoModelXml.ITkPixelGeoModelConfig import ITkPixelReadoutGeometryCfg - result.merge(ITkPixelReadoutGeometryCfg(flags,setGeometryAlignable=SetITkPixelAlignable)) + result.merge(ITkPixelReadoutGeometryCfg(flags,setGeometryAlignable=SetITkPixelAlignable,setAlignmentFolderName=setAlignmentFolderName)) kwargs.setdefault("PixelDetEleCollKey","ITkPixelDetectorElementCollection") else: kwargs.setdefault("PixelDetEleCollKey","") if flags.Detector.EnableITkStrip: from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripReadoutGeometryCfg - result.merge(ITkStripReadoutGeometryCfg(flags,setGeometryAlignable=SetITkStripAlignable)) + result.merge(ITkStripReadoutGeometryCfg(flags,setGeometryAlignable=SetITkStripAlignable,setAlignmentFolderName=setAlignmentFolderName)) kwargs.setdefault("SCTDetEleCollKey","ITkStripDetectorElementCollection") else: kwargs.setdefault("SCTDetEleCollKey","") from InDetAlignGenTools.InDetAlignGenToolsConfig import ITkAlignDBTool - dbTool = result.popToolsAndMerge(ITkAlignDBTool(flags)) + dbTool = result.popToolsAndMerge(ITkAlignDBTool(flags,setAlignmentFolderName=setAlignmentFolderName)) kwargs.setdefault("IDAlignDBTool",dbTool) kwargs.setdefault("TRTDetEleCollKey","") @@ -51,7 +51,7 @@ def CreateITkMisalignAlgCfg(flags, name="CreateITkMisalignAlg",SetITkPixelAligna result.addEventAlgo(CompFactory.InDetAlignment.CreateMisalignAlg(name,**kwargs)) return result -def CreateInDetMisalignAlgCfg(flags, name="CreateInDetMisalignAlg", **kwargs): +def CreateInDetMisalignAlgCfg(flags, name="CreateInDetMisalignAlg",setAlignmentFolderName="/Indet/Align", **kwargs): result = ComponentAccumulator() if flags.Detector.EnablePixel: @@ -73,7 +73,7 @@ def CreateInDetMisalignAlgCfg(flags, name="CreateInDetMisalignAlg", **kwargs): kwargs.setdefault("TRTDetEleCollKey","") from InDetAlignGenTools.InDetAlignGenToolsConfig import InDetAlignDBTool - dbTool = result.popToolsAndMerge(InDetAlignDBTool(flags)) + dbTool = result.popToolsAndMerge(InDetAlignDBTool(flags,setAlignmentFolderName=setAlignmentFolderName)) histoSvc = CompFactory.THistSvc(Output = ["IDENTIFIERTREE DATAFILE='InDetIdentifierTree.root' TYPE='ROOT' OPT='RECREATE'"]) result.addService( histoSvc ) diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/scripts/CreateMisalignmentITk.py b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/scripts/CreateMisalignmentITk.py index 55cd69985f49aff936b59bb10d954222f44e62e6..8a10d12d60bed5a3bb583a87f71fb61e0a46abc7 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/scripts/CreateMisalignmentITk.py +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/scripts/CreateMisalignmentITk.py @@ -33,11 +33,11 @@ def getFlags(**kwargs): flags.GeoModel.Align.Dynamic = False #Define the output database file name and add it to the flags - if not 'misalignmentMode' in kwargs.keys(): - misalignmentMode = 11 # Radial + if not 'MisalignMode' in kwargs.keys(): + MisalignMode = 11 # Radial else: - misalignmentMode=int(kwargs.get('misalignmentMode',11)) - databaseFilename = 'MisalignmentSet%s.db' % (misalignmentMode) + MisalignMode=int(kwargs.get('MisalignMode',11)) + databaseFilename = 'MisalignmentSet%s.db' % (MisalignMode) flags.IOVDb.DBConnection="sqlite://;schema=%s;dbname=OFLCOND" % (databaseFilename) flags.IOVDb.GlobalTag = "OFLCOND-MC21-SDR-RUN4-01" @@ -58,13 +58,13 @@ def CreateMis(flags,name="CreateITkMisalignAlg",**kwargs): createFreshDB = not(readDBPoolFile or misalignmentOnTopOfExistingSet) - misalignmentMode = kwargs.pop('misalignmentMode',11) + MisalignMode = kwargs.pop('MisalignMode',11) shiftInMicrons = 100 - if misalignmentMode in [11, 12, 31]: + if MisalignMode in [11, 12, 31]: shiftInMicrons = 500 - outFiles = 'MisalignmentSet%s' % (misalignmentMode) + outFiles = 'MisalignmentSet%s' % (MisalignMode) misalignModeMap = {0:'no Misalignment', 1: 'misalignment by 6 parameters', 2: 'random misalignment', @@ -75,30 +75,34 @@ def CreateMis(flags,name="CreateITkMisalignAlg",**kwargs): #################################################################################################################### acc=MainServicesCfg(flags) - print ("\n CreateMisalignAlg: Creation of misalignment mode %s: %s \n" % (misalignmentMode,misalignModeMap.get(misalignmentMode,'unknown'))) + print ("\n CreateMisalignAlg: Creation of misalignment mode %s: %s \n" % (int(MisalignMode),misalignModeMap.get(int(MisalignMode),'unknown'))) kwargs.setdefault("ASCIIFilenameBase",outFiles) - kwargs.setdefault("SQLiteTag",'Misalignmen+sttMode_'+str(misalignModeMap.get(misalignmentMode,'unknown'))) - kwargs.setdefault("MisalignMode",int(misalignmentMode)) + kwargs.setdefault("SQLiteTag",'MisalignMode_'+str(misalignModeMap.get(int(MisalignMode),'unknown'))) + kwargs.setdefault("MisalignMode",int(MisalignMode)) kwargs.setdefault("MaxShift",shiftInMicrons) kwargs.setdefault("CreateFreshDB",createFreshDB) #Create and configure the AlignDB tool itkAlignFolder="/Indet/AlignITk" + AlignFolder="/Indet/Align" writeDBPoolFile=True #Activate or deactivate writing to outFiles + '.pool.root' kargsTool={} kargsTool.setdefault("SCTTwoSide",True) kargsTool.setdefault("DBRoot",itkAlignFolder) kargsTool.setdefault("DBKey",itkAlignFolder) kargsTool.setdefault("forceUserDBConfig",True) - kargsTool.setdefault("AlignmentRootFolder","/Indet/AlignITk") if writeDBPoolFile: - kargsTool.setdefault("CondStream", acc.setPrivateTools(CompFactory.AthenaOutputStreamTool(OutputFile = outFiles+'.pool.root'))) - kargsTool.setdefault("DBRoot","/Indet/Align") - kargsTool.setdefault("DBKey","/Indet/Align") + InDetCondStream=CompFactory.AthenaOutputStreamTool(OutputFile = outFiles+'.pool.root') + InDetCondStream.PoolContainerPrefix="<type>" + InDetCondStream.TopLevelContainerName="" + InDetCondStream.SubLevelBranchName="<key>" + kargsTool.setdefault("CondStream",InDetCondStream) + kargsTool.setdefault("DBRoot",AlignFolder) + kargsTool.setdefault("DBKey",AlignFolder) dbTool = acc.popToolsAndMerge(ITkAlignDBTool(flags,**kargsTool)) kwargs.setdefault("IDAlignDBTool",dbTool) - cfg=CreateITkMisalignAlgCfg(flags,name=name,SetITkPixelAlignable=True,SetITkStripAlignable=True,**kwargs) + cfg=CreateITkMisalignAlgCfg(flags,name=name,SetITkPixelAlignable=True,SetITkStripAlignable=True,setAlignmentFolderName=AlignFolder,**kwargs) acc.merge(cfg) if writeDBPoolFile: print("To be writen DB pool File") @@ -119,6 +123,6 @@ if __name__ == "__main__": acc.printConfig() #run sc=acc.run(10) - if sc.isFailure: + if sc.isFailure(): print("Failed to run the Misalignment Algorithm") sys.exit(-1) diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignDBTool.h b/InnerDetector/InDetAlignTools/InDetAlignGenTools/InDetAlignGenTools/InDetAlignDBTool.h old mode 100755 new mode 100644 diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/python/InDetAlignGenToolsConfig.py b/InnerDetector/InDetAlignTools/InDetAlignGenTools/python/InDetAlignGenToolsConfig.py index 211b5fdb4e233c1a23132c8abed4935e6bbf52c0..1c130484d4da63c2c6be40ffab3cb1bef150064b 100644 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/python/InDetAlignGenToolsConfig.py +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/python/InDetAlignGenToolsConfig.py @@ -3,10 +3,11 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def ITkAlignDBTool(flags, name="ITkAlignDBTool", **kwargs): +def ITkAlignDBTool(flags, name="ITkAlignDBTool",setAlignmentFolderName="/Indet/AlignITk", **kwargs): acc = ComponentAccumulator() kwargs.setdefault("PixelManager","ITkPixel") kwargs.setdefault("SCT_Manager","ITkStrip") + kwargs.setdefault("DBRoot",setAlignmentFolderName) acc.setPrivateTools(CompFactory.InDetAlignDBTool(name,**kwargs)) return acc diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx old mode 100755 new mode 100644 index d3aee50a4bf753074b9299232f9aa0498438e6ce..078a6646979e9d22223d8ef51fdeac06f1a07c42 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx @@ -1280,8 +1280,6 @@ StatusCode InDetAlignDBTool::outputObjs() { } // write objects to stream if (StatusCode::SUCCESS!=m_par_condstream->streamObjects(typekeys)) { - ATH_MSG_ERROR("Could not stream output objects" ); - return StatusCode::FAILURE; }else{ ATH_MSG_DEBUG("Streamed output objects" ); } diff --git a/InnerDetector/InDetConditions/ITkConditionsUtils/scripts/ITkPixelChargeCalibration.py b/InnerDetector/InDetConditions/ITkConditionsUtils/scripts/ITkPixelChargeCalibration.py index a1fc510450d32362572bcf4cb93a8fc3b751e016..9e95c4eb74ecbcc9a86ecc10a6fbd5daa3efa035 100755 --- a/InnerDetector/InDetConditions/ITkConditionsUtils/scripts/ITkPixelChargeCalibration.py +++ b/InnerDetector/InDetConditions/ITkConditionsUtils/scripts/ITkPixelChargeCalibration.py @@ -22,7 +22,7 @@ logging.info("High thresholds enabled: %s", args.highThresholds) dbName = "OFLP200" dbFolder = "/ITk/PixelChargeCalib" -dbTag = "ChargeCalib-MC21-01" +dbTag = "PixelChargeCalib_LUTTest-00-00" dbFile = "ITkPixelChargeCalib.db" runSince = 0 @@ -69,41 +69,43 @@ iovMax = cool.ValidityKeyMax if runUntil == 'inf' else runUntil << 32 | 0 logging.info("IoV range: %s - %s", iovMin, iovMax) + ## Format: -# analog threshold value, sigma, nose and timewalk for normal, long and large pixels -# A,C,E constants for normal and large pixels -# p1, p2 +# analog threshold value,noise for normal,long/ganged pixels +# Q0-Q16 charge calibration constants for normal and long/ganged pixels # quad chip if args.highThresholds: + calibQuad = [ - [2000, 24, 75, 2500, 2000, 24, 75, 2500, 2000, 24, 75, 2500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], - [2000, 24, 75, 2500, 2000, 24, 75, 2500, 2000, 24, 75, 2500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], - [2000, 24, 75, 2500, 2000, 24, 75, 2500, 2000, 24, 75, 2500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], - [2000, 24, 75, 2500, 2000, 24, 75, 2500, 2000, 24, 75, 2500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], + [2000, 75, 2000, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], + [2000, 75, 2000, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], + [2000, 75, 2000, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], + [2000, 75, 2000, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], ] # single chip 50x50 calibSingle = [ - [2000, 24, 75, 2500, 2000, 24, 75, 2500, 2000, 24, 75, 2500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], + [2000, 75, 2000, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], ] # single chip 25x150 (L0) calibSingleL0 = [ - [2000, 36, 110, 2500, 2000, 36, 110, 2500, 2000, 36, 110, 2500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], + [2000, 110, 2000, 110, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], ] + else: calibQuad = [ - [600, 24, 75, 1000, 600, 24, 75, 1000, 600, 24, 75, 1000, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], - [600, 24, 75, 1000, 600, 24, 75, 1000, 600, 24, 75, 1000, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], - [600, 24, 75, 1000, 600, 24, 75, 1000, 600, 24, 75, 1000, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], - [600, 24, 75, 1000, 600, 24, 75, 1000, 600, 24, 75, 1000, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], + [600, 75, 600, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], + [600, 75, 600, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], + [600, 75, 600, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], + [600, 75, 600, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], ] # single chip 50x50 calibSingle = [ - [600, 24, 75, 1000, 600, 24, 75, 1000, 600, 24, 75, 1000, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], + [600, 75, 600, 75, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], ] # single chip 25x150 (L0) calibSingleL0 = [ - [900, 36, 110, 1500, 900, 36, 110, 1500, 900, 36, 110, 1500, 14.0, -1000.0, 8000.0, 14.0, -1000, 8000.0, 0.4, 0.02], + [900, 110, 900, 110, 2080, 2957, 4000, 5163, 6824, 8700, 11285, 14709, 19600, 27500, 40400, 69500, 166400, 3000000, 999999999., 999999999.], ] # read pixel identifiers diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/ITkPixelConditionsConfig.py b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/ITkPixelConditionsConfig.py index b91dbdd3ddafcf1e61eba7a558e01431a4331d69..22098e5eb786966ec82bbf161e410de9325de3ea 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/ITkPixelConditionsConfig.py +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/ITkPixelConditionsConfig.py @@ -50,18 +50,18 @@ def ITkPixelModuleConfigCondAlgCfg(flags, name="ITkPixelModuleConfigCondAlg", ** acc.addCondAlgo(CompFactory.PixelModuleConfigCondAlg(name, **CondArgs)) return acc -def ITkPixelAlignCondAlgCfg(flags, name="ITkPixelAlignCondAlg", **kwargs): +def ITkPixelAlignCondAlgCfg(flags, name="ITkPixelAlignCondAlg",setAlignmentFolderName="/Indet/Align", **kwargs): """Return a ComponentAccumulator with configured PixelAlignCondAlg for ITk""" acc = ComponentAccumulator() if flags.GeoModel.Align.Dynamic: raise RuntimeError("Dynamic alignment not supported for ITk yet") else: - acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align", className="AlignableTransformContainer")) + acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", setAlignmentFolderName, className="AlignableTransformContainer")) kwargs.setdefault("DetManagerName", "ITkPixel") kwargs.setdefault("UseDynamicAlignFolders", flags.GeoModel.Align.Dynamic) - kwargs.setdefault("ReadKeyStatic", "/Indet/Align") + kwargs.setdefault("ReadKeyStatic", setAlignmentFolderName) # kwargs.setdefault("ReadKeyDynamicL1", "/Indet/AlignL1/ID") # kwargs.setdefault("ReadKeyDynamicL2", "/Indet/AlignL2/PIX") # kwargs.setdefault("ReadKeyDynamicL3", "/Indet/AlignL3") @@ -143,10 +143,10 @@ def ITkPixelDeadMapCondAlgCfg(flags, name="ITkPixelDeadMapCondAlg", **kwargs): acc.addCondAlgo(CompFactory.PixelDeadMapCondAlg(name, **kwargs)) return acc -def ITkPixelDetectorElementCondAlgCfg(flags, name="ITkPixelDetectorElementCondAlg", **kwargs): +def ITkPixelDetectorElementCondAlgCfg(flags, name="ITkPixelDetectorElementCondAlg",setAlignmentFolderName="/Indet/Align", **kwargs): """Return a ComponentAccumulator with configured PixelDetectorElementCondAlg for ITk""" acc = ComponentAccumulator() - acc.merge(ITkPixelAlignCondAlgCfg(flags)) + acc.merge(ITkPixelAlignCondAlgCfg(flags,setAlignmentFolderName=setAlignmentFolderName)) kwargs.setdefault("DetManagerName", "ITkPixel") kwargs.setdefault("PixelAlignmentStore", "ITkPixelAlignmentStore") kwargs.setdefault("WriteKey", "ITkPixelDetectorElementCollection") diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.cxx index 4019b7431756b435f445b34432c238e63bff59ac..bc5f4661cd4ab127b22ec29b6e432f3303a0dcad 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.cxx @@ -170,7 +170,7 @@ StatusCode PixelChargeLUTCalibCondAlg::execute(const EventContext& ctx) const { const auto &calibArray = data.at(j); if (!calibArray.empty()) { // new charge calibration for RUN-3 - if (p_design->getReadoutTechnology() == InDetDD::PixelReadoutTechnology::FEI4 && !(element->isDBM())) { + if ((p_design->getReadoutTechnology() == InDetDD::PixelReadoutTechnology::FEI4 && !(element->isDBM())) || (m_useLUTRD53 && p_design->getReadoutTechnology() == InDetDD::PixelReadoutTechnology::RD53)) { if (calibArray.size() != FEStringSize) { ATH_MSG_FATAL("Parameter size is not consistent(" << FEStringSize << ") " << calibArray.size() << " at (i,j)=(" << moduleHash << "," << j << ")"); return StatusCode::FAILURE; diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.h index 97fdfa1728831fa78edc3994032030084d87a4a5..c489fe005fc863b927fe3d4001729344a37f0739 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeLUTCalibCondAlg.h @@ -48,6 +48,8 @@ class PixelChargeLUTCalibCondAlg : public AthReentrantAlgorithm { SG::WriteCondHandleKey<PixelChargeCalibCondData> m_writeKey {this, "WriteKey", "PixelChargeCalibCondData", "Output charge caliblation data"}; + + Gaudi::Property<bool> m_useLUTRD53 {this, "useLUTRD53",false,"use LUT for RD53 charge calibration"}; }; #endif diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/ITkStripConditionsAlgorithmsConfig.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/ITkStripConditionsAlgorithmsConfig.py index a144422c8b5279dca1d08f4061a3c72a06cbe350..8b58187c6d520030c6d704eb431bdf7b43d4cf5a 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/ITkStripConditionsAlgorithmsConfig.py +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/python/ITkStripConditionsAlgorithmsConfig.py @@ -6,13 +6,13 @@ from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripGeoModelCfg -def ITkStripAlignCondAlgCfg(flags, name="ITkStripAlignCondAlg", **kwargs): +def ITkStripAlignCondAlgCfg(flags, name="ITkStripAlignCondAlg",setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align", **kwargs): """Return a configured SCT_AlignCondAlg for ITk""" - acc = ITkStripGeoModelCfg(flags) + acc = ITkStripGeoModelCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) if flags.GeoModel.Align.Dynamic: raise RuntimeError("Dynamic alignment not supported for ITk yet") else: - acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align", className="AlignableTransformContainer")) + acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", setAlignmentFolderName, className="AlignableTransformContainer")) kwargs.setdefault("DetManagerName", "ITkStrip") kwargs.setdefault("WriteKey", "ITkStripAlignmentStore") @@ -64,11 +64,11 @@ def ITkStripConfigurationCondAlgCfg(flags, name="ITkStripConfigurationCondAlg", return acc -def ITkStripDetectorElementCondAlgCfg(flags, name="ITkStripDetectorElementCondAlg", **kwargs): +def ITkStripDetectorElementCondAlgCfg(flags, name="ITkStripDetectorElementCondAlg",setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align", **kwargs): kwargs.setdefault("DetManagerName", "ITkStrip") kwargs.setdefault("ReadKey", "ITkStripAlignmentStore") kwargs.setdefault("WriteKey", "ITkStripDetectorElementCollection") - acc = ITkStripAlignCondAlgCfg(flags) + acc = ITkStripAlignCondAlgCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) acc.addCondAlgo(CompFactory.SCT_DetectorElementCondAlg(name, **kwargs)) return acc diff --git a/InnerDetector/InDetConfig/python/ITkTrackRecoConfig.py b/InnerDetector/InDetConfig/python/ITkTrackRecoConfig.py index 79947c5619660fbfa97c1cedb7acb6ae3af4e456..a1292cf3aca25f3ea17b22453e5f76bf4d6aadba 100644 --- a/InnerDetector/InDetConfig/python/ITkTrackRecoConfig.py +++ b/InnerDetector/InDetConfig/python/ITkTrackRecoConfig.py @@ -212,6 +212,16 @@ def ITkTrackRecoCfg(flags): "ITkCommonKernel", AugmentationTools=[TrackStateOnSurfaceDecorator])) + if flags.Tracking.doStoreSiSPSeededTracks: + from DerivationFrameworkInDet.InDetToolsConfig import ( + ITkSiSPTrackStateOnSurfaceDecoratorCfg) + SiSPTrackStateOnSurfaceDecorator = result.getPrimaryAndMerge( + ITkSiSPTrackStateOnSurfaceDecoratorCfg(flags)) + result.addEventAlgo( + CompFactory.DerivationFramework.CommonAugmentation( + "SiSPITkCommonKernel", + AugmentationTools=[SiSPTrackStateOnSurfaceDecorator])) + if flags.Input.isMC: from InDetPhysValMonitoring.InDetPhysValDecorationConfig import ( InDetPhysHitDecoratorAlgCfg) @@ -232,6 +242,18 @@ def ITkTrackRecoCfg(flags): xAODTrackParticlesFromTracksContainerName=( f"{TrackContainer}TrackParticles"))) + if flags.Tracking.doStoreSiSPSeededTracks: + result.merge(ITkTrackParticleCnvAlgCfg( + flags, + name = "ITkSiSPSeededTracksCnvAlg", + TrackContainerName = "SiSPSeededTracks", + xAODTrackParticlesFromTracksContainerName=( + "SiSPSeededTracksTrackParticles"), + AssociationMapName=( + "PRDtoTrackMapCombinedITkTracks"))) + + + # output result.merge(ITkTrackRecoOutputCfg(flags)) @@ -298,16 +320,21 @@ def ITkTrackRecoOutputCfg(flags): if (flags.Tracking.doLargeD0 and flags.Tracking.storeSeparateLargeD0Container): toAOD += [ - 'xAOD::TrackParticleContainer#InDetLargeD0TrackParticles', - 'xAOD::TrackParticleAuxContainer#InDetLargeD0TrackParticlesAux.' + "xAOD::TrackParticleContainer#InDetLargeD0TrackParticles", + f"xAOD::TrackParticleAuxContainer#InDetLargeD0TrackParticlesAux.{excludedAuxData}" ] - if flags.Tracking.doStoreTrackSeeds: + if flags.Tracking.doStoreSiSPSeededTracks: toAOD += [ - "xAOD::TrackParticleContainer#SiSPSeedSegmentsTrackParticles", - "xAOD::TrackParticleAuxContainer#SiSPSeedSegmentsTrackParticlesAux." + "xAOD::TrackStateValidationContainer#SiSP_ITkPixel_MSOSs", + "xAOD::TrackStateValidationAuxContainer#SiSP_ITkPixel_MSOSsAux.", + "xAOD::TrackStateValidationContainer#SiSP_ITkStrip_MSOSs", + "xAOD::TrackStateValidationAuxContainer#SiSP_ITkStrip_MSOSsAux.", + "xAOD::TrackParticleContainer#SiSPSeededTracksTrackParticles", + f"xAOD::TrackParticleAuxContainer#SiSPSeededTracksTrackParticlesAux.{excludedAuxData}" ] + result = ComponentAccumulator() result.merge(addToESD(flags, toAOD+toESD)) result.merge(addToAOD(flags, toAOD)) diff --git a/InnerDetector/InDetConfig/python/ITkTrackingSiPatternConfig.py b/InnerDetector/InDetConfig/python/ITkTrackingSiPatternConfig.py index 4ee8ec07bbee929de15758eae3da130420a52ead..a7746ea20226e18a11f0c4de3829a737f21fd13f 100644 --- a/InnerDetector/InDetConfig/python/ITkTrackingSiPatternConfig.py +++ b/InnerDetector/InDetConfig/python/ITkTrackingSiPatternConfig.py @@ -51,7 +51,7 @@ def ITkTrackingSiPatternCfg(flags, # # --- Deducing configuration from the flags # - from ActsInterop.TrackingComponentConfigurer import ( + from ActsConfig.TrackingComponentConfigurer import ( TrackingComponentConfigurer) configuration_settings = TrackingComponentConfigurer(flags) @@ -73,7 +73,7 @@ def ITkTrackingSiPatternCfg(flags, # ACTS seed if configuration_settings.doActsSeed: - from ActsTrkSeeding.ActsTrkSeedingConfig import ( + from ActsConfig.ActsTrkSeedingConfig import ( ActsTrkSeedingCfg) acc.merge(ActsTrkSeedingCfg(flags)) @@ -86,7 +86,7 @@ def ITkTrackingSiPatternCfg(flags, # ACTS track if configuration_settings.doActsTrack: - from ActsTrkFinding.ActsTrkFindingConfig import ActsTrkFindingCfg + from ActsConfig.ActsTrkFindingConfig import ActsTrkFindingCfg if configuration_settings.doAthenaTrack: acc.merge(ActsTrkFindingCfg(flags)) else: # send output TrackCollection to Athena ambiguity scorer etc diff --git a/InnerDetector/InDetConfig/python/InDetPriVxFinderToolConfig.py b/InnerDetector/InDetConfig/python/InDetPriVxFinderToolConfig.py index 2c0b258e5b2fedc474e9d00846f05a67695c4f9e..b8d73965f44b3d87b58391e746c1c60cdca63a69 100644 --- a/InnerDetector/InDetConfig/python/InDetPriVxFinderToolConfig.py +++ b/InnerDetector/InDetConfig/python/InDetPriVxFinderToolConfig.py @@ -187,98 +187,6 @@ def TrigGaussIterativeFindingCfg(flags, GaussIterativeFindingCfg(flags, name+signature, **kwargs))) return acc -def ActsGaussAdaptiveMultiFindingCfg(flags, - name="ActsAdaptiveMultiPriVtxFinderTool", - **kwargs): - acc = ComponentAccumulator() - - if "TrackSelector" not in kwargs: - from InDetConfig.InDetTrackSelectionToolConfig import ( - VtxInDetTrackSelectionCfg) - kwargs.setdefault("TrackSelector", acc.popToolsAndMerge( - VtxInDetTrackSelectionCfg(flags))) - - if "TrackingGeometryTool" not in kwargs: - from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometryToolCfg - kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge( - ActsTrackingGeometryToolCfg(flags))) # PrivateToolHandle - - if "ExtrapolationTool" not in kwargs: - from ActsGeometry.ActsGeometryConfig import ActsExtrapolationToolCfg - kwargs.setdefault("ExtrapolationTool", acc.popToolsAndMerge( - ActsExtrapolationToolCfg(flags))) # PrivateToolHandle - - kwargs.setdefault("useBeamConstraint", - flags.Tracking.PriVertex.useBeamConstraint) - kwargs.setdefault("tracksMaxZinterval", - flags.Tracking.PriVertex.maxZinterval) - kwargs.setdefault("do3dSplitting", - not flags.Tracking.PriVertex.useBeamConstraint) - - acc.setPrivateTools( - CompFactory.ActsTrk.AdaptiveMultiPriVtxFinderTool(name, **kwargs)) - return acc - -def TrigActsGaussAdaptiveMultiFindingCfg( - flags, - name="ActsAdaptiveMultiPriVtxFinderTool", - signature="", - **kwargs): - acc = ComponentAccumulator() - - if "TrackSelector" not in kwargs: - from InDetConfig.InDetTrackSelectionToolConfig import ( - TrigVtxInDetTrackSelectionCfg) - kwargs.setdefault("TrackSelector", acc.popToolsAndMerge( - TrigVtxInDetTrackSelectionCfg(flags, signature=signature))) - - from TrigInDetConfig.ConfigSettings import getInDetTrigConfig - config = getInDetTrigConfig(signature) - - kwargs.setdefault("useBeamConstraint", True) - kwargs.setdefault("useSeedConstraint", False) - kwargs.setdefault("tracksMaxZinterval", config.TracksMaxZinterval) - kwargs.setdefault("do3dSplitting", False) - kwargs.setdefault("addSingleTrackVertices", config.addSingleTrackVertices) - - acc.setPrivateTools(acc.popToolsAndMerge( - ActsGaussAdaptiveMultiFindingCfg(flags, name+signature, **kwargs))) - return acc - -def ActsIterativeFindingCfg(flags, - name="ActsIterativePriVtxFinderTool", - **kwargs): - acc = ComponentAccumulator() - - if "TrackSelector" not in kwargs: - from InDetConfig.InDetTrackSelectionToolConfig import ( - VtxInDetTrackSelectionCfg) - kwargs.setdefault("TrackSelector", acc.popToolsAndMerge( - VtxInDetTrackSelectionCfg(flags))) - - if "TrackingGeometryTool" not in kwargs: - from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometryToolCfg - kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge( - ActsTrackingGeometryToolCfg(flags))) # PrivateToolHandle - - if "ExtrapolationTool" not in kwargs: - from ActsGeometry.ActsGeometryConfig import ActsExtrapolationToolCfg - kwargs.setdefault("ExtrapolationTool", acc.popToolsAndMerge( - ActsExtrapolationToolCfg(flags))) # PrivateToolHandle - - kwargs.setdefault("useBeamConstraint", - flags.Tracking.PriVertex.useBeamConstraint) - kwargs.setdefault("significanceCutSeeding", 12) - kwargs.setdefault("maximumChi2cutForSeeding", 49) - kwargs.setdefault("maxVertices", flags.Tracking.PriVertex.maxVertices) - kwargs.setdefault("doMaxTracksCut", flags.Tracking.PriVertex.doMaxTracksCut) - kwargs.setdefault("maxTracks", flags.Tracking.PriVertex.maxTracks) - - acc.setPrivateTools( - CompFactory.ActsTrk.IterativePriVtxFinderTool(name, **kwargs)) - return acc - - def VertexFinderToolCfg(flags, **kwargs): if flags.Tracking.PriVertex.setup == VertexSetup.IVF: @@ -286,6 +194,7 @@ def VertexFinderToolCfg(flags, **kwargs): elif flags.Tracking.PriVertex.setup == VertexSetup.FastIVF: return FastIterativeFindingCfg(flags, **kwargs) elif flags.Tracking.PriVertex.setup == VertexSetup.ActsGaussAMVF: + from ActsConfig.ActsTrkPriVxFinderConfig import ActsGaussAdaptiveMultiFindingCfg return ActsGaussAdaptiveMultiFindingCfg(flags, **kwargs) def TrigVertexFinderToolCfg(flags, signature="", **kwargs): @@ -294,6 +203,7 @@ def TrigVertexFinderToolCfg(flags, signature="", **kwargs): config = getInDetTrigConfig(signature) if config.vertexSetup == VertexSetup.ActsGaussAMVF: + from ActsConfig.ActsTrkPriVxFinderConfig import TrigActsGaussAdaptiveMultiFindingCfg return TrigActsGaussAdaptiveMultiFindingCfg( flags, signature=signature, **kwargs) elif config.vertexSetup == VertexSetup.GaussAMVF: diff --git a/InnerDetector/InDetConfig/python/InDetVKalVxInJetToolConfig.py b/InnerDetector/InDetConfig/python/InDetVKalVxInJetToolConfig.py index 1018e623e3d166a4ca7c049ac76a29fd1a10a759..0951ff76d46fe2c20a26dc279eb3b4a2f39a903b 100644 --- a/InnerDetector/InDetConfig/python/InDetVKalVxInJetToolConfig.py +++ b/InnerDetector/InDetConfig/python/InDetVKalVxInJetToolConfig.py @@ -12,8 +12,8 @@ def TCTDecorCheckInToolCfg(flags, name="TCTDecorCheckInTool", **kwargs): kwargs.setdefault("JetCollection","AntiKt4EMPFlowJets") from TrkConfig.TrkVKalVrtFitterConfig import TrkVKalVrtFitterCfg - VertexFitterTool = acc.popToolsAndMerge(TrkVKalVrtFitterCfg(flags,"VertexFitterTool")) - kwargs.setdefault("TrackClassificationTool",acc.popToolsAndMerge(InDetTrkInJetTypeCfg(flags,name="TrkInJetType",JetCollection=kwargs["JetCollection"],VertexFitterTool=VertexFitterTool))) + VertexFitter = acc.popToolsAndMerge(TrkVKalVrtFitterCfg(flags,"VKalVrtFitter")) + kwargs.setdefault("TrackClassificationTool",acc.popToolsAndMerge(InDetTrkInJetTypeCfg(flags,name="TrkInJetType",JetCollection=kwargs["JetCollection"],VertexFitterTool=VertexFitter))) acc.addEventAlgo(CompFactory.TCTDecorCheckInTool(name, **kwargs)) return acc @@ -28,12 +28,17 @@ def InDetTrkInJetTypeCfg(flags, name="TrkInJetType", **kwargs): def InDetVKalVxInJetToolCfg(flags, name="InDetVKalVxInJetTool", **kwargs): acc = ComponentAccumulator() + from TrkConfig.TrkVKalVrtFitterConfig import BTAG_TrkVKalVrtFitterCfg + VertexFitter = acc.popToolsAndMerge(BTAG_TrkVKalVrtFitterCfg(flags,"VKalVrtFitter")) + if "TrackClassTool" not in kwargs: kwargs.setdefault("TrackClassTool", acc.popToolsAndMerge( - InDetTrkInJetTypeCfg(flags))) + InDetTrkInJetTypeCfg(flags,VertexFitterTool=VertexFitter))) kwargs.setdefault("ExistIBL", flags.GeoModel.Run in [LHCPeriod.Run2, LHCPeriod.Run3]) kwargs.setdefault("getNegativeTag", "Flip" in name) + kwargs.setdefault("UseFrozenVersion", True) + kwargs.setdefault("VertexFitterTool", VertexFitter) if flags.GeoModel.Run >= LHCPeriod.Run4: from InDetConfig.InDetEtaDependentCutsConfig import IDEtaDependentCuts_SV1_SvcCfg diff --git a/InnerDetector/InDetConfig/python/SiClusterOnTrackTool_SCTStripConfig.py b/InnerDetector/InDetConfig/python/SiClusterOnTrackTool_SCTStripConfig.py index dc6e85d14e2bf4311fe68ebecee809f1d1a82779..544e802a4615a66748f45b2b7e7b658a8d2bb423 100644 --- a/InnerDetector/InDetConfig/python/SiClusterOnTrackTool_SCTStripConfig.py +++ b/InnerDetector/InDetConfig/python/SiClusterOnTrackTool_SCTStripConfig.py @@ -25,14 +25,7 @@ def InDetBroadSCT_ClusterOnTrackToolCfg(flags, name='InDetBroadSCT_ClusterOnTrac def ITkStripClusterOnTrackToolCfg(flags, name='ITkStrip_ClusterOnTrackTool', **kwargs): acc = ComponentAccumulator() - if 'LorentzAngleTool' not in kwargs: - from SiLorentzAngleTool.ITkStripLorentzAngleConfig import ITkStripLorentzAngleToolCfg - kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge( - ITkStripLorentzAngleToolCfg(flags))) - - kwargs.setdefault("CorrectionStrategy", 0 ) # do correct position bias kwargs.setdefault("ErrorStrategy", 0 ) # use width / sqrt(12) - kwargs.setdefault("ErrorScalingKey", "") acc.setPrivateTools(CompFactory.ITk.StripClusterOnTrackTool(name, **kwargs)) diff --git a/InnerDetector/InDetConfig/python/SiClusterizationToolConfig.py b/InnerDetector/InDetConfig/python/SiClusterizationToolConfig.py index b3901de2517295c252114fad25202fe4ea5524f8..d413c565ef2623c486f13d88e7f65f440d6ab51c 100644 --- a/InnerDetector/InDetConfig/python/SiClusterizationToolConfig.py +++ b/InnerDetector/InDetConfig/python/SiClusterizationToolConfig.py @@ -417,7 +417,9 @@ def ITKStrip_SCT_ClusteringToolCfg( def ITkTruthClusterizationFactoryCfg( flags, name='ITkTruthClusterizationFactory', **kwargs): acc = ComponentAccumulator() + kwargs.setdefault("InputSDOMap", "ITkPixelSDO_Map") + acc.setPrivateTools( CompFactory.InDet.TruthClusterizationFactory(name, **kwargs)) return acc @@ -432,3 +434,20 @@ def ITkTruthPixelClusterSplitProbToolCfg( acc.setPrivateTools( CompFactory.InDet.TruthPixelClusterSplitProbTool(name, **kwargs)) return acc + + +def HitsToxAODCopierCfg(flags): + ca = ComponentAccumulator() + from InDetConfig.SiClusterizationToolConfig import ITkPixelRDOToolCfg + tool = ca.popToolsAndMerge(ITkPixelRDOToolCfg(flags)) + alg = CompFactory.InDet.HitsToxAODCopier(PixelRDOTool=tool, PixelRDOContainerKey="ITkPixelRDOs") + ca.addEventAlgo(alg) + + from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD + # for the available content of this collection, consult the HitsToxAODCopier.cxx + toRecod = [ "xAOD::BaseContainer#PixelHits", "xAOD::AuxContainerBase#PixelHitsAux.col.row.tot.eta_module.phi_module.layer_disk.barrel_ec.detid", + "xAOD::BaseContainer#StripHits", "xAOD::AuxContainerBase#StripHitsAux.strip.side.eta_module.phi_module.layer_disk.barrel_ec.detid" ] + ca.merge(addToAOD(flags, toRecod)) + ca.merge(addToESD(flags, toRecod)) + + return ca diff --git a/InnerDetector/InDetConfig/python/SiSPSeededTrackFinderConfig.py b/InnerDetector/InDetConfig/python/SiSPSeededTrackFinderConfig.py index 4a27279372b1bbf1ebcac8d274f2bd6280b780bc..8c63b8da4700a789d7139b07c0c9e8a7ba579cf9 100644 --- a/InnerDetector/InDetConfig/python/SiSPSeededTrackFinderConfig.py +++ b/InnerDetector/InDetConfig/python/SiSPSeededTrackFinderConfig.py @@ -84,13 +84,13 @@ def ITkSiSPSeededTrackFinderCfg(flags, name="ITkSiSpTrackFinder", **kwargs): if "SeedsTool" not in kwargs: ITkSiSpacePointsSeedMaker = None - from ActsInterop.TrackingComponentConfigurer import ( + from ActsConfig.TrackingComponentConfigurer import ( TrackingComponentConfigurer) configuration_settings = TrackingComponentConfigurer(flags) if (flags.Tracking.ActiveConfig.extension != "ConversionFinding" and configuration_settings.ActsToAthenaSeedConverter): - from ActsTrkSeedingTool.ActsTrkSeedingToolConfig import ( + from ActsConfig.ActsTrkSeedingConfig import ( ActsTrkSiSpacePointsSeedMakerCfg) ITkSiSpacePointsSeedMaker = acc.popToolsAndMerge( ActsTrkSiSpacePointsSeedMakerCfg(flags)) diff --git a/InnerDetector/InDetConfig/python/SiSpacePointFormationConfig.py b/InnerDetector/InDetConfig/python/SiSpacePointFormationConfig.py index b17ffd13a3ce3e6e808e805890a1b0c487133d5c..0194def7e3eae66472bbaccf1282e72d5f63b321 100644 --- a/InnerDetector/InDetConfig/python/SiSpacePointFormationConfig.py +++ b/InnerDetector/InDetConfig/python/SiSpacePointFormationConfig.py @@ -5,6 +5,12 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import BeamType +def InDetToXAODSpacePointConversionCfg(flags, + name: str = "InDetToXAODSpacePointConversion", + **kwargs) -> ComponentAccumulator: + acc = ComponentAccumulator() + acc.addEventAlgo( CompFactory.InDet.InDetToXAODSpacePointConversion(name, **kwargs) ) + return acc def InDetSiElementPropertiesTableCondAlgCfg( flags, name="InDetSiElementPropertiesTableCondAlg", **kwargs): diff --git a/InnerDetector/InDetConfig/python/SiliconPreProcessing.py b/InnerDetector/InDetConfig/python/SiliconPreProcessing.py index 5da07742c2f7ebec13d1be8d29424b43de27012a..68f7ced4f2361fe678a58963c96feafc29b79468 100644 --- a/InnerDetector/InDetConfig/python/SiliconPreProcessing.py +++ b/InnerDetector/InDetConfig/python/SiliconPreProcessing.py @@ -109,7 +109,7 @@ def ITkRecPreProcessingSiliconCfg(flags, **kwargs): # # --- Deducing configuration from the flags # - from ActsInterop.TrackingComponentConfigurer import ( + from ActsConfig.TrackingComponentConfigurer import ( TrackingComponentConfigurer) configuration_settings = TrackingComponentConfigurer(flags) @@ -122,7 +122,7 @@ def ITkRecPreProcessingSiliconCfg(flags, **kwargs): acc.merge(AthenaTrkClusterizationCfg(flags)) if configuration_settings.doActsCluster: - from ActsTrkClusterization.ActsTrkClusterizationConfig import ( + from ActsConfig.ActsTrkClusterizationConfig import ( ActsTrkClusterizationCfg) acc.merge(ActsTrkClusterizationCfg(flags)) @@ -162,7 +162,7 @@ def ITkRecPreProcessingSiliconCfg(flags, **kwargs): acc.merge(ITkSiTrackerSpacePointFinderCfg(flags)) if configuration_settings.doActsSpacePoint: - from TrkConfig.ActsTrkSpacePointFormationConfig import ( + from ActsConfig.ActsTrkSpacePointFormationConfig import ( ActsTrkSpacePointFormationCfg) acc.merge(ActsTrkSpacePointFormationCfg(flags)) @@ -173,13 +173,14 @@ def ITkRecPreProcessingSiliconCfg(flags, **kwargs): if (not flags.Detector.EnableITkPixel or not flags.Detector.EnableITkStrip): raise RuntimeError( - "Space Point EDM converter (Trk -> xAOD) must be activated for both Pixel and Strips") + "Space Point EDM converter (InDet -> xAOD) must be activated for both Pixel and Strips") # - # --- Trk -> xAOD Space Point EDM converter - from SiSpacePointFormation.SiSpacePointFormationConfig import ( - TrkToXAODSpacePointConversionCfg) - acc.merge(TrkToXAODSpacePointConversionCfg(flags)) + # --- InDet -> xAOD Space Point EDM converter + # + from InDetConfig.SiSpacePointFormationConfig import ( + InDetToXAODSpacePointConversionCfg) + acc.merge(InDetToXAODSpacePointConversionCfg(flags)) # this truth must only be done if you do PRD and SpacePointformation # If you only do the latter (== running on ESD) then the needed input (simdata) diff --git a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/GeoModelXmlTool.h b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/GeoModelXmlTool.h index 4aebe726eff90822cc1c83ae9b3bee827296aaab..ba3267887be7a75cca7d945696f23c397795467b 100644 --- a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/GeoModelXmlTool.h +++ b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/GeoModelXmlTool.h @@ -32,7 +32,7 @@ protected: // method to check if we are using the Run4 geometry workflow, from a single sqlite file, and if so, return the reader // NB return can be null - used downstream to check if we are using sqlite inputs or not - const GeoModelIO::ReadGeoModel* getSqliteReader() const; + GeoModelIO::ReadGeoModel* getSqliteReader() const; // (optional) containingDetector/envelopeVolume can be used if the geometry tree needs to be further descended to add "topVolume" // (optional) sqlreader steers if using a pre-built sqlite input, or parsing the geometry xml files to build it here @@ -41,6 +41,7 @@ protected: Gaudi::Property<std::string> m_gmxFilename{this, "GmxFilename", "", "The name of the local file to read the geometry from"}; Gaudi::Property<std::string> m_detectorName{this, "DetectorName", "ITkStrip", ""}; ServiceHandle<IRDBAccessSvc> m_rdbAccessSvc{this, "RDBAccessSvc", "RDBAccessSvc", ""}; + ServiceHandle<IRDBAccessSvc> m_sqliteReadSvc{this, "SqliteReadSvc", "SqliteReadSvc", ""}; ServiceHandle<IGeoDbTagSvc> m_geoDbTagSvc{this, "GeoDbTagSvc", "GeoDbTagSvc", ""}; Gaudi::Property<std::string> m_dtdName{this, "OverrideDtdName", "", "Override standard .dtd file from GeoModelXml"}; diff --git a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/src/GeoModelXmlTool.cxx b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/src/GeoModelXmlTool.cxx index 226859e83bb828a793c7a4f9397f0fbd009ba646..fafef6ec2725ccc3ab451af21ef2d32de6b7e36c 100644 --- a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/src/GeoModelXmlTool.cxx +++ b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/src/GeoModelXmlTool.cxx @@ -27,6 +27,7 @@ StatusCode GeoModelXmlTool::createBaseTool() { ATH_CHECK(m_geoDbTagSvc.retrieve()); ATH_CHECK(m_rdbAccessSvc.retrieve()); + ATH_CHECK(m_sqliteReadSvc.retrieve()); return StatusCode::SUCCESS; } @@ -165,6 +166,6 @@ void GeoModelXmlTool::createVolume(GeoPhysVol* world, GmxInterface& gmxInterface Gmx2Geo gmx2Geo(gmxInput, world, gmxInterface, flags); } -const GeoModelIO::ReadGeoModel* GeoModelXmlTool::getSqliteReader() const{ +GeoModelIO::ReadGeoModel* GeoModelXmlTool::getSqliteReader() const{ return m_geoDbTagSvc->getSqliteReader(); } diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h index 68cdeb5bccf219b78d865f3af1c3cef045244c2c..e195c40b905334bb9adccfd9da68d6de65f31dd5 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/DiscOverlapDescriptor.h @@ -117,7 +117,7 @@ namespace InDet { const Trk::BinnedArray<Trk::Surface>* m_bin_array; std::vector<Trk::BinUtility*>* m_singleBinUtils; - bool m_pixelCase; + bool m_pixelCase; }; diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SCT_OverlapDescriptor.h b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SCT_OverlapDescriptor.h index cb0a6d95e188b14e5e07ba4c0d121838bad44e25..ac60f9777b9d3e486c1147afab4c786968e8ac56 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SCT_OverlapDescriptor.h +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SCT_OverlapDescriptor.h @@ -74,7 +74,7 @@ namespace InDet { public: /** Constructor */ - SCT_OverlapDescriptor(bool addMoreSurfaces = false, int eta_slices = 3); + SCT_OverlapDescriptor(bool addMoreSurfaces = false, int eta_slices = 4); /** Destructor */ virtual ~SCT_OverlapDescriptor() = default; diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SiLayerBuilderImpl.h b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SiLayerBuilderImpl.h index 4f5882d2bcb3e572f7593e82b452e75f7423a77e..f4e4181e9b212419f0a2a51a932c50598d39628d 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SiLayerBuilderImpl.h +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/InDetTrackingGeometry/SiLayerBuilderImpl.h @@ -126,8 +126,8 @@ namespace InDet { IntegerArrayProperty m_layerIndicesBarrel{this, "LayerIndicesBarrel", {} }; //!< indices to be used for layer creation (used for ITk specific case) IntegerArrayProperty m_layerIndicesEndcap{this, "LayerIndicesEndcap", {} }; //!< indices to be used for layer creation (used for ITk specific case) - BooleanProperty m_useRingLayout{this, "UseRingLayout", false}; //!< to enable creation of rings for ITk pixel geometry (used for ITk specific case) - BooleanProperty m_addMoreSurfaces {this, "AddMoreSurfaces", false}; //!< to add additional surfaces to the SCT_OverlapDescriptor (used for ITk specific case) + BooleanProperty m_useRingLayout{this, "UseRingLayout", false}; //!< to enable creation of rings for ITk pixel geometry (used for ITk specific case) + BooleanProperty m_addMoreSurfaces{this, "AddMoreSurfaces", false}; //!< to add additional surfaces to the PixelOverlapDescriptor, SCT_OverlapDescriptor and DiscOverlapDescriptor (used for ITk specific case) // Properties only in SiLayerBuilderCond SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCT_ReadKey{this, "SCT_ReadKey", "SCT_DetectorElementCollection", "Key of output SiDetectorElementCollection for SCT"}; diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx index 423098d6fedcb6df4c72b5b1aca8765b26b9ef93..150fc8771af88b691b08eb3f98a5240eb07ccc50 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/DiscOverlapDescriptor.cxx @@ -61,7 +61,7 @@ getSCT_ID(StoreGateSvc const * const detStore) } // end anonymous namespace -InDet::DiscOverlapDescriptor::DiscOverlapDescriptor(const Trk::BinnedArray<Trk::Surface>* bin_array, +InDet::DiscOverlapDescriptor::DiscOverlapDescriptor(const Trk::BinnedArray<Trk::Surface>* bin_array, std::vector<Trk::BinUtility*>* singleBinUtils, bool isPixel): m_bin_array(bin_array), @@ -69,21 +69,19 @@ InDet::DiscOverlapDescriptor::DiscOverlapDescriptor(const Trk::BinnedArray<Trk:: m_pixelCase(isPixel) {} -/** get the compatible surfaces */ -bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceIntersection>& surfaces, +bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceIntersection>& surfaces, const Trk::Surface& tsf, const Amg::Vector3D& pos, const Amg::Vector3D&) const -{ - //These are done once no matter how many +{ //These are done once no matter how many //instances of DiscOverlapDescriptor we have static const StoreGateSvc* const detStore = getDetStore(); static const PixelID* const pixIdHelper = getPixelID(detStore); static const SCT_ID* const sctIdHelper = getSCT_ID(detStore); - + // get the according detector element const InDetDD::SiDetectorElement* pElement = dynamic_cast<const InDetDD::SiDetectorElement*>(tsf.associatedDetectorElement()); - + // first add the target surface surfaces.emplace_back(Trk::Intersection(pos, 0., true),&tsf); int etaModule = @@ -96,34 +94,34 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt size_t newCapacity = surfaces.size() + 19; if (pElement->otherSide()) newCapacity += 19; surfaces.reserve(newCapacity); - - addOtherSideDO(pElement,surfaces); - + + addOtherSideDO(pElement,surfaces); + addNextInPhiDO(pElement,surfaces); addPrevInPhiDO(pElement,surfaces); - + addNextInPhiDO(pElement->nextInPhi(),surfaces); addPrevInPhiDO(pElement->prevInPhi(),surfaces); - + // First use the bin utiliy to find the surfaces on the same disc but in different rings // This is done as follows: // 1 -> Find at which bin corresponds the surface, i.e. at which ring on the disc it corresponds - // 2 -> If it is not 0 (i.e. the surface doesn't belong to the innermost ring), + // 2 -> If it is not 0 (i.e. the surface doesn't belong to the innermost ring), // look for the surfaces in the ring with smaller eta value (it returns 2 or 3 surfaces) - // 3 -> If it is smaller than the number of rings (i.e. the surface doen't belong to the outermost ring), - // look for the surfaces in the ring with bigger eta value (it returns 2 or 3 surfaces)// + // 3 -> If it is smaller than the number of rings (i.e. the surface doen't belong to the outermost ring), + // look for the surfaces in the ring with bigger eta value (it returns 2 or 3 surfaces)// if (m_bin_array && !m_singleBinUtils->empty()){ const Trk::Surface* samePhi_PrevEta = nullptr; const Trk::Surface* samePhi_NextEta = nullptr; - + const Trk::Surface* previousPhi_PrevEta = nullptr; const Trk::Surface* nextPhi_PrevEta = nullptr; - + const Trk::Surface* previousPhi_NextEta = nullptr; const Trk::Surface* nextPhi_NextEta = nullptr; - + Trk::BinnedArraySpan<Trk::Surface const * const> surf = m_bin_array->arrayObjects(); size_t offset = 0; for (unsigned int bin = 0; bin < m_singleBinUtils->size(); bin++) { @@ -163,7 +161,7 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt previousPhi_NextEta = surf[ss]; PrevDeltaPhi = DeltaPhi; } - + if( DeltaPhi > NextDeltaPhi && DeltaPhi < 0) { nextPhi_NextEta = surf[ss]; NextDeltaPhi = DeltaPhi; @@ -172,7 +170,7 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt } offset += (std::as_const(*m_singleBinUtils).at(bin))->bins(); } - + if (samePhi_PrevEta) { const InDetDD::SiDetectorElement* PhiEta_Element = dynamic_cast<const InDetDD::SiDetectorElement*>(samePhi_PrevEta->associatedDetectorElement()); if (PhiEta_Element) { @@ -186,23 +184,23 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt if (PhiEta_Element) { addSurfaceDO(PhiEta_Element,surfaces); addOtherSideDO(PhiEta_Element, surfaces); - + addPrevInPhiDO(PhiEta_Element,surfaces); addPrevInPhiDO(PhiEta_Element->prevInPhi(),surfaces); } } - + if (nextPhi_PrevEta) { const InDetDD::SiDetectorElement* PhiEta_Element = dynamic_cast<const InDetDD::SiDetectorElement*>(nextPhi_PrevEta->associatedDetectorElement()); if (PhiEta_Element) { addSurfaceDO(PhiEta_Element,surfaces); addOtherSideDO(PhiEta_Element, surfaces); - + addNextInPhiDO(PhiEta_Element,surfaces); addNextInPhiDO(PhiEta_Element->nextInPhi(),surfaces); } } - + if (samePhi_NextEta) { const InDetDD::SiDetectorElement* PhiEta_Element = dynamic_cast<const InDetDD::SiDetectorElement*>(samePhi_NextEta->associatedDetectorElement()); if (PhiEta_Element) { @@ -210,31 +208,31 @@ bool InDet::DiscOverlapDescriptor::reachableSurfaces(std::vector<Trk::SurfaceInt addOtherSideDO(PhiEta_Element, surfaces); } } - + if (previousPhi_NextEta) { const InDetDD::SiDetectorElement* PhiEta_Element = dynamic_cast<const InDetDD::SiDetectorElement*>(previousPhi_NextEta->associatedDetectorElement()); if (PhiEta_Element) { addSurfaceDO(PhiEta_Element,surfaces); addOtherSideDO(PhiEta_Element, surfaces); - + addPrevInPhiDO(PhiEta_Element,surfaces); addPrevInPhiDO(PhiEta_Element->prevInPhi(),surfaces); } } - + if (nextPhi_NextEta) { const InDetDD::SiDetectorElement* PhiEta_Element = dynamic_cast<const InDetDD::SiDetectorElement*>(nextPhi_NextEta->associatedDetectorElement()); if (PhiEta_Element) { addSurfaceDO(PhiEta_Element,surfaces); addOtherSideDO(PhiEta_Element, surfaces); - + addNextInPhiDO(PhiEta_Element,surfaces); addNextInPhiDO(PhiEta_Element->nextInPhi(),surfaces); } } } } - + return false; } @@ -245,19 +243,19 @@ bool InDet::DiscOverlapDescriptor::dumpSurfaces(std::vector<Trk::SurfaceIntersec static const StoreGateSvc* const detStore = getDetStore(); static const PixelID* const pixIdHelper = getPixelID(detStore); static const SCT_ID* const sctIdHelper = getSCT_ID(detStore); - + for (auto & surface : surfaces) { - Identifier hitId = (surface.object)->associatedDetectorElementIdentifier(); + Identifier hitId = (surface.object)->associatedDetectorElementIdentifier(); if (m_pixelCase) - std::cout << "barrel_ec " << pixIdHelper->barrel_ec(hitId) - << ", layer_disk " << pixIdHelper->layer_disk(hitId) - << ", phi_module " << pixIdHelper->phi_module(hitId) + std::cout << "barrel_ec " << pixIdHelper->barrel_ec(hitId) + << ", layer_disk " << pixIdHelper->layer_disk(hitId) + << ", phi_module " << pixIdHelper->phi_module(hitId) << ", eta_module " << pixIdHelper->eta_module(hitId) << std::endl; - else - std::cout << "barrel_ec " << sctIdHelper->barrel_ec(hitId) - << ", layer_disk " << sctIdHelper->layer_disk(hitId) - << ", phi_module " << sctIdHelper->phi_module(hitId) - << ", eta_module " << sctIdHelper->eta_module(hitId) + else + std::cout << "barrel_ec " << sctIdHelper->barrel_ec(hitId) + << ", layer_disk " << sctIdHelper->layer_disk(hitId) + << ", phi_module " << sctIdHelper->phi_module(hitId) + << ", eta_module " << sctIdHelper->eta_module(hitId) << ", side " << sctIdHelper->side(hitId) << std::endl; } return true; diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilderImpl.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilderImpl.cxx index bedbf1e859634f230a1ae9b36add43bd069fab97..9c31f087dfb18af1ee27b844c4853ad2170bb299 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilderImpl.cxx +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilderImpl.cxx @@ -1155,7 +1155,7 @@ InDet::SiLayerBuilderImpl::cylindricalLayersImpl(const InDetDD::SiDetectorElemen // prepare the right overlap descriptor std::unique_ptr<Trk::OverlapDescriptor> olDescriptor = nullptr; if (m_pixelCase){ - olDescriptor = std::make_unique<InDet::PixelOverlapDescriptor>(); + olDescriptor = std::make_unique<InDet::PixelOverlapDescriptor>(m_addMoreSurfaces); } else { olDescriptor = std::make_unique<InDet::SCT_OverlapDescriptor>(m_addMoreSurfaces); diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt index 58a82f8816fe84243ad077aa09cb256ccce41168..6d46ceea828c4057c1303482a9e23861ce8680ef 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt @@ -12,7 +12,7 @@ atlas_add_library( PixelGeoModelXmlLib src/*.cxx PUBLIC_HEADERS PixelGeoModelXml PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} - LINK_LIBRARIES InDetGeoModelUtils PixelReadoutGeometryLib + LINK_LIBRARIES InDetGeoModelUtils PixelReadoutGeometryLib GeometryDBSvcLib PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} GaudiKernel DetDescrConditions InDetSimEvent ) diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelDetectorTool.h b/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelDetectorTool.h index 77588b329566fe66dd96a43ea103b44f77de0299..f89b5c393e4be0efd4d9eafa7ca4830979d8df8b 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelDetectorTool.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelDetectorTool.h @@ -13,6 +13,7 @@ #include <InDetGeoModelUtils/GeoModelXmlTool.h> #include <InDetGeoModelUtils/WaferTree.h> #include <ReadoutGeometryBase/SiCommonItems.h> +#include "GeometryDBSvc/IGeometryDBSvc.h" #include <memory> @@ -33,9 +34,6 @@ public: virtual ~PixelDetectorTool() = default; virtual StatusCode create() override final; virtual StatusCode clear() override final; - virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override final; - virtual StatusCode align(IOVSVC_CALLBACK_ARGS_P(I,keys)) override final; - private: const InDetDD::PixelDetectorManager *m_detManager{}; std::unique_ptr<InDetDD::SiCommonItems> m_commonItems{}; @@ -46,6 +44,8 @@ private: Gaudi::Property<std::string> m_alignmentFolderName{this, "AlignmentFolderName", "/Indet/Align", ""}; // Print out how many of each layer/eta/phi etc. have been set up. void doNumerology(InDetDD::PixelDetectorManager *manager); + ServiceHandle< IGeometryDBSvc > m_geometryDBSvc{this,"GeometryDBSvc","InDetGeometryDBSvc",""}; + }; } // namespace ITk diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelGmxInterface.h b/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelGmxInterface.h index 737afc52218d2813793b9d7d3d1a30a6b28a5f00..f3285ffaea0ea7cdd2566cafe0a0a481b6b84fa5 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelGmxInterface.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/PixelGeoModelXml/PixelGmxInterface.h @@ -13,6 +13,12 @@ #include <sstream> #include <string> +class IRDBAccessSvc; + +namespace GeoModelIO{ + class ReadGeoModel; +} + namespace InDetDD { class PixelDetectorManager; @@ -50,6 +56,8 @@ public: int circuitsPhi, int circuitsEta, int diodeColPerCirc, int diodeRowPerCirc) const; + void buildReadoutGeometryFromSqlite(IRDBAccessSvc * rdbAccessSvc, GeoModelIO::ReadGeoModel* sqlreader); + protected: std::map<std::string, int> m_geometryMap; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/python/ITkPixelGeoModelConfig.py b/InnerDetector/InDetDetDescr/PixelGeoModelXml/python/ITkPixelGeoModelConfig.py index 9563f7a7910bb8c32f495e9d16b360e2e4f5ecc2..58482cbeacc4c76ea26e5c54bd45a6a6ea579d32 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/python/ITkPixelGeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/python/ITkPixelGeoModelConfig.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -def ITkPixelGeoModelCfg(flags,setGeometryAlignable=False): +def ITkPixelGeoModelCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): from AtlasGeoModel.GeoModelConfig import GeoModelCfg acc = GeoModelCfg(flags) geoModelSvc = acc.getPrimary() @@ -9,6 +9,7 @@ def ITkPixelGeoModelCfg(flags,setGeometryAlignable=False): ITkPixelDetectorTool = CompFactory.ITk.PixelDetectorTool() # ITkPixelDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic ITkPixelDetectorTool.Alignable = setGeometryAlignable # make this a flag? Set true as soon as decided on folder structure + ITkPixelDetectorTool.AlignmentFolderName = setAlignmentFolderName ITkPixelDetectorTool.DetectorName = "ITkPixel" if flags.ITk.Geometry.PixelLocal: # Setting this filename triggers reading from local file rather than DB @@ -19,26 +20,26 @@ def ITkPixelGeoModelCfg(flags,setGeometryAlignable=False): return acc -def ITkPixelAlignmentCfg(flags): +def ITkPixelAlignmentCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): if flags.GeoModel.Align.LegacyConditionsAccess: # revert to old style CondHandle in case of simulation from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline - return addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align") + return addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", setAlignmentFolderName) else: from PixelConditionsAlgorithms.ITkPixelConditionsConfig import ITkPixelAlignCondAlgCfg - return ITkPixelAlignCondAlgCfg(flags) + return ITkPixelAlignCondAlgCfg(flags,setAlignmentFolderName=setAlignmentFolderName) -def ITkPixelSimulationGeometryCfg(flags): +def ITkPixelSimulationGeometryCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): # main GeoModel config - acc = ITkPixelGeoModelCfg(flags) - acc.merge(ITkPixelAlignmentCfg(flags)) + acc = ITkPixelGeoModelCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) + acc.merge(ITkPixelAlignmentCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName)) return acc -def ITkPixelReadoutGeometryCfg(flags): +def ITkPixelReadoutGeometryCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): # main GeoModel config - acc = ITkPixelGeoModelCfg(flags) - acc.merge(ITkPixelAlignmentCfg(flags)) + acc = ITkPixelGeoModelCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) + acc.merge(ITkPixelAlignmentCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName)) from PixelConditionsAlgorithms.ITkPixelConditionsConfig import ITkPixelDetectorElementCondAlgCfg - acc.merge(ITkPixelDetectorElementCondAlgCfg(flags)) + acc.merge(ITkPixelDetectorElementCondAlgCfg(flags,setAlignmentFolderName=setAlignmentFolderName)) return acc diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelDetectorTool.cxx b/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelDetectorTool.cxx index b888b9b1d7abc13eaeb280cd9fbdd7d2fedd3b71..e175988c4495202b05fe444ca3bff67e30c5e110 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelDetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelDetectorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "PixelGeoModelXml/PixelDetectorTool.h" @@ -39,7 +39,7 @@ StatusCode PixelDetectorTool::create() m_commonItems = std::make_unique<InDetDD::SiCommonItems>(idHelper); - const GeoModelIO::ReadGeoModel* sqlreader = getSqliteReader(); + GeoModelIO::ReadGeoModel* sqlreader = getSqliteReader(); // If we are not taking the geo from sqlite, check the availability of tables // (or that we have a local geometry) @@ -64,21 +64,23 @@ StatusCode PixelDetectorTool::create() // The & takes the address of the GeoVPhysVol GeoPhysVol *world = &*theExpt->getPhysVol(); auto *manager = new InDetDD::PixelDetectorManager(&*detStore(), m_detectorName, "PixelID"); - manager->addFolder(m_alignmentFolderName); - + const std::string topFolder(m_alignmentFolderName); + manager->addFolder(topFolder); if (m_alignable) { - manager->addChannel("/Indet/Align/ID", 2, InDetDD::global); - manager->addChannel("/Indet/Align/PIX", 1, InDetDD::global); - manager->addChannel("/Indet/Align/PIXB1", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXB2", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXB3", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXB4", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXEA1", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXEA2", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXEA3", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXEC1", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXEC2", 0, InDetDD::local); - manager->addChannel("/Indet/Align/PIXEC3", 0, InDetDD::local); + InDetDD::AlignFolderType alignFolderType = InDetDD::static_run1 ; + manager->addAlignFolderType(alignFolderType); + manager->addChannel(topFolder +"/ID", 2, InDetDD::global); + manager->addChannel(topFolder +"/PIX", 1, InDetDD::global); + manager->addChannel(topFolder +"/PIXB1", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXB2", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXB3", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXB4", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXEA1", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXEA2", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXEA3", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXEC1", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXEC2", 0, InDetDD::local); + manager->addChannel(topFolder +"/PIXEC3", 0, InDetDD::local); } InDetDD::ITk::PixelGmxInterface gmxInterface(manager, m_commonItems.get(), &m_moduleTree); @@ -87,6 +89,10 @@ StatusCode PixelDetectorTool::create() // empty strings are the (optional) containing detector and envelope names // allowed to pass a null sqlreader ptr - it will be used to steer the source of the geometry const GeoVPhysVol* topVolume = createTopVolume(world, gmxInterface, node, table,"","",sqlreader); + if(sqlreader){ + ATH_MSG_INFO("Building Pixel Readout Geometry from SQLite using "<<m_geoDbTagSvc->getParamSvcName()); + gmxInterface.buildReadoutGeometryFromSqlite(m_sqliteReadSvc.operator->(),sqlreader); + } if (topVolume) { //see that a valid pointer is returned manager->addTreeTop(topVolume); doNumerology(manager); @@ -121,51 +127,6 @@ StatusCode PixelDetectorTool::clear() return StatusCode::SUCCESS; } -StatusCode PixelDetectorTool::registerCallback ATLAS_NOT_THREAD_SAFE () -{ - // - // Register call-back for software alignment - // - if (m_alignable) { - if (detStore()->contains<AlignableTransformContainer>(m_alignmentFolderName)) { - ATH_MSG_DEBUG("Registering callback on AlignableTransformContainer with folder " << m_alignmentFolderName); - const DataHandle<AlignableTransformContainer> atc; - StatusCode sc = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, m_alignmentFolderName); - if (sc.isFailure()) { - ATH_MSG_ERROR("Could not register callback on AlignableTransformContainer with folder " - << m_alignmentFolderName); - return StatusCode::FAILURE; - } - } else { - ATH_MSG_WARNING("Unable to register callback on AlignableTransformContainer with folder " - << m_alignmentFolderName << ", Alignment disabled (only if no Run2 scheme is loaded)!"); - } - } else { - ATH_MSG_INFO("Alignment disabled. No callback registered"); - // We return failure otherwise it will try and register a GeoModelSvc callback associated with this callback. - } - return StatusCode::SUCCESS; -} - - -StatusCode PixelDetectorTool::align(IOVSVC_CALLBACK_ARGS_P(I, keys)) -{ - // - // The call-back routine, which just calls the real call-back routine from the manager. - // - if (!m_detManager) { - ATH_MSG_WARNING("Manager does not exist"); - return StatusCode::FAILURE; - } - if (m_alignable) { - return m_detManager->align(I, keys); - } else { - ATH_MSG_DEBUG("Alignment disabled. No alignments applied"); - return StatusCode::SUCCESS; - } -} - - void PixelDetectorTool::doNumerology(InDetDD::PixelDetectorManager * manager) { ATH_MSG_INFO( "\n\nPixel Numerology:\n===============\n\nNumber of parts is " << m_moduleTree.nParts() ); diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelGmxInterface.cxx b/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelGmxInterface.cxx index c6bde0765560dbe3066433e3f631d05aa06a3def..1d7d2949526bb5a95b94404b7f9b4e4923579a39 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelGmxInterface.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/src/PixelGmxInterface.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "PixelGeoModelXml/PixelGmxInterface.h" @@ -12,6 +12,11 @@ #include <ReadoutGeometryBase/PixelDiodeMatrix.h> #include <ReadoutGeometryBase/SiCommonItems.h> +#include <RDBAccessSvc/IRDBAccessSvc.h> +#include <RDBAccessSvc/IRDBRecord.h> +#include <RDBAccessSvc/IRDBRecordset.h> +#include <GeoModelRead/ReadGeoModel.h> +#include <GeoModelKernel/GeoFullPhysVol.h> namespace { @@ -422,5 +427,56 @@ std::shared_ptr<const PixelDiodeMatrix> PixelGmxInterface::buildMatrix(double ph return fullMatrix; } +void PixelGmxInterface::buildReadoutGeometryFromSqlite(IRDBAccessSvc * rdbAccessSvc,GeoModelIO::ReadGeoModel* sqlreader){ + + const std::array<std::string,2> sensorTypes({"QuadChip_RD53","SingleChip_RD53"}); + const std::array<std::string,17> rd53_ParamNames({"circuitsPerEta","circuitsPerPhi","columns","detectorType","is3D","nEtaEndPerSide","nEtaLongPerSide","nPhiEndPerSide","nPhiLongPerSide","pitchEta","pitchEtaEnd","pitchEtaLong","pitchPhi","pitchPhiEnd","pitchPhiLong","rows","thickness"}); + + for(const std::string & sType:sensorTypes){ + IRDBRecordset_ptr rd53 = rdbAccessSvc->getRecordsetPtr(sType,""); + if(rd53->size() !=0){ + for (unsigned int iR =0;iR<rd53->size();iR++){ + std::map<std::string,std::string> rd53_Map; + for(const std::string & paramName:rd53_ParamNames){ + std::string paramValue = (*rd53)[iR]->getString(paramName); + rd53_Map[paramName] = paramValue; + } + std::string rd35_Name = (*rd53)[iR]->getString("SensorType"); + makePixelModule(rd35_Name,rd53_Map); + } + } + else ATH_MSG_WARNING("Could not retrieve "<<sType<<" table"); + } + + //Now, loop over the FullPhysVols and create the SiDetectorElements + //lots of string parsing... + const std::array<std::string,5> fields({"barrel_endcap","layer_wheel","phi_module","eta_module","side"}); + //The below is a map of string keys which contain all the Identifier/DetElement relevant info, and the associated FullPhysVol + std::map<std::string, GeoFullPhysVol*> mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>("GeoModelXML"); + for (const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){ + //find the name of the corresponding detector design type + size_t startRG = fullPhysVolInfoString.find("RD53_"); + if(startRG==std::string::npos){ + ATH_MSG_DEBUG("GeoFullPhysVol "<<fullPhysVolInfoString<<" does not have the expected format. Skipping"); + continue; + } + std::string typeName = fullPhysVolInfoString.substr(startRG); + std::map<std::string, int> index; + for (const std::string & field:fields){ + size_t first = fullPhysVolInfoString.find(field+"_"); + size_t last = fullPhysVolInfoString.find("_",first+field.size()+1);//start looking only after end of first delimiter (plus 1 for the "_" appended) ends + if(first==std::string::npos || last==std::string::npos){ + ATH_MSG_DEBUG("Could not extract "<<field<<" from "<<fullPhysVolInfoString<<". Skipping"); + continue; + } + std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1)); + index[field] = std::stoi(strNew); + } + + addSensor(typeName,index,0,fullPhysVolPointer); + } + +} + } // namespace ITk } // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h index e41d023bb636ff67378d3e9176b6152b24e6c433..4350a69d4078c4209c17a9b036d58c277b223d84 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h @@ -175,10 +175,6 @@ public: virtual std::pair<int,int> getStripRow(SiCellId id) const; /** Test if point is in the active part of the detector with specified tolerances */ virtual SiIntersect inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const override; - /** Test if point is in the active part of the detector with specified tolerances - allows forcing of most stringent check*/ - virtual SiIntersect inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol, bool forceStringentCheck) const override; - - private: SCT_ModuleSideDesign(); diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ModuleSideDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ModuleSideDesign.cxx index 993b7bee3237af8c7238710401ec6cd17721341e..0507ca247fc7c1132d24a6ac1c2539bb09badb14 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ModuleSideDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/SCT_ModuleSideDesign.cxx @@ -126,18 +126,7 @@ std::pair<int,int> SCT_ModuleSideDesign::getStripRow(SiCellId /*id*/) const { return {0,0}; } - SiIntersect SCT_ModuleSideDesign::inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol, bool forceStringent) const { - - //if we are not doing a stringent check, we should first see if there is - //a motherDesign, and if so, do the check based on that instead - if(!forceStringent){ - - const SCT_ModuleSideDesign * mother = getMother(); - - //Stringent check on mother, to skip checking for "grandmother" - if(mother) return mother->inDetector(localPosition,phiTol,etaTol, true); - - } + SiIntersect SCT_ModuleSideDesign::inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const { double etaDist = 0; double phiDist = 0; @@ -161,9 +150,4 @@ std::pair<int,int> SCT_ModuleSideDesign::getStripRow(SiCellId /*id*/) const { return state; } -SiIntersect SCT_ModuleSideDesign::inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const { - //default check is not "stringent" - i.e it will use a mother if one exists - return inDetector(localPosition,phiTol,etaTol, false); -} - } // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt index 5fbe5319d07b36fc4c3b80c8ff6767539abbdb25..4f3dcab75a25c5f5ecb7cf81bda1bf775f57ca0a 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt @@ -12,7 +12,7 @@ atlas_add_component( StripGeoModelXml src/components/*.cxx PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} CxxUtils - GaudiKernel DetDescrConditions InDetGeoModelUtils InDetSimEvent SCT_ReadoutGeometry ) + GaudiKernel DetDescrConditions InDetGeoModelUtils InDetSimEvent SCT_ReadoutGeometry GeometryDBSvcLib ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/python/ITkStripGeoModelConfig.py b/InnerDetector/InDetDetDescr/StripGeoModelXml/python/ITkStripGeoModelConfig.py index 8f6b8b8a25057a9b6411378b76cabd0b3cc24f4f..c9488e7e252920d8e9fea447d1340eb13218d38b 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/python/ITkStripGeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/python/ITkStripGeoModelConfig.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -def ITkStripGeoModelCfg(flags,setGeometryAlignable=False): +def ITkStripGeoModelCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): from AtlasGeoModel.GeoModelConfig import GeoModelCfg acc = GeoModelCfg(flags) geoModelSvc = acc.getPrimary() @@ -9,6 +9,7 @@ def ITkStripGeoModelCfg(flags,setGeometryAlignable=False): ITkStripDetectorTool = CompFactory.ITk.StripDetectorTool() # ITkStripDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic #Will we need to do dynamic alignment for ITk? ITkStripDetectorTool.Alignable = setGeometryAlignable # make this a flag? Set true as soon as decided on folder structure + ITkStripDetectorTool.AlignmentFolderName = setAlignmentFolderName ITkStripDetectorTool.DetectorName = "ITkStrip" if flags.ITk.Geometry.StripLocal: # Setting this filename triggers reading from local file rather than DB @@ -19,26 +20,26 @@ def ITkStripGeoModelCfg(flags,setGeometryAlignable=False): return acc -def ITkStripAlignmentCfg(flags): +def ITkStripAlignmentCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): if flags.GeoModel.Align.LegacyConditionsAccess: # revert to old style CondHandle in case of simulation from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline - return addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align") + return addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", setAlignmentFolderName) else: from SCT_ConditionsAlgorithms.ITkStripConditionsAlgorithmsConfig import ITkStripAlignCondAlgCfg - return ITkStripAlignCondAlgCfg(flags) + return ITkStripAlignCondAlgCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) -def ITkStripSimulationGeometryCfg(flags): +def ITkStripSimulationGeometryCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): # main GeoModel config - acc = ITkStripGeoModelCfg(flags) - acc.merge(ITkStripAlignmentCfg(flags)) + acc = ITkStripGeoModelCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) + acc.merge(ITkStripAlignmentCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName)) return acc -def ITkStripReadoutGeometryCfg(flags): +def ITkStripReadoutGeometryCfg(flags,setGeometryAlignable=False,setAlignmentFolderName="/Indet/Align"): # main GeoModel config - acc = ITkStripGeoModelCfg(flags) - acc.merge(ITkStripAlignmentCfg(flags)) + acc = ITkStripGeoModelCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName) + acc.merge(ITkStripAlignmentCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName)) from SCT_ConditionsAlgorithms.ITkStripConditionsAlgorithmsConfig import ITkStripDetectorElementCondAlgCfg - acc.merge(ITkStripDetectorElementCondAlgCfg(flags)) + acc.merge(ITkStripDetectorElementCondAlgCfg(flags,setGeometryAlignable=setGeometryAlignable,setAlignmentFolderName=setAlignmentFolderName)) return acc diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx index 4f75d93e1bed9977d0392b7cddc7998345c25aae..5dad451efe3282c2cacee7203d4e4486d5b020b8 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx @@ -11,6 +11,7 @@ #include <GeoModelKernel/GeoPhysVol.h> #include <GeoModelUtilities/GeoModelExperiment.h> #include <SGTools/DataProxy.h> +#include "GeoModelRead/ReadGeoModel.h" namespace ITk @@ -42,7 +43,7 @@ StatusCode StripDetectorTool::create() std::string node{"SCT"}; std::string table{"ITKXDD"}; - const GeoModelIO::ReadGeoModel* sqlreader = getSqliteReader(); + GeoModelIO::ReadGeoModel* sqlreader = getSqliteReader(); if(!sqlreader){ if (!isAvailable(node, table)) { @@ -70,6 +71,12 @@ StatusCode StripDetectorTool::create() // empty strings are the (optional) containing detector and envelope names // allowed to pass a null sqlreader ptr - it will be used to steer the source of the geometry const GeoVPhysVol* topVolume = createTopVolume(world, gmxInterface, node, table,"","",sqlreader); + // if we are using SQLite inputs, + if(sqlreader){ + ATH_MSG_INFO("Building Strip Readout Geometry from SQLite using "<<m_geoDbTagSvc->getParamSvcName()); + gmxInterface.buildReadoutGeometryFromSqlite(m_sqliteReadSvc.operator->(),sqlreader); + } + if (topVolume) { //see that a valid pointer is returned manager->addTreeTop(topVolume); doNumerology(manager); @@ -104,51 +111,6 @@ StatusCode StripDetectorTool::clear() return StatusCode::SUCCESS; } - -StatusCode StripDetectorTool::registerCallback ATLAS_NOT_THREAD_SAFE () -{ - // - // Register call-back for software alignment - // - if (m_alignable) { - if (detStore()->contains<AlignableTransformContainer>(m_alignmentFolderName)) { - ATH_MSG_DEBUG("Registering callback on AlignableTransformContainer with folder " << m_alignmentFolderName); - const DataHandle<AlignableTransformContainer> atc; - StatusCode sc = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, m_alignmentFolderName); - if (sc.isFailure()) { - ATH_MSG_ERROR("Could not register callback on AlignableTransformContainer with folder " - << m_alignmentFolderName); - return StatusCode::FAILURE; - } - } else { - ATH_MSG_WARNING("Unable to register callback on AlignableTransformContainer with folder " - << m_alignmentFolderName << ", Alignment disabled (only if no Run2 scheme is loaded)!"); - } - } else { - ATH_MSG_INFO("Alignment disabled. No callback registered"); - // We return failure otherwise it will try and register a GeoModelSvc callback associated with this callback. - } - return StatusCode::SUCCESS; -} - - -StatusCode StripDetectorTool::align(IOVSVC_CALLBACK_ARGS_P(I, keys)){ - // - // The call-back routine, which just calls the real call-back routine from the manager. - // - if (!m_detManager) { - ATH_MSG_WARNING("Manager does not exist"); - return StatusCode::FAILURE; - } - if (m_alignable) { - return m_detManager->align(I, keys); - } else { - ATH_MSG_DEBUG("Alignment disabled. No alignments applied"); - return StatusCode::SUCCESS; - } -} - - void StripDetectorTool::doNumerology(InDetDD::SCT_DetectorManager * manager) { ATH_MSG_INFO("\n\nSCT Numerology:\n===============\n\nNumber of parts is " << m_waferTree.nParts() << "\n"); diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.h index 95e3cd747e8138bee0b8b0b7dd574d6b68c79435..2e118e16dae967e9c3bce51f490849b23c26e803 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.h +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.h @@ -14,6 +14,7 @@ #include <InDetGeoModelUtils/GeoModelXmlTool.h> #include <InDetGeoModelUtils/WaferTree.h> #include <ReadoutGeometryBase/SiCommonItems.h> +#include "GeometryDBSvc/IGeometryDBSvc.h" #include <memory> @@ -34,8 +35,6 @@ public: virtual ~StripDetectorTool() = default; virtual StatusCode create() override final; virtual StatusCode clear() override final; - virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override final; - virtual StatusCode align(IOVSVC_CALLBACK_ARGS_P(I,keys)) override final; private: const InDetDD::SCT_DetectorManager *m_detManager{}; @@ -47,6 +46,7 @@ private: Gaudi::Property<std::string> m_alignmentFolderName{this, "AlignmentFolderName", "/Indet/Align", ""}; // Print out how many of each layer/eta/phi etc. have been set up. void doNumerology(InDetDD::SCT_DetectorManager *manager); + ServiceHandle< IGeometryDBSvc > m_geometryDBSvc{this,"GeometryDBSvc","InDetGeometryDBSvc",""}; }; } // namespace ITk diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx index 818f3814f04d966531bd861a29e6e8cbc7057d8b..79dc17a674c4b92438161a2937f613216dc3fb82 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx @@ -13,6 +13,12 @@ #include <SCT_ReadoutGeometry/StripBoxDesign.h> #include <SCT_ReadoutGeometry/StripStereoAnnulusDesign.h> +#include <RDBAccessSvc/IRDBAccessSvc.h> +#include <RDBAccessSvc/IRDBRecord.h> +#include <RDBAccessSvc/IRDBRecordset.h> +#include <GeoModelRead/ReadGeoModel.h> +#include <GeoModelKernel/GeoFullPhysVol.h> + namespace { constexpr int SCT_HitIndex{1}; @@ -619,5 +625,79 @@ void StripGmxInterface::addAlignable(int level, m_detectorManager->addAlignableTransform(level, id, transform, fpv); } +void StripGmxInterface::buildReadoutGeometryFromSqlite(IRDBAccessSvc * rdbAccessSvc,GeoModelIO::ReadGeoModel* sqlreader){ + + IRDBRecordset_ptr stereoAnnulus = rdbAccessSvc->getRecordsetPtr("StereoAnnulus",""); + const std::array<std::string,13> stereoAnnulusParamNames({"thickness","carrierType","readoutSide","fieldDirection","stripDirection","stereoAngle","centreR","nRows","splitLevel","nStrips","phiPitch","startR","endR"}); + + if(stereoAnnulus->size() !=0){ + for (unsigned int iR =0;iR<stereoAnnulus->size();iR++){ + std::map<std::string,std::string> stereoAnnulusMap; + for(std::string paramName:stereoAnnulusParamNames){ + std::string paramValue = (*stereoAnnulus)[iR]->getString(paramName); + stereoAnnulusMap[paramName] = paramValue; + } + std::string stereoAnnulusName = (*stereoAnnulus)[iR]->getString("SensorType"); + makeStereoAnnulus(stereoAnnulusName,stereoAnnulusMap); + } + } + else ATH_MSG_WARNING("Could not retrieve StereoAnnulus table"); + + IRDBRecordset_ptr stripBox = rdbAccessSvc->getRecordsetPtr("SiStripBox",""); + const std::array<std::string,10> stripBoxParamNames({"thickness","carrierType","readoutSide","fieldDirection","stripDirection","nRows","stripLength","splitLevel","nStrips","pitch"}); + + if(stripBox->size() !=0){ + for (unsigned int iR =0;iR<stripBox->size();iR++){ + std::map<std::string,std::string> stripBoxMap; + for(std::string paramName:stripBoxParamNames){ + std::string paramValue = (*stripBox)[iR]->getString(paramName); + stripBoxMap[paramName] = paramValue; + } + std::string stripBoxName = (*stripBox)[iR]->getString("SensorType"); + makeSiStripBox(stripBoxName,stripBoxMap); + } + } + else ATH_MSG_WARNING("Could not retrieve SiStripBox table"); + + //Now, loop over the FullPhysVols and create the SiDetectorElements (including splitting where needed) + //lots of string parsing... + std::vector<std::string> fields({"barrel_endcap","layer_wheel","phi_module","eta_module","side"}); + //The below is a map of string keys which contain all the Identifier/DetElement relevant info, and the associated FullPhysVol + std::map<std::string, GeoFullPhysVol*> mapFPV = sqlreader->getPublishedNodes<std::string, GeoFullPhysVol*>("GeoModelXML"); + for (const auto&[fullPhysVolInfoString, fullPhysVolPointer] : mapFPV){ + //find the name of the corresponding detector design type + size_t startRG = fullPhysVolInfoString.find("RG_"); + if(startRG==std::string::npos){ + ATH_MSG_DEBUG("GeoFullPhysVol "<<fullPhysVolInfoString<<" does not have the expected format. Skipping"); + continue; + } + std::string typeName = fullPhysVolInfoString.substr(startRG); + std::map<std::string, int> index; + for (std::string field:fields){ + size_t first = fullPhysVolInfoString.find(field+"_"); + size_t last = fullPhysVolInfoString.find("_",first+field.size()+1);//start looking only after end of first delimiter (plus 1 for the "_" appended) ends + if(first==std::string::npos || last==std::string::npos){ + ATH_MSG_DEBUG("Could not extract "<<field<<" from "<<fullPhysVolInfoString<<". Skipping"); + continue; + } + std::string strNew = fullPhysVolInfoString.substr(first+field.size()+1,last-(first+field.size()+1)); + index[field] = std::stoi(strNew); + } + //now check if we need to split + size_t splitPos = fullPhysVolInfoString.find("split_"); + if(splitPos!=std::string::npos){ + size_t last = fullPhysVolInfoString.find("_",splitPos+6);//"split_" is 6 characters + std::string strNew = fullPhysVolInfoString.substr(splitPos+6,last-(splitPos+6)); + int splitLevel = std::stoi(strNew); + for(int i=0;i<splitLevel;i++){ + std::string field = "eta_module";//eventually specify in Xml the field to split in? + std::pair<std::string,int> extraIndex(field,i); + addSplitSensor(typeName,index,extraIndex,0,fullPhysVolPointer); + } + } + else addSensor(typeName,index,0,fullPhysVolPointer); + } +} + } // namespace ITk } // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.h index 8ccc6d16395188dc2b6148f9361a69872c69ad7b..92850324ce80d2d70c766c75f59a3292b9aa091c 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.h +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.h @@ -13,6 +13,12 @@ #include <string> #include <sstream> +class IRDBAccessSvc; + +namespace GeoModelIO{ + class ReadGeoModel; +} + namespace InDetDD { @@ -53,6 +59,8 @@ public: GeoVFullPhysVol *fpv, GeoAlignableTransform *transform) override final; + void buildReadoutGeometryFromSqlite(IRDBAccessSvc * rdbAccessSvc, GeoModelIO::ReadGeoModel* sqlreader); + private: void makeSiStripBox(const std::string& typeName, const std::map<std::string, std::string> ¶meters); diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx index 5b568da11520a63debf650a6ef1dac3bb61afcb3..e2f27a72002583ac047e52023938e88130ec7451 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx @@ -293,6 +293,8 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, double ncharges = initialConditions[6]; double iTotalLength = initialConditions[7]; + const double oneOverNchargesTimes1e6 = 1./(1.E+6 * ncharges); + //Set up physical detector properties, switch on detector material ATH_MSG_DEBUG("Applying planar sensor simulation"); double sensorThickness = Module.design().thickness(); @@ -316,10 +318,11 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, double collectionDist = 0.2 * CLHEP::mm; double smearScale = 1. + 0.35 * smearRand; double tanLorentz(0); + double coLorentz(0); if (m_radiationDamageSimulationType != RadiationDamageSimulationType::TEMPLATE_CORRECTION) { tanLorentz = m_lorentzAngleTool->getTanLorentzAngle(Module.identifyHash()); + coLorentz = std::sqrt(1.0 + (tanLorentz*tanLorentz)); } - double coLorentz = std::sqrt(1.0 + (tanLorentz*tanLorentz)); const EBC_EVCOLL evColl = EBC_MAINEVCOLL; const HepMcParticleLink::PositionFlag idxFlag = @@ -425,7 +428,7 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, for (int j = 0; j < ncharges; j++) { // amount of energy to be converted into charges at current step - double energy_per_step = 1.0 * iHitRecord.second / 1.E+6 / ncharges; + double energy_per_step = oneOverNchargesTimes1e6 * iHitRecord.second; double u = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0); // need to update to std::logf when we update gcc - this is a known bug in gcc libc const double drifttime_e = (-1.) * (trappingTimes.first) * logf(u); //ns @@ -566,7 +569,12 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, } else if (m_radiationDamageSimulationType == RadiationDamageSimulationType::TEMPLATE_CORRECTION && !(Module.isDBM()) && Module.isBarrel()){ // will run radiation damage but with the template method - for (auto & iHitRecord : trfHitRecord) { + + const PixelHistoConverter& distanceCorrectionHist = m_distanceCorrection[layer]; + const PixelHistoConverter& lorentzCorrectionHist = m_lorentzCorrection[layer]; + const PixelHistoConverter& chargeCorrectionHist = m_chargeCorrection[layer]; + + for (const auto & iHitRecord : trfHitRecord) { double eta_i = eta_0; double phi_i = phi_0; double depth_i = depth_0; @@ -578,13 +586,14 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, const double depthZ = (depth_i + 0.5*sensorThickness)*1e3; // to get it in micro meters - const double dist_electrode = m_distanceCorrection.at(layer).getContent(depthZ); + const double dist_electrode = distanceCorrectionHist.getContent(depthZ); // get corrected LA - tanLorentz = m_lorentzCorrection.at(layer).getContent(depthZ); + tanLorentz = lorentzCorrectionHist.getContent(depthZ); + coLorentz = std::sqrt(1.0 + (tanLorentz*tanLorentz)); // for charge corrections - const double chargeCorrection = m_chargeCorrection.at(layer).getContent(depthZ); + const double chargeCorrection = chargeCorrectionHist.getContent(depthZ); // nonTrapping probability double nontrappingProbability = 1.0; @@ -594,7 +603,7 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, for (int j = 0; j < ncharges; j++) { // amount of energy to be converted into charges at current step - double energy_per_step = 1.0 * iHitRecord.second / 1.E+6 / ncharges; + double energy_per_step = oneOverNchargesTimes1e6 * iHitRecord.second; // diffusion sigma double rdif = this->m_diffusionConstant * std::sqrt(dist_electrode * coLorentz / 0.3); @@ -634,7 +643,7 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, }//end cycle for charge }//trfHitRecord.size() } else { // run without radiation damage - for (auto & iHitRecord : trfHitRecord) { + for (const auto & iHitRecord : trfHitRecord) { double eta_i = eta_0; double phi_i = phi_0; double depth_i = depth_0; @@ -659,7 +668,7 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit>& phit, for (int j = 0; j < ncharges; j++) { // amount of energy to be converted into charges at current step - double energy_per_step = 1.0 * iHitRecord.second / 1.E+6 / ncharges; + double energy_per_step = oneOverNchargesTimes1e6 * iHitRecord.second; // diffusion sigma double rdif = this->m_diffusionConstant * std::sqrt(dist_electrode * coLorentz / 0.3); diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/tools/RunPrintSiDetElements.py b/InnerDetector/InDetExample/InDetDetDescrExample/tools/RunPrintSiDetElements.py index 3c3cd4e14f9409eefaad60eea18cbdcc3f432634..ac2658010bd985d7d2c5ec4b69e9d22abbeee8f1 100755 --- a/InnerDetector/InDetExample/InDetDetDescrExample/tools/RunPrintSiDetElements.py +++ b/InnerDetector/InDetExample/InDetDetDescrExample/tools/RunPrintSiDetElements.py @@ -16,6 +16,8 @@ parser.add_argument("--localgeo", default=False, action="store_true", help="Use local geometry XML files") parser.add_argument("--geometrytag",default="ATLAS-P2-RUN4-01-01-00", type=str, help="The geometry tag to use") +parser.add_argument("--sqlitefile",default="", type=str, + help="SQLite input file to use") args = parser.parse_args() @@ -46,6 +48,10 @@ ConfigFlags.Input.Files = [] if args.localgeo: ConfigFlags.ITk.Geometry.AllLocal = True +elif args.sqlitefile != "": + print("Using SQLite input") + ConfigFlags.GeoModel.SQLiteDB = args.sqlitefile + from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags setupDetectorFlags(ConfigFlags, args.detectors, toggle_geometry=True) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index cdda995f55fbc52090b4ae16fe31088bd64f03c5..55d184d1e010854056d118f9c65a67508d05a2a2 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -800,7 +800,7 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o do3dSplitting = InDetFlags.doPrimaryVertex3DFinding()) else: from ActsGeometry.ActsTrackingGeometryTool import ActsTrackingGeometryTool - from ActsTrkPriVtxFinderTool.ActsTrkPriVtxFinderToolConf import ActsTrk__AdaptiveMultiPriVtxFinderTool + from ActsVertexReconstruction.ActsVertexReconstructionConf import ActsTrk__AdaptiveMultiPriVtxFinderTool actsTrackingGeometryTool = getattr(ToolSvc,"ActsTrackingGeometryTool") actsExtrapolationTool = CfgMgr.ActsExtrapolationTool("ActsExtrapolationTool") actsExtrapolationTool.TrackingGeometryTool = actsTrackingGeometryTool @@ -837,7 +837,7 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o # --- ACTS IVF configured with Full Billoir Vertex Fitter # from ActsGeometry.ActsTrackingGeometryTool import ActsTrackingGeometryTool - from ActsTrkPriVtxFinderTool.ActsTrkPriVtxFinderToolConf import ActsTrk__IterativePriVtxFinderTool + from ActsVertexReconstruction.ActsVertexReconstructionConf import ActsTrk__IterativePriVtxFinderTool actsTrackingGeometryTool = getattr(ToolSvc,"ActsTrackingGeometryTool") actsExtrapolationTool = CfgMgr.ActsExtrapolationTool("ActsExtrapolationTool") actsExtrapolationTool.TrackingGeometryTool = actsTrackingGeometryTool diff --git a/InnerDetector/InDetMeasurementUtilities/CMakeLists.txt b/InnerDetector/InDetMeasurementUtilities/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3fbe738d2a4d46d41edae0b8e0d5cc3c98ccca58 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( InDetMeasurementUtilities ) + +atlas_add_library( InDetMeasurementUtilitiesLib + src/ClusterConversionUtilities.cxx + src/SpacePointConversionUtilities.cxx + PUBLIC_HEADERS + InDetMeasurementUtilities + LINK_LIBRARIES + InDetPrepRawData + xAODInDetMeasurement + InDetIdentifier + InDetReadoutGeometry + PixelReadoutGeometryLib + SCT_ReadoutGeometry + TrkSpacePoint + SiSpacePoint + ) + +# Component(s) in the package: +atlas_add_component( InDetMeasurementUtilities + src/*.cxx + src/components/*.cxx + LINK_LIBRARIES + InDetMeasurementUtilitiesLib + GaudiKernel + AthenaBaseComps + StoreGateLib + BeamSpotConditionsData + ) + +atlas_install_scripts( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + diff --git a/InnerDetector/InDetMeasurementUtilities/InDetMeasurementUtilities/ClusterConversionUtilities.h b/InnerDetector/InDetMeasurementUtilities/InDetMeasurementUtilities/ClusterConversionUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..7c9e8dadd8ef6bd3f0d9235445cd8cca3691bcb2 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/InDetMeasurementUtilities/ClusterConversionUtilities.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CLUSTER_CONVERSION_UTILITIES_H +#define CLUSTER_CONVERSION_UTILITIES_H + +#include "InDetPrepRawData/PixelClusterContainer.h" +#include "InDetPrepRawData/SCT_ClusterContainer.h" + +#include "xAODInDetMeasurement/PixelClusterContainer.h" +#include "xAODInDetMeasurement/PixelClusterAuxContainer.h" +#include "xAODInDetMeasurement/StripClusterContainer.h" +#include "xAODInDetMeasurement/StripClusterAuxContainer.h" + +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" + +#include "InDetIdentifier/PixelID.h" +#include "InDetIdentifier/SCT_ID.h" + +namespace TrackingUtilities { + + StatusCode convertInDetToXaodCluster(const InDet::PixelCluster& indetCluster, + const InDetDD::SiDetectorElement& element, + xAOD::PixelCluster& xaodCluster); + + StatusCode convertInDetToXaodCluster(const InDet::SCT_Cluster& indetCluster, + const InDetDD::SiDetectorElement& element, + xAOD::StripCluster& xaodCluster); + + StatusCode convertXaodToInDetCluster(const xAOD::PixelCluster& xaodCluster, + const InDetDD::SiDetectorElement& element, + const PixelID& pixelID, + InDet::PixelCluster*& indetCluster); + + StatusCode convertXaodToInDetCluster(const xAOD::StripCluster& xaodCluster, + const InDetDD::SiDetectorElement& element, + const SCT_ID& stripID, + InDet::SCT_Cluster*& indetCluster, + double shift = 0.); +} // Namespace + +#endif diff --git a/InnerDetector/InDetMeasurementUtilities/InDetMeasurementUtilities/SpacePointConversionUtilities.h b/InnerDetector/InDetMeasurementUtilities/InDetMeasurementUtilities/SpacePointConversionUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..4775f383a093b6abb7322632f42b0cbbf928d614 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/InDetMeasurementUtilities/SpacePointConversionUtilities.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SPACEPOINT_CONVERSION_UTILITIES_H +#define SPACEPOINT_CONVERSION_UTILITIES_H + +#include "xAODInDetMeasurement/PixelClusterContainer.h" +#include "xAODInDetMeasurement/PixelClusterAuxContainer.h" +#include "xAODInDetMeasurement/StripClusterContainer.h" +#include "xAODInDetMeasurement/StripClusterAuxContainer.h" +#include "xAODInDetMeasurement/SpacePointContainer.h" +#include "xAODInDetMeasurement/SpacePointAuxContainer.h" + +#include "TrkSpacePoint/SpacePointContainer.h" +#include "TrkSpacePoint/SpacePointOverlapCollection.h" + +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "SiSpacePoint/PixelSpacePoint.h" + +#include "SiSpacePoint/SCT_SpacePoint.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetIdentifier/SCT_ID.h" + +namespace TrackingUtilities { + + StatusCode convertTrkToXaodPixelSpacePoint(const InDet::PixelSpacePoint& trkSpacePoint, + xAOD::SpacePoint& xaodSpacePoint); + + StatusCode convertTrkToXaodStripSpacePoint(const InDet::SCT_SpacePoint& trkSpacePoint, + const Amg::Vector3D& vertex, + xAOD::SpacePoint& xaodSpacePoint); + +} + +#endif diff --git a/InnerDetector/InDetMeasurementUtilities/share/CSV_InDetExporter.py b/InnerDetector/InDetMeasurementUtilities/share/CSV_InDetExporter.py new file mode 100755 index 0000000000000000000000000000000000000000..6f53af1e90f4dad0f18d261076452db73359ae51 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/share/CSV_InDetExporter.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from ROOT import xAOD, TFile +import os +import csv +from argparse import ArgumentParser +from numpy import asarray, array + +class CSVDumper: + + def __init__(self, inputAOD, outputDir, dict_variables_types, treename="CollectionTree", nEvents=-1): + + xAOD.Init() # Setting up ROOT tools + self.tree = xAOD.MakeTransientTree( TFile(inputAOD), treename ) + self.n_entries = self.tree.GetEntriesFast() + self.outputDir = outputDir + + if nEvents < 0 or nEvents > self.n_entries: # Getting number of events to run + self.nEvents = self.n_entries + else: + self.nEvents = nEvents + print(f"Running on {self.nEvents} events") + + os.system("mkdir -p "+self.outputDir) # Creating directory to store files + + # Container and Variables with their types that should be stored in csv format. Should be something like: + #{ + # "ContainerName": { "var1": "int", + # "var2": "float", + # } + #} + self.dict_variables_types = dict_variables_types + + def WriteCSV(self, filename, dictionary): + + with open(filename, "w") as out: + writer = csv.writer(out) + writer.writerow(dictionary.keys()) + writer.writerows( zip(*dictionary.values()) ) + print(f"New file saved: {filename}") + + def ArrayFloat3_to_CppArray(self, ArrayFloat3): # Check ArrayFloat3 in https://gitlab.cern.ch/atlas/athena/-/blob/master/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/SpacePoint_v1.h + arr = ArrayFloat3.data() + arr.reshape((3,)) + return list(arr) + + + def ProcessEvent(self, evt): + + # Getting aux variables based on the implementation of https://gitlab.cern.ch/atlas/athena/-/commit/fc5baf9fd2bb28c56f115fc2107a3ff159f1945d + print("--> Event "+str(evt)) + self.tree.GetEntry(evt) + EventNumber = self.tree.EventInfo.mcEventNumber() + + for container in self.dict_variables_types.keys(): + dict_lists = {} + dict_container = self.dict_variables_types[container] + try: + tp = getattr(self.tree, container) + except Exception: + print(".. Missing ", container) + continue + + for var,fmt in dict_container.items(): + sp = asarray( tp.getConstDataSpan[ fmt ]( var ) ) + + if "ArrayFloat3" in fmt: # Needed extra coding with dealing with xAOD::ArrayFloat3 instead of standard C++ array + sp = array( list( map(self.ArrayFloat3_to_CppArray, sp) ) ) + + if sp.ndim == 1: + dict_lists[var] = sp + else: + # Then we have an array. Each element of the array will be a column in the csv file. [We want things flat] + for column in range(sp.shape[1]): + dict_lists[var+f"_at{column}"] = sp.T[column] + + self.WriteCSV( filename=f"{self.outputDir}/{container}_event_{EventNumber}.csv", dictionary=dict_lists ) + + + def Run(self): + + for evt in range(self.nEvents): + self.ProcessEvent(evt) + + +if __name__ == "__main__": + + parser = ArgumentParser() + parser.add_argument('--inputAOD', type=str, default="") + parser.add_argument('--outputDir', type=str, default="") + parser.add_argument('--treename', type=str, default="CollectionTree") + parser.add_argument('--nEvents', type=int, default=-1) + args = parser.parse_args() + + if args.inputAOD == "": + raise Exception("No inputAOD was provided!") + + if args.outputDir == "": + raise Exception("No outputDir was provided!") + + dict_variables_types = { + #All obtained AuxElement content using the HitsToxAODCopier tool + "PixelHits": { "col": "int", "row": "int", "tot": "int", "eta_module": "int", "phi_module": "int", "layer_disk": "int", "barrel_ec": "int", "detid": "unsigned long"}, + "StripHits": { "strip": "int", "side": "int", "eta_module": "int", "phi_module": "int", "layer_disk": "int", "barrel_ec": "int", "detid": "unsigned long"}, + + #https://gitlab.cern.ch/atlas/athena/-/blob/master/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/PixelClusterAuxContainer_v1.h + "ITkPixelClusters": {"globalPosition":"std::array<float,3>", "channelsInPhi":"int", "channelsInEta":"int", "widthInEta":"float", "omegaX":"float", "omegaY":"float", "totalToT":"int", "totalCharge":"float", "energyLoss":"float", "splitProbability1":"float", "splitProbability2":"float", "lvl1a":"int", "localPosition":"std::array<float,3>", "localCovariance":"std::array<float,9>"}, + # ITkPixelClusters.isSplit is char with all ''? Keeping out for the moment + + #https://gitlab.cern.ch/atlas/athena/-/blob/master/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/StripClusterAuxContainer_v1.h + "ITkStripClusters": {"globalPosition":"std::array<float,3>", "channelsInPhi":"int", "localPosition":"std::array<float,3>", "localCovariance":"std::array<float,9>"}, + + #https://gitlab.cern.ch/atlas/athena/-/blob/master/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/SpacePoint_v1.h + "ITkStripSpacePoints": {"globalPosition":"std::array<float,3>", "radius":"float", "varianceR":"float", "varianceZ":"float", "topHalfStripLength":"float", "bottomHalfStripLength":"float", "topStripDirection":"xAOD::ArrayFloat3", "bottomStripDirection":"xAOD::ArrayFloat3", "stripCenterDistance":"xAOD::ArrayFloat3", "topStripCenter":"xAOD::ArrayFloat3"}, + + #https://gitlab.cern.ch/atlas/athena/-/blob/master/Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/versions/SpacePoint_v1.h + "ITkPixelSpacePoints": {"globalPosition":"std::array<float,3>", "radius":"float", "varianceR":"float", "varianceZ":"float"}, + + } + + Dumper = CSVDumper(inputAOD=args.inputAOD, + outputDir=args.outputDir, + dict_variables_types=dict_variables_types, + treename=args.treename, + nEvents=args.nEvents) + Dumper.Run() diff --git a/InnerDetector/InDetMeasurementUtilities/src/ClusterConversionUtilities.cxx b/InnerDetector/InDetMeasurementUtilities/src/ClusterConversionUtilities.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2993037f98899fe0982036fbfdff06e6fb644b3b --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/src/ClusterConversionUtilities.cxx @@ -0,0 +1,275 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetMeasurementUtilities/ClusterConversionUtilities.h" + +#include "PixelReadoutGeometry/PixelModuleDesign.h" +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" + +namespace TrackingUtilities { + + StatusCode convertInDetToXaodCluster(const InDet::PixelCluster& indetCluster, + const InDetDD::SiDetectorElement& element, + xAOD::PixelCluster& xaodCluster) + { + IdentifierHash idHash = element.identifyHash(); + + auto localPos = indetCluster.localPosition(); + auto localCov = indetCluster.localCovariance(); + + Eigen::Matrix<float,2,1> localPosition(localPos.x(), localPos.y()); + + Eigen::Matrix<float,2,2> localCovariance; + localCovariance.setZero(); + localCovariance(0, 0) = localCov(0, 0); + localCovariance(1, 1) = localCov(1, 1); + + auto globalPos = indetCluster.globalPosition(); + Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z()); + + auto RDOs = indetCluster.rdoList(); + auto ToTs = indetCluster.totList(); + auto charges = indetCluster.chargeList(); + auto width = indetCluster.width(); + auto omegaX = indetCluster.omegax(); + auto omegaY = indetCluster.omegay(); + auto isSplit = indetCluster.isSplit(); + auto splitProbability1 = indetCluster.splitProbability1(); + auto splitProbability2 = indetCluster.splitProbability2(); + + xaodCluster.setMeasurement<2>(idHash, localPosition, localCovariance); + xaodCluster.setRDOlist(RDOs); + xaodCluster.globalPosition() = globalPosition; + xaodCluster.setToTlist(ToTs); + xaodCluster.setChargelist(charges); + xaodCluster.setLVL1A(indetCluster.LVL1A()); + xaodCluster.setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]); + xaodCluster.setWidthInEta(static_cast<float>(width.widthPhiRZ()[1])); + xaodCluster.setOmegas(omegaX, omegaY); + xaodCluster.setIsSplit(isSplit); + xaodCluster.setSplitProbabilities(splitProbability1, splitProbability2); + + return StatusCode::SUCCESS; + } + + + StatusCode convertInDetToXaodCluster(const InDet::SCT_Cluster& indetCluster, + const InDetDD::SiDetectorElement& element, + xAOD::StripCluster& xaodCluster) + { + static const double one_over_twelve = 1. / 12.; + IdentifierHash idHash = element.identifyHash(); + + auto localPos = indetCluster.localPosition(); + auto localCov = indetCluster.localCovariance(); + + Eigen::Matrix<float,1,1> localPosition; + Eigen::Matrix<float,1,1> localCovariance; + localCovariance.setZero(); + + if (element.isBarrel()) { + localPosition(0, 0) = localPos.x(); + localCovariance(0, 0) = element.phiPitch() * element.phiPitch() * one_over_twelve; + } else { + InDetDD::SiCellId cellId = element.cellIdOfPosition(localPos); + const InDetDD::StripStereoAnnulusDesign *design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element.design()); + if ( design == nullptr ) { + return StatusCode::FAILURE; + } + InDetDD::SiLocalPosition localInPolar = design->localPositionOfCellPC(cellId); + localPosition(0, 0) = localInPolar.xPhi(); + localCovariance(0, 0) = design->phiPitchPhi() * design->phiPitchPhi() * one_over_twelve; + } + + auto globalPos = indetCluster.globalPosition(); + Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z()); + + auto RDOs = indetCluster.rdoList(); + auto width = indetCluster.width(); + + xaodCluster.setMeasurement<1>(idHash, localPosition, localCovariance); + xaodCluster.setRDOlist(RDOs); + xaodCluster.globalPosition() = globalPosition; + xaodCluster.setChannelsInPhi(width.colRow()[0]); + + return StatusCode::SUCCESS; + } + + StatusCode convertXaodToInDetCluster(const xAOD::PixelCluster& xaodCluster, + const InDetDD::SiDetectorElement& element, + const PixelID& pixelID, + InDet::PixelCluster*& indetCluster) + { + const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&element.design())); + if (design == nullptr) { + return StatusCode::FAILURE; + } + + const auto& locPos = xaodCluster.localPosition<2>(); + Amg::Vector2D localPosition(locPos(0,0), locPos(1,0)); + + InDetDD::SiLocalPosition centroid(localPosition); + const Identifier id = element.identifierOfPosition(centroid); + + const auto& globalPos = xaodCluster.globalPosition(); + Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0)); + + auto errorMatrix = Amg::MatrixX(2,2); + errorMatrix.setIdentity(); + errorMatrix.fillSymmetric(0, 0, xaodCluster.localCovariance<2>()(0, 0)); + errorMatrix.fillSymmetric(1, 1, xaodCluster.localCovariance<2>()(1, 1)); + + int colmax = std::numeric_limits<int>::min(); + int rowmax = std::numeric_limits<int>::min(); + int colmin = std::numeric_limits<int>::max(); + int rowmin = std::numeric_limits<int>::max(); + + const std::vector<Identifier>& rod_list_cluster = xaodCluster.rdoList(); + for (const auto& this_rdo : rod_list_cluster) { + const int row = pixelID.phi_index(this_rdo); + if (row > rowmax) + rowmax = row; + if (row < rowmin) + rowmin = row; + + const int col = pixelID.eta_index(this_rdo); + if (col > colmax) + colmax = col; + if (col < colmin) + colmin = col; + } + + double etaWidth = design->widthFromColumnRange(colmin, colmax); + double phiWidth = design->widthFromRowRange(rowmin, rowmax); + InDet::SiWidth width( Amg::Vector2D(xaodCluster.channelsInPhi(), xaodCluster.channelsInEta()), + Amg::Vector2D(phiWidth,etaWidth) ); + + indetCluster = new InDet::PixelCluster(id, + localPosition, + globalPosition, + xaodCluster.rdoList(), + xaodCluster.lvl1a(), + xaodCluster.totList(), + xaodCluster.chargeList(), + width, + &element, + errorMatrix, + xaodCluster.omegaX(), + xaodCluster.omegaY(), + xaodCluster.isSplit(), + xaodCluster.splitProbability1(), + xaodCluster.splitProbability2()); + + return StatusCode::SUCCESS; + } + + StatusCode convertXaodToInDetCluster(const xAOD::StripCluster& xaodCluster, + const InDetDD::SiDetectorElement& element, + const SCT_ID& stripID, + InDet::SCT_Cluster*& indetCluster, + double shift) + { + static const double one_over_twelve = 1. / 12.; + + bool isBarrel = element.isBarrel(); + const InDetDD::SCT_ModuleSideDesign* design = nullptr; + if (not isBarrel) { + design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&element.design()); + } else { + design = dynamic_cast<const InDetDD::SCT_ModuleSideDesign*>(&element.design()); + } + + if (design == nullptr) { + return StatusCode::FAILURE; + } + + const auto designShape = design->shape(); + + + const auto& rdoList = xaodCluster.rdoList(); + Identifier id = rdoList.front(); + + const auto& localPos = xaodCluster.localPosition<1>(); + + double pos_x = localPos(0, 0); + double pos_y = 0; + if (not isBarrel) { + const Identifier firstStripId = rdoList.front(); + int firstStrip = stripID.strip(firstStripId); + int stripRow = stripID.row(firstStripId); + int clusterSizeInStrips = xaodCluster.channelsInPhi(); + auto clusterPosition = design->localPositionOfCluster(design->strip1Dim(firstStrip, stripRow), clusterSizeInStrips); + pos_x = clusterPosition.xPhi() + shift; + pos_y = clusterPosition.xEta(); + } + + Amg::Vector2D locpos = Amg::Vector2D( pos_x, pos_y ); + + // Most of the following is taken from what is done in ClusterMakerTool + // Need to make this computation instead of using the local pos + // with local pos instead some differences w.r.t. reference are observed + const auto& firstStrip = stripID.strip(rdoList.front()); + const auto& lastStrip = stripID.strip(rdoList.back()); + const auto& row = stripID.row(rdoList.front()); + const int firstStrip1D = design->strip1Dim (firstStrip, row ); + const int lastStrip1D = design->strip1Dim( lastStrip, row ); + const InDetDD::SiCellId cell1(firstStrip1D); + const InDetDD::SiCellId cell2(lastStrip1D); + const InDetDD::SiLocalPosition firstStripPos( element.rawLocalPositionOfCell(cell1 )); + const InDetDD::SiLocalPosition lastStripPos( element.rawLocalPositionOfCell(cell2) ); + const InDetDD::SiLocalPosition centre( (firstStripPos+lastStripPos) * 0.5 ); + const double clusterWidth = design->stripPitch() * ( lastStrip - firstStrip + 1 ); + + const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->endsOfStrip(centre) ); + const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) ); + + InDet::SiWidth width( Amg::Vector2D(xaodCluster.channelsInPhi(), 1), + Amg::Vector2D(clusterWidth, stripLength) ); + + const double col_x = width.colRow().x(); + const double col_y = width.colRow().y(); + + double scale_factor = 1.; + if ( col_x == 1 ) + scale_factor = 1.05; + else if ( col_x == 2 ) + scale_factor = 0.27; + + auto errorMatrix = Amg::MatrixX(2,2); + errorMatrix.setIdentity(); + errorMatrix.fillSymmetric(0, 0, scale_factor * scale_factor * width.phiR() * width.phiR() * one_over_twelve); + errorMatrix.fillSymmetric(1, 1, width.z() * width.z() / col_y / col_y * one_over_twelve); + + if( designShape == InDetDD::Trapezoid or + designShape == InDetDD::Annulus) { + // rotation for endcap SCT + + // The following is being computed with the local position, + // without considering the lorentz shift + // So we remove it from the local position + Amg::Vector2D local(pos_x - shift, pos_y); + double sn = element.sinStereoLocal(local); + double sn2 = sn * sn; + double cs2 = 1. - sn2; + double w = element.phiPitch(local) / element.phiPitch(); + double v0 = errorMatrix(0,0) * w * w; + double v1 = errorMatrix(1,1); + errorMatrix.fillSymmetric( 0, 0, cs2 * v0 + sn2 * v1 ); + errorMatrix.fillSymmetric( 0, 1, sn * std::sqrt(cs2) * (v0 - v1) ); + errorMatrix.fillSymmetric( 1, 1, sn2 * v0 + cs2 * v1 ); + } + + indetCluster = new InDet::SCT_Cluster(id, + locpos, + rdoList, + width, + &element, + errorMatrix); + + return StatusCode::SUCCESS; + } + +} // Namespace + + diff --git a/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODClusterConversion.cxx b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODClusterConversion.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d485195971dd50f9cbbbfaf438b12436d6ca44e0 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODClusterConversion.cxx @@ -0,0 +1,152 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "src/InDetToXAODClusterConversion.h" +#include "InDetMeasurementUtilities/ClusterConversionUtilities.h" + +#include "Identifier/Identifier.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetIdentifier/SCT_ID.h" +#include "InDetPrepRawData/PixelClusterCollection.h" +#include "InDetPrepRawData/SCT_ClusterCollection.h" + +#include "StoreGate/WriteHandle.h" +#include "StoreGate/ReadHandle.h" + +#include "xAODInDetMeasurement/PixelClusterAuxContainer.h" +#include "xAODInDetMeasurement/StripClusterAuxContainer.h" + +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" + +#include "AthContainers/DataVector.h" +#include <iterator> + + + +using namespace InDet; + +// Constructor with parameters: +InDetToXAODClusterConversion::InDetToXAODClusterConversion(const std::string &name, ISvcLocator *pSvcLocator) : +AthReentrantAlgorithm(name, pSvcLocator) +{} + + +//----------------------------------------------------------------------------- +// Initialize method: +StatusCode InDetToXAODClusterConversion::initialize() { + ATH_MSG_INFO("Initializing " << name() << " ..."); + + ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID")); + ATH_CHECK(detStore()->retrieve(m_stripID,"SCT_ID")); + + ATH_CHECK( m_pixelDetEleCollKey.initialize() ); + ATH_CHECK( m_stripDetEleCollKey.initialize() ); + + ATH_CHECK( m_inputPixelClusterContainerKey.initialize() ); + ATH_CHECK( m_inputStripClusterContainerKey.initialize() ); + ATH_CHECK( m_outputPixelClusterContainerKey.initialize() ); + ATH_CHECK( m_outputStripClusterContainerKey.initialize() ); + + ATH_MSG_DEBUG( "Initialize done !" ); + return StatusCode::SUCCESS; +} + +//---------------------------------------------------------------------------- +// +StatusCode InDetToXAODClusterConversion::execute(const EventContext& ctx) const { + ATH_MSG_DEBUG("Executing " << name() << " ..."); + + ATH_MSG_DEBUG("Converting Pixel Clusters: InDet -> xAOD"); + ATH_CHECK( convertPixelClusters(ctx) ); + + ATH_MSG_DEBUG("Converting Strip Clusters: InDet -> xAOD"); + ATH_CHECK( convertStripClusters(ctx) ); + + return StatusCode::SUCCESS; +} + +StatusCode InDetToXAODClusterConversion::convertPixelClusters(const EventContext& ctx) const { + SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle(m_pixelDetEleCollKey, ctx); + const InDetDD::SiDetectorElementCollection* pixElements(*pixelDetEleHandle); + if (not pixelDetEleHandle.isValid() or pixElements==nullptr) { + ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available."); + return StatusCode::FAILURE; + } + + SG::WriteHandle<xAOD::PixelClusterContainer> outputPixelClusterContainer(m_outputPixelClusterContainerKey, ctx); + ATH_CHECK( outputPixelClusterContainer.record (std::make_unique<xAOD::PixelClusterContainer>(), + std::make_unique<xAOD::PixelClusterAuxContainer>()) ); + ATH_MSG_DEBUG( "Recorded xAOD::PixelClusterContainer with key: " << m_outputPixelClusterContainerKey.key() ); + + SG::ReadHandle<InDet::PixelClusterContainer> inputPixelClusterContainer(m_inputPixelClusterContainerKey, ctx); + + static const SG::AuxElement::Accessor< ElementLink< InDet::PixelClusterCollection > > pixelLinkAcc("pixelClusterLink"); + for (const auto *const clusterCollection : *inputPixelClusterContainer) { + if (!clusterCollection) continue; + for(const auto *const theCluster : *clusterCollection) { + Identifier clusterId = theCluster->identify(); + + const InDetDD::SiDetectorElement *element=pixElements->getDetectorElement(m_pixelID->wafer_hash(m_pixelID->wafer_id(clusterId))); + if ( element==nullptr ) { + ATH_MSG_FATAL( "Invalid pixel detector element for cluster identifier " << clusterId ); + return StatusCode::FAILURE; + } + + xAOD::PixelCluster * pixelCl = new xAOD::PixelCluster(); + outputPixelClusterContainer->push_back(pixelCl); + ATH_CHECK( TrackingUtilities::convertInDetToXaodCluster(*theCluster, *element, *pixelCl) ); + + // Create auxiliary branches accessors + ElementLink<InDet::PixelClusterCollection> pixelLink(theCluster, *clusterCollection); + pixelLinkAcc( *pixelCl ) = pixelLink; + } + } + + ATH_MSG_DEBUG("xAOD::PixelClusterContainer with size: " << outputPixelClusterContainer->size()); + return StatusCode::SUCCESS; +} + +StatusCode InDetToXAODClusterConversion::convertStripClusters(const EventContext& ctx) const { + SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> stripDetEleHandle(m_stripDetEleCollKey, ctx); + const InDetDD::SiDetectorElementCollection* stripElements(*stripDetEleHandle); + if (not stripDetEleHandle.isValid() or stripElements==nullptr) { + ATH_MSG_FATAL(m_stripDetEleCollKey.fullKey() << " is not available."); + return StatusCode::FAILURE; + } + + SG::WriteHandle<xAOD::StripClusterContainer> outputStripClusterContainer(m_outputStripClusterContainerKey, ctx); + ATH_CHECK( outputStripClusterContainer.record (std::make_unique<xAOD::StripClusterContainer>(), + std::make_unique<xAOD::StripClusterAuxContainer>()) ); + ATH_MSG_DEBUG( "Recorded xAOD::StripClusterContainer with key: " << m_outputStripClusterContainerKey.key() ); + + SG::ReadHandle<InDet::SCT_ClusterContainer> inputStripClusterContainer(m_inputStripClusterContainerKey, ctx); + + static const SG::AuxElement::Accessor< ElementLink< InDet::SCT_ClusterCollection > > stripLinkAcc("sctClusterLink"); + for (const auto *const clusterCollection : *inputStripClusterContainer) { + if (!clusterCollection) continue; + for(const auto *const theCluster : *clusterCollection) { + Identifier clusterId = theCluster->identify(); + + const InDetDD::SiDetectorElement *element=stripElements->getDetectorElement(m_stripID->wafer_hash(m_stripID->wafer_id(clusterId))); + if ( element==nullptr ) { + ATH_MSG_FATAL( "Invalid strip detector element for cluster with identifier " << clusterId ); + return StatusCode::FAILURE; + } + + + xAOD::StripCluster * stripCl = new xAOD::StripCluster(); + outputStripClusterContainer->push_back(stripCl); + ATH_CHECK( TrackingUtilities::convertInDetToXaodCluster(*theCluster, *element, *stripCl) ); + + // Create auxiliary branches accessors + ElementLink<InDet::SCT_ClusterCollection> stripLink(theCluster, *clusterCollection); + stripLinkAcc( *stripCl ) = stripLink; + } + } + + ATH_MSG_DEBUG("xAOD::StripClusterContainer with size: " << outputStripClusterContainer->size()); + + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/InDetToXAODClusterConversion.h b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODClusterConversion.h similarity index 95% rename from InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/InDetToXAODClusterConversion.h rename to InnerDetector/InDetMeasurementUtilities/src/InDetToXAODClusterConversion.h index 3742eb9ed85f241bb98de8655881fa1a34604f15..5b24610e06cd44e5966f44b9456cbf87958f151c 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/InDetToXAODClusterConversion.h +++ b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODClusterConversion.h @@ -55,6 +55,10 @@ public: InDetToXAODClusterConversion &operator=(const InDetToXAODClusterConversion&) = delete; //@} +private: + StatusCode convertPixelClusters(const EventContext& ctx) const; + StatusCode convertStripClusters(const EventContext& ctx) const; + private: const PixelID* m_pixelID {}; const SCT_ID* m_stripID {}; diff --git a/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODSpacePointConversion.cxx b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODSpacePointConversion.cxx new file mode 100644 index 0000000000000000000000000000000000000000..60bb5c2385bb91522bf8228c38d3d00ed58f8693 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODSpacePointConversion.cxx @@ -0,0 +1,158 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "src/InDetToXAODSpacePointConversion.h" +#include "InDetMeasurementUtilities/SpacePointConversionUtilities.h" + +#include "InDetPrepRawData/SiCluster.h" + +namespace InDet { + + InDetToXAODSpacePointConversion::InDetToXAODSpacePointConversion(const std::string &name, + ISvcLocator *pSvcLocator) + : AthReentrantAlgorithm(name, pSvcLocator) + {} + + StatusCode InDetToXAODSpacePointConversion::initialize() + { + ATH_MSG_DEBUG("Initializing " << name() << " ..."); + + ATH_CHECK( m_beamSpotKey.initialize() ); + + ATH_CHECK( m_inSpacepointsPixel.initialize() ); + ATH_CHECK( m_inSpacepointsStrip.initialize() ); + ATH_CHECK( m_inSpacepointsOverlap.initialize() ); + + ATH_CHECK( m_outSpacepointsPixel.initialize() ); + ATH_CHECK( m_outSpacepointsStrip.initialize() ); + ATH_CHECK( m_outSpacepointsOverlap.initialize() ); + + return StatusCode::SUCCESS; + } + + StatusCode InDetToXAODSpacePointConversion::execute(const EventContext& ctx) const + { + ATH_MSG_DEBUG("Executing " << name() << " ..."); + + // Conds + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; + const InDet::BeamSpotData* beamSpot = *beamSpotHandle; + auto vertex = beamSpot->beamVtx().position(); + + // Convert + ATH_CHECK( convertPixel(ctx) ); + ATH_CHECK( convertStrip(ctx, vertex) ); + ATH_CHECK( convertStripOverlap(ctx, vertex) ); + + return StatusCode::SUCCESS; + } + + StatusCode InDetToXAODSpacePointConversion::convertPixel(const EventContext& ctx) const + { + // Input + SG::ReadHandle< ::SpacePointContainer > pixel_handle = SG::makeHandle( m_inSpacepointsPixel, ctx ); + ATH_CHECK( pixel_handle.isValid() ); + const ::SpacePointContainer* pixel_container = pixel_handle.cptr(); + + // Output + std::unique_ptr< xAOD::SpacePointContainer > pixel_xaod_container = std::make_unique< xAOD::SpacePointContainer >(); + std::unique_ptr< xAOD::SpacePointAuxContainer > pixel_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >(); + pixel_xaod_container->setStore( pixel_xaod_aux_container.get() ); + + pixel_xaod_container->reserve(pixel_container->size()); + pixel_xaod_aux_container->reserve(pixel_container->size()); + + // Conversion + std::size_t counter = 0; + for (const ::SpacePointCollection *spc : *pixel_container) { + for (const Trk::SpacePoint *sp : *spc) { + const InDet::PixelSpacePoint *indetSP = dynamic_cast<const InDet::PixelSpacePoint *>(sp); + + pixel_xaod_container->push_back( new xAOD::SpacePoint() ); + ATH_CHECK( TrackingUtilities::convertTrkToXaodPixelSpacePoint(*indetSP, *pixel_xaod_container->back()) ); + pixel_xaod_container->back()->setMeasurementIndexes({counter++}); + } + } + + // Store + SG::WriteHandle< xAOD::SpacePointContainer > pixel_xaod_handle = SG::makeHandle( m_outSpacepointsPixel, ctx ); + ATH_CHECK( pixel_xaod_handle.record( std::move(pixel_xaod_container), std::move(pixel_xaod_aux_container) ) ); + + return StatusCode::SUCCESS; + } + + StatusCode InDetToXAODSpacePointConversion::convertStrip(const EventContext& ctx, + const Amg::Vector3D& vertex) const + { + // Input + SG::ReadHandle< ::SpacePointContainer > strip_handle = SG::makeHandle( m_inSpacepointsStrip, ctx ); + ATH_CHECK( strip_handle.isValid() ); + const ::SpacePointContainer* strip_container = strip_handle.cptr(); + + // Output + std::unique_ptr< xAOD::SpacePointContainer > strip_xaod_container = std::make_unique< xAOD::SpacePointContainer >(); + std::unique_ptr< xAOD::SpacePointAuxContainer > strip_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >(); + strip_xaod_container->setStore( strip_xaod_aux_container.get() ); + + strip_xaod_container->reserve(strip_container->size()); + strip_xaod_aux_container->reserve(strip_container->size()); + + // Conversion + std::size_t counter = 0; + for (const ::SpacePointCollection *spc : *strip_container) { + for (const Trk::SpacePoint *sp : *spc) { + const InDet::SCT_SpacePoint *indetSP = dynamic_cast<const InDet::SCT_SpacePoint *>(sp); + + strip_xaod_container->push_back( new xAOD::SpacePoint() ); + ATH_CHECK( TrackingUtilities::convertTrkToXaodStripSpacePoint(*indetSP, vertex, *strip_xaod_container->back()) ); + strip_xaod_container->back()->setMeasurementIndexes({counter, counter++}); + } + } + + // Store + SG::WriteHandle< xAOD::SpacePointContainer > strip_xaod_handle = SG::makeHandle( m_outSpacepointsStrip, ctx ); + ATH_CHECK( strip_xaod_handle.record( std::move(strip_xaod_container), std::move(strip_xaod_aux_container) ) ); + + return StatusCode::SUCCESS; + } + + + StatusCode InDetToXAODSpacePointConversion::convertStripOverlap(const EventContext& ctx, + const Amg::Vector3D& vertex) const + { + // Inputs + SG::ReadHandle< ::SpacePointOverlapCollection > strip_overlap_handle = SG::makeHandle( m_inSpacepointsOverlap, ctx ); + ATH_CHECK( strip_overlap_handle.isValid() ); + const ::SpacePointOverlapCollection* strip_overlap_container = strip_overlap_handle.cptr(); + + // Outputs + std::unique_ptr< xAOD::SpacePointContainer > strip_overlap_xaod_container = std::make_unique< xAOD::SpacePointContainer >(); + std::unique_ptr< xAOD::SpacePointAuxContainer > strip_overlap_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >(); + strip_overlap_xaod_container->setStore( strip_overlap_xaod_aux_container.get() ); + + strip_overlap_xaod_container->reserve(strip_overlap_container->size()); + strip_overlap_xaod_aux_container->reserve(strip_overlap_container->size()); + + // Conversion + static const SG::AuxElement::Accessor< ElementLink< ::SpacePointOverlapCollection > > stripSpacePointLinkAcc("stripOverlapSpacePointLink"); + std::size_t counter = 0; + for (const Trk::SpacePoint *sp : *strip_overlap_container) { + const InDet::SCT_SpacePoint *indetSP = dynamic_cast<const InDet::SCT_SpacePoint *>(sp); + + strip_overlap_xaod_container->push_back( new xAOD::SpacePoint() ); + ATH_CHECK( TrackingUtilities::convertTrkToXaodStripSpacePoint(*indetSP, vertex, *strip_overlap_xaod_container->back()) ); + strip_overlap_xaod_container->back()->setMeasurementIndexes({counter, counter++}); + + ElementLink< ::SpacePointOverlapCollection > TrkLink(sp, *strip_overlap_container); + stripSpacePointLinkAcc( *strip_overlap_xaod_container->back() ) = TrkLink; + } + + // Store + SG::WriteHandle< xAOD::SpacePointContainer > strip_overlap_xaod_handle = SG::makeHandle( m_outSpacepointsOverlap, ctx ); + ATH_CHECK( strip_overlap_xaod_handle.record( std::move(strip_overlap_xaod_container), std::move(strip_overlap_xaod_aux_container) ) ); + + return StatusCode::SUCCESS; + } + +} diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/TrkToXAODSpacePointConversion.h b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODSpacePointConversion.h similarity index 82% rename from InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/TrkToXAODSpacePointConversion.h rename to InnerDetector/InDetMeasurementUtilities/src/InDetToXAODSpacePointConversion.h index 30f3c189070070f6ffcd892fe21f02523a9d5b5f..5cbe4e462e9851da1374c7d9391e73e126ec3477 100644 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/TrkToXAODSpacePointConversion.h +++ b/InnerDetector/InDetMeasurementUtilities/src/InDetToXAODSpacePointConversion.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRKTOXAOD_SPACEPOINT_CONVERSION_H -#define TRKTOXAOD_SPACEPOINT_CONVERSION_H +#ifndef INDETTOXAOD_SPACEPOINT_CONVERSION_H +#define INDETTOXAOD_SPACEPOINT_CONVERSION_H #include "AthenaBaseComps/AthReentrantAlgorithm.h" @@ -17,22 +17,17 @@ namespace InDet { - class TrkToXAODSpacePointConversion : + class InDetToXAODSpacePointConversion : public AthReentrantAlgorithm { public: /// Constructor with parameters: - TrkToXAODSpacePointConversion(const std::string &name, ISvcLocator *pSvcLocator); - + InDetToXAODSpacePointConversion(const std::string &name, ISvcLocator *pSvcLocator); + //@name Usual algorithm methods //@{ virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& ctx) const override; //@{ - //@} - TrkToXAODSpacePointConversion() = delete; - TrkToXAODSpacePointConversion(const TrkToXAODSpacePointConversion&) = delete; - TrkToXAODSpacePointConversion &operator=(const TrkToXAODSpacePointConversion&) = delete; - //@} private: StatusCode convertPixel(const EventContext& ctx) const; diff --git a/InnerDetector/InDetMeasurementUtilities/src/SpacePointConversionUtilities.cxx b/InnerDetector/InDetMeasurementUtilities/src/SpacePointConversionUtilities.cxx new file mode 100644 index 0000000000000000000000000000000000000000..524fbc5ae907051698fa491d106685ae8eb341f7 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/src/SpacePointConversionUtilities.cxx @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetMeasurementUtilities/SpacePointConversionUtilities.h" + +#include "InDetPrepRawData/SiCluster.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" + +namespace TrackingUtilities { + + StatusCode convertTrkToXaodPixelSpacePoint(const InDet::PixelSpacePoint& trkSpacePoint, + xAOD::SpacePoint& xaodSpacePoint) + { + unsigned int idHash = trkSpacePoint.elementIdList().first; + const auto& globPos = trkSpacePoint.globalPosition(); + + const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(trkSpacePoint.clusterList().first); + const InDetDD::SiDetectorElement *de = c->detectorElement(); + const Amg::Transform3D &Tp = de->surface().transform(); + + float r_3 = static_cast<float>( Tp(0,2) ); + float r_4 = static_cast<float>( Tp(1,2) ); + float r_5 = static_cast<float>( Tp(2,2) ); + + const Amg::MatrixX& v = c->localCovariance(); + float f22 = static_cast<float>( v(1,1) ); + float wid = static_cast<float>( c->width().z() ); + float cov = wid*wid*.08333; + if(cov < f22) cov = f22; + float covr = 6 * cov * (r_5*r_5); + float covz = 6 * cov * (r_3*r_3 + r_4*r_4); + + xaodSpacePoint.setSpacePoint(idHash, + globPos.cast<float>(), + covr, + covz, + {static_cast<std::size_t>(0)}); + + return StatusCode::SUCCESS; + } + + StatusCode convertTrkToXaodStripSpacePoint(const InDet::SCT_SpacePoint& trkSpacePoint, + const Amg::Vector3D& vertex, + xAOD::SpacePoint& xaodSpacePoint) + { + std::pair<unsigned int, unsigned int> idHashes = trkSpacePoint.elementIdList(); + const auto& globPos = trkSpacePoint.globalPosition(); + + const InDet::SiCluster *c0 = static_cast<const InDet::SiCluster *>(trkSpacePoint.clusterList().first); + const InDet::SiCluster *c1 = static_cast<const InDet::SiCluster *>(trkSpacePoint.clusterList().second); + const InDetDD::SiDetectorElement *d0 = c0->detectorElement(); + const InDetDD::SiDetectorElement *d1 = c1->detectorElement(); + + Amg::Vector2D lc0 = c0->localPosition(); + Amg::Vector2D lc1 = c1->localPosition(); + + std::pair<Amg::Vector3D, Amg::Vector3D> e0 = + (d0->endsOfStrip(InDetDD::SiLocalPosition(lc0.y(), lc0.x(), 0.))); + std::pair<Amg::Vector3D, Amg::Vector3D> e1 = + (d1->endsOfStrip(InDetDD::SiLocalPosition(lc1.y(), lc1.x(), 0.))); + + auto stripCenter_1 = 0.5 * (e0.first + e0.second); + auto stripDir_1 = e0.first - e0.second; + auto trajDir_1 = 2. * ( stripCenter_1 - vertex); + + auto stripCenter_2 = 0.5 * (e1.first + e1.second); + auto stripDir_2 = e1.first - e1.second; + + float topHalfStripLength = 0.5 * stripDir_1.norm(); + Eigen::Matrix<double, 3, 1> topStripDirection = - stripDir_1 / (2. * topHalfStripLength); + Eigen::Matrix<double, 3, 1> topStripCenter = 0.5 * trajDir_1; + float bottomHalfStripLength = 0.5 * stripDir_2.norm(); + Eigen::Matrix<double, 3, 1> bottomStripDirection = - stripDir_2 / (2. * bottomHalfStripLength); + Eigen::Matrix<double, 3, 1> stripCenterDistance = stripCenter_1 - stripCenter_2; + + const Amg::MatrixX& v = trkSpacePoint.localCovariance(); + float f22 = static_cast<float>( v(1,1) ); + + float covr = d0->isBarrel() ? .1 : 8.*f22; + float covz = d0->isBarrel() ? 8.*f22 : .1; + + xaodSpacePoint.setSpacePoint({idHashes.first, idHashes.second}, + globPos.cast<float>(), + covr, + covz, + {static_cast<std::size_t>(0), static_cast<std::size_t>(0)}, + topHalfStripLength, + bottomHalfStripLength, + topStripDirection.cast<float>(), + bottomStripDirection.cast<float>(), + stripCenterDistance.cast<float>(), + topStripCenter.cast<float>()); + + return StatusCode::SUCCESS; + } + +} diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/XAODToInDetClusterConversion.cxx b/InnerDetector/InDetMeasurementUtilities/src/XAODToInDetClusterConversion.cxx similarity index 53% rename from InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/XAODToInDetClusterConversion.cxx rename to InnerDetector/InDetMeasurementUtilities/src/XAODToInDetClusterConversion.cxx index cae2db0bbe340419c719f7e88283516792c2e0eb..b186c2ad09d018eefdd2f3fa684a56183d9f9346 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/XAODToInDetClusterConversion.cxx +++ b/InnerDetector/InDetMeasurementUtilities/src/XAODToInDetClusterConversion.cxx @@ -1,8 +1,10 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "InDetPrepRawDataFormation/XAODToInDetClusterConversion.h" +#include "src/XAODToInDetClusterConversion.h" +#include "InDetMeasurementUtilities/ClusterConversionUtilities.h" + #include "InDetIdentifier/PixelID.h" #include "InDetIdentifier/SCT_ID.h" #include "xAODInDetMeasurement/ContainerAccessor.h" @@ -14,50 +16,50 @@ #include <cmath> namespace InDet { - + XAODToInDetClusterConversion::XAODToInDetClusterConversion(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) {} - + StatusCode XAODToInDetClusterConversion::initialize() { - ATH_MSG_DEBUG( "Initializing " << name() << " ... " ); - + ATH_MSG_INFO( "Initializing " << name() << " ... " ); + // Pixel Clusters ATH_CHECK( m_pixelDetEleCollKey.initialize() ); ATH_CHECK( detStore()->retrieve(m_pixelID,"PixelID") ); - + ATH_CHECK( m_inputPixelClusterContainerKey.initialize() ); ATH_CHECK( m_pixelClusterContainerLinkKey.initialize() ); ATH_CHECK( m_outputPixelClusterContainerKey.initialize() ); - + // Strip Clusters ATH_CHECK( m_stripDetEleCollKey.initialize() ); ATH_CHECK( detStore()->retrieve(m_stripID, "SCT_ID") ); - + ATH_CHECK( m_inputStripClusterContainerKey.initialize() ); ATH_CHECK( m_stripClusterContainerLinkKey.initialize() ); ATH_CHECK( m_outputStripClusterContainerKey.initialize() ); - + ATH_CHECK( m_lorentzAngleTool.retrieve() ); - + return StatusCode::SUCCESS; } - + StatusCode XAODToInDetClusterConversion::execute(const EventContext& ctx) const { ATH_MSG_DEBUG( "Executing " << name() << " ... " ); - + ATH_MSG_DEBUG("Converting Pixel Clusters: xAOD -> InDet"); ATH_CHECK( convertPixelClusters(ctx) ); - + ATH_MSG_DEBUG("Converting Strip Clusters: xAOD -> InDet"); ATH_CHECK( convertStripClusters(ctx) ); - + return StatusCode::SUCCESS; } - + StatusCode XAODToInDetClusterConversion::convertPixelClusters(const EventContext& ctx) const { SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle( m_pixelDetEleCollKey, ctx ); @@ -94,79 +96,15 @@ namespace InDet { return StatusCode::FAILURE; } - const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design())); - if (design == nullptr) { - ATH_MSG_ERROR("Could not retrieve InDetDD::PixelModuleDesign from element with hashId: " << hashId); - return StatusCode::FAILURE; - } - std::unique_ptr<InDet::PixelClusterCollection> collection = std::make_unique<InDet::PixelClusterCollection>(hashId); // Get the detector element and range for the idHash for (const auto& this_range : pixelAccessor.rangesForIdentifierDirect(hashId)) { - for (auto start = this_range.first; start != this_range.second; start++) { + for (auto start = this_range.first; start != this_range.second; ++start) { const xAOD::PixelCluster* in_cluster = *start; - const auto& locPos = in_cluster->localPosition<2>(); - Amg::Vector2D localPosition(locPos(0,0), locPos(1,0)); - - InDetDD::SiLocalPosition centroid(localPosition); - const Identifier id = element->identifierOfPosition(centroid); - - const auto& globalPos = in_cluster->globalPosition(); - Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0)); - - bool isSplit = static_cast<bool>(in_cluster->isSplit()); - - auto errorMatrix = Amg::MatrixX(2,2); - errorMatrix.setIdentity(); - errorMatrix.fillSymmetric(0, 0, in_cluster->localCovariance<2>()(0, 0)); - errorMatrix.fillSymmetric(1, 1, in_cluster->localCovariance<2>()(1, 1)); - - int colmax = std::numeric_limits<int>::min(); - int rowmax = std::numeric_limits<int>::min(); - int colmin = std::numeric_limits<int>::max(); - int rowmin = std::numeric_limits<int>::max(); - - const std::vector<Identifier>& rod_list_cluster = in_cluster->rdoList(); - for (const auto& this_rdo : rod_list_cluster) { - const int row = m_pixelID->phi_index(this_rdo); - if (row > rowmax) - rowmax = row; - if (row < rowmin) - rowmin = row; - - const int col = m_pixelID->eta_index(this_rdo); - if (col > colmax) - colmax = col; - if (col < colmin) - colmin = col; - } - - double etaWidth = design->widthFromColumnRange(colmin, colmax); - double phiWidth = design->widthFromRowRange(rowmin, rowmax); - InDet::SiWidth width( Amg::Vector2D(in_cluster->channelsInPhi(), in_cluster->channelsInEta()), - Amg::Vector2D(phiWidth,etaWidth) ); - - - - // Create Cluster - InDet::PixelCluster* cluster = new InDet::PixelCluster(id, - localPosition, - globalPosition, - in_cluster->rdoList(), - in_cluster->lvl1a(), - in_cluster->totList(), - in_cluster->chargeList(), - width, - element, - errorMatrix, - in_cluster->omegaX(), - in_cluster->omegaY(), - isSplit, - in_cluster->splitProbability1(), - in_cluster->splitProbability2()); - + InDet::PixelCluster* cluster = nullptr; + ATH_CHECK( TrackingUtilities::convertXaodToInDetCluster(*in_cluster, *element, *m_pixelID, cluster) ); cluster->setHashAndIndex(hashId, collection->size()); // Add to Collection @@ -224,20 +162,6 @@ namespace InDet { bool isBarrel = element->isBarrel(); - const InDetDD::SCT_ModuleSideDesign* design = nullptr; - if (not isBarrel) { - design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&element->design()); - } else { - design = dynamic_cast<const InDetDD::SCT_ModuleSideDesign*>(&element->design()); - } - - if (design == nullptr) { - ATH_MSG_ERROR( "Could not retrieve InDetDD::SCT_ModuleSideDesign from element with hashId: " << hashId ); - return StatusCode::FAILURE; - } - - const auto designShape = design->shape(); - double shift = not isBarrel ? m_lorentzAngleTool->getLorentzShift(hashId) : 0.; @@ -247,92 +171,11 @@ namespace InDet { // Get the detector element and range for the idHash for (const auto& this_range : stripAccessor.rangesForIdentifierDirect(hashId)) { - for (auto start = this_range.first; start != this_range.second; start++) { + for (auto start = this_range.first; start != this_range.second; ++start) { const xAOD::StripCluster* in_cluster = *start; - const auto& rdoList = in_cluster->rdoList(); - Identifier id = rdoList.front(); - - const auto& localPos = in_cluster->localPosition<1>(); - - double pos_x = localPos(0, 0); - double pos_y = 0; - if (not isBarrel) { - const Identifier firstStripId = rdoList.front(); - int firstStrip = m_stripID->strip(firstStripId); - int stripRow = m_stripID->row(firstStripId); - int clusterSizeInStrips = in_cluster->channelsInPhi(); - auto clusterPosition = design->localPositionOfCluster(design->strip1Dim(firstStrip, stripRow), clusterSizeInStrips); - pos_x = clusterPosition.xPhi() + shift; - pos_y = clusterPosition.xEta(); - } - - Amg::Vector2D locpos = Amg::Vector2D( pos_x, pos_y ); - - // Most of the following is taken from what is done in ClusterMakerTool - - // Need to make this computation instead of using the local pos - // with local pos instead some differences w.r.t. reference are observed - const auto& firstStrip = m_stripID->strip(rdoList.front()); - const auto& lastStrip = m_stripID->strip(rdoList.back()); - const auto& row = m_stripID->row(rdoList.front()); - const int firstStrip1D = design->strip1Dim (firstStrip, row ); - const int lastStrip1D = design->strip1Dim( lastStrip, row ); - const InDetDD::SiCellId cell1(firstStrip1D); - const InDetDD::SiCellId cell2(lastStrip1D); - const InDetDD::SiLocalPosition firstStripPos( element->rawLocalPositionOfCell(cell1 )); - const InDetDD::SiLocalPosition lastStripPos( element->rawLocalPositionOfCell(cell2) ); - const InDetDD::SiLocalPosition centre( (firstStripPos+lastStripPos)*0.5 ); - const double clusterWidth = design->stripPitch() * ( lastStrip - firstStrip + 1 ); - - const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->endsOfStrip(centre) ); - const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) ); - - InDet::SiWidth width( Amg::Vector2D(in_cluster->channelsInPhi(), 1), - Amg::Vector2D(clusterWidth, stripLength) ); - - const double col_x = width.colRow().x(); - const double col_y = width.colRow().y(); - - double scale_factor = 1.; - if ( col_x == 1 ) - scale_factor = 1.05; - else if ( col_x == 2 ) - scale_factor = 0.27; - - auto errorMatrix = Amg::MatrixX(2,2); - errorMatrix.setIdentity(); - errorMatrix.fillSymmetric(0, 0, scale_factor * scale_factor * width.phiR() * width.phiR() / 12.); - errorMatrix.fillSymmetric(1, 1, width.z() * width.z() / col_y / col_y / 12.); - - if( designShape == InDetDD::Trapezoid or - designShape == InDetDD::Annulus) { - // rotation for endcap SCT - - // The following is being computed with the local position, - // without considering the lorentz shift - // So we remove it from the local position - Amg::Vector2D local(pos_x - shift, pos_y); - double sn = element->sinStereoLocal(local); - double sn2 = sn * sn; - double cs2 = 1. - sn2; - double w = element->phiPitch(local) / element->phiPitch(); - double v0 = errorMatrix(0,0) * w * w; - double v1 = errorMatrix(1,1); - errorMatrix.fillSymmetric( 0, 0, cs2 * v0 + sn2 * v1 ); - errorMatrix.fillSymmetric( 0, 1, sn * std::sqrt(cs2) * (v0 - v1) ); - errorMatrix.fillSymmetric( 1, 1, sn2 * v0 + cs2 * v1 ); - } - - // Create Cluster - InDet::SCT_Cluster* cluster = new InDet::SCT_Cluster(id, - locpos, - rdoList, - width, - element, - errorMatrix); - cluster->setHitsInThirdTimeBin( in_cluster->hitsInThirdTimeBin() ); - + InDet::SCT_Cluster* cluster = nullptr; + ATH_CHECK( TrackingUtilities::convertXaodToInDetCluster(*in_cluster, *element, *m_stripID, cluster, shift) ); cluster->setHashAndIndex(hashId, collection->size()); // Add to Collection diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/XAODToInDetClusterConversion.h b/InnerDetector/InDetMeasurementUtilities/src/XAODToInDetClusterConversion.h similarity index 98% rename from InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/XAODToInDetClusterConversion.h rename to InnerDetector/InDetMeasurementUtilities/src/XAODToInDetClusterConversion.h index 11acbf00649fafbed0c552dfd0c7f57e624929ef..307f6b386a437cd2754824f2682030904e8da767 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/InDetPrepRawDataFormation/XAODToInDetClusterConversion.h +++ b/InnerDetector/InDetMeasurementUtilities/src/XAODToInDetClusterConversion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETRIOMAKER_XAODTOINDETCLUSTERCONVERSION_H diff --git a/InnerDetector/InDetMeasurementUtilities/src/components/InDetMeasurementUtilities_entries.cxx b/InnerDetector/InDetMeasurementUtilities/src/components/InDetMeasurementUtilities_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..233470ee592df9ab25caf361bae251052060a8b6 --- /dev/null +++ b/InnerDetector/InDetMeasurementUtilities/src/components/InDetMeasurementUtilities_entries.cxx @@ -0,0 +1,12 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "src/InDetToXAODClusterConversion.h" +#include "src/XAODToInDetClusterConversion.h" +#include "src/InDetToXAODSpacePointConversion.h" + +DECLARE_COMPONENT( InDet::InDetToXAODClusterConversion ) +DECLARE_COMPONENT( InDet::XAODToInDetClusterConversion ) +DECLARE_COMPONENT( InDet::InDetToXAODSpacePointConversion ) + diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/InDetToXAODClusterConversion.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/InDetToXAODClusterConversion.cxx deleted file mode 100644 index 2719c68d56cbe95af74cf669832fa4948723811a..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/InDetToXAODClusterConversion.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "InDetPrepRawDataFormation/InDetToXAODClusterConversion.h" - -#include "Identifier/Identifier.h" -#include "InDetIdentifier/PixelID.h" -#include "InDetIdentifier/SCT_ID.h" -#include "InDetPrepRawData/PixelClusterCollection.h" -#include "InDetPrepRawData/SCT_ClusterCollection.h" - -#include "StoreGate/WriteHandle.h" -#include "StoreGate/ReadHandle.h" - -#include "xAODMeasurementBase/UncalibratedMeasurement.h" -#include "xAODInDetMeasurement/PixelClusterAuxContainer.h" -#include "xAODInDetMeasurement/StripClusterAuxContainer.h" - -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" - -#include "AthContainers/DataVector.h" -#include <iterator> - -using namespace InDet; - -// Constructor with parameters: -InDetToXAODClusterConversion::InDetToXAODClusterConversion(const std::string &name, ISvcLocator *pSvcLocator) : -AthReentrantAlgorithm(name, pSvcLocator) -{} - - -//----------------------------------------------------------------------------- -// Initialize method: -StatusCode InDetToXAODClusterConversion::initialize(){ - - ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID")); - ATH_CHECK(detStore()->retrieve(m_stripID,"SCT_ID")); - - ATH_CHECK( m_pixelDetEleCollKey.initialize() ); - ATH_CHECK( m_stripDetEleCollKey.initialize() ); - - ATH_CHECK( m_inputPixelClusterContainerKey.initialize() ); - ATH_CHECK( m_inputStripClusterContainerKey.initialize() ); - ATH_CHECK( m_outputPixelClusterContainerKey.initialize() ); - ATH_CHECK( m_outputStripClusterContainerKey.initialize() ); - - ATH_MSG_DEBUG( "Initialize done !" ); - return StatusCode::SUCCESS; -} - -//---------------------------------------------------------------------------- -// -StatusCode InDetToXAODClusterConversion::execute(const EventContext& ctx) const { - - SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle(m_pixelDetEleCollKey, ctx); - const InDetDD::SiDetectorElementCollection* pixElements(*pixelDetEleHandle); - if (not pixelDetEleHandle.isValid() or pixElements==nullptr) { - ATH_MSG_FATAL(m_pixelDetEleCollKey.fullKey() << " is not available."); - return StatusCode::FAILURE; - } - - SG::WriteHandle<xAOD::PixelClusterContainer> outputPixelClusterContainer(m_outputPixelClusterContainerKey, ctx); - ATH_CHECK( outputPixelClusterContainer.record (std::make_unique<xAOD::PixelClusterContainer>(), - std::make_unique<xAOD::PixelClusterAuxContainer>()) ); - ATH_MSG_DEBUG( "Recorded xAOD::PixelClusterContainer with key: " << m_outputPixelClusterContainerKey.key() ); - - SG::ReadHandle<InDet::PixelClusterContainer> inputPixelClusterContainer(m_inputPixelClusterContainerKey, ctx); - - for (const auto *const clusterCollection : *inputPixelClusterContainer) { - if (!clusterCollection) continue; - for(const auto *const theCluster : *clusterCollection) { - Identifier clusterId = theCluster->identify(); - - const InDetDD::SiDetectorElement *element=pixElements->getDetectorElement(m_pixelID->wafer_hash(m_pixelID->wafer_id(clusterId))); - if ( element==nullptr ) { - ATH_MSG_FATAL( "Invalid pixel detector element for cluster identifier " << clusterId ); - return StatusCode::FAILURE; - } - IdentifierHash idHash = element->identifyHash(); - - auto localPos = theCluster->localPosition(); - auto localCov = theCluster->localCovariance(); - - Eigen::Matrix<float,2,1> localPosition(localPos.x(), localPos.y()); - - Eigen::Matrix<float,2,2> localCovariance; - localCovariance.setZero(); - localCovariance(0, 0) = localCov(0, 0); - localCovariance(1, 1) = localCov(1, 1); - - auto globalPos = theCluster->globalPosition(); - Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z()); - - auto RDOs = theCluster->rdoList(); - auto ToTs = theCluster->totList(); - auto charges = theCluster->chargeList(); - auto width = theCluster->width(); - auto omegaX = theCluster->omegax(); - auto omegaY = theCluster->omegay(); - auto isSplit = theCluster->isSplit(); - auto splitProbability1 = theCluster->splitProbability1(); - auto splitProbability2 = theCluster->splitProbability2(); - - xAOD::PixelCluster * pixelCl = new xAOD::PixelCluster(); - outputPixelClusterContainer->push_back(pixelCl); - - pixelCl->setMeasurement<2>(idHash, localPosition, localCovariance); - pixelCl->setRDOlist(RDOs); - pixelCl->globalPosition() = globalPosition; - pixelCl->setToTlist(ToTs); - pixelCl->setChargelist(charges); - pixelCl->setLVL1A(theCluster->LVL1A()); - pixelCl->setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]); - pixelCl->setOmegas(omegaX, omegaY); - pixelCl->setIsSplit(isSplit); - pixelCl->setSplitProbabilities(splitProbability1, splitProbability2); - - // Create auxiliary branches accessors - const SG::AuxElement::Accessor< ElementLink< InDet::PixelClusterCollection > > pixelLinkAcc("pixelClusterLink"); - ElementLink<InDet::PixelClusterCollection> pixelLink(theCluster, *clusterCollection); - pixelLinkAcc( *pixelCl ) = pixelLink; - - } - } - - ATH_MSG_DEBUG("xAOD::PixelClusterContainer with size: " << outputPixelClusterContainer->size()); - - SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> stripDetEleHandle(m_stripDetEleCollKey, ctx); - const InDetDD::SiDetectorElementCollection* stripElements(*stripDetEleHandle); - if (not stripDetEleHandle.isValid() or stripElements==nullptr) { - ATH_MSG_FATAL(m_stripDetEleCollKey.fullKey() << " is not available."); - return StatusCode::FAILURE; - } - - SG::WriteHandle<xAOD::StripClusterContainer> outputStripClusterContainer(m_outputStripClusterContainerKey, ctx); - ATH_CHECK( outputStripClusterContainer.record (std::make_unique<xAOD::StripClusterContainer>(), - std::make_unique<xAOD::StripClusterAuxContainer>()) ); - ATH_MSG_DEBUG( "Recorded xAOD::StripClusterContainer with key: " << m_outputStripClusterContainerKey.key() ); - - SG::ReadHandle<InDet::SCT_ClusterContainer> inputStripClusterContainer(m_inputStripClusterContainerKey, ctx); - for (const auto *const clusterCollection : *inputStripClusterContainer) { - if (!clusterCollection) continue; - for(const auto *const theCluster : *clusterCollection) { - Identifier clusterId = theCluster->identify(); - - const InDetDD::SiDetectorElement *element=stripElements->getDetectorElement(m_stripID->wafer_hash(m_stripID->wafer_id(clusterId))); - if ( element==nullptr ) { - ATH_MSG_FATAL( "Invalid strip detector element for cluster with identifier " << clusterId ); - return StatusCode::FAILURE; - } - - IdentifierHash idHash = element->identifyHash(); - - auto localPos = theCluster->localPosition(); - auto localCov = theCluster->localCovariance(); - - Eigen::Matrix<float,1,1> localPosition; - Eigen::Matrix<float,1,1> localCovariance; - localCovariance.setZero(); - - if (element->isBarrel()) { - localPosition(0, 0) = localPos.x(); - localCovariance(0, 0) = element->phiPitch()*element->phiPitch()/12.; - } else { - InDetDD::SiCellId cellId = element->cellIdOfPosition(localPos); - const InDetDD::StripStereoAnnulusDesign *design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element->design()); - if ( design==nullptr ) { - ATH_MSG_FATAL( "Invalid strip annulus design for module with identifier/identifierHash " << element->identify() << "/" << idHash); - return StatusCode::FAILURE; - } - InDetDD::SiLocalPosition localInPolar = design->localPositionOfCellPC(cellId); - localPosition(0, 0) = localInPolar.xPhi(); - localCovariance(0, 0) = design->phiPitchPhi()*design->phiPitchPhi()/12.; - } - - auto globalPos = theCluster->globalPosition(); - Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z()); - - auto RDOs = theCluster->rdoList(); - auto width = theCluster->width(); - - xAOD::StripCluster * stripCl = new xAOD::StripCluster(); - outputStripClusterContainer->push_back(stripCl); - stripCl->setMeasurement<1>(idHash, localPosition, localCovariance); - stripCl->setRDOlist(RDOs); - stripCl->globalPosition() = globalPosition; - stripCl->setChannelsInPhi(width.colRow()[0]); - stripCl->setHitsInThirdTimeBin(theCluster->hitsInThirdTimeBin()); - - // Create auxiliary branches accessors - const SG::AuxElement::Accessor< ElementLink< InDet::SCT_ClusterCollection > > stripLinkAcc("sctClusterLink"); - ElementLink<InDet::SCT_ClusterCollection> stripLink(theCluster, *clusterCollection); - stripLinkAcc( *stripCl ) = stripLink; - } - } - - ATH_MSG_DEBUG("xAOD::StripClusterContainer with size: " << outputStripClusterContainer->size()); - - return StatusCode::SUCCESS; - } - - diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/components/InDetPrepRawDataFormation_entries.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/components/InDetPrepRawDataFormation_entries.cxx index 1acdeaab16111ecb8dcc61c43cb7477b2d4f1866..7fd96abd853ec66fbbb44e2426eab1f57d9e24b1 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/components/InDetPrepRawDataFormation_entries.cxx +++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/components/InDetPrepRawDataFormation_entries.cxx @@ -6,8 +6,6 @@ #include "InDetPrepRawDataFormation/SCT_Clusterization.h" #include "InDetPrepRawDataFormation/TRT_RIO_Maker.h" #include "../CacheCreator.h" -#include "InDetPrepRawDataFormation/InDetToXAODClusterConversion.h" -#include "InDetPrepRawDataFormation/XAODToInDetClusterConversion.h" #include "../SiDetectorElementStatusAlg.h" #include "../SiDetectorElementStatusCondAlg.h" @@ -15,8 +13,6 @@ DECLARE_COMPONENT( InDet::PixelClusterization ) DECLARE_COMPONENT( InDet::SCT_Clusterization ) DECLARE_COMPONENT( InDet::TRT_RIO_Maker ) DECLARE_COMPONENT( InDet::CacheCreator ) -DECLARE_COMPONENT( InDet::InDetToXAODClusterConversion ) -DECLARE_COMPONENT( InDet::XAODToInDetClusterConversion ) DECLARE_COMPONENT( InDet::SiDetectorElementStatusAlg ) DECLARE_COMPONENT( InDet::SiDetectorElementStatusCondAlg ) diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/python/SiSpacePointFormationConfig.py b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/python/SiSpacePointFormationConfig.py deleted file mode 100644 index b523cf8efa4d7a00fa152b96ef1b244989bf7851..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/python/SiSpacePointFormationConfig.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory - -def TrkToXAODSpacePointConversionCfg(flags, - name: str = "TrkToXAODSpacePointConversion", - **kwargs) -> ComponentAccumulator: - - acc = ComponentAccumulator() - acc.addEventAlgo( CompFactory.InDet.TrkToXAODSpacePointConversion(name, **kwargs) ) - return acc - diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/TrkToXAODSpacePointConversion.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/TrkToXAODSpacePointConversion.cxx deleted file mode 100644 index 46818a2825ca81a9116228df43002196f2e6bc83..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/TrkToXAODSpacePointConversion.cxx +++ /dev/null @@ -1,257 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -#include "SiSpacePointFormation/TrkToXAODSpacePointConversion.h" -#include "InDetPrepRawData/SiCluster.h" - -namespace InDet { - - TrkToXAODSpacePointConversion::TrkToXAODSpacePointConversion(const std::string &name, - ISvcLocator *pSvcLocator) - : AthReentrantAlgorithm(name, pSvcLocator) - {} - - StatusCode TrkToXAODSpacePointConversion::initialize() - { - ATH_MSG_DEBUG("Initializing " << name() << " ..."); - - ATH_CHECK( m_beamSpotKey.initialize() ); - - ATH_CHECK( m_inSpacepointsPixel.initialize() ); - ATH_CHECK( m_inSpacepointsStrip.initialize() ); - ATH_CHECK( m_inSpacepointsOverlap.initialize() ); - - ATH_CHECK( m_outSpacepointsPixel.initialize() ); - ATH_CHECK( m_outSpacepointsStrip.initialize() ); - ATH_CHECK( m_outSpacepointsOverlap.initialize() ); - - return StatusCode::SUCCESS; - } - - StatusCode TrkToXAODSpacePointConversion::execute(const EventContext& ctx) const - { - ATH_MSG_DEBUG("Executing " << name() << " ..."); - - // Conds - SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; - const InDet::BeamSpotData* beamSpot = *beamSpotHandle; - auto vertex = beamSpot->beamVtx().position(); - - // Convert - ATH_CHECK( convertPixel(ctx) ); - ATH_CHECK( convertStrip(ctx, vertex) ); - ATH_CHECK( convertStripOverlap(ctx, vertex) ); - - return StatusCode::SUCCESS; - } - - StatusCode TrkToXAODSpacePointConversion::convertPixel(const EventContext& ctx) const - { - // Input - SG::ReadHandle< ::SpacePointContainer > pixel_handle = SG::makeHandle( m_inSpacepointsPixel, ctx ); - ATH_CHECK( pixel_handle.isValid() ); - const ::SpacePointContainer* pixel_container = pixel_handle.cptr(); - - // Output - std::unique_ptr< xAOD::SpacePointContainer > pixel_xaod_container = std::make_unique< xAOD::SpacePointContainer >(); - std::unique_ptr< xAOD::SpacePointAuxContainer > pixel_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >(); - pixel_xaod_container->setStore( pixel_xaod_aux_container.get() ); - - pixel_xaod_container->reserve(pixel_container->size()); - pixel_xaod_aux_container->reserve(pixel_container->size()); - - // Conversion - std::size_t counter = 0; - for (const ::SpacePointCollection *spc : *pixel_container) { - for (const Trk::SpacePoint *sp : *spc) { - unsigned int idHash = sp->elementIdList().first; - const auto& globPos = sp->globalPosition(); - - const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(sp->clusterList().first); - const InDetDD::SiDetectorElement *de = c->detectorElement(); - const Amg::Transform3D &Tp = de->surface().transform(); - - float r_3 = static_cast<float>( Tp(0,2) ); - float r_4 = static_cast<float>( Tp(1,2) ); - float r_5 = static_cast<float>( Tp(2,2) ); - - const Amg::MatrixX& v = c->localCovariance(); - float f22 = static_cast<float>( v(1,1) ); - float wid = static_cast<float>( c->width().z() ); - float cov = wid*wid*.08333; - if(cov < f22) cov = f22; - float covr = 6 * cov * (r_5*r_5); - float covz = 6 * cov * (r_3*r_3 + r_4*r_4); - - pixel_xaod_container->push_back( new xAOD::SpacePoint() ); - pixel_xaod_container->back()->setSpacePoint(idHash, - globPos.cast<float>(), - covr, - covz, - {counter++}); - } - } - - // Store - SG::WriteHandle< xAOD::SpacePointContainer > pixel_xaod_handle = SG::makeHandle( m_outSpacepointsPixel, ctx ); - ATH_CHECK( pixel_xaod_handle.record( std::move(pixel_xaod_container), std::move(pixel_xaod_aux_container) ) ); - - return StatusCode::SUCCESS; - } - - StatusCode TrkToXAODSpacePointConversion::convertStrip(const EventContext& ctx, - const Amg::Vector3D& vertex) const - { - // Input - SG::ReadHandle< ::SpacePointContainer > strip_handle = SG::makeHandle( m_inSpacepointsStrip, ctx ); - ATH_CHECK( strip_handle.isValid() ); - const ::SpacePointContainer* strip_container = strip_handle.cptr(); - - // Output - std::unique_ptr< xAOD::SpacePointContainer > strip_xaod_container = std::make_unique< xAOD::SpacePointContainer >(); - std::unique_ptr< xAOD::SpacePointAuxContainer > strip_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >(); - strip_xaod_container->setStore( strip_xaod_aux_container.get() ); - - strip_xaod_container->reserve(strip_container->size()); - strip_xaod_aux_container->reserve(strip_container->size()); - - // Conversion - std::size_t counter = 0; - for (const ::SpacePointCollection *spc : *strip_container) { - for (const Trk::SpacePoint *sp : *spc) { - std::pair<unsigned int, unsigned int> idHashes = sp->elementIdList(); - const auto& globPos = sp->globalPosition(); - - const InDet::SiCluster *c0 = static_cast<const InDet::SiCluster *>(sp->clusterList().first); - const InDet::SiCluster *c1 = static_cast<const InDet::SiCluster *>(sp->clusterList().second); - const InDetDD::SiDetectorElement *d0 = c0->detectorElement(); - const InDetDD::SiDetectorElement *d1 = c1->detectorElement(); - - Amg::Vector2D lc0 = c0->localPosition(); - Amg::Vector2D lc1 = c1->localPosition(); - - std::pair<Amg::Vector3D, Amg::Vector3D> e0 = - (d0->endsOfStrip(InDetDD::SiLocalPosition(lc0.y(), lc0.x(), 0.))); - std::pair<Amg::Vector3D, Amg::Vector3D> e1 = - (d1->endsOfStrip(InDetDD::SiLocalPosition(lc1.y(), lc1.x(), 0.))); - - auto stripCenter_1 = 0.5 * (e0.first + e0.second); - auto stripDir_1 = e0.first - e0.second; - auto trajDir_1 = 2. * ( stripCenter_1 - vertex); - - auto stripCenter_2 = 0.5 * (e1.first + e1.second); - auto stripDir_2 = e1.first - e1.second; - - float topHalfStripLength = 0.5 * stripDir_1.norm(); - Eigen::Matrix<double, 3, 1> topStripDirection = - stripDir_1 / (2. * topHalfStripLength); - Eigen::Matrix<double, 3, 1> topStripCenter = 0.5 * trajDir_1; - float bottomHalfStripLength = 0.5 * stripDir_2.norm(); - Eigen::Matrix<double, 3, 1> bottomStripDirection = - stripDir_2 / (2. * bottomHalfStripLength); - Eigen::Matrix<double, 3, 1> stripCenterDistance = stripCenter_1 - stripCenter_2; - - const Amg::MatrixX& v = sp->localCovariance(); - float f22 = static_cast<float>( v(1,1) ); - - float covr = d0->isBarrel() ? .1 : 8.*f22; - float covz = d0->isBarrel() ? 8.*f22 : .1; - - strip_xaod_container->push_back( new xAOD::SpacePoint() ); - strip_xaod_container->back()->setSpacePoint({idHashes.first, idHashes.second}, - globPos.cast<float>(), - covr, - covz, - {counter, counter++}, - topHalfStripLength, - bottomHalfStripLength, - topStripDirection.cast<float>(), - bottomStripDirection.cast<float>(), - stripCenterDistance.cast<float>(), - topStripCenter.cast<float>()); - } - } - - // Store - SG::WriteHandle< xAOD::SpacePointContainer > strip_xaod_handle = SG::makeHandle( m_outSpacepointsStrip, ctx ); - ATH_CHECK( strip_xaod_handle.record( std::move(strip_xaod_container), std::move(strip_xaod_aux_container) ) ); - - return StatusCode::SUCCESS; - } - - - StatusCode TrkToXAODSpacePointConversion::convertStripOverlap(const EventContext& ctx, - const Amg::Vector3D& vertex) const - { - // Inputs - SG::ReadHandle< ::SpacePointOverlapCollection > strip_overlap_handle = SG::makeHandle( m_inSpacepointsOverlap, ctx ); - ATH_CHECK( strip_overlap_handle.isValid() ); - const ::SpacePointOverlapCollection* strip_overlap_container = strip_overlap_handle.cptr(); - - // Outputs - std::unique_ptr< xAOD::SpacePointContainer > strip_overlap_xaod_container = std::make_unique< xAOD::SpacePointContainer >(); - std::unique_ptr< xAOD::SpacePointAuxContainer > strip_overlap_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >(); - strip_overlap_xaod_container->setStore( strip_overlap_xaod_aux_container.get() ); - - strip_overlap_xaod_container->reserve(strip_overlap_container->size()); - strip_overlap_xaod_aux_container->reserve(strip_overlap_container->size()); - - // Conversion - std::size_t counter = 0; - for (const Trk::SpacePoint *sp : *strip_overlap_container) { - std::pair<unsigned int, unsigned int> idHashes = sp->elementIdList(); - const auto& globPos = sp->globalPosition(); - - const InDet::SiCluster *c0 = static_cast<const InDet::SiCluster *>(sp->clusterList().first); - const InDet::SiCluster *c1 = static_cast<const InDet::SiCluster *>(sp->clusterList().second); - const InDetDD::SiDetectorElement *d0 = c0->detectorElement(); - const InDetDD::SiDetectorElement *d1 = c1->detectorElement(); - - Amg::Vector2D lc0 = c0->localPosition(); - Amg::Vector2D lc1 = c1->localPosition(); - - std::pair<Amg::Vector3D, Amg::Vector3D> e0 = - (d0->endsOfStrip(InDetDD::SiLocalPosition(lc0.y(), lc0.x(), 0.))); - std::pair<Amg::Vector3D, Amg::Vector3D> e1 = - (d1->endsOfStrip(InDetDD::SiLocalPosition(lc1.y(), lc1.x(), 0.))); - - auto stripCenter_1 = 0.5 * (e0.first + e0.second); - auto stripDir_1 = e0.first - e0.second; - auto trajDir_1 = 2. * ( stripCenter_1 - vertex); - - auto stripCenter_2 = 0.5 * (e1.first + e1.second); - auto stripDir_2 = e1.first - e1.second; - - float topHalfStripLength = 0.5 * stripDir_1.norm(); - Eigen::Matrix<double, 3, 1> topStripDirection = - stripDir_1 / (2. * topHalfStripLength); - Eigen::Matrix<double, 3, 1> topStripCenter = 0.5 * trajDir_1; - float bottomHalfStripLength = 0.5 * stripDir_2.norm(); - Eigen::Matrix<double, 3, 1> bottomStripDirection = - stripDir_2 / (2. * bottomHalfStripLength); - Eigen::Matrix<double, 3, 1> stripCenterDistance = stripCenter_1 - stripCenter_2; - - const Amg::MatrixX& v = sp->localCovariance(); - float f22 = static_cast<float>( v(1,1) ); - - float covr = d0->isBarrel() ? .1 : 8.*f22; - float covz = d0->isBarrel() ? 8.*f22 : .1; - - strip_overlap_xaod_container->push_back( new xAOD::SpacePoint() ); - strip_overlap_xaod_container->back()->setSpacePoint({idHashes.first, idHashes.second}, - globPos.cast<float>(), - covr, - covz, - {counter, counter++}, - topHalfStripLength, - bottomHalfStripLength, - topStripDirection.cast<float>(), - bottomStripDirection.cast<float>(), - stripCenterDistance.cast<float>(), - topStripCenter.cast<float>()); - } - - // Store - SG::WriteHandle< xAOD::SpacePointContainer > strip_overlap_xaod_handle = SG::makeHandle( m_outSpacepointsOverlap, ctx ); - ATH_CHECK( strip_overlap_xaod_handle.record( std::move(strip_overlap_xaod_container), std::move(strip_overlap_xaod_aux_container) ) ); - - return StatusCode::SUCCESS; - } -} diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx index a893dda0019901dfaa27288a0b02b932f50b76cb..f1e0294382d6404586b348efdf61b5901a10d898 100644 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx @@ -1,7 +1,6 @@ #include "../SiElementPropertiesTableCondAlg.h" #include "SiSpacePointFormation/SiTrackerSpacePointFinder.h" -#include "SiSpacePointFormation/TrkToXAODSpacePointConversion.h" DECLARE_COMPONENT( InDet::SiElementPropertiesTableCondAlg ) DECLARE_COMPONENT( InDet::SiTrackerSpacePointFinder ) -DECLARE_COMPONENT( InDet::TrkToXAODSpacePointConversion ) + diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTools_xk.h b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTools_xk.h index df549b2af01da1cc161d7c1652107f2d67c29177..94110add5479278ef8d8503ebd1de7b50cc7ce8e 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTools_xk.h +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTools_xk.h @@ -99,7 +99,6 @@ namespace InDet{ void setHeavyIon (bool); void setFastTracking (bool); void setITkGeometry (bool); - const std::vector<bool> *pixelStatus() const { return m_pixelDetElStatus ? &m_pixelDetElStatus->getElementStatus() : nullptr; } const std::vector<bool> *sctStatus() const { return m_sctDetElStatus ? &m_sctDetElStatus->getElementStatus() : nullptr; } @@ -261,8 +260,6 @@ namespace InDet{ { m_ITkGeometry = isITk; } - - } // end of name space #endif // SiTools_xk diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTrajectoryElement_xk.icc b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTrajectoryElement_xk.icc index c218af119abc5f08f15f3c1b9f59babc5c22229f..bbd65178bc95c1b0f40c34e5184e0bd611ef5b61 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTrajectoryElement_xk.icc +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/SiSPSeededTrackFinderData/SiTrajectoryElement_xk.icc @@ -67,7 +67,8 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithStereo double Xc = m_xi2maxlink; double bestX2 = m_xi2maxlink; double Xm = m_xi2max ; - int nm = m_tools->isITkGeometry() ? m_tools->maxclusters() : 10; + int nMaxClusters = m_tools->isITkGeometry() ? m_tools->maxclusters() : 9; + int nMaxClustersForBestChi2 = m_tools->isITkGeometry() ? nMaxClusters-1 : nMaxClusters; /// holder for best cluster seen not pasing cuts const InDet::SiCluster* cl = nullptr; @@ -125,13 +126,13 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithStereo /// so far /// If we have less than nm saved, save it in the next slot - if(nLinksFound<nm){ + if(nLinksFound<=nMaxClusters) { L[nLinksFound++]=l; } else { /// otherwise, don't add it, and update the chi2 cut to /// the worst one in our list, to get rid of further /// candidates early on. - Xm=L[nm-1].xi2(); + Xm=L[nMaxClustersForBestChi2].xi2(); } /// finally, update the chi2 cut - don't bother with anything worse @@ -178,7 +179,8 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoPIX /// chi2 cuts double Xc = m_xi2maxlink; double Xm = m_xi2max ; - int nm = m_tools->isITkGeometry() ? m_tools->maxclusters() : 10; + int nMaxClusters = m_tools->isITkGeometry() ? m_tools->maxclusters() : 9; + int nMaxClustersForBestChi2 = m_tools->isITkGeometry() ? nMaxClusters-1 : nMaxClusters; /// best cluster seen const InDet::SiCluster* cl = nullptr; @@ -233,9 +235,10 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoPIX for(int i=0; i!=nLinksFound; ++i) L[i].Comparison(l); /// and place the worst link (remember that l is now a different link, see above)! /// If within capacity, increment counter and add - if(nLinksFound<nm) L[nLinksFound++]=l; + if(nLinksFound<=nMaxClusters) + L[nLinksFound++]=l; /// otherwise increment cut to avoid bothering with lower qualities in the future - else Xm=L[nm-1].xi2(); + else Xm=L[nMaxClustersForBestChi2].xi2(); /// update looser chi2 cut to match the tighter one - we found at least one good cluster Xc = Xm; } @@ -273,7 +276,8 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoSCT /// chi2 cuts double Xc = m_xi2maxlink; double Xm = m_xi2max ; - int nm = m_tools->isITkGeometry() ? m_tools->maxclusters() : 10; + int nMaxClusters = m_tools->isITkGeometry() ? m_tools->maxclusters() : 9; + int nMaxClustersForBestChi2 = m_tools->isITkGeometry() ? nMaxClusters-1 : nMaxClusters; /// best cluster seen const InDet::SiCluster* cl = nullptr; @@ -334,9 +338,10 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoSCT /// left with a link to the worst chi² one for(int i=0; i!=nLinksFound; ++i) L[i].Comparison(l); /// and place the worst link so far at the end if space. - if(nLinksFound<nm) L[nLinksFound++]=l; + if(nLinksFound<=nMaxClusters) + L[nLinksFound++]=l; /// otherwise, update chi2 cut to not bother with worse clusters anymore - else Xm=L[nm-1].xi2(); + else Xm=L[nMaxClustersForBestChi2].xi2(); /// update looser chi2 to match the tighter one - we have at least one good link now Xc = Xm; } @@ -373,7 +378,8 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithStereoAss double Xc = m_xi2maxlink; double Xl = m_xi2maxlink; double Xm = m_xi2max ; - int nm = m_tools->isITkGeometry() ? m_tools->maxclusters() : 10; + int nMaxClusters = m_tools->isITkGeometry() ? m_tools->maxclusters() : 9; + int nMaxClustersForBestChi2 = m_tools->isITkGeometry() ? nMaxClusters-1 : nMaxClusters; const InDet::SiCluster* cl = nullptr; @@ -416,8 +422,9 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithStereoAss /// it replaces in ascending chi², and we will be /// left with a link to the worst chi² one for(int i=0; i!=nLinksFound; ++i) L[i].Comparison(l); - if(nLinksFound<nm) L[nLinksFound++]=l; - else Xm=L[nm-1].xi2(); + if(nLinksFound<=nMaxClusters) + L[nLinksFound++]=l; + else Xm=L[nMaxClustersForBestChi2].xi2(); Xc = Xm+6.; } else if(!nLinksFound && x < Xl) {Xl = x; Xc = x+6.; cl = c;} @@ -446,7 +453,8 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoAssPIX double PV2 = Tp_cov(1, 1); double Xc = m_xi2maxlink; double Xm = m_xi2max ; - int nm = m_tools->isITkGeometry() ? m_tools->maxclusters() : 10; + int nMaxClusters = m_tools->isITkGeometry() ? m_tools->maxclusters() : 9; + int nMaxClustersForBestChi2 = m_tools->isITkGeometry() ? nMaxClusters-1 : nMaxClusters; const InDet::SiCluster* cl = nullptr; @@ -480,7 +488,9 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoAssPIX /// it replaces in ascending chi², and we will be /// left with a link to the worst chi² one for(int i=0; i!=nLinksFound; ++i) L[i].Comparison(l); - if(nLinksFound<nm) L[nLinksFound++]=l; else Xm=L[nm-1].xi2(); + if(nLinksFound<=nMaxClusters) + L[nLinksFound++]=l; + else Xm=L[nMaxClustersForBestChi2].xi2(); Xc = Xm; } else if(!nLinksFound) {Xc = x; cl = c;} @@ -509,7 +519,8 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoAssSCT double PV2 = Tp_cov(1, 1); double Xc = m_xi2maxlink; double Xm = m_xi2max ; - int nm = m_tools->isITkGeometry() ? m_tools->maxclusters() : 10; + int nMaxClusters = m_tools->isITkGeometry() ? m_tools->maxclusters() : 9; + int nMaxClustersForBestChi2 = m_tools->isITkGeometry() ? nMaxClusters-1 : nMaxClusters; const InDet::SiCluster* cl = nullptr; @@ -557,7 +568,9 @@ int InDet::SiTrajectoryElement_xk::searchClustersWithoutStereoAssSCT /// it replaces in ascending chi², and we will be /// left with a link to the worst chi² one for(int i=0; i!=nLinksFound; ++i) L[i].Comparison(l); - if(nLinksFound<nm) L[nLinksFound++]=l; else Xm=L[nm-1].xi2(); + if(nLinksFound<=nMaxClusters) + L[nLinksFound++]=l; + else Xm=L[nMaxClustersForBestChi2].xi2(); Xc = Xm; } else if(!nLinksFound) {Xc = x; cl = c;} diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx index cf4a284bfcef9e54c39d5d150bb82f38200a0f00..4ad7a41af730a0a93656cc6a8df182a40a34222f 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointsProSeed.cxx @@ -217,6 +217,8 @@ namespace ITk float A = (Vt - Vb) / dU; float S2 = 1. + A * A; float B = Vb - A * Ub; + if (B==0) + return; float B2 = B * B; // dzdr diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectoryElement_xk.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectoryElement_xk.cxx index 8151c376ed34327073af383d06dd6fde9761ba68..5586a5207585ae9069cdc8999a464201ec6dda59 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectoryElement_xk.cxx +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectoryElement_xk.cxx @@ -2243,6 +2243,12 @@ bool InDet::SiTrajectoryElement_xk::initiateState { /// Gives Tb the x and (for pix) the y of the cluster, and the corresponding cov elements, /// and copies everything else from inputPars + if (m_tools->isITkGeometry()) { + // using pattern covariance for all clusters for ITk + Amg::MatrixX cov(2,2); + patternCovariances(m_cluster,cov(0,0),cov(1,0),cov(1,1)); + return outputPars.initiate(inputPars,m_cluster->localPosition(),cov); + } return outputPars.initiate(inputPars,m_cluster->localPosition(),m_cluster->localCovariance()); } @@ -2264,8 +2270,16 @@ void InDet::SiTrajectoryElement_xk::patternCovariances (const InDet::SiCluster* c,double& covX,double& covXY,double& covY) const { const Amg::MatrixX& v = c->localCovariance(); + if (m_tools->useFastTracking() and m_stereo) { + // in fast tracking mode, endcap strip clusters use cluster covariance terms + covX=v(0,0); + covY=v(1,1); + covXY=v(1,0); + return; + } covX = c->width().phiR(); covX*=(covX*s_oneOverTwelve); /// sigma ~pitch / sqrt(12) + covXY = c->localCovariance()(1,0); if(!m_tools->useFastTracking()){ if(covX < v(0,0)) covX=v(0,0); /// if larger error in cluster covariance, replace covx by it diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h index 773d9ca2129583602c94b81f1c8232234d56bf6b..204263accb8d28a41d466c970cc0471ea5d6ad3d 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/IInDetTrackSelectionTool.h @@ -40,7 +40,8 @@ namespace InDet { CutLevel { NoCut, Loose, LoosePrimary, TightPrimary, LooseMuon, LooseElectron, LooseTau, - MinBias, HILoose, HITight + MinBias, HILoose, HITight, + HITightOptimized, HILooseOptimized }; /// Interface for track selection tool diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h index f4964e15187260da21ccbbcfdbdf2ada9c2c7800..ea2237792299b76d9d008555846888bac40d86c0 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/InDetTrackSelectionTool/InDetTrackSelectionTool.h @@ -24,6 +24,10 @@ #include <map> #include <mutex> #include <unordered_map> +#include <string> +#include <sstream> +#include <algorithm> +#include <iterator> namespace InDetAccessor { @@ -200,6 +204,22 @@ namespace InDet { std::vector< Double_t > m_vecPtCutoffsForSctHitsCut; //!< Above each of these pT levels a new SCT hits + dead sensors will be applied std::vector< Int_t > m_vecMinNSctHitsAbovePt; //!< the minimum SCT hits above each pt level + std::vector< Double_t > m_vecEtaCutoffsForZ0SinThetaCut; //!< Above each of these eta levels a new z0*sin(theta) cut will be applied + std::vector< Double_t > m_vecPtCutoffsForZ0SinThetaCut; //!< Above each of these pT levels a new z0*sin(theta) cut will be applied + std::vector< std::vector< Double_t >> m_vecvecMaxZ0SinThetaAboveEtaPt; //!< Maximum values of z0*sin(theta) above each eta-pT level + + std::vector< Double_t > m_vecEtaCutoffsForD0Cut;//!< Above each of these eta levels a new d0 cut will be applied + std::vector< Double_t > m_vecPtCutoffsForD0Cut; //!< Above each of these pT levels a new d0 cut will be applied + std::vector< std::vector< Double_t >> m_vecvecMaxD0AboveEtaPt; //!< Maximum values of d0 above each eta-pT level + + std::vector< Double_t > m_vecEtaCutoffsForSctHolesCut;//!< Above each of these eta levels a new SCT holes cut will be applied + std::vector< Double_t > m_vecPtCutoffsForSctHolesCut; //!< Above each of these pT levels a new SCT holes cut will be applied + std::vector< std::vector< Double_t >> m_vecvecMaxSctHolesAboveEtaPt; //!< Maximum numbers of SCT holes above each eta-pT level + + std::vector< Double_t > m_vecEtaCutoffsForSctHitsPlusDeadCut;//!< Above each of these eta levels a new SCT hits cut will be applied + std::vector< Double_t > m_vecPtCutoffsForSctHitsPlusDeadCut; //!< Above each of these pT levels a new SCT hits cut will be applied + std::vector< std::vector< Double_t >> m_vecvecMinSctHitsPlusDeadAboveEtaPt; //!< Minimum numbers of SCT hits plus dead sensors above each eta-pT level + /// Object used to store the last decision asg::AcceptInfo m_acceptInfo; //!< Object that stores detailed selection information diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx index f0853d7c299d5d7520743ecd4090553c5729fc31..9b097bf6cac7bd9b1e07f8ac752f51da61628e07 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx @@ -185,10 +185,34 @@ InDet::InDetTrackSelectionTool::InDetTrackSelectionTool(const std::string& name, "Minimum eta cutoffs for each pT cut"); declareProperty("vecMinPtAboveEta", m_vecMinPtAboveEta, "Minimum transverse momentum above each eta cutoff"); - declareProperty("vecPtCutoffsForSctHitsCut", m_vecPtCutoffsForSctHitsCut, "Minimum pt cutoffs for each SCT hits"); declareProperty("vecMinNSctHitsAbovePt", m_vecMinNSctHitsAbovePt, "Minimum SCT hits above each pt cutoff"); + + declareProperty("vecEtaCutoffsForZ0SinThetaCut", m_vecEtaCutoffsForZ0SinThetaCut, + "Minimum eta cutoffs for each Z0SinTheta value"); + declareProperty("vecPtCutoffsForZ0SinThetaCut", m_vecPtCutoffsForZ0SinThetaCut, + "Minimum pt cutoffs for each Z0SinTheta value"); + declareProperty("vecvecMaxZ0SinThetaAboveEtaPt", m_vecvecMaxZ0SinThetaAboveEtaPt, "Maximum Z0SinTheta value above each eta and pT cutoff"); + + declareProperty("vecEtaCutoffsForD0Cut", m_vecEtaCutoffsForD0Cut, + "Minimum eta cutoffs for each D0 value"); + declareProperty("vecPtCutoffsForD0Cut", m_vecPtCutoffsForD0Cut, + "Minimum pt cutoffs for each D0 value"); + declareProperty("vecvecMaxD0AboveEtaPt", m_vecvecMaxD0AboveEtaPt, "Maximum D0 value above each eta and pT cutoff"); + + declareProperty("vecEtaCutoffsForSctHolesCut", m_vecEtaCutoffsForSctHolesCut, + "Minimum eta cutoffs for each SctHoles value"); + declareProperty("vecPtCutoffsForSctHolesCut", m_vecPtCutoffsForSctHolesCut, + "Minimum pt cutoffs for each SctHoles value"); + declareProperty("vecvecMaxSctHolesAboveEtaPt", m_vecvecMaxSctHolesAboveEtaPt, "Maximum SctHoles value above each eta and pT cutoff"); + + declareProperty("vecEtaCutoffsForSctHitsPlusDeadCut", m_vecEtaCutoffsForSctHitsPlusDeadCut, + "Minimum eta cutoffs for each SctHitsPlusDead value"); + declareProperty("vecPtCutoffsForSctHitsPlusDeadCut", m_vecPtCutoffsForSctHitsPlusDeadCut, + "Minimum pt cutoffs for each SctHitsPlusDead value"); + declareProperty("vecvecMinSctHitsPlusDeadAboveEtaPt", m_vecvecMinSctHitsPlusDeadAboveEtaPt, "Minimum SctHitsPlusDead value above each eta and pT cutoff"); + declareProperty("useExperimentalInnermostLayersCut", m_useExperimentalInnermostLayersCut, "Use the experimental cut on pixel holes"); #ifndef XAOD_ANALYSIS declareProperty("minNSiHitsMod", m_minNSiHitsMod); @@ -766,8 +790,6 @@ StatusCode InDet::InDetTrackSelectionTool::setupCuts(std::map< std::string, std: }); } - - if (!m_vecPtCutoffsForSctHitsCut.empty() || !m_vecMinNSctHitsAbovePt.empty()) { auto cutSize = m_vecPtCutoffsForSctHitsCut.size(); if (cutSize != m_vecMinNSctHitsAbovePt.size()) { @@ -796,9 +818,235 @@ StatusCode InDet::InDetTrackSelectionTool::setupCuts(std::map< std::string, std: xAOD::numberOfSCTDeadSensors}) >= (*p_vecMinNSctHitsAbovePt)[bin_i]; }); } + + if (!m_vecPtCutoffsForZ0SinThetaCut.empty() || + !m_vecEtaCutoffsForZ0SinThetaCut.empty() || + !m_vecvecMaxZ0SinThetaAboveEtaPt.empty()) { + auto etaSize = m_vecEtaCutoffsForZ0SinThetaCut.size(); + auto ptSize = m_vecPtCutoffsForZ0SinThetaCut.size(); + if (etaSize != m_vecvecMaxZ0SinThetaAboveEtaPt.size()) { + ATH_MSG_ERROR( "Eta cutoffs and Z0SinTheta cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + for (size_t i_size=0; i_size<etaSize-1; ++i_size) { + if (ptSize != m_vecvecMaxZ0SinThetaAboveEtaPt.at(i_size).size()) { + ATH_MSG_ERROR( "Pt cutoffs and Z0SinTheta cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + } + + std::stringstream pTRangeBuffer; + std::copy(m_vecPtCutoffsForZ0SinThetaCut.begin(), m_vecPtCutoffsForZ0SinThetaCut.end(), std::ostream_iterator<Double_t>(pTRangeBuffer, ", ")); + std::string pTString=pTRangeBuffer.str(); + ATH_MSG_INFO("Z0SinTheta cuts (<=) for pT above "<<pTString.substr(0, pTString.size()-2)<<"MeV, respectively:"); + for (size_t i_cut_eta=0; i_cut_eta<etaSize; ++i_cut_eta) + { + std::stringstream etaRangeBuffer; + etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForZ0SinThetaCut.at(i_cut_eta) << " < |#eta| < "; + if(i_cut_eta!=etaSize-1) etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForZ0SinThetaCut.at(i_cut_eta+1); + else etaRangeBuffer << std::setprecision(2) << std::fixed <<m_maxAbsEta; + + std::stringstream cutBuffer; + std::copy(m_vecvecMaxZ0SinThetaAboveEtaPt.at(i_cut_eta).begin(), m_vecvecMaxZ0SinThetaAboveEtaPt.at(i_cut_eta).end(), std::ostream_iterator<Double_t>(cutBuffer, ", ")); + std::string cutString=cutBuffer.str(); + + ATH_MSG_INFO(" for "<<etaRangeBuffer.str()<<": "<<cutString.substr(0, cutString.size()-2)); + } + + if (!checkOrder(m_vecEtaCutoffsForZ0SinThetaCut)) { + ATH_MSG_ERROR( "Eta values not in ascending order." ); + return StatusCode::FAILURE; + } + if (!checkOrder(m_vecPtCutoffsForZ0SinThetaCut)) { + ATH_MSG_ERROR( "Pt values not in ascending order." ); + return StatusCode::FAILURE; + } + + trackCuts["Z0SinTheta"].push_back([p_vecEtaCutoffsForZ0SinThetaCut = &std::as_const(m_vecEtaCutoffsForZ0SinThetaCut), + p_vecPtCutoffsForZ0SinThetaCut = &std::as_const(m_vecPtCutoffsForZ0SinThetaCut), + p_vecvecMaxZ0SinThetaAboveEtaPt = &std::as_const(m_vecvecMaxZ0SinThetaAboveEtaPt)] (Trk_Helper helper, const asg::AsgMessaging &msgHelper) { + double eta = helper.eta(msgHelper); + unsigned int bin_eta = findBin(*p_vecEtaCutoffsForZ0SinThetaCut, std::fabs(eta)); + double pt = helper.pt(msgHelper); + unsigned int bin_pt = findBin(*p_vecPtCutoffsForZ0SinThetaCut, pt); + return bin_eta >= p_vecEtaCutoffsForZ0SinThetaCut->size() + || bin_pt >= p_vecPtCutoffsForZ0SinThetaCut->size() + || std::fabs(helper.z0(msgHelper) * std::sin(helper.theta(msgHelper))) <= (*p_vecvecMaxZ0SinThetaAboveEtaPt)[bin_eta][bin_pt]; + }); + } + + if (!m_vecPtCutoffsForD0Cut.empty() || + !m_vecEtaCutoffsForD0Cut.empty() || + !m_vecvecMaxD0AboveEtaPt.empty()) { + auto etaSize = m_vecEtaCutoffsForD0Cut.size(); + auto ptSize = m_vecPtCutoffsForD0Cut.size(); + if (etaSize != m_vecvecMaxD0AboveEtaPt.size()) { + ATH_MSG_ERROR( "Eta cutoffs and D0 cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + for (size_t i_size=0; i_size<etaSize-1; ++i_size) { + if (ptSize != m_vecvecMaxD0AboveEtaPt.at(i_size).size()) { + ATH_MSG_ERROR( "Pt cutoffs and D0 cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + } + + std::stringstream pTRangeBuffer; + std::copy(m_vecPtCutoffsForD0Cut.begin(), m_vecPtCutoffsForD0Cut.end(), std::ostream_iterator<Double_t>(pTRangeBuffer, ", ")); + std::string pTString=pTRangeBuffer.str(); + ATH_MSG_INFO("D0 cuts (<=) for pT above "<<pTString.substr(0, pTString.size()-2)<<"MeV, respectively:"); + for (size_t i_cut_eta=0; i_cut_eta<etaSize; ++i_cut_eta) + { + std::stringstream etaRangeBuffer; + etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForD0Cut.at(i_cut_eta) << " < |#eta| < "; + if(i_cut_eta!=etaSize-1) etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForD0Cut.at(i_cut_eta+1); + else etaRangeBuffer << std::setprecision(2) << std::fixed <<m_maxAbsEta; + + std::stringstream cutBuffer; + std::copy(m_vecvecMaxD0AboveEtaPt.at(i_cut_eta).begin(), m_vecvecMaxD0AboveEtaPt.at(i_cut_eta).end(), std::ostream_iterator<Double_t>(cutBuffer, ", ")); + std::string cutString=cutBuffer.str(); + + ATH_MSG_INFO(" for "<<etaRangeBuffer.str()<<": "<<cutString.substr(0, cutString.size()-2)); + } + + if (!checkOrder(m_vecEtaCutoffsForD0Cut)) { + ATH_MSG_ERROR( "Eta values not in ascending order." ); + return StatusCode::FAILURE; + } + if (!checkOrder(m_vecPtCutoffsForD0Cut)) { + ATH_MSG_ERROR( "Pt values not in ascending order." ); + return StatusCode::FAILURE; + } + + trackCuts["D0"].push_back([p_vecEtaCutoffsForD0Cut = &std::as_const(m_vecEtaCutoffsForD0Cut), + p_vecPtCutoffsForD0Cut = &std::as_const(m_vecPtCutoffsForD0Cut), + p_vecvecMaxD0AboveEtaPt = &std::as_const(m_vecvecMaxD0AboveEtaPt)] (Trk_Helper helper, const asg::AsgMessaging &msgHelper) { + double eta = helper.eta(msgHelper); + unsigned int bin_eta = findBin(*p_vecEtaCutoffsForD0Cut, std::fabs(eta)); + double pt = helper.pt(msgHelper); + unsigned int bin_pt = findBin(*p_vecPtCutoffsForD0Cut, pt); + return bin_eta >= p_vecEtaCutoffsForD0Cut->size() + || bin_pt >= p_vecPtCutoffsForD0Cut->size() + || std::fabs(helper.d0(msgHelper)) <= (*p_vecvecMaxD0AboveEtaPt)[bin_eta][bin_pt]; + }); + } + + if (!m_vecPtCutoffsForSctHolesCut.empty() || + !m_vecEtaCutoffsForSctHolesCut.empty() || + !m_vecvecMaxSctHolesAboveEtaPt.empty()) { + auto etaSize = m_vecEtaCutoffsForSctHolesCut.size(); + auto ptSize = m_vecPtCutoffsForSctHolesCut.size(); + if (etaSize != m_vecvecMaxSctHolesAboveEtaPt.size()) { + ATH_MSG_ERROR( "Eta cutoffs and SctHoles cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + for (size_t i_size=0; i_size<etaSize-1; ++i_size) { + if (ptSize != m_vecvecMaxSctHolesAboveEtaPt.at(i_size).size()) { + ATH_MSG_ERROR( "Pt cutoffs and SctHoles cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + } + + std::stringstream pTRangeBuffer; + std::copy(m_vecPtCutoffsForSctHolesCut.begin(), m_vecPtCutoffsForSctHolesCut.end(), std::ostream_iterator<Double_t>(pTRangeBuffer, ", ")); + std::string pTString=pTRangeBuffer.str(); + ATH_MSG_INFO("SctHoles cuts (<=) for pT above "<<pTString.substr(0, pTString.size()-2)<<"MeV, respectively:"); + for (size_t i_cut_eta=0; i_cut_eta<etaSize; ++i_cut_eta) + { + std::stringstream etaRangeBuffer; + etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForSctHolesCut.at(i_cut_eta) << " < |#eta| < "; + if(i_cut_eta!=etaSize-1) etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForSctHolesCut.at(i_cut_eta+1); + else etaRangeBuffer << std::setprecision(2) << std::fixed <<m_maxAbsEta; + + std::stringstream cutBuffer; + std::copy(m_vecvecMaxSctHolesAboveEtaPt.at(i_cut_eta).begin(), m_vecvecMaxSctHolesAboveEtaPt.at(i_cut_eta).end(), std::ostream_iterator<Double_t>(cutBuffer, ", ")); + std::string cutString=cutBuffer.str(); + + ATH_MSG_INFO(" for "<<etaRangeBuffer.str()<<": "<<cutString.substr(0, cutString.size()-2)); + } + + if (!checkOrder(m_vecEtaCutoffsForSctHolesCut)) { + ATH_MSG_ERROR( "Eta values not in ascending order." ); + return StatusCode::FAILURE; + } + if (!checkOrder(m_vecPtCutoffsForSctHolesCut)) { + ATH_MSG_ERROR( "Pt values not in ascending order." ); + return StatusCode::FAILURE; + } + + trackCuts["SctHits"].push_back([p_vecEtaCutoffsForSctHolesCut = &std::as_const(m_vecEtaCutoffsForSctHolesCut), + p_vecPtCutoffsForSctHolesCut = &std::as_const(m_vecPtCutoffsForSctHolesCut), + p_vecvecMaxSctHolesAboveEtaPt = &std::as_const(m_vecvecMaxSctHolesAboveEtaPt)] (Trk_Helper helper, const asg::AsgMessaging &msgHelper) { + double eta = helper.eta(msgHelper); + unsigned int bin_eta = findBin(*p_vecEtaCutoffsForSctHolesCut, std::fabs(eta)); + double pt = helper.pt(msgHelper); + unsigned int bin_pt = findBin(*p_vecPtCutoffsForSctHolesCut, pt); + return bin_eta >= p_vecEtaCutoffsForSctHolesCut->size() + || bin_pt >= p_vecPtCutoffsForSctHolesCut->size() + || getSummary(helper, msgHelper, xAOD::numberOfSCTHoles) <= (*p_vecvecMaxSctHolesAboveEtaPt)[bin_eta][bin_pt]; + }); + } + + if (!m_vecPtCutoffsForSctHitsPlusDeadCut.empty() || + !m_vecEtaCutoffsForSctHitsPlusDeadCut.empty() || + !m_vecvecMinSctHitsPlusDeadAboveEtaPt.empty()) { + auto etaSize = m_vecEtaCutoffsForSctHitsPlusDeadCut.size(); + auto ptSize = m_vecPtCutoffsForSctHitsPlusDeadCut.size(); + if (etaSize != m_vecvecMinSctHitsPlusDeadAboveEtaPt.size()) { + ATH_MSG_ERROR( "Eta cutoffs and SctHitsPlusDead cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + for (size_t i_size=0; i_size<etaSize-1; ++i_size) { + if (ptSize != m_vecvecMinSctHitsPlusDeadAboveEtaPt.at(i_size).size()) { + ATH_MSG_ERROR( "Pt cutoffs and SctHitsPlusDead cuts must be vectors of the same length." ); + return StatusCode::FAILURE; + } + } + + std::stringstream pTRangeBuffer; + std::copy(m_vecPtCutoffsForSctHitsPlusDeadCut.begin(), m_vecPtCutoffsForSctHitsPlusDeadCut.end(), std::ostream_iterator<Double_t>(pTRangeBuffer, ", ")); + std::string pTString=pTRangeBuffer.str(); + ATH_MSG_INFO("SctHitsPlusDead cuts (>=) for pT above "<<pTString.substr(0, pTString.size()-2)<<"MeV, respectively:"); + for (size_t i_cut_eta=0; i_cut_eta<etaSize; ++i_cut_eta) + { + std::stringstream etaRangeBuffer; + etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForSctHitsPlusDeadCut.at(i_cut_eta) << " < |#eta| < "; + if(i_cut_eta!=etaSize-1) etaRangeBuffer << std::setprecision(2) << std::fixed << m_vecEtaCutoffsForSctHitsPlusDeadCut.at(i_cut_eta+1); + else etaRangeBuffer << std::setprecision(2) << std::fixed <<m_maxAbsEta; + + std::stringstream cutBuffer; + std::copy(m_vecvecMinSctHitsPlusDeadAboveEtaPt.at(i_cut_eta).begin(), m_vecvecMinSctHitsPlusDeadAboveEtaPt.at(i_cut_eta).end(), std::ostream_iterator<Double_t>(cutBuffer, ", ")); + std::string cutString=cutBuffer.str(); + + ATH_MSG_INFO(" for "<<etaRangeBuffer.str()<<": "<<cutString.substr(0, cutString.size()-2)); + } + + if (!checkOrder(m_vecEtaCutoffsForSctHitsPlusDeadCut)) { + ATH_MSG_ERROR( "Eta values not in ascending order." ); + return StatusCode::FAILURE; + } + if (!checkOrder(m_vecPtCutoffsForSctHitsPlusDeadCut)) { + ATH_MSG_ERROR( "Pt values not in ascending order." ); + return StatusCode::FAILURE; + } + + trackCuts["SctHits"].push_back([p_vecEtaCutoffsForSctHitsPlusDeadCut = &std::as_const(m_vecEtaCutoffsForSctHitsPlusDeadCut), + p_vecPtCutoffsForSctHitsPlusDeadCut = &std::as_const(m_vecPtCutoffsForSctHitsPlusDeadCut), + p_vecvecMinSctHitsPlusDeadAboveEtaPt = &std::as_const(m_vecvecMinSctHitsPlusDeadAboveEtaPt)] (Trk_Helper helper, const asg::AsgMessaging &msgHelper) { + double eta = helper.eta(msgHelper); + unsigned int bin_eta = findBin(*p_vecEtaCutoffsForSctHitsPlusDeadCut, std::fabs(eta)); + double pt = helper.pt(msgHelper); + unsigned int bin_pt = findBin(*p_vecPtCutoffsForSctHitsPlusDeadCut, pt); + return bin_eta >= p_vecEtaCutoffsForSctHitsPlusDeadCut->size() + || bin_pt >= p_vecPtCutoffsForSctHitsPlusDeadCut->size() + || getSummarySum<2,Trk_Helper>(helper, msgHelper, {xAOD::numberOfSCTHits, xAOD::numberOfSCTDeadSensors}) >= (*p_vecvecMinSctHitsPlusDeadAboveEtaPt)[bin_eta][bin_pt]; + }); + } + return StatusCode::SUCCESS; } + template <class Trk_Helper> asg::AcceptData InDet::InDetTrackSelectionTool::accept(Trk_Helper helper, const std::map< std::string, std::vector< std::function<bool(Trk_Helper helper, const asg::AsgMessaging &msgHelper)> > > &trackCuts) const { @@ -1128,6 +1376,18 @@ void InDet::InDetTrackSelectionTool::setCutLevelPrivate(InDet::CutLevel level, B m_vecMinPtAboveEta.clear(); m_vecPtCutoffsForSctHitsCut.clear(); m_vecMinNSctHitsAbovePt.clear(); + m_vecEtaCutoffsForZ0SinThetaCut.clear(); + m_vecPtCutoffsForZ0SinThetaCut.clear(); + m_vecvecMaxZ0SinThetaAboveEtaPt.clear(); + m_vecEtaCutoffsForD0Cut.clear(); + m_vecPtCutoffsForD0Cut.clear(); + m_vecvecMaxD0AboveEtaPt.clear(); + m_vecEtaCutoffsForSctHolesCut.clear(); + m_vecPtCutoffsForSctHolesCut.clear(); + m_vecvecMaxSctHolesAboveEtaPt.clear(); + m_vecEtaCutoffsForSctHitsPlusDeadCut.clear(); + m_vecPtCutoffsForSctHitsPlusDeadCut.clear(); + m_vecvecMinSctHitsPlusDeadAboveEtaPt.clear(); } break; case CutLevel::Loose : @@ -1226,6 +1486,84 @@ void InDet::InDetTrackSelectionTool::setCutLevelPrivate(InDet::CutLevel level, B if (overwrite || m_maxZ0SinTheta >= LOCAL_MAX_DOUBLE) m_maxZ0SinTheta = 1.0; if (overwrite || m_maxChiSqperNdf >= LOCAL_MAX_DOUBLE) m_maxChiSqperNdf = 6.0; break; + case CutLevel::HILooseOptimized: + setCutLevelPrivate(CutLevel::NoCut, overwrite); + if (overwrite || m_maxAbsEta >= LOCAL_MAX_DOUBLE) m_maxAbsEta = 2.5; + if (overwrite || m_maxNPixelHoles >= LOCAL_MAX_INT) m_maxNPixelHoles = 0; + if (overwrite || m_useMinBiasInnermostLayersCut >= 0) m_useMinBiasInnermostLayersCut = 1; + if (overwrite || (m_vecEtaCutoffsForZ0SinThetaCut.empty() && + m_vecPtCutoffsForZ0SinThetaCut.empty() && + m_vecvecMaxZ0SinThetaAboveEtaPt.empty())){ + m_vecEtaCutoffsForZ0SinThetaCut = {0.0, 1.1, 1.6, 2.0}; + m_vecPtCutoffsForZ0SinThetaCut = {500, 600, 700, 800, 900, 1000, 1500, + 2000, 2500, 3000, 5000, 8000, 12000}; + m_vecvecMaxZ0SinThetaAboveEtaPt = {{2.10, 2.15, 6.00, 5.00, 3.10, 2.00, 1.75, 1.60, 1.43, 1.40, 1.05, 0.65, 0.60}, + {1.44, 1.47, 1.50, 1.55, 1.62, 1.45, 1.45, 1.78, 1.73, 1.50, 1.20, 0.97, 0.53}, + {1.40, 1.45, 1.50, 1.46, 1.41, 1.37, 1.25, 1.50, 1.50, 1.36, 1.10, 0.85, 0.52}, + {1.51, 1.70, 1.70, 1.71, 1.71, 1.53, 1.54, 1.49, 1.36, 1.20, 0.95, 0.60, 0.55}}; + } + if (overwrite || (m_vecEtaCutoffsForD0Cut.empty() && + m_vecPtCutoffsForD0Cut.empty() && + m_vecvecMaxD0AboveEtaPt.empty())){ + m_vecEtaCutoffsForD0Cut = {0.0, 1.1, 1.6, 2.0}; + m_vecPtCutoffsForD0Cut = {500, 600, 700, 800, 900, 1000, 1500, + 2000, 2500, 3000, 5000, 8000, 12000}; + m_vecvecMaxD0AboveEtaPt = {{0.81, 0.90, 0.94, 0.92, 0.90, 0.75, 0.65, 0.63, 0.62, 0.60, 0.63, 0.50, 0.55}, + {1.00, 0.98, 0.98, 0.92, 0.90, 0.69, 0.67, 0.86, 0.88, 0.88, 0.88, 0.87, 1.06}, + {1.19, 1.15, 1.10, 1.08, 1.03, 0.94, 0.85, 0.97, 0.97, 0.96, 0.95, 0.92, 1.04}, + {1.33, 1.23, 1.21, 1.15, 1.15, 1.07, 0.94, 0.97, 0.97, 0.97, 0.98, 1.10, 1.10}}; + } + break; + case CutLevel::HITightOptimized: + setCutLevelPrivate(CutLevel::NoCut, overwrite); + if (overwrite || m_maxAbsEta >= LOCAL_MAX_DOUBLE) m_maxAbsEta = 2.5; + if (overwrite || m_maxNPixelHoles >= LOCAL_MAX_INT) m_maxNPixelHoles = 0; + if (overwrite || m_useMinBiasInnermostLayersCut >= 0) m_useMinBiasInnermostLayersCut = 1; + if (overwrite || (m_vecEtaCutoffsForZ0SinThetaCut.empty() && + m_vecPtCutoffsForZ0SinThetaCut.empty() && + m_vecvecMaxZ0SinThetaAboveEtaPt.empty())){ + m_vecEtaCutoffsForZ0SinThetaCut = {0.0, 1.1, 1.6, 2.0}; + m_vecPtCutoffsForZ0SinThetaCut = {500, 600, 700, 800, 900, 1000, 1500, + 2000, 2500, 3000, 5000, 8000, 12000}; + m_vecvecMaxZ0SinThetaAboveEtaPt = {{0.62, 0.70, 0.82, 0.87, 0.74, 0.61, 0.50, 0.48, 0.46, 0.45, 0.30, 0.24, 0.23}, + {0.51, 0.53, 0.53, 0.53, 0.52, 0.43, 0.28, 0.27, 0.28, 0.30, 0.24, 0.22, 0.13}, + {0.91, 0.89, 0.87, 0.55, 0.59, 0.37, 0.39, 0.31, 0.34, 0.35, 0.30, 0.30, 0.20}, + {0.76, 0.71, 0.69, 0.48, 0.48, 0.47, 0.46, 0.42, 0.38, 0.32, 0.28, 0.20, 0.15}}; + } + if (overwrite || (m_vecEtaCutoffsForD0Cut.empty() && + m_vecPtCutoffsForD0Cut.empty() && + m_vecvecMaxD0AboveEtaPt.empty())){ + m_vecEtaCutoffsForD0Cut = {0.0, 1.1, 1.6, 2.0}; + m_vecPtCutoffsForD0Cut = {500, 600, 700, 800, 900, 1000, 1500, + 2000, 2500, 3000, 5000, 8000, 12000}; + m_vecvecMaxD0AboveEtaPt = {{0.34, 0.39, 0.47, 0.49, 0.55, 0.47, 0.44, 0.21, 0.19, 0.17, 0.12, 0.14, 0.15}, + {0.32, 0.32, 0.33, 0.33, 0.33, 0.27, 0.16, 0.15, 0.13, 0.15, 0.13, 0.16, 0.20}, + {0.95, 0.91, 0.88, 0.35, 0.37, 0.24, 0.26, 0.22, 0.23, 0.24, 0.19, 0.19, 0.23}, + {0.68, 0.67, 0.65, 0.42, 0.42, 0.36, 0.35, 0.31, 0.27, 0.26, 0.27, 0.28, 0.30}}; + } + if (overwrite || (m_vecEtaCutoffsForSctHolesCut.empty() && + m_vecPtCutoffsForSctHolesCut.empty() && + m_vecvecMaxSctHolesAboveEtaPt.empty())){ + m_vecEtaCutoffsForSctHolesCut = {0.0, 1.1, 1.6, 2.0}; + m_vecPtCutoffsForSctHolesCut = {500, 600, 700, 800, 900, 1000, 1500, + 2000, 2500, 3000, 5000, 8000, 12000}; + m_vecvecMaxSctHolesAboveEtaPt = {{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}, + {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; + } + if (overwrite || (m_vecEtaCutoffsForSctHitsPlusDeadCut.empty() && + m_vecPtCutoffsForSctHitsPlusDeadCut.empty() && + m_vecvecMinSctHitsPlusDeadAboveEtaPt.empty())){ + m_vecEtaCutoffsForSctHitsPlusDeadCut = {0.0, 1.1, 1.6, 2.0}; + m_vecPtCutoffsForSctHitsPlusDeadCut = {500, 600, 700, 800, 900, 1000, 1500, + 2000, 2500, 3000, 5000, 8000, 12000}; + m_vecvecMinSctHitsPlusDeadAboveEtaPt = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 0, 0, 0}, + {8, 8, 8, 7, 7, 6, 6, 6, 6, 6, 0, 0, 0}, + {7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + } + break; default: ATH_MSG_ERROR("CutLevel not recognized. Cut selection will remain unchanged."); break; @@ -1245,5 +1583,7 @@ InDet::InDetTrackSelectionTool::s_mapCutLevel = {"LooseTau", InDet::CutLevel::LooseTau}, {"MinBias", InDet::CutLevel::MinBias}, {"HILoose", InDet::CutLevel::HILoose}, - {"HITight", InDet::CutLevel::HITight} + {"HITight", InDet::CutLevel::HITight}, + {"HILooseOptimized", InDet::CutLevel::HILooseOptimized}, + {"HITightOptimized", InDet::CutLevel::HITightOptimized} }; diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx index b545ab9afd1c2bc6704f2d71f0ce79a27a5c4246..b9a60350404c050bfdef854e6c66cf96aed3ca38 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/test/ut_InDetTrackSelectionTool.cxx @@ -41,6 +41,8 @@ bool passLooseTau( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ) bool passMinBias( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ); bool passHILoose( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ); bool passHITight( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ); +bool passHILooseOptimized( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ); +bool passHITightOptimized( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ); bool passExpPix( const TrackParticle& trk, const xAOD::Vertex* vtx = nullptr ); uint8_t getSum(const TrackParticle&, xAOD::SummaryType); void dumpTrack( const TrackParticle& ); @@ -79,6 +81,8 @@ int main( int argc, char* argv[] ) { FUNC_HELP( MinBias ); FUNC_HELP( HILoose ); FUNC_HELP( HITight ); + FUNC_HELP( HILooseOptimized ); + FUNC_HELP( HITightOptimized ); #undef FUNC_HELP for (const auto& cutLevelPair : cutFuncs) { @@ -373,6 +377,134 @@ bool passHITight( const TrackParticle& trk, const xAOD::Vertex* vtx ) return true; } +bool passHILooseOptimized( const TrackParticle& trk, const xAOD::Vertex* vtx ) +{ + auto eta=std::fabs(trk.eta()); + if (eta > 2.5) return false; + + uint8_t nPixHoles = getSum(trk, xAOD::numberOfPixelHoles); + if (nPixHoles > 0) return false; + + bool expectIBL = getSum(trk, xAOD::expectInnermostPixelLayerHit); + bool expectBL = getSum(trk, xAOD::expectNextToInnermostPixelLayerHit); + uint8_t nIBL = getSum(trk, xAOD::numberOfInnermostPixelLayerHits); + uint8_t nBL = getSum(trk, xAOD::numberOfNextToInnermostPixelLayerHits); + if (expectIBL) { + if (nIBL < 1) return false; + } else { + if (expectBL && nBL < 1) return false; + } + + std::vector<double> vEta = {0.0, 1.1,1.6,2.0}; + std::vector<double> vPt = {500, 600, 700, 800, 900, 1000, 1500, + 2000,2500,3000,5000,8000,12000}; + std::vector<std::vector<double>> vvMaxZ0sT = {{2.10,2.15,6.00,5.00,3.10,2.00,1.75,1.60,1.43,1.40,1.05,0.65,0.60}, + {1.44,1.47,1.50,1.55,1.62,1.45,1.45,1.78,1.73,1.50,1.20,0.97,0.53}, + {1.40,1.45,1.50,1.46,1.41,1.37,1.25,1.50,1.50,1.36,1.10,0.85,0.52}, + {1.51,1.70,1.70,1.71,1.71,1.53,1.54,1.49,1.36,1.20,0.95,0.60,0.55}}; + std::vector<std::vector<double>> vvMaxD0 = {{0.81,0.90,0.94,0.92,0.90,0.75,0.65,0.63,0.62,0.60,0.63,0.50,0.55}, + {1.00,0.98,0.98,0.92,0.90,0.69,0.67,0.86,0.88,0.88,0.88,0.87,1.06}, + {1.19,1.15,1.10,1.08,1.03,0.94,0.85,0.97,0.97,0.96,0.95,0.92,1.04}, + {1.33,1.23,1.21,1.15,1.15,1.07,0.94,0.97,0.97,0.97,0.98,1.10,1.10}}; + auto pt=std::fabs(trk.pt()); + if(eta>vEta.at(0) && pt>vPt.at(0)) + { + uint8_t eta_bin=0; + for(;eta_bin<vEta.size()-1;++eta_bin) + { + if(vEta.at(eta_bin)<=eta && eta<vEta.at(eta_bin+1)) + { + break; + } + } + uint8_t pt_bin=0; + for(;pt_bin<vPt.size()-1;++pt_bin) + { + if(vPt.at(pt_bin)<=pt && pt<vPt.at(pt_bin+1)) + { + break; + } + } + + if (vtx != nullptr) { + if (std::fabs(trk.z0()+trk.vz()-vtx->z())*std::sin(trk.theta()) > vvMaxZ0sT.at(eta_bin).at(pt_bin)) return false; + } + if(std::abs(trk.d0())>vvMaxD0.at(eta_bin).at(pt_bin)) return false; + } + + return true; +} + +bool passHITightOptimized( const TrackParticle& trk, const xAOD::Vertex* vtx ) +{ + auto eta=std::fabs(trk.eta()); + if (eta > 2.5) return false; + + uint8_t nPixHoles = getSum(trk, xAOD::numberOfPixelHoles); + if (nPixHoles > 0) return false; + + bool expectIBL = getSum(trk, xAOD::expectInnermostPixelLayerHit); + bool expectBL = getSum(trk, xAOD::expectNextToInnermostPixelLayerHit); + uint8_t nIBL = getSum(trk, xAOD::numberOfInnermostPixelLayerHits); + uint8_t nBL = getSum(trk, xAOD::numberOfNextToInnermostPixelLayerHits); + if (expectIBL) { + if (nIBL < 1) return false; + } else { + if (expectBL && nBL < 1) return false; + } + + std::vector<double> vEta = {0.0,1.1,1.6,2.0}; + std::vector<double> vPt = {500, 600, 700, 800, 900, 1000, 1500, + 2000,2500,3000,5000,8000,12000}; + std::vector<std::vector<double>> vvMaxZ0sT = {{0.62,0.70,0.82,0.87,0.74,0.61,0.50,0.48,0.46,0.45,0.30,0.24,0.23}, + {0.51,0.53,0.53,0.53,0.52,0.43,0.28,0.27,0.28,0.30,0.24,0.22,0.13}, + {0.91,0.89,0.87,0.55,0.59,0.37,0.39,0.31,0.34,0.35,0.30,0.30,0.20}, + {0.76,0.71,0.69,0.48,0.48,0.47,0.46,0.42,0.38,0.32,0.28,0.20,0.15}}; + std::vector<std::vector<double>> vvMaxD0 = {{0.34,0.39,0.47,0.49,0.55,0.47,0.44,0.21,0.19,0.17,0.12,0.14,0.15}, + {0.32,0.32,0.33,0.33,0.33,0.27,0.16,0.15,0.13,0.15,0.13,0.16,0.20}, + {0.95,0.91,0.88,0.35,0.37,0.24,0.26,0.22,0.23,0.24,0.19,0.19,0.23}, + {0.68,0.67,0.65,0.42,0.42,0.36,0.35,0.31,0.27,0.26,0.27,0.28,0.30}}; + std::vector<std::vector<double>> vvMaxSctHoles = {{0,0,0,0,0,0,0,1,1,1,1,1,1}, + {0,0,0,0,0,0,1,1,1,1,1,1,1}, + {1,1,1,1,1,1,1,1,1,1,1,1,1}, + {1,1,1,1,1,1,1,1,1,1,1,1,1}}; + std::vector<std::vector<double>> vvMinSctHits = {{0,0,0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,6,6,6,6,0,0,0}, + {8,8,8,7,7,6,6,6,6,6,0,0,0}, + {7,7,7,0,0,0,0,0,0,0,0,0,0}}; + auto pt=std::fabs(trk.pt()); + if(eta>vEta.at(0) && pt>vPt.at(0)) + { + uint8_t eta_bin=0; + for(;eta_bin<vEta.size()-1;++eta_bin) + { + if(vEta.at(eta_bin)<=eta && eta<vEta.at(eta_bin+1)) + { + break; + } + } + uint8_t pt_bin=0; + for(;pt_bin<vPt.size()-1;++pt_bin) + { + if(vPt.at(pt_bin)<=pt && pt<vPt.at(pt_bin+1)) + { + break; + } + } + + if (vtx != nullptr) { + if (std::fabs(trk.z0()+trk.vz()-vtx->z())*std::sin(trk.theta()) > vvMaxZ0sT.at(eta_bin).at(pt_bin)) return false; + } + if(std::abs(trk.d0())>vvMaxD0.at(eta_bin).at(pt_bin)) return false; + uint8_t nSctHoles = getSum(trk, xAOD::numberOfSCTHoles); + if (nSctHoles > vvMaxSctHoles.at(eta_bin).at(pt_bin)) return false; + uint8_t nSctHits = getSum(trk, xAOD::numberOfSCTHits) + getSum(trk, xAOD::numberOfSCTDeadSensors); + if (nSctHits < vvMinSctHits.at(eta_bin).at(pt_bin)) return false; + } + + return true; +} + // whether the track passes the experimental pixel cut bool passExpPix( const TrackParticle& trk, const xAOD::Vertex* ) { diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/util/InDetTrackSelectionToolTester.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/util/InDetTrackSelectionToolTester.cxx index 70d6c2415f655a59b4ee527e805aae3d95adf5a3..c7048b5db08d6c417ef42f192d6b551708b3b7a9 100644 --- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/util/InDetTrackSelectionToolTester.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/util/InDetTrackSelectionToolTester.cxx @@ -111,7 +111,7 @@ int main( int argc, char* argv[] ) { unique_ptr< TFile > outFile(new TFile("IDTrackSelectionToolTestOut.root", "RECREATE")); Info( APP_NAME, "Creating output file %s", outFile->GetName() ); - const vector<string> cutNames = {"NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon", "LooseElectron", "MinBias", "HILoose", "HITight"}; // these are names of pre-defined selections + const vector<string> cutNames = {"NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon", "LooseElectron", "MinBias", "HILoose", "HITight", "HILooseOptimized", "HITightOptimized"}; // these are names of pre-defined selections const vector<string> otherCutNames = {"IP", "IPSigma", "IPSignificance"}; // other configurations we will define manually std::map<string, unique_ptr<TrkSelTool> > selToolMap; std::map<string, unique_ptr<HistFamily> > histFamilyMap; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx index 7087a95117dba6ffb48a1c33d59dfebf1fed3b29..ed7d47d30970d14e9bf578597f5bb711f018f3d1 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx @@ -49,7 +49,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, m_zTrkErrorCut(5.0), m_cutBVrtScore(0.015), m_vrt2TrMassLimit(4000.), - m_useFrozenVersion(true), + m_useFrozenVersion(false), m_fillHist(false), m_existIBL(true), m_RobustFit(1), diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/ITkStripClusterOnTrackTool.h b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/ITkStripClusterOnTrackTool.h index e8d250538fbaa06ec9f00d330c5de4d31824cf78..c9d9edac0162aa2ad31650eabde32445af1db289 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/ITkStripClusterOnTrackTool.h +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/ITkStripClusterOnTrackTool.h @@ -17,15 +17,13 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "TrkToolInterfaces/IRIO_OnTrackCreator.h" -#include "InDetCondTools/ISiLorentzAngleTool.h" #include "InDetRIO_OnTrack/SCT_ClusterOnTrack.h" #include "InDetRIO_OnTrack/SCTRIO_OnTrackErrorScaling.h" -#include "SCT_ModuleDistortions/ISCT_ModuleDistortionsTool.h" #include "TrkParameters/TrackParameters.h" namespace ITk { -/** @brief creates StripClusterOnTrack objects allowing to +/** @brief creates SCT_ClusterOnTrack objects allowing to calibrate cluster position and error using a given track hypothesis. See doxygen of Trk::RIO_OnTrackCreator for details. @@ -49,69 +47,25 @@ public: virtual StatusCode initialize() override; - /** @brief produces an StripClusterOnTrack using the measured - SCT_Cluster and the track prediction. - - This method is a factory, so the client has to take care - of management/deletion of the StripClusterOnTrack. + /** @brief produces an SCT_ClusterOnTrack for ITk strip clusters + * using the measured SCT_Cluster and the track prediction. + * This method is a factory, so the client has to take care + * of management/deletion of the SCT_ClusterOnTrack. */ virtual const InDet::SCT_ClusterOnTrack* correct (const Trk::PrepRawData&, const Trk::TrackParameters&) const override; - - /** @brief Returns a correction to be applied to the Strip cluster local x position - in simulated events to remove a position bias introduced by the Strip digitisation. - - @param [in] phi angle of track relative to Lorentz drift direction, in transverse plane - @param [in] nstrip Strip cluster size (number of strips) - */ - static double getCorrection(double phi, int nstrip) ; - - - /** @brief Returns the resolution on the reconstructed position (local x) of Strip clusters - in simulated events. - - @param [in] phi angle of track relative to Lorentz drift direction, in transverse plane - @param [in] nstrip Strip cluster size (number of strips) - - The parameterisation of the resolution contained in getError() was derived from SCT - barrel clusters (80 micron pitch). It can be applied also to endcap clusters, after - rescaling to the appropriate pitch. - */ - static double getError(double phi, int nstrip) ; - - private: +private: /////////////////////////////////////////////////////////////////// // Private data: /////////////////////////////////////////////////////////////////// - //! toolhandle for central error scaling - SG::ReadCondHandleKey<RIO_OnTrackErrorScaling> m_stripErrorScalingKey - {this,"ErrorScalingKey", "/Indet/TrkErrorScalingITkStrip", "Key for ITkStrip error scaling conditions data."}; - - ToolHandle<ISCT_ModuleDistortionsTool> m_distortionsTool{this, "DistortionsTool", "StripDistortionsTool", "Tool to retrieve ITkStrip distortions"}; - ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; - //! flag storing if errors need scaling or should be kept nominal - - //! job options - bool m_option_make2dimBarrelClusters; - bool m_doDistortions ;//!< Flag to set Distortions - int m_option_errorStrategy; - int m_option_correctionStrategy; - - // Correction for AnnulusBounds - std::unique_ptr<const InDet::SCT_ClusterOnTrack> correctAnnulus(const InDet::SCT_Cluster*, const Trk::TrackParameters&) const; - - /// @brief Correction method for polar annulus bounds. - /// Produces local polar coordinates from the cartesian measurement @c SC, - /// but links back to the original cluster. Expects that @c trackPar - /// links to a @c DiscSurface with @c AnnulusBoundsPC bounds on it. - /// Also assumes @c SC links to an instance @c StripStereoAnnulusBounds - /// @param SC The cartesian cluster to correct - /// @param trackPar Track parameters - std::unique_ptr<const InDet::SCT_ClusterOnTrack> correctAnnulusPC - (const InDet::SCT_Cluster* SC, const Trk::TrackParameters& trackPar) const; + //! toolhandle for central error scaling + SG::ReadCondHandleKey<RIO_OnTrackErrorScaling> m_stripErrorScalingKey + {this,"ErrorScalingKey", "/Indet/TrkErrorScalingITkStrip", "Key for ITkStrip error scaling conditions data."}; + IntegerProperty m_option_errorStrategy{this, "ErrorStrategy", -1, "if ErrorStrategy < 0, keep previous errors else recompute"}; + IntegerProperty m_option_correctionStrategy{this, "CorrectionStrategy", -1, "if CorrectionStrategy >= 0, apply correction to position"}; }; diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/ITkStripClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/ITkStripClusterOnTrackTool.cxx index 40b5e4b29bad8411f4dbb5327ed8470cff5d27bb..0df266a52c2ea2e1868c40f1cc24915ef7336ad3 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/ITkStripClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/ITkStripClusterOnTrackTool.cxx @@ -13,9 +13,7 @@ #include "SiClusterOnTrackTool/ITkStripClusterOnTrackTool.h" #include "TrkSurfaces/RectangleBounds.h" -#include "TrkSurfaces/TrapezoidBounds.h" #include "TrkSurfaces/AnnulusBounds.h" -#include "TrkSurfaces/AnnulusBoundsPC.h" #include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" #include "ReadoutGeometryBase/SiCellId.h" #include "TrkRIO_OnTrack/ErrorScalingCast.h" @@ -31,21 +29,8 @@ using CLHEP::deg; ITk::StripClusterOnTrackTool::StripClusterOnTrackTool (const std::string &t, const std::string &n, const IInterface *p) : - AthAlgTool(t, n, p), - m_option_make2dimBarrelClusters(false), - m_doDistortions(false), - m_option_errorStrategy(-1), - m_option_correctionStrategy(-1) { + AthAlgTool(t, n, p) { declareInterface<IRIO_OnTrackCreator>(this); - - declareProperty("MakeTwoDimBarrelClusters", m_option_make2dimBarrelClusters, - "flag if strip length should be part of the measurement"); - declareProperty("ErrorStrategy", m_option_errorStrategy, - "if ErrorStrategy < 0, keep previous errors else recompute"); - declareProperty("CorrectionStrategy", m_option_correctionStrategy, - "if CorrectionStrategy >= 0, apply a correction to the cluster position"); - declareProperty("doDistortions", m_doDistortions, - "Simulation of module distortions"); } /////////////////////////////////////////////////////////////////// @@ -56,40 +41,36 @@ StatusCode ITk::StripClusterOnTrackTool::initialize() { StatusCode sc = AlgTool::initialize(); - msg(MSG::INFO) << "A strategy to "; + ATH_MSG_INFO("Error strategy set to "); switch (m_option_errorStrategy) { - case -1: msg(MSG::INFO) << "keep the PRD errors"; + case -1: ATH_MSG_INFO("keep the PRD errors"); break; - case 0: msg(MSG::INFO) << "apply simple pitch errors"; + case 0: ATH_MSG_INFO("apply width/sqrt(12) as errors"); break; - case 1: msg(MSG::INFO) << "assign tuned ITkStrip errors"; - break; + default: ATH_MSG_ERROR(" -- NO, UNKNOWN. Pls check jobOptions!"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO(" will be applied during ITkStripClusterOnTrack making"); - case 2: msg(MSG::INFO) << "assign tuned, angle-dependent ITkStrip errors"; + ATH_MSG_INFO("Position correction strategy set to "); + switch (m_option_correctionStrategy) { + case -1: ATH_MSG_INFO("keep the global position as evaluated"); break; - default: msg(MSG::INFO) << " -- NO, UNKNOWN. Pls check jobOptions!"; - break; + default: ATH_MSG_ERROR(" -- NO, UNKNOWN. Pls check jobOptions!"); + return StatusCode::FAILURE; } - msg(MSG::INFO) << " will be applied during ITkStripClusterOnTrack making" << endmsg; + ATH_MSG_INFO(" will be applied during ITkStripClusterOnTrack making"); + // get the error scaling tool if (!m_stripErrorScalingKey.key().empty()) { ATH_CHECK(m_stripErrorScalingKey.initialize()); - ATH_MSG_DEBUG("Detected need for scaling ITkStrip errors."); + ATH_MSG_INFO("Detected need for scaling ITkStrip errors."); } - // Get ISCT_ModuleDistortionsTool - if (m_doDistortions) { - ATH_CHECK(m_distortionsTool.retrieve()); - } else { - m_distortionsTool.disable(); - } - - ATH_CHECK(m_lorentzAngleTool.retrieve()); - return sc; } @@ -100,423 +81,217 @@ ITk::StripClusterOnTrackTool::initialize() { const InDet::SCT_ClusterOnTrack * ITk::StripClusterOnTrackTool::correct (const Trk::PrepRawData &rio, const Trk::TrackParameters &trackPar) const { - const InDet::SCT_Cluster *SC = nullptr; + const InDet::SCT_Cluster *cluster = nullptr; - if (!(SC = dynamic_cast<const InDet::SCT_Cluster *> (&rio))) { + if (!(cluster = dynamic_cast<const InDet::SCT_Cluster *> (&rio))) { ATH_MSG_WARNING("Attempt to correct RIO which is not SCT_Cluster with ITk::StripClusterOnTrackTool: returning nullptr"); return nullptr; } - const InDet::SiWidth width = SC->width(); - const Amg::Vector2D &colRow = width.colRow(); + ATH_MSG_VERBOSE("STARTING CLUSTER ON TRACK CORRECTION... " << __func__ << " " << __LINE__); + ATH_MSG_VERBOSE(" DUMPING CLUSTER POSITION / COVARIANCE: "); + ATH_MSG_VERBOSE("STRIP CLUSTER POS --> " << cluster->localPosition()[0] << ", " << cluster->localPosition()[1]); + ATH_MSG_VERBOSE("STRIP CLUSTER COV --> " << cluster->localCovariance()(0, 0) << ", " << cluster->localCovariance()(0, 1)); + ATH_MSG_VERBOSE("STRIP CLUSTER COV --> " << cluster->localCovariance()(1, 0) << ", " << cluster->localCovariance()(1, 1)); + ATH_MSG_VERBOSE("STRIP CLUSTER GLOBAL POSITION = " << cluster->globalPosition().x() << ", " << cluster->globalPosition().y() << ", " << cluster->globalPosition().z()); // Get pointer to detector element // - const InDetDD::SiDetectorElement *EL = SC->detectorElement(); - if (!EL) { + const InDetDD::SiDetectorElement *detectorElement = cluster->detectorElement(); + if (!detectorElement) { return nullptr; } - IdentifierHash iH = EL->identifyHash(); - - const Trk::SurfaceBounds *bounds = &trackPar.associatedSurface().bounds(); - Trk::SurfaceBounds::BoundsType boundsType = bounds->type(); - - auto designShape = EL->design().shape(); // Get local position of track // Amg::Vector2D loct = trackPar.localPosition(); - - // Find phi angle of track relative to Lorentz drift direction, if needed - // - double dphi(0.); - double sinAlpha = EL->sinStereoLocal(SC->localPosition()); + double sinAlpha = detectorElement->sinStereoLocal(cluster->localPosition()); double cosAlpha = std::sqrt(1 - sinAlpha * sinAlpha); - if (m_option_errorStrategy == 2 || m_option_correctionStrategy == 0) { - double pNormal = trackPar.momentum().dot(EL->normal()); - double pPhi = trackPar.momentum().dot(Amg::AngleAxis3D(asin(-sinAlpha), Amg::Vector3D::UnitZ()) * EL->phiAxis()); - dphi = std::atan(pPhi / pNormal) - std::atan(m_lorentzAngleTool->getTanLorentzAngle(iH)); - } Amg::Vector3D localstripdir(-sinAlpha, cosAlpha, 0.); + ATH_MSG_VERBOSE("STRIP DIRECTION = " << localstripdir[0] << ", " << localstripdir[1]); Amg::Vector3D globalstripdir = trackPar.associatedSurface().transform().linear() * localstripdir; - double distance = (trackPar.position() - SC->globalPosition()).mag(); - - double boundsy = -1; - double striphalflength = -1; - - if(boundsType == Trk::SurfaceBounds::Trapezoid){ - boundsy = (static_cast<const Trk::TrapezoidBounds *>(bounds))->halflengthY(); - } - - else if (boundsType == Trk::SurfaceBounds::Rectangle){ - boundsy = (static_cast<const Trk::RectangleBounds *>(bounds))->halflengthY(); - } - - else if(boundsType == Trk::SurfaceBounds::Annulus){ - //for annuli do something different, since we already have in-sensor stereo rotations which strip length accounts for - // cartesian or polar coordinate annulus bounds? - const Trk::AnnulusBounds *abounds - = dynamic_cast<const Trk::AnnulusBounds *> (&trackPar.associatedSurface().bounds()); - const Trk::AnnulusBoundsPC *aboundspc - = dynamic_cast<const Trk::AnnulusBoundsPC *> (&trackPar.associatedSurface().bounds()); - if(aboundspc != nullptr) { - return correctAnnulusPC(SC, trackPar).release(); - } - else if(abounds != nullptr) { - const InDetDD::SiCellId & lp = EL->cellIdOfPosition(SC->localPosition()); - const InDetDD::StripStereoAnnulusDesign * design = static_cast<const InDetDD::StripStereoAnnulusDesign *> (&EL->design()); - striphalflength = design->stripLength(lp) / 2.0; - if (distance > striphalflength) distance = striphalflength - 1; // subtract 1 to be consistent with below; no sure why this has to be so large... + // Evaluate distance between cluster and estimated track parameters + // used later on to estimate the corrected cluster position + double distance = (trackPar.position() - cluster->globalPosition()).mag(); + + ATH_MSG_VERBOSE(" DUMPING TRACK PARAMETER POSITION / COVARIANCE: "); + ATH_MSG_VERBOSE("TRACK PAR LOCAL POS = " << loct[0] << ", " << loct[1]); + ATH_MSG_VERBOSE("TRACK PAR GLOBAL POSITION = " << trackPar.position().x() << ", " << trackPar.position().y() << ", " << trackPar.position().z()); + + // phi pitch in radians, for endcap modules + double phiPitchInRad = 0.; + + // barrel or endcap treatment + if (detectorElement->isBarrel()) { + // barrel treatment: + // get the module half length from the associated surface bounds + const Trk::SurfaceBounds *bounds = &trackPar.associatedSurface().bounds(); + double boundsy = (static_cast<const Trk::RectangleBounds *>(bounds))->halflengthY(); + ATH_MSG_VERBOSE("BARREL ====>>>> DISTANCE*COSALPHA / HALF LENGTH --> " << distance*cosAlpha << " / " << boundsy); + // Check if distance between track parameter local position + // and cluster position is larger than surface bounds (including local stereo angle). + // If so, set distance to maximum (- tolerance) + if (distance*cosAlpha > boundsy){ + ATH_MSG_VERBOSE("DISTANCE TO LARGE COMPARED TO BOUNDS, SETTING TO MAXIMUM"); + distance = boundsy/cosAlpha - 1.; // use 1 mm as tolerance parameter + // if local position is negative, also the distance has to be negative + if (loct.y() < 0) + distance = -distance; } - else { - // this shouldn't really happen - ATH_MSG_ERROR("AnnulusBounds type is neither cartesian nor polar"); - return nullptr; + } else { + // endcap treatment: + // for annuli do something different, since we already have in-sensor + // stereo rotations which strip length accounts for + const InDetDD::StripStereoAnnulusDesign * design = + static_cast<const InDetDD::StripStereoAnnulusDesign *> (&detectorElement->design()); + const InDetDD::SiCellId & siCellId = detectorElement->cellIdOfPosition(cluster->localPosition()); + double striphalflength = design->stripLength(siCellId) / 2.0; + ATH_MSG_VERBOSE("ENDCAP ====>>>> DISTANCE / STRIP HALF LENGTH --> " << distance << " / " << striphalflength); + // caching phi pitch in radians + phiPitchInRad = design->phiWidth()/design->diodesInRow(0); + // Check if distance between track parameter local position + // and cluster position is larger than strip length. + // If so, set distance to maximum (- tolerance) + if (distance > striphalflength) { + ATH_MSG_VERBOSE("DISTANCE TO LARGE COMPARED TO BOUNDS, SETTING TO MAXIMUM"); + distance = striphalflength - 1.; // use 1 mm as tolerance parameter } - } // boundsType == Trk::SurfaceBounds::Annulus - - else { - ATH_MSG_ERROR("Undefined bounds! Strip position may be off-sensor!"); - return nullptr; - } - - if (boundsy>0 && distance*cosAlpha> boundsy){ - //skip this for Annulus (which has boundsy=-1) as we have already dealt with out-of-bounds hits - distance=boundsy/cosAlpha-1; } - // SCT_ClusterOnTrack production - // - Trk::LocalParameters locpar; - if (loct.y() < 0) { - distance = -distance; - } - Amg::Vector3D glob(SC->globalPosition() + distance * globalstripdir); - Amg::MatrixX oldcov = SC->localCovariance(); + Amg::MatrixX prevCov = cluster->localCovariance(); // Local position and error matrix production // - // let's start to re-compute cluster error if errorStrategy >=0 - // These were derived by the studies reported on 25th September 2006 - // https://indico.cern.ch/event/430391/contributions/1066157/attachments/929942/1317007/SCTSoft_25Sept06_clusters.pdf - // and on 4th February 2008 - // https://indico.cern.ch/event/22934/contributions/485813/attachments/379647/528096/ClusterErrors_04Feb08.pdf constexpr double ONE_TWELFTH= 1.0/12.; if (m_option_errorStrategy > -1) { Amg::MatrixX mat(2, 2); mat.setZero(); + const InDet::SiWidth width = cluster->width(); switch (m_option_errorStrategy) { case 0: + // apply width/sqrt(12) as errors mat(0, 0) = std::pow(width.phiR(), 2) * ONE_TWELFTH; mat(1, 1) = std::pow(width.z(), 2) * ONE_TWELFTH; break; - case 1: - if (colRow.x() == 1) { - mat(0, 0) = std::pow(1.05 * width.phiR(), 2) * ONE_TWELFTH; - } else if (colRow.x() == 2) { - mat(0, 0) = std::pow(0.27 * width.phiR(), 2) * ONE_TWELFTH; - } else { - mat(0, 0) = std::pow(width.phiR(), 2) * ONE_TWELFTH; - } - mat(1, 1) = std::pow(width.z() / colRow.y(), 2) * ONE_TWELFTH; - break; - - case 2: - mat(0, 0) = std::pow(getError(dphi, int(colRow.x())) * (EL->phiPitch() / 0.080), 2); - mat(1, 1) = std::pow(width.z() / colRow.y(), 2) * ONE_TWELFTH; - break; - default: // don't do anything.... break; } - // rotation for endcap ITkStrip - if (designShape == InDetDD::Trapezoid || designShape == InDetDD::Annulus) { - double sn = EL->sinStereoLocal(SC->localPosition()); - double sn2 = sn * sn; - double cs2 = 1. - sn2; - double w = EL->phiPitch(SC->localPosition()) / EL->phiPitch(); - double v0 = mat(0, 0) * w * w; + ATH_MSG_VERBOSE("CLUSTER ON TRACK COVARIANCE = " << mat(0, 0) << ", " << mat(0, 1) ); + ATH_MSG_VERBOSE(" " << mat(1, 0) << ", " << mat(1, 1) ); + + // error matrix rotation for endcap clusters + if (not detectorElement->isBarrel()) { + // the cluster covariance is expressed in the module + // frame and needs to be rotated into the strip frame. + // This rotation is done using the jacobian: + // + // J = ( cos(alpha) sin(alpha) + // -sin(alpha) cos(alpha) ) + // + // The rotated covariance becomes + // C = J C_{0} J^T + // + // where C_{0} is the cluster covariance, + // and alpha is the local stereo angle. + // + // C_{0} = ( var_{0}^2 0 + // 0 var_{1}^2 ) + // + // var_{0} also accounts for the pitch scaling. + // + double sinAlpha = detectorElement->sinStereoLocal(cluster->localPosition()); + double sinAlpha2 = sinAlpha * sinAlpha; + double cosAlpha2 = (1. - sinAlpha) * (1. + sinAlpha);; + double weight = detectorElement->phiPitch(cluster->localPosition()) / detectorElement->phiPitch(); + double v0 = mat(0, 0) * weight * weight; double v1 = mat(1, 1); - mat(0, 0) = (cs2 * v0 + sn2 * v1); - mat(1, 0) = (sn * std::sqrt(cs2) * (v0 - v1)); + mat(0, 0) = (cosAlpha2 * v0 + sinAlpha2 * v1); + mat(1, 0) = (sinAlpha * std::sqrt(cosAlpha2) * (v0 - v1)); mat(0, 1) = mat(1, 0); - mat(1, 1) = (sn2 * v0 + cs2 * v1); + mat(1, 1) = (sinAlpha2 * v0 + cosAlpha2 * v1); + + ATH_MSG_VERBOSE(" ROTATION OF ENDCAP STRIP CLUSTER COVARIANCE"); + ATH_MSG_VERBOSE("sinAlpha / sinAlpha2 / cosAlpha2 / weight = " << sinAlpha << " / " << sinAlpha2 << " / " << cosAlpha2 << " / " << weight); + ATH_MSG_VERBOSE("v0 / v1 = " << v0 << " / " << v1); + ATH_MSG_VERBOSE("ROTATED CLUSTER COVARIANCE = " << mat(0, 0) << ", " << mat(0, 1) ); + ATH_MSG_VERBOSE(" " << mat(1, 0) << ", " << mat(1, 1) ); + } - oldcov = mat; + // updating covariance + prevCov = mat; } - // else if (designShape == InDetDD::PolarAnnulus) {// polar rotation for endcap} - - Amg::MatrixX cov(oldcov); - // barrel - // if (designShape != InDetDD::Trapezoid && designShape!=InDetDD::Annulus && designShape != InDetDD::PolarAnnulus) { - if (designShape == InDetDD::Box) { - Trk::DefinedParameter lpos1dim(SC->localPosition().x(), Trk::locX); - locpar = (m_option_make2dimBarrelClusters) ? - Trk::LocalParameters(SC->localPosition()) :// PRDformation does 2-dim - Trk::LocalParameters(lpos1dim); - if (!m_option_make2dimBarrelClusters) { - cov = Amg::MatrixX(1, 1); - cov(0, 0) = oldcov(0, 0); - } + Trk::LocalParameters localParameters; + Amg::MatrixX covariance(prevCov); + Amg::Vector3D globalPosition(cluster->globalPosition() + distance * globalstripdir); + + // construction of the local parameters to build cluster on track + if (detectorElement->isBarrel()) { + Trk::DefinedParameter lpos1dim(cluster->localPosition().x(), Trk::locX); + localParameters = Trk::LocalParameters(lpos1dim); + covariance = Amg::MatrixX(1, 1); + covariance(0, 0) = prevCov(0, 0); + // scaling errors if required if (!m_stripErrorScalingKey.key().empty()) { SG::ReadCondHandle<RIO_OnTrackErrorScaling> error_scaling( m_stripErrorScalingKey ); - cov = Trk::ErrorScalingCast<SCTRIO_OnTrackErrorScaling>(*error_scaling) - ->getScaledCovariance(std::move(cov), false, 0.0); + covariance = Trk::ErrorScalingCast<SCTRIO_OnTrackErrorScaling>(*error_scaling) + ->getScaledCovariance(std::move(covariance), false, 0.0); } - // } else if (designShape == InDetDD::PolarAnnulus) { // polar specialisation - } else { // endcap - locpar = Trk::LocalParameters(SC->localPosition()); + } else { + localParameters = Trk::LocalParameters(cluster->localPosition()); + // scaling errors if required if (!m_stripErrorScalingKey.key().empty()) { SG::ReadCondHandle<RIO_OnTrackErrorScaling> error_scaling(m_stripErrorScalingKey); - cov = Trk::ErrorScalingCast<SCTRIO_OnTrackErrorScaling>(*error_scaling) - ->getScaledCovariance(std::move(cov), true, - EL->sinStereoLocal(SC->localPosition())); + covariance = Trk::ErrorScalingCast<SCTRIO_OnTrackErrorScaling>(*error_scaling) + ->getScaledCovariance(std::move(covariance), true, + detectorElement->sinStereoLocal(cluster->localPosition())); } - double Sn = EL->sinStereoLocal(SC->localPosition()); - double Sn2 = Sn * Sn; - double Cs2 = (1. - Sn) * (1. + Sn); - double SC = Sn * std::sqrt(Cs2); - double W = EL->phiPitch(loct) / EL->phiPitch(); - double dV0 = (Cs2 * cov(0, 0) + Sn2 * cov(1, 1) + - 2. * SC * cov(1, 0)) * (W * W - 1.); - cov(0, 0) += (Cs2 * dV0); - cov(1, 0) += (SC * dV0); - cov(0, 1) = cov(1, 0); - cov(1, 1) += (Sn2 * dV0); - } - if (m_doDistortions) { - if (EL->isBarrel() == 1) {// Only apply disortions to barrel modules - locpar[Trk::locX] -= m_distortionsTool->correctReconstruction(trackPar, *EL, locpar, loct); - } - } - - - // Apply correction for cluster position bias - // - if (m_option_correctionStrategy == 0) { - double correction = getCorrection(dphi, int(colRow.x())) * EL->hitDepthDirection(); - locpar[Trk::locX] += correction; + // For endcap strip clusters, the error matrix needs to be scaled + // accordingly to the strip pitch (in mm) at the estimated track parameter. + // The scaling term is evaluated in the strip frame and + // transformed in the module frame. + double sinAlpha = detectorElement->sinStereoLocal(cluster->localPosition()); + double sinAlpha2 = sinAlpha * sinAlpha; + double cosAlpha2 = (1. - sinAlpha) * (1. + sinAlpha); + double sinAlphaCosAlpha = sinAlpha * std::sqrt(cosAlpha2); + // Weight factor to express the strip pitch (in mm) from the module center to the + // estimated track parameter position. + double radiusAtLocPos = std::hypot(loct.x(), loct.y()); + double phiPitchAtLocPos = phiPitchInRad*radiusAtLocPos; + double weight = phiPitchAtLocPos / detectorElement->phiPitch(); + // Error matrix scaling term, this is expressend in the module frame. + // It is evaluated using the same jacobian used above. + double dV0 = (cosAlpha2 * covariance(0, 0) + sinAlpha2 * covariance(1, 1) + + 2. * sinAlphaCosAlpha * covariance(1, 0)) * (weight * weight - 1.); + + // The final covariance matrix, which also accounts for the scaling: + // Scaling and rotation are done with the same transformation: + // + // C = J C_{0} J^T + // + // where C_{0} is also includes the scaling term dV0: + // + // C_{0} = ( var_{0}^2 + dV0 0 + // 0 var_{1}^2 ) + // + // The scaling terms are then added to the previously evaluated matrix: + covariance(0, 0) += (cosAlpha2 * dV0); + covariance(1, 0) += (sinAlphaCosAlpha * dV0); + covariance(0, 1) = covariance(1, 0); + covariance(1, 1) += (sinAlpha2 * dV0); + + ATH_MSG_VERBOSE(" SCALING OF ENDCAP STRIP CLUSTER COVARIANCE"); + ATH_MSG_VERBOSE("sinAlpha / sinAlpha2 / cosAlpha2 / weight = " << sinAlpha << " / " << sinAlpha2 << " / " << cosAlpha2 << " / " << weight ); + ATH_MSG_VERBOSE("dV0 = (" << cosAlpha2 * covariance(0, 0) << " + " << sinAlpha2 * covariance(1, 1) << " + " << 2. * sinAlphaCosAlpha * covariance(1, 0) << " ) * " << (weight * weight - 1.) << " = " << dV0); + ATH_MSG_VERBOSE("SCALED CLUSTER COVARIANCE = " << covariance(0, 0) << ", " << covariance(0, 1) ); + ATH_MSG_VERBOSE(" " << covariance(1, 0) << ", " << covariance(1, 1) ); } + // final construction of clustr of track bool isbroad = m_option_errorStrategy == 0; - return new InDet::SCT_ClusterOnTrack(SC, locpar, cov, iH, glob, isbroad); -} - -double -ITk::StripClusterOnTrackTool::getCorrection(double phi, int nstrip) { - // Inherited from SCT - // Worth revisiting at some point, if only to retrieve the numbers from the database instead of using hardcoded ones - - float corr1[30] = { - 0.3, 0.8, 1.1, 1.5, 1.9, 1.9, 2.1, 2.4, 2.3, 2.6, - 2.6, 2.7, 2.8, 2.7, 2.5, 2.6, 2.8, 2.6, 2.6, 2.7, - 2.2, 1.8, 1.8, 1.6, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0 - }; - float corr2[30] = { - 0.0, 0.0, 0.0, 1.0, 1.5, 1.7, 1.7, 2.3, 2.1, 2.5, - 2.5, 2.7, 2.7, 2.9, 3.0, 3.0, 3.0, 3.0, 3.4, 3.4, - 3.0, 3.2, 2.6, 2.6, 3.0, 2.7, 2.5, 2.4, 1.7, 1.3 - }; - - // Phi bins have 1 degree width, and cover 0-30 degrees - int phiBin = static_cast<int>(std::abs(phi) / deg); - - float correction(0.); - - if (phiBin < 30) { - if (nstrip == 1) { - correction = corr1[phiBin]; - } - if (nstrip == 2) { - correction = corr2[phiBin]; - } - } - - if (phi > 0.) { - correction *= -1.; - } - - return correction * micrometer; -} - -double -ITk::StripClusterOnTrackTool::getError(double phi, int nstrip) { - // Inherited from SCT - // Worth revisiting at some point, if only to retrieve the numbers from the database instead of using hardcoded ones - float sigma1[60] = { - 22.1, 21.8, 21.4, 21.0, 20.5, 20.0, 19.6, 19.1, 18.5, 18.0, - 17.4, 17.0, 16.4, 15.8, 15.4, 14.9, 14.4, 14.1, 13.3, 13.1, - 12.9, 12.4, 12.6, 12.2, 12.3, 12.6, 13.4, 14.2, 15.6, 19.3, - 22.8, 29.5, 33.2, 41.8, 44.3, 48.4, 49.9, 54.0, 53.0, 56.3, - 57.5, 56.3, 64.5, 65.7, 66.1, 69.4, 74.8, 78.3, 78.8, 79.8, - 73.5, 73.8, 75.8, 84.3, 87.0, 99.9, 86.3, 0.0, 0.0, 0.0 - }; - float sigma2[60] = { - 22.2, 20.3, 18.8, 16.0, 14.6, 13.8, 12.9, 12.9, 12.7, 12.3, - 12.7, 12.6, 13.0, 13.3, 14.0, 14.6, 15.3, 15.9, 16.6, 17.6, - 18.4, 19.3, 19.9, 20.5, 21.0, 21.2, 21.5, 21.4, 21.3, 21.3, - 20.9, 20.8, 20.6, 20.7, 20.3, 20.7, 21.7, 24.4, 26.5, 29.5, - 34.6, 41.6, 48.5, 52.3, 54.5, 58.4, 61.8, 66.7, 69.9, 72.1, - 78.9, 79.2, 81.8, 80.9, 87.5, 99.2, 0.0, 0.0, 0.0, 0.0 - }; - float sigma3[60] = { - 70.1, 73.6, 71.7, 66.9, 68.3, 66.8, 66.2, 64.8, 66.6, 63.3, - 63.3, 60.4, 59.0, 57.1, 56.4, 54.4, 54.2, 54.4, 50.3, 48.9, - 48.1, 41.9, 38.0, 31.8, 28.3, 23.1, 23.0, 20.3, 18.5, 17.6, - 17.7, 16.8, 18.3, 19.3, 19.0, 20.0, 20.9, 21.6, 22.0, 22.2, - 22.7, 22.4, 24.3, 24.8, 24.6, 27.0, 29.8, 37.0, 47.7, 49.3, - 58.2, 60.2, 66.8, 70.8, 77.3, 80.6, 0.0, 0.0, 0.0, 0.0 - }; - float sigma4[60] = { - 103.2, 100.4, 100.7, 101.2, 107.4, 100.6, 100.9, 100.4, 96.3, 98.2, - 96.7, 94.5, 96.9, 91.7, 90.5, 89.5, 86.3, 90.6, 82.4, 89.3, - 87.3, 77.6, 75.7, 77.2, 77.3, 84.1, 80.1, 66.9, 73.7, 72.3, - 58.1, 65.6, 64.2, 54.7, 47.2, 44.4, 34.6, 36.4, 29.1, 25.8, - 18.8, 21.6, 18.6, 20.3, 22.7, 23.3, 24.1, 22.4, 24.7, 24.7, - 27.3, 30.4, 37.0, 46.4, 59.4, 62.6, 65.3, 0.0, 0.0, 0.0 - }; - float sigma5[60] = { - 150.9, 139.7, 133.9, 139.8, 141.4, 134.9, 138.4, 129.3, 137.9, 128.7, - 132.4, 130.1, 124.2, 115.8, 131.4, 115.2, 128.7, 112.8, 130.7, 129.0, - 115.8, 101.3, 115.9, 116.1, 121.7, 109.9, 110.0, 97.2, 96.4, 107.3, - 98.2, 80.0, 73.2, 87.0, 97.0, 88.5, 72.2, 73.9, 80.8, 75.7, - 69.5, 67.1, 54.1, 58.9, 47.3, 50.6, 29.5, 26.6, 25.8, 20.9, - 20.6, 21.9, 22.1, 21.1, 27.9, 41.6, 0.0, 0.0, 0.0, 0.0 - }; - - // Phi bins have 1 degree width, and cover 0-60 degrees - int phiBin = static_cast<int>(std::abs(phi) / deg); - - float sigma(0.); - - if (phiBin < 60) { - if (nstrip == 1) { - sigma = sigma1[phiBin]; - } - if (nstrip == 2) { - sigma = sigma2[phiBin]; - } - if (nstrip == 3) { - sigma = sigma3[phiBin]; - } - if (nstrip == 4) { - sigma = sigma4[phiBin]; - } - if (nstrip == 5) { - sigma = sigma5[phiBin]; - } - } - if (sigma < 0.1) { - sigma = std::max(100., float(nstrip) * 80. / std::sqrt(12)); - } - - return sigma * micrometer; -} - - -/////////////////////////////////////////////////////////////////// -// Trk::SCT_ClusterOnTrack production for AnnulusBounds -/////////////////////////////////////////////////////////////////// - -std::unique_ptr<const InDet::SCT_ClusterOnTrack> ITk::StripClusterOnTrackTool::correctAnnulus - (const InDet::SCT_Cluster* SC, const Trk::TrackParameters&) const -{ - - if(!SC) return nullptr; - const InDetDD::SiDetectorElement* EL = SC->detectorElement(); if(!EL) return nullptr; - IdentifierHash iH = EL->identifyHash(); - - Trk::LocalParameters locpar(SC->localPosition ()); - Amg::MatrixX cov (SC->localCovariance()); - Amg::Vector3D glob (SC->globalPosition ()); - bool isbroad=m_option_errorStrategy==0; - - //return new InDet::SCT_ClusterOnTrack (SC,locpar,cov,iH,glob,isbroad); - return std::make_unique<const InDet::SCT_ClusterOnTrack> (SC,locpar,cov,iH,glob,isbroad); -} - -std::unique_ptr<const InDet::SCT_ClusterOnTrack> ITk::StripClusterOnTrackTool::correctAnnulusPC - (const InDet::SCT_Cluster* SC, const Trk::TrackParameters& trackPar) const -{ - ATH_MSG_VERBOSE(name() << " " << __FUNCTION__); - if(!SC) return nullptr; - - const SCT_ID* sct_ID = nullptr; - if (detStore()->retrieve(sct_ID, "SCT_ID").isFailure()) { - ATH_MSG_ERROR ( "Could not get SCT ID helper" ); - throw std::runtime_error("Unable to get SCT_ID helper"); - } - - const InDetDD::SiDetectorElement* EL = SC->detectorElement(); if(!EL) return nullptr; - - Trk::LocalParameters locpar(SC->localPosition()); // local parameters from cluster: CENTER - - const InDetDD::StripStereoAnnulusDesign *design - = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *> (&EL->design()); - - if(design == nullptr) { - ATH_MSG_ERROR(__FUNCTION__ << " called with non AnnulusBounds"); - return nullptr; - } - - // get first and last strip and row from Cluster - const Identifier& firstStripId = SC->rdoList().front(); - const Identifier& lastStripId = SC->rdoList().back(); - - int firstStrip = sct_ID->strip(firstStripId); - int firstStripRow = sct_ID->row(firstStripId); - int lastStrip = sct_ID->strip(lastStripId); - - int clusterSizeFromId = lastStrip - firstStrip + 1; - - // cell id from cluster - InDetDD::SiCellId lp = EL->cellIdOfPosition(SC->localPosition()); - IdentifierHash iH = EL->identifyHash(); - - // use the original center lp to get pitch and length - double striplength = design->stripLength(lp); // in mm I assume - double pitch = design->phiPitchPhi(lp); // in units of phi - - // build covariance - Amg::MatrixX cov(2,2); - cov.setZero(); - cov(0, 0) = striplength*striplength / 12.; - cov(1, 1) = pitch*pitch / 12.; - - // ?? - bool isbroad=m_option_errorStrategy==0; - - const InDet::SiWidth width = SC->width(); - - InDetDD::SiCellId clusterStartLp = design->strip1Dim(firstStrip, firstStripRow); - - InDetDD::SiLocalPosition siLocPC = design->localPositionOfClusterPC(clusterStartLp, clusterSizeFromId); - - // xPhi is phi, xEta is r - Amg::Vector2D locposPC(siLocPC.xEta(), siLocPC.xPhi()); - - // Apply Lorentz correction, it is given in Y direction of the design, - // which is xPhi, but straight line, and not curved. - // Apply it as arc length now - // @TODO: This is not really correct - double shiftY = m_lorentzAngleTool->getLorentzShift(iH); - double shiftArc = shiftY / locposPC[0]; // phiLorentz = yLorentz / R - Amg::Vector2D lorentz(0, shiftArc); - locposPC += lorentz; - - // build local parameters from measurement position - Trk::LocalParameters locparPC(locposPC); - - // use track parameters' surface for loc to glob - // that is the disc surface - Amg::Vector3D glob = trackPar.associatedSurface().localToGlobal(locposPC); - - auto cot = std::make_unique<const InDet::SCT_ClusterOnTrack> (SC, locparPC, cov, iH, glob, isbroad); - // note: cot has the original surface set. cot->associatedSurface() will return the XY plane surface, - // NOT the PC disc surface - return cot; + return new InDet::SCT_ClusterOnTrack(cluster, localParameters, covariance, + detectorElement->identifyHash(), globalPosition, isbroad); } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h index c539a94545f7dbec8f924f5e425eaa803384e4a0..51ab96edd8dadfaf3ffe66ae561f8682521e1883 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -126,24 +126,22 @@ public: const PixelChargeCalibCondData *calibData, const PixelOfflineCalibData *offlineCalibData) const; - xAOD::PixelCluster* xAODpixelCluster(xAOD::PixelClusterContainer& container, - const Amg::Vector2D& localPos, - const std::vector<Identifier>& rdoList, - const int lvl1a, - const std::vector<int>& totList, - const SiWidth& width, - const InDetDD::SiDetectorElement* element, - bool ganged, - int errorStrategy, - const PixelID& pixelID, + xAOD::PixelCluster* xAODpixelCluster(xAOD::PixelCluster& cluster, + const Amg::Vector2D& localPos, + const std::vector<Identifier>& rdoList, + const int lvl1a, + const std::vector<int>& totList, + const SiWidth& width, + const InDetDD::SiDetectorElement* element, + bool ganged, + int errorStrategy, + const PixelID& pixelID, bool split, double splitProb1, double splitProb2, const PixelChargeCalibCondData *calibData, const PixelOfflineCalibData *offlineCalibData) const; - - // Computes global position and errors for SCT cluster. // Called by SCT Clustering tools // diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index 264107d5fb811f1831e49f17f5fb1ce207e7cedd..c09dbde113730e374e6dc653918ad155c4c7610a 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ //*************************************************************************** @@ -78,8 +78,8 @@ InDet::PixelCluster* newInDetpixelCluster(const Identifier& RDOId, // to not crash class AddNewxAODpixelCluster { public: - AddNewxAODpixelCluster(xAOD::PixelClusterContainer& container) - : m_container(container) {} + AddNewxAODpixelCluster(xAOD::PixelCluster& cluster) + : m_cluster(&cluster) {} xAOD::PixelCluster* operator()(const Identifier& /*RDOId*/, const Amg::Vector2D& locpos, @@ -96,8 +96,6 @@ public: bool split, float splitProb1, float splitProb2) { - xAOD::PixelCluster * pixelCl = new xAOD::PixelCluster(); - m_container.push_back(pixelCl); IdentifierHash idHash = detEl->identifyHash(); Eigen::Matrix<float,2,1> localPosition(locpos.x(), locpos.y()); @@ -105,22 +103,23 @@ public: localCovariance(0, 0) = locErrMat(0, 0); localCovariance(1, 1) = locErrMat(1, 1); - pixelCl->setMeasurement<2>(idHash, localPosition, localCovariance); - pixelCl->setRDOlist(rdoList); - pixelCl->globalPosition() = globpos.cast<float>(); - pixelCl->setToTlist(totList); - pixelCl->setChargelist(chargeList); - pixelCl->setLVL1A(lvl1a); - pixelCl->setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]); - pixelCl->setOmegas(omegax, omegay); - pixelCl->setIsSplit(split); - pixelCl->setSplitProbabilities(splitProb1, splitProb2); - - return pixelCl; + m_cluster->setMeasurement<2>(idHash, localPosition, localCovariance); + m_cluster->setRDOlist(rdoList); + m_cluster->globalPosition() = globpos.cast<float>(); + m_cluster->setToTlist(totList); + m_cluster->setChargelist(chargeList); + m_cluster->setLVL1A(lvl1a); + m_cluster->setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]); + m_cluster->setWidthInEta(static_cast<float>(width.widthPhiRZ()[1])); + m_cluster->setOmegas(omegax, omegay); + m_cluster->setIsSplit(split); + m_cluster->setSplitProbabilities(splitProb1, splitProb2); + + return m_cluster; } private: - xAOD::PixelClusterContainer& m_container; + xAOD::PixelCluster *m_cluster; }; @@ -584,7 +583,7 @@ PixelCluster* ClusterMakerTool::pixelCluster( xAOD::PixelCluster* ClusterMakerTool::xAODpixelCluster( - xAOD::PixelClusterContainer& container, + xAOD::PixelCluster& cluster, const Amg::Vector2D& localPos, const std::vector<Identifier>& rdoList, const int lvl1a, @@ -614,9 +613,9 @@ xAOD::PixelCluster* ClusterMakerTool::xAODpixelCluster( split, splitProb1, splitProb2, - AddNewxAODpixelCluster(container), - calibData, - offlineCalibData); + AddNewxAODpixelCluster(cluster), + calibData, + offlineCalibData); } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/HitsToxAODCopier.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/HitsToxAODCopier.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ab5495b99c3725308628f6e8f3e6421b1c9739ef --- /dev/null +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/HitsToxAODCopier.cxx @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "HitsToxAODCopier.h" +namespace InDet { +HitsToxAODCopier::HitsToxAODCopier(const std::string& name, + ISvcLocator* pSvcLocator) + : AthReentrantAlgorithm(name, pSvcLocator) {} + + +StatusCode HitsToxAODCopier::initialize() { + ATH_CHECK(m_pixelRDOTool.retrieve()); + ATH_CHECK(m_pixelRdoContainerKey.initialize()); + ATH_CHECK(m_pixelOutputKey.initialize()); + ATH_CHECK(m_stripRdoContainerKey.initialize()); + ATH_CHECK(m_stripOutputKey.initialize()); + + ATH_CHECK(detStore()->retrieve(m_pixelIdHelper, "PixelID")); + ATH_CHECK(detStore()->retrieve(m_stripIdHelper, "SCT_ID")); + + return StatusCode::SUCCESS; +} + +StatusCode HitsToxAODCopier::execute(const EventContext& context) const { + ATH_CHECK(exportPixel(context)); + ATH_CHECK(exportStrip(context)); + return StatusCode::SUCCESS; +} + +StatusCode HitsToxAODCopier::exportPixel(const EventContext& context) const { + SG::ReadHandle<PixelRDO_Container> rdoContainer = + SG::makeHandle(m_pixelRdoContainerKey, context); + ATH_CHECK(rdoContainer.isValid()); + + auto output = std::make_unique<xAOD::BaseContainer>(); + auto outputAux = std::make_unique<xAOD::AuxContainerBase>(); + output->setStore(outputAux.get()); + static const SG::AuxElement::Accessor<int> col("col"); + static const SG::AuxElement::Accessor<int> row("row"); + static const SG::AuxElement::Accessor<int> tot("tot"); + static const SG::AuxElement::Accessor<int> eta_module("eta_module"); + static const SG::AuxElement::Accessor<int> phi_module("phi_module"); + static const SG::AuxElement::Accessor<int> layer_disk("layer_disk"); + static const SG::AuxElement::Accessor<int> barrel_ec("barrel_ec"); + static const SG::AuxElement::Accessor<uint64_t> id("detid"); + + for (auto collection : *rdoContainer) { + const InDetDD::SiDetectorElement* element = + m_pixelRDOTool->checkCollection(*collection, context); + if (element != nullptr) { + std::vector<InDet::UnpackedPixelRDO> hits = + m_pixelRDOTool->getUnpackedPixelRDOs(*collection, *m_pixelIdHelper, + element, context); + for (auto hit : hits) { + auto* item = new SG::AuxElement(); + output->push_back(item); + col(*item) = hit.COL; + row(*item) = hit.ROW; + tot(*item) = hit.TOT; + eta_module(*item) = m_pixelIdHelper->eta_module(hit.ID); + phi_module(*item) = m_pixelIdHelper->phi_module(hit.ID); + layer_disk(*item) = m_pixelIdHelper->layer_disk(hit.ID); + barrel_ec(*item) = m_pixelIdHelper->barrel_ec(hit.ID); + id(*item) = hit.ID.get_compact(); + } + } + } + auto outputHandle = SG::makeHandle(m_pixelOutputKey, context); + ATH_CHECK(outputHandle.record(std::move(output), std::move(outputAux))); + + return StatusCode::SUCCESS; +} + + +StatusCode HitsToxAODCopier::exportStrip(const EventContext& context) const { + SG::ReadHandle<SCT_RDO_Container> rdoContainer = + SG::makeHandle(m_stripRdoContainerKey, context); + ATH_CHECK(rdoContainer.isValid()); + + auto output = std::make_unique<xAOD::BaseContainer>(); + auto outputAux = std::make_unique<xAOD::AuxContainerBase>(); + output->setStore(outputAux.get()); + static const SG::AuxElement::Accessor<int> strip("strip"); + static const SG::AuxElement::Accessor<int> side("side"); + static const SG::AuxElement::Accessor<int> eta_module("eta_module"); + static const SG::AuxElement::Accessor<int> phi_module("phi_module"); + static const SG::AuxElement::Accessor<int> layer_disk("layer_disk"); + static const SG::AuxElement::Accessor<int> barrel_ec("barrel_ec"); + static const SG::AuxElement::Accessor<uint64_t> id("detid"); + + for ( auto collection: *rdoContainer) { + if ( collection == nullptr) continue; + // const IdentifierHash idHash = rdos->identifyHash(); + for ( auto hit: *collection) { + auto* item = new SG::AuxElement(); + output->push_back(item); + strip(*item) = m_stripIdHelper->strip(hit->identify()); + side(*item) = m_stripIdHelper->side(hit->identify()); + eta_module(*item) = m_stripIdHelper->eta_module(hit->identify()); + phi_module(*item) = m_stripIdHelper->phi_module(hit->identify()); + layer_disk(*item) = m_stripIdHelper->layer_disk(hit->identify()); + barrel_ec(*item) = m_stripIdHelper->barrel_ec(hit->identify()); + id(*item) = hit->identify().get_compact(); + } + } + + auto outputHandle = SG::makeHandle(m_stripOutputKey, context); + ATH_CHECK(outputHandle.record(std::move(output), std::move(outputAux))); + return StatusCode::SUCCESS; +} + +} // namespace InDet \ No newline at end of file diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/HitsToxAODCopier.h b/InnerDetector/InDetRecTools/SiClusterizationTool/src/HitsToxAODCopier.h new file mode 100644 index 0000000000000000000000000000000000000000..0ea99300595dec5c6afabd447d386c9e0cc2d8c2 --- /dev/null +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/HitsToxAODCopier.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef SICLUSTERIZATIONTOOL_HITSTOXAODCOPIER_H +#define SICLUSTERIZATIONTOOL_HITSTOXAODCOPIER_H + +// Framework includes +#include <InDetIdentifier/PixelID.h> +#include "InDetIdentifier/SCT_ID.h" +#include <InDetRawData/PixelRDO_Container.h> +#include <InDetRawData/SCT_RDO_Container.h> +#include <StoreGate/ReadHandleKey.h> +#include <StoreGate/WriteHandleKey.h> +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "SiClusterizationTool/PixelRDOTool.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODCore/BaseContainer.h" + +// STL includes +#include <string> + +/** + * @class HitsToxAODCopier + * @brief Algorithm to copy RDO hits into xAOD writable format + **/ +namespace InDet { +class HitsToxAODCopier : public AthReentrantAlgorithm { + public: + HitsToxAODCopier(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~HitsToxAODCopier() override = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& context) const override; + + private: + ToolHandle<InDet::PixelRDOTool> m_pixelRDOTool{this, "PixelRDOTool", + "InDet::PixelRDOTool"}; + SG::ReadHandleKey<PixelRDO_Container> m_pixelRdoContainerKey{ + this, "PixelRDOContainerKey", "ITkPixelRDOs"}; + SG::ReadHandleKey<SCT_RDO_Container> m_stripRdoContainerKey{ + this, "StripRDOContainerKey", "ITkStripRDOs"}; + + SG::WriteHandleKey<xAOD::BaseContainer> m_pixelOutputKey{ + this, "PixelOutputCollectionKey", "PixelHits", "name of output container"}; + + SG::WriteHandleKey<xAOD::BaseContainer> m_stripOutputKey{ + this, "StripOutputCollectionKey", "StripHits", "name of output container"}; + + const PixelID* m_pixelIdHelper = nullptr; + const SCT_ID* m_stripIdHelper = nullptr; + + + StatusCode exportPixel(const EventContext& context) const; + StatusCode exportStrip(const EventContext& context) const; + +}; +} // namespace InDet +#endif // SICLUSTERIZATIONTOOL_HITSTOXAODCOPIER_H diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/components/SiClusterizationTool_entries.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/components/SiClusterizationTool_entries.cxx index 26230bce100be5b9c88427014f791c29493bf79c..b40ff37c57ac65a27a8a328ae46885c39372b70e 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/components/SiClusterizationTool_entries.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/components/SiClusterizationTool_entries.cxx @@ -13,6 +13,7 @@ #include "SiClusterizationTool/TruthPixelClusterSplitProbTool.h" #include "../LWTNNCondAlg.h" #include "../TTrainedNetworkCondAlg.h" +#include "../HitsToxAODCopier.h" DECLARE_COMPONENT( InDet::PixelRDOTool ) DECLARE_COMPONENT( InDet::MergedPixelsTool ) @@ -28,6 +29,7 @@ DECLARE_COMPONENT( InDet::NnPixelClusterSplitProbTool ) DECLARE_COMPONENT( InDet::TruthPixelClusterSplitter ) DECLARE_COMPONENT( InDet::TruthClusterizationFactory ) DECLARE_COMPONENT( InDet::TruthPixelClusterSplitProbTool ) +DECLARE_COMPONENT( InDet::HitsToxAODCopier ) diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx index d6fc9f9142b18d66b3444fd886f4f2facee9a728..f578575eb60af59d3fd6c4fed2149e8755509c75 100644 --- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx +++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx @@ -509,10 +509,10 @@ void InDet::SiDetElementsRoadMaker_xk::detElementsRoad } auto vec2 = lDE; std::sort(lDE.begin(),lDE.end(),InDet::compDetElementWays()); - // Fill list pointers to detector elements + // Fill pointers to detector elements Road.reserve(lDE.size()); for (auto & d : lDE){ - if (testDirection && d.way() < 0) continue; + if (testDirection && d.way() < 0) {continue;} Road.push_back(d.link()->detElement()); } } diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h index 621b053f90ed086aa073d340b2d75900e8ee46be..12c4c107939d059077d6437c76613e3874baba45 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/ITkSiSpacePointsSeedMaker.h @@ -212,7 +212,7 @@ namespace ITk FloatProperty m_rmaxSSS{this, "radMaxSSS", 1000.}; BooleanProperty m_isLRT{this, "isLRT", false}; FloatProperty m_drminPPP{this, "mindRadiusPPP", 6.}; - FloatProperty m_drmaxPPP{this, "maxdRadiusPPP", 120.}; + FloatProperty m_drmaxPPP{this, "maxdRadiusPPP", 150.}; FloatProperty m_zmaxPPP{this, "maxZPPP", 2700.}; FloatProperty m_drminSSS{this, "mindRadiusSSS", 20.}; FloatProperty m_drmaxSSS{this, "maxdRadiusSSS", 300.}; @@ -268,7 +268,7 @@ namespace ITk float m_COF{134 * .05 * 9}; float m_dzMaxFast {200.}; float m_R2MaxFast {2500.}; - float m_rmaxPPP {140.}; + float m_rmaxPPP {140.}; float m_dzmaxSSS {900.}; float m_drminSeedConf{5.}; //@} diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx index db137e8f9c730750fed923e6ec8ae8792b44f2a7..8e15f9e1dee279b5e98f3c6a9ea66e99192d9099 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/ITkSiSpacePointsSeedMaker.cxx @@ -1241,7 +1241,7 @@ void SiSpacePointsSeedMaker::buildConnectionMaps(std::array<int, arraySizePhiZ> } } - /** + /** * z bins 3 / 7: 450mm < |z| < 925mm.: * also include the central z region in the bottom SP search. * likely for PPP seeds with hits in pixel barrel + endcaps @@ -1407,11 +1407,11 @@ void SiSpacePointsSeedMaker::fillLists(EventData &data) const {-2500., 0}, {-1400., 1}, {-925., 2}, - {-450., 3}, - {-250, 4}, - {250, 5}, - {450, 6}, - {925, 7}, + {-500., 3}, + {-250., 4}, + {250., 5}, + {500., 6}, + {925., 7}, {1400, 8}, {2500, 9}, {100000, 10}, ///< if we encounter Si hits at z > +100m, we are probably not in ATLAS anymore... @@ -2058,7 +2058,8 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, std::array<std::vector<SiSpacePointForSeed *>::iterator, arraySizeNeighbourBins> &iter_endTopCands, const int numberBottomCells, const int numberTopCells, int &nseed) const { - /** + + /** * This method implements the seed search for a single phi-Z region of the detector. * The central SP is taken from the region, while the top and bottom SP are allowed * to come from either the same or a range of neighbouring cells. @@ -2100,7 +2101,6 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, /// Loop through all central space point candidates for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP) { - const float &R = (*iter_centralSP)->radius(); if(R > data.RTmax) break; ///< stop if we have moved outside our radial region of interest. @@ -2141,11 +2141,10 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, if(( (*iter_otherSP)->radius()- R ) >= m_drminPPP) break; } iter_topCands[cell]=iter_otherSP; - + /// loop over each SP in each cell for (; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP) { - /// evaluate the radial distance, float Rt = (*iter_otherSP)->radius(); float dR = Rt - R; @@ -2222,13 +2221,12 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, for(; iter_otherSP!=iter_endBottomCands[cell]; ++iter_otherSP) { if( (R - (*iter_otherSP)->radius()) <= m_drmaxPPP) break; - } + } iter_bottomCands[cell]=iter_otherSP; /// in each cell, loop over the space points for (; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP) { - /// evaluate the radial distance between the central and bottom SP const float &Rb = (*iter_otherSP)->radius(); float dR = R - Rb; @@ -2335,8 +2333,9 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, float d0max = maxd0cut; size_t Nc = 1; - if (data.ITkSP[b]->radius() > m_rmaxPPP) + if (data.ITkSP[b]->radius() > m_rmaxPPP){ Nc = 0; + } if (data.nOneSeedsQ) ++Nc; @@ -2465,6 +2464,7 @@ void SiSpacePointsSeedMaker::production3SpPPP(EventData &data, } ///< end loop over top space point candidates /// now apply further cleaning on the seed candidates for this central+bottom pair. + if (data.ITkCmSp.size() > Nc) { newOneSeedWithCurvaturesComparisonPPP(data, data.ITkSP[b], (*iter_centralSP), Z - R * Tzb); @@ -3658,8 +3658,10 @@ void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparisonPPP(EventData &da float Qmin = 1.e20; float Rb = 2. * SPb->radius(); int NTc(2); - if (Rb > 280.) + if (Rb > 280.) { NTc = 1; + } + SiSpacePointForSeed *SPmin = nullptr; bool Qm = Rb < 120. || std::abs(Zob) > 150.; diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_ART_ACTS_SEEDS_R22.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_ART_ACTS_SEEDS_R22.xml new file mode 100644 index 0000000000000000000000000000000000000000..bbae0457d0e5a9ef4bdf00a9cc6062192b81c8ad --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_ART_ACTS_SEEDS_R22.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" ?> +<!-- + DCube configuration XML file = dcube_config.xml + auto-generated using DCube 4.6692016 ($Rev: 217525 $ $Date$) by Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) + on Tue, 07 Apr 2020 17:46:00 CEST + from Root reference file: IDPVM/PHYSVAL.root + Statistics tests: + "['KS', 'meany']" + Legend: + * KS - Kolmogorov-Smirnov test (default) + * chi2 - chi2 test + * bbb - bin-by-bin comparision + * meany - avg eff mean y [TProfiles only!] + * all - all above tests + Tweaks: + [1] remove or comment out (using HTML comments tags) histograms not relevant + to your analysis + [2] provide a new content to "ref_desc" and "mon_desc" tags to something + more meaningful + [3] and of course feel free to change attribute "tests" in each "hist" tag + [4] limits of p-value warning and failure can be set by changing attributes + in <plimit> tag + [5] if you want to make plots FOR EVERY histogram in your monitored file + change attribute "inclusive" in <mode> tag to "true" +--> +<dcube_client_config> + <dcube branch="*" cmtconfig="*" install="*" jobId="*" project="*"> + <!-- + ################################################### + DCubeClient for: + [1] branch: * + [2] install: * + [3] cmtconfig: * + [4] project: * + [5] jobId: * + [6] reference root file: /eos/home-n/npetters/www/dcube/IDPVM/PHYSVAL.root + [7] p-values limits FAIL = 0.750000 WARN = 0.950000 + ################################################### +--> + <reference file="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/601237_ttbar_allhad_PU200_ITk_master_v1.RDO.root" /> + <ref_desc> + PUT YOUR REFERENCE DESCRIPTION HERE + </ref_desc> + <test_desc> + PUT YOUR TEST DESCRIPTION HERE + </test_desc> + <plimit fail="0.75" warn="0.95"/> + <TDirectory name="/"> + <TDirectory name="run_242020"> + <TDirectory name="ActsTrkAnalysis"> + <TDirectory name="PixelSeeds"> + <hist2D name="zr1" plotopts="box" tests="KS" type="TH2F"/> + <hist2D name="zr2" plotopts="box" tests="KS" type="TH2F"/> + <hist2D name="zr3" plotopts="box" tests="KS" type="TH2F"/> + <hist1D name="Nseed" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="x1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="x2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="x3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="y1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="y2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="y3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="z1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="z2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="z3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="r1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="r2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="r3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="pT" plotopts="logy" tests="KS" type="TH1F"/> + <hist1D name="Eta" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="Theta" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="d0" plotopts="logy" tests="KS" type="TH1F"/> + <hist1D name="dzdr_b" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="dzdr_t" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="Penalty" plotopts="logy" tests="KS" type="TH1F"/> + </TDirectory> + <TDirectory name="StripSeeds"> + <hist2D name="zr1" plotopts="box" tests="KS" type="TH2F"/> + <hist2D name="zr2" plotopts="box" tests="KS" type="TH2F"/> + <hist2D name="zr3" plotopts="box" tests="KS" type="TH2F"/> + <hist1D name="Nseed" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="x1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="x2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="x3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="y1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="y2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="y3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="z1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="z2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="z3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="r1" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="r2" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="r3" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="pT" plotopts="logy" tests="KS" type="TH1F"/> + <hist1D name="Eta" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="Theta" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="d0" plotopts="logy" tests="KS" type="TH1F"/> + <hist1D name="dzdr_b" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="dzdr_t" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="Penalty" plotopts="logy" tests="KS" type="TH1F"/> + </TDirectory> + </TDirectory> + </TDirectory> + </TDirectory> + </dcube> +</dcube_client_config> diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_CKF_ITk.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_CKF_ITk.xml index 2686c0dd3668af7ea6ebfaa8ac3f864cfb6885b1..960ea0a5f3f9dc7311d91ff42e5de28c81ad66bb 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_CKF_ITk.xml +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_CKF_ITk.xml @@ -1,11 +1,11 @@ <?xml version="1.0" ?> <!-- - DCube configuration XML file = dcube_config.xml - auto-generated using DCube 4.6692016 ($Rev: 217525 $ $Date$) by Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) - on Tue, 07 Apr 2020 17:46:00 CEST - from Root reference file: IDPVM/PHYSVAL.root + DCube configuration XML file = dcube_IDPVMPlots_ACTS_CKF_ITk.xml + auto-generated using DCube 5.4 by Krzysztof Daniel Ciba (Krzysztof.Ciba@NOSPAMgmail.com) + on Wed, 29 Mar 2023 16:20:57 BST + from Root reference file: ttbar_pu200/idpvm.root Statistics tests: - "['KS', 'meany']" + "['KS']" Legend: * KS - Kolmogorov-Smirnov test (default) * chi2 - chi2 test @@ -33,17 +33,13 @@ [3] cmtconfig: * [4] project: * [5] jobId: * - [6] reference root file: /eos/home-n/npetters/www/dcube/IDPVM/PHYSVAL.root + [6] reference root file: ttbar_pu200/idpvm.root [7] p-values limits FAIL = 0.750000 WARN = 0.950000 ################################################### --> - <reference file="/eos/atlas/atlascerngroupdisk/data-art/grid-input/InDetPhysValMonitoring/ReferenceHistograms/physval_mu1GeV.root"/> - <ref_desc> - PUT YOUR REFERENCE DESCRIPTION HERE - </ref_desc> - <test_desc> - PUT YOUR TEST DESCRIPTION HERE - </test_desc> + <reference file="ttbar_pu200/idpvm.root"/> + <ref_desc></ref_desc> + <test_desc></test_desc> <plimit fail="0.75" warn="0.95"/> <TDirectory name="/"> <TDirectory name="SquirrelPlots"> @@ -63,6 +59,7 @@ <hist1D name="reco_ndof" plotopts="" tests="KS" type="TH1F"/> <hist1D name="reco_chi2Overndof" plotopts="" tests="KS" type="TH1F"/> <hist1D name="reco_author" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="reco_time" plotopts="" tests="KS" type="TH1F"/> <hist1D name="truth_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="truth_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="truth_z0sin" plotopts="" tests="KS" type="TH1F"/> @@ -78,60 +75,66 @@ <TDirectory name="HitsOnTracks"> <hist1D name="nPixelHits" plotopts="" tests="KS" type="TH1F"/> <hist1D name="nSCTHits" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="nInnerMostPixelHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nNextToInnerMostPixelHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelHoles_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTHoles_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nNextToInnerMostPixelHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelHoles_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTHoles_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelOutliers_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelSharedHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelSplitHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nExpectedInnerMostPixelHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nExpectedNextToInnerMostPixelHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelOutliers_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelContribLayers_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelSharedHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelSplitHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelGangedHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelGangedHitsFlaggedFakes_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTOutliers_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTDoubleHoles_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTSharedHits_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelDeadSensors_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTDeadSensors_vs_eta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelOutliers_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelSharedHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nInnerMostPixelSplitHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nExpectedInnerMostPixelHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nExpectedNextToInnerMostPixelHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelOutliers_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelContribLayers_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelSharedHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelSplitHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelGangedHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelGangedHitsFlaggedFakes_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTOutliers_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTDoubleHoles_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTSharedHits_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nPixelDeadSensors_vs_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="nSCTDeadSensors_vs_phi" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="nPixelHoles" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nSCTHoles" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nInnerMostPixelHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nNextToInnerMostPixelHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelHoles_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTHoles_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nInnerMostPixelHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nNextToInnerMostPixelHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelHoles_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTHoles_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelSharedHits" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nSCTSharedHits" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nInnerMostPixelSharedHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelSharedHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTSharedHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nInnerMostPixelSharedHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelSharedHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTSharedHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelOutliers" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nPixelContribLayers" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nPixelSplitHits" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nSCTOutliers" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nSCTDoubleHoles" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nInnerMostPixelOutliers_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nInnerMostPixelSplitHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nExpectedInnerMostPixelHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nExpectedNextToInnerMostPixelHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelOutliers_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelContribLayers_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelSplitHits_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTOutliers_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTDoubleHoles_vs_eta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nInnerMostPixelOutliers_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nInnerMostPixelSplitHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nExpectedInnerMostPixelHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nExpectedNextToInnerMostPixelHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelOutliers_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelContribLayers_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nPixelSplitHits_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTOutliers_vs_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="nSCTDoubleHoles_vs_phi" plotopts="" tests="KS" type="TProfile"/> </TDirectory> </TDirectory> <TDirectory name="Tracks"> <hist1D name="ntrack" plotopts="" tests="KS" type="TH1F"/> <hist1D name="ntracksel" plotopts="" tests="KS" type="TH1F"/> <hist1D name="nparticle" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="nparticlesel" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="num_truthmatch_match" plotopts="" tests="KS" type="TH1F"/> </TDirectory> <TDirectory name="Matched"> <TDirectory name="Resolutions"> <TDirectory name="Primary"> + <hist1D name="pull_d0" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="res_d0" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="sigma_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_eta_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resmean_vs_eta_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_pt_d0" plotopts="" tests="KS" type="TH1F"/> @@ -140,8 +143,11 @@ <hist1D name="pullmean_vs_eta_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullwidth_vs_pt_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullmean_vs_pt_d0" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="sigma_vs_eta_d0" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="sigma_vs_pt_d0" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="sigma_vs_eta_d0" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_d0" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="pull_z0" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="res_z0" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="sigma_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_eta_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resmean_vs_eta_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_pt_z0" plotopts="" tests="KS" type="TH1F"/> @@ -150,8 +156,21 @@ <hist1D name="pullmean_vs_eta_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullwidth_vs_pt_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullmean_vs_pt_z0" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="sigma_vs_eta_z0" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="sigma_vs_pt_z0" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="sigma_vs_eta_z0" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_z0" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="pull_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="res_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="sigma_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="resolution_vs_eta_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="resmean_vs_eta_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="resolution_vs_pt_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="resmean_vs_pt_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="pullwidth_vs_eta_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="pullmean_vs_eta_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="pullwidth_vs_pt_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="pullmean_vs_pt_qoverp" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="sigma_vs_eta_qoverp" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_qoverp" plotopts="" tests="KS" type="TProfile"/> <hist1D name="pull_ptqopt" plotopts="" tests="KS" type="TH1F"/> <hist1D name="res_ptqopt" plotopts="" tests="KS" type="TH1F"/> <hist1D name="sigma_ptqopt" plotopts="" tests="KS" type="TH1F"/> @@ -163,15 +182,11 @@ <hist1D name="pullmean_vs_eta_ptqopt" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullwidth_vs_pt_ptqopt" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullmean_vs_pt_ptqopt" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="sigma_vs_eta_ptqopt" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="sigma_vs_pt_ptqopt" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="sigma_vs_eta_ptqopt" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_ptqopt" plotopts="" tests="KS" type="TProfile"/> <hist1D name="pull_theta" plotopts="" tests="KS" type="TH1F"/> <hist1D name="res_theta" plotopts="" tests="KS" type="TH1F"/> <hist1D name="sigma_theta" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="resHelper_eta_theta" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="resHelper_pt_theta" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="pullHelper_eta_theta" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="pullHelper_pt_theta" plotopts="" tests="KS" type="TH2F"/> <hist1D name="resolution_vs_eta_theta" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resmean_vs_eta_theta" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_pt_theta" plotopts="" tests="KS" type="TH1F"/> @@ -180,15 +195,11 @@ <hist1D name="pullmean_vs_eta_theta" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullwidth_vs_pt_theta" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullmean_vs_pt_theta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="sigma_vs_eta_theta" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="sigma_vs_pt_theta" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="sigma_vs_eta_theta" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_theta" plotopts="" tests="KS" type="TProfile"/> <hist1D name="pull_phi" plotopts="" tests="KS" type="TH1F"/> <hist1D name="res_phi" plotopts="" tests="KS" type="TH1F"/> <hist1D name="sigma_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="resHelper_eta_phi" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="resHelper_pt_phi" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="pullHelper_eta_phi" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="pullHelper_pt_phi" plotopts="" tests="KS" type="TH2F"/> <hist1D name="resolution_vs_eta_phi" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resmean_vs_eta_phi" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_pt_phi" plotopts="" tests="KS" type="TH1F"/> @@ -197,15 +208,11 @@ <hist1D name="pullmean_vs_eta_phi" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullwidth_vs_pt_phi" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullmean_vs_pt_phi" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="sigma_vs_eta_phi" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="sigma_vs_pt_phi" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="sigma_vs_eta_phi" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_phi" plotopts="" tests="KS" type="TProfile"/> <hist1D name="pull_z0sin" plotopts="" tests="KS" type="TH1F"/> <hist1D name="res_z0sin" plotopts="" tests="KS" type="TH1F"/> <hist1D name="sigma_z0sin" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="resHelper_eta_z0sin" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="resHelper_pt_z0sin" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="pullHelper_eta_z0sin" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="pullHelper_pt_z0sin" plotopts="" tests="KS" type="TH2F"/> <hist1D name="resolution_vs_eta_z0sin" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resmean_vs_eta_z0sin" plotopts="" tests="KS" type="TH1F"/> <hist1D name="resolution_vs_pt_z0sin" plotopts="" tests="KS" type="TH1F"/> @@ -214,33 +221,47 @@ <hist1D name="pullmean_vs_eta_z0sin" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullwidth_vs_pt_z0sin" plotopts="" tests="KS" type="TH1F"/> <hist1D name="pullmean_vs_pt_z0sin" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="sigma_vs_eta_z0sin" plotopts="" tests="meany" type="TProfile"/> - <hist1D name="sigma_vs_pt_z0sin" plotopts="" tests="meany" type="TProfile"/> + <hist1D name="sigma_vs_eta_z0sin" plotopts="" tests="KS" type="TProfile"/> + <hist1D name="sigma_vs_pt_z0sin" plotopts="" tests="KS" type="TProfile"/> </TDirectory> </TDirectory> </TDirectory> <TDirectory name="FakeRate"> - <graph name="fakerate_vs_eta" plotopts="" type="TEfficiency"/> - <graph name="fakerate_vs_pt" plotopts="" type="TEfficiency"/> - <graph name="fakerate_vs_phi" plotopts="" type="TEfficiency"/> - <graph name="fakerate_vs_d0" plotopts="" type="TEfficiency"/> - <graph name="fakerate_vs_z0" plotopts="" type="TEfficiency"/> + <graph name="fakerate_vs_eta" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="fakerate_vs_pt" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="fakerate_vs_lowpt" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="fakerate_vs_phi" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="fakerate_vs_d0" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="fakerate_vs_z0" plotopts="" tests="KS" type="TEfficiency"/> </TDirectory> <TDirectory name="Unlinked"> <TDirectory name="FakeRate"> - <graph name="fakerate_vs_eta" plotopts="" type="TEfficiency"/> + <graph name="fakerate_vs_eta" plotopts="" tests="KS" type="TEfficiency"/> </TDirectory> </TDirectory> <TDirectory name="Efficiency"> - <graph name="efficiency_vs_eta" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_pt" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_phi" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_d0" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_z0" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_R" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_Z" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_prodR" plotopts="" type="TEfficiency"/> - <graph name="efficiency_vs_prodZ" plotopts="" type="TEfficiency"/> + <graph name="efficiency_vs_eta" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_pt" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_pt_low" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_pt_high" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_lowpt" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_phi" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_d0" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_d0_abs" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_z0" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_z0_abs" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_R" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_Z" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="extended_efficiency_vs_d0" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="extended_efficiency_vs_d0_abs" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="extended_efficiency_vs_z0" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="extended_efficiency_vs_z0_abs" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_prodR" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_prodR_extended" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_prodZ" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_prodZ_extended" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_pt_log" plotopts="" tests="KS" type="TEfficiency"/> + <graph name="efficiency_vs_pteta" plotopts="" tests="KS" type="TEfficiency"/> </TDirectory> </TDirectory> <TDirectory name="Vertices"> @@ -266,6 +287,9 @@ <hist1D name="vx_track_err_d0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="vx_track_z0" plotopts="" tests="KS" type="TH1F"/> <hist1D name="vx_track_err_z0" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="vx_type_truth" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="vx_z_diff" plotopts="" tests="KS" type="TH1F"/> + <hist1D name="vx_z_diff_pull" plotopts="" tests="KS" type="TH1F"/> </TDirectory> </TDirectory> </TDirectory> diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_R22.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_R22.xml index 5c329f423a47604a78bff0327e6a74d0c2b38fea..37c3460386a86c0b66cb37760d4ab56f5bd99f8c 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_R22.xml +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/dcube_IDPVMPlots_ACTS_R22.xml @@ -86,6 +86,8 @@ <hist1D name="sizeX_endcap" plotopts="logy" tests="KS" type="TH1F"/> <hist1D name="sizeY_barrel" plotopts="logy" tests="KS" type="TH1F"/> <hist1D name="sizeY_endcap" plotopts="logy" tests="KS" type="TH1F"/> + <hist1D name="widthY_barrel" plotopts="logy" tests="KS" type="TH1F"/> + <hist1D name="widthY_endcap" plotopts="logy" tests="KS" type="TH1F"/> </TDirectory> <TDirectory name="ITkStripClusters"> <hist2D name="global_xy_barrel" plotopts="box" tests="KS" type="TH2F"/> @@ -117,8 +119,6 @@ <hist1D name="localCovXX_endcap" plotopts="logy" tests="KS" type="TH1F"/> <hist1D name="sizeX_barrel" plotopts="logy" tests="KS" type="TH1F"/> <hist1D name="sizeX_endcap" plotopts="logy" tests="KS" type="TH1F"/> - <hist1D name="hitsInThirdTimeBin_barrel" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="hitsInThirdTimeBin_endcap" plotopts="" tests="KS" type="TH1F"/> </TDirectory> <TDirectory name="ITkPixelSpacePoints"> <hist2D name="global_xy_barrel" plotopts="box" tests="KS" type="TH2F"/> diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ckf_mu100GeV.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ckf_mu100GeV.sh index 77f5bf88970f22a2d5305e39a1be8409d936ba83..5db0b777a27eb5c716b67c58d6cb87f167beb5dc 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ckf_mu100GeV.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ckf_mu100GeV.sh @@ -9,10 +9,10 @@ lastref_dir=last_results dcubeXml=dcube_IDPVMPlots_ACTS_CKF_ITk.xml -rdo_23p0=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/RDO/mc15_14TeV.900040.PG_singlemu_Pt100_etaFlatnp0_43.recon.RDO.e8185_s3856_r13824/RDO.29831688._000001.pool.root.1 +rdo_23p0=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/RDO/ATLAS-P2-RUN4-01-01-00/mc21_14TeV.900498.PG_single_muonpm_Pt100_etaFlatnp0_43.recon.RDO.e8481_s4038_r14362/RDO.32628466._000005.pool.root.1 # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" @@ -33,7 +33,7 @@ run () { run "Reconstruction" \ Reco_tf.py --CA \ --steering doRAWtoALL \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsValidateTracksFlags" \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsValidateTracksFlags" \ --inputRDOFile ${rdo_23p0} \ --outputAODFile AOD.root \ --maxEvents 1000 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_default_seeding_ttbar_PU200.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_default_seeding_ttbar_PU200.sh new file mode 100755 index 0000000000000000000000000000000000000000..856b246cb0d4bf58aac281f2c8c422a5a2dc6c56 --- /dev/null +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_default_seeding_ttbar_PU200.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# art-description: Run 4 configuration, ITK only recontruction, all-hadronic ttbar, full pileup, acts activated +# art-type: grid +# art-include: master/Athena +# art-output: *.root +# art-output: *.xml +# art-output: dcube* +# art-html: dcube_last + +lastref_dir=last_results +dcubeXml=dcube_ART_ACTS_SEEDS_R22.xml +input_rdo=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/ATLAS-P2-RUN4-01-01-00_ttbar_mu200.RDO.root + +# search in $DATAPATH for matching file +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) +# Don't run if dcube config not found +if [ -z "$dcubeXmlAbsPath" ]; then + echo "art-result: 1 dcube-xml-config" + exit 1 +fi + +geometry=ATLAS-P2-RUN4-01-00-00 + +run () { + name="${1}" + cmd="${@:2}" + ############ + echo "Running ${name}..." + time ${cmd} + rc=$? + # Only report hard failures for comparison Acts-Trk since we know + # they are different. We do not expect this test to succeed + [ "${name}" = "dcube-trk" ] && [ $rc -ne 255 ] && rc=0 + echo "art-result: $rc ${name}" + return $rc +} + +# Only schedule what we need for this specific test +# We want to run Athena +# We want to schedule Trk->xAOD SP convertion +# We want to run the Acts Seeding Algorithm +# We want to activate the analysis of seed and estimated track parameters (flag) +run "Reconstruction" \ + Reco_tf.py --CA \ + --inputRDOFile ${input_rdo} \ + --outputAODFile AOD.pool.root \ + --steering doRAWtoALL \ + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude" \ + --postInclude "InDetConfig.SiSpacePointFormationConfig.InDetToXAODSpacePointConversionCfg,ActsConfig.ActsTrkSeedingConfig.ActsTrkSeedingCfg" \ + --preExec "flags.Tracking.doTruth=False;flags.DQ.useTrigger=False;flags.Acts.doAnalysis=True;flags.Output.HISTFileName=\"ActsMonitoringOutput.root\"" \ + --maxEvents 5 + +reco_rc=$? +if [ $reco_rc != 0 ]; then + exit $reco_rc +fi + +echo "download latest result..." +art.py download --user=artprod --dst="$lastref_dir" "$ArtPackage" "$ArtJobName" +ls -la "$lastref_dir" + +# Needs to be updated!!! +run "dcube-last" \ + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ + -p -x dcube_last \ + -c ${dcubeXmlAbsPath} \ + -r ${lastref_dir}/ActsMonitoringOutput.root \ + ActsMonitoringOutput.root + diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ttbar_PU200.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ttbar_PU200.sh index 1882173b04023051b0edfe1de4ad8b0043780c23..77b988ba99db9704d232e3d4070d5b9609a032c0 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ttbar_PU200.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_acts_ttbar_PU200.sh @@ -13,7 +13,7 @@ dcubeXml=dcube_IDPVMPlots_ACTS_R22.xml rdo_23p0=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/inputs/ATLAS-P2-RUN4-01-01-00_ttbar_mu200.RDO.root # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" @@ -41,8 +41,10 @@ run "Reconstruction" \ --inputRDOFile ${rdo_23p0} \ --outputAODFile AOD.root \ --steering doRAWtoALL \ - --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsInterop.ActsCIFlags.actsArtFlags" \ - --postInclude "ActsInterop.ActsPostIncludes.PersistifyActsEDMCfg" + --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude,ActsConfig.ActsCIFlags.actsArtFlags" \ + --postInclude "ActsConfig.ActsPostIncludes.PersistifyActsEDMCfg" \ + --preExec "flags.Acts.EDM.PersistifyClusters=True;flags.Acts.EDM.PersistifySpacePoints=True;" \ + --maxEvents 20 reco_rc=$? if [ $reco_rc != 0 ]; then diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_el10.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_el10.sh index 77f22078e115379689ede1e3165b9b45322d1227..24fccf3213fa49dcae82821e8ab5e8b26974fe16 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_el10.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_el10.sh @@ -16,7 +16,7 @@ ref_21p9=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitorin geometry=ATLAS-P2-RUN4-01-01-00 # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_FTF.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_FTF.sh index fb0facfae67e60823cde2c9e4f2445b7324465bf..1ffd33534b2702f47e66804ae20482f4c546273c 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_FTF.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_FTF.sh @@ -10,10 +10,18 @@ # art-html: dcube_last lastref_dir=last_results -dcubeXml="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/dcube/config/IDPVMPlots_ITk_FastTrackFinder.xml" +dcubeXml=dcube_ART_IDPVMPlots_ITk.xml geometry=ATLAS-P2-RUN4-01-01-00 +# search in $DATAPATH for matching file +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) +# Don't run if dcube config not found +if [ -z "$dcubeXmlAbsPath" ]; then + echo "art-result: 1 dcube-xml-config" + exit 1 +fi + run () { name="${1}" cmd="${@:2}" @@ -60,14 +68,14 @@ run "Reconstruction" \ --outputAODFile AOD.root \ --steering doRAWtoALL \ --preInclude InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude \ - --preExec "flags.Tracking.useITkFTF=True" + --preExec "flags.Tracking.useITkFTF=True;flags.Tracking.doITkFastTracking=True" run "IDPVM" \ runIDPVM.py \ --filesInput AOD.root \ --outputFile idpvm.root \ + --doTightPrimary \ --doHitLevelPlots \ - --doExpertPlots \ --truthMinPt=1000 reco_rc=$? @@ -82,6 +90,6 @@ ls -la "$lastref_dir" run "dcube-last" \ $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ -p -x dcube_last \ - -c ${dcubeXml} \ + -c ${dcubeXmlAbsPath} \ -r ${lastref_dir}/idpvm.root \ idpvm.root diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_reco.sh index 096a21895382e2ff6998452339f67f5e92a22455..aa6bef727542bb074d5b3d6a0df34fb6165fc058 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_mu100_reco.sh @@ -16,7 +16,7 @@ ref_21p9=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitorin geometry=ATLAS-P2-RUN4-01-01-00 # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_pi10_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_pi10_reco.sh index 7034938aab2e8db98503049c093912b9f0f8c088..e9ec43399777f2b43685e51c55b442176482d630 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_pi10_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_pi10_reco.sh @@ -16,7 +16,7 @@ ref_21p9=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitorin geometry=ATLAS-P2-RUN4-01-01-00 # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU0.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU0.sh index 93469c78bb817e8047038904cb93a12b84f28dd0..f10528374b27dcee2e7515264eb136be0984859d 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU0.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU0.sh @@ -16,7 +16,7 @@ ref_21p9=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitorin geometry=ATLAS-P2-RUN4-01-01-00 # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200.sh index ac251f6fe099d6b3862e41ca3534688ab533959e..eabf0ba76154b38f533577ec50fb01b7a13f3716 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200.sh @@ -14,7 +14,7 @@ rdo_23p0=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitorin geometry=ATLAS-P2-RUN4-01-01-00 # search in $DATAPATH for matching file -dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -name $dcubeXml -print -quit 2>/dev/null) +dcubeXmlAbsPath=$(find -H ${DATAPATH//:/ } -mindepth 1 -maxdepth 1 -name $dcubeXml -print -quit 2>/dev/null) # Don't run if dcube config not found if [ -z "$dcubeXmlAbsPath" ]; then echo "art-result: 1 dcube-xml-config" diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200_FTF.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200_FTF.sh index 1ee68c15fe8dd8301e7df450af80fb5d246790f5..8479fef0501fef53082969f3eb4fb8ce5c486459 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200_FTF.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_run4_ttbar_PU200_FTF.sh @@ -31,7 +31,7 @@ run "Reconstruction" \ --outputAODFile AOD.root \ --steering doRAWtoALL \ --preInclude InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude \ - --preExec "flags.Tracking.useITkFTF=True" + --preExec "flags.Tracking.useITkFTF=True;flags.Tracking.doITkFastTracking=True" run "IDPVM" \ diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh index 22976bfac344bf31ac9992de81a93965d83f27a0..cbbcfa15c2b3e23b7006c7d099ec852d73a04a54 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh @@ -29,6 +29,12 @@ if [[ "$ATLAS_RELEASE_BASE" == *"23.0"* ]]; then dcubeRef_idtide="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_idtide_r23.root" dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_lrt_r23.root" fi +dcubeRef_idtide="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_idtide_r24.root" +dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_lrt_r24.root" +if [[ "$ATLAS_RELEASE_BASE" == *"23.0"* ]]; then + dcubeRef_idtide="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_idtide_r23.root" + dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_lrt_r23.root" +fi # Reco step based on test InDetPhysValMonitoring ART setup from Josh Moss. run Reco_tf.py \ @@ -71,7 +77,6 @@ if [ $rec_tf_exit_code -eq 0 ] ;then -c ${dcubeXml_idtide} \ -r ${dcubeRef_idtide} \ physval_idtide.ntuple.root - echo "art-result: $? shifter_plots_idtide" echo "compare with last build" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ @@ -86,7 +91,6 @@ if [ $rec_tf_exit_code -eq 0 ] ;then -c ${dcubeXml_lrt} \ -r ${dcubeRef_lrt} \ physval_lrt.ntuple.root - echo "art-result: $? shifter_plots_lrt" echo "compare with last build" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/CMakeLists.txt b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..be99eb4d0ef278dfaec0cc6a5eb22ba4878e9ac6 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( xAODMuonPrepData ) + +# External dependencies: +find_package( xAODUtilities ) + +atlas_add_library( xAODMuonPrepData + xAODMuonPrepData/*.h xAODMuonPrepData/versions/*.h Root/*.cxx + PUBLIC_HEADERS xAODMuonPrepData + LINK_LIBRARIES xAODCore GeoPrimitives MuonPrepRawData + xAODMeasurementBase Identifier MuonReadoutGeometryR4) + + +atlas_add_xaod_smart_pointer_dicts( + INPUT xAODMuonPrepData/selection.xml + OUTPUT _selectionFile + CONTAINERS "xAOD::MdtDriftCircleContainer_v1" ) + +atlas_add_dictionary( xAODMuonPrepDataDict + xAODMuonPrepData/xAODMuonPrepDataDict.h + ${_selectionFile} + LINK_LIBRARIES xAODCore xAODMuonPrepData + EXTRA_FILES Root/dict/*.cxx ) + diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/MdtDriftCircleAuxContainer_v1.cxx b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/MdtDriftCircleAuxContainer_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..358a1d61b9c254c0d0b67c04185b08b964dd0674 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/MdtDriftCircleAuxContainer_v1.cxx @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +// EDM include(s): +#include "xAODCore/AuxStoreAccessorMacros.h" +// Local include(s): +#include "xAODMuonPrepData/versions/MdtDriftCircleAuxContainer_v1.h" + +namespace xAOD { +MdtDriftCircleAuxContainer_v1::MdtDriftCircleAuxContainer_v1() + : AuxContainerBase() { + AUX_VARIABLE(tdc); + AUX_VARIABLE(adc); + AUX_VARIABLE(driftTube); + AUX_VARIABLE(tubeLayer); + AUX_VARIABLE(driftCircleStatus); +} +} // namespace xAOD \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/MdtDriftCircle_v1.cxx b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/MdtDriftCircle_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e3dbb7d9252f4e1a87bfc9270f0a9ec87a06d5ea --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/MdtDriftCircle_v1.cxx @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +// EDM include(s): +#include "xAODCore/AuxStoreAccessorMacros.h" +// Local include(s): +#include "MuonReadoutGeometryR4/MdtReadoutElement.h" +#include "TrkEventPrimitives/ParamDefs.h" +#include "xAODMuonPrepData/versions/MdtDriftCircle_v1.h" + +namespace { +static const SG::AuxElement::Accessor<uint8_t> accDriftStatus{ + "driftCircleStatus"}; +} +namespace xAOD { +using MdtDriftCircleStatus = MdtDriftCircle_v1::MdtDriftCircleStatus; + +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(MdtDriftCircle_v1, int16_t, tdc, setTdc) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(MdtDriftCircle_v1, int16_t, adc, setAdc) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(MdtDriftCircle_v1, uint16_t, driftTube, + setTube) +AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(MdtDriftCircle_v1, uint8_t, tubeLayer, + setLayer) + +void MdtDriftCircle_v1::setStatus(MdtDriftCircleStatus st) { + accDriftStatus(*this) = st; +} + +IdentifierHash MdtDriftCircle_v1::measurementHash() const { + return MuonGMR4::MdtReadoutElement::measurementHash(tubeLayer(), + driftTube()); +} +MdtDriftCircleStatus MdtDriftCircle_v1::status() const { + return static_cast<MdtDriftCircleStatus>(accDriftStatus(*this)); +} +float MdtDriftCircle_v1::driftRadius() const { + return localPosition<1>()[Trk::locR]; +} +/** @brief Returns the covariance of the drift radius*/ +float MdtDriftCircle_v1::driftRadiusCov() const { + return localCovariance<1>()(Trk::locR, Trk::locR); +} +/** @brief Returns the uncertainty on the drift radius*/ +float MdtDriftCircle_v1::driftRadiusUncert() const { + return std::sqrt(driftRadiusCov()); +} +void MdtDriftCircle_v1::setDriftRadius(float r) { + localPosition<1>()[Trk::locR] = r; +} +void MdtDriftCircle_v1::setDriftRadCov(float cov) { + localCovariance<1>()(Trk::locR, Trk::locR) = cov; +} + +} // namespace xAOD diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/dict/ContainerProxies.cxx b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/dict/ContainerProxies.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8c76f75b13a0426ff2feac431b1a426083dba57c --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/dict/ContainerProxies.cxx @@ -0,0 +1,12 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +// EDM include(s): +#include "xAODCore/AddDVProxy.h" + +// Local include(s): +#include "xAODMuonPrepData/versions/MdtDriftCircleContainer_v1.h" + +// Set up the collection proxies: +ADD_NS_DV_PROXY(xAOD, MdtDriftCircleContainer_v1); diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/ATLAS_CHECK_THREAD_SAFETY b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..078ff456cafadf668a782b8de2ca1927ab701941 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/ diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircle.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircle.h new file mode 100644 index 0000000000000000000000000000000000000000..9d00bcad431f4c9a790e040c2f9978ef017e13f6 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircle.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMUONPREPDATA_MDTMEASUREMENT_H +#define XAODMUONPREPDATA_MDTMEASUREMENT_H + +#include "xAODMuonPrepData/versions/MdtDriftCircle_v1.h" + +/// Namespace holding all the xAOD EDM classes +namespace xAOD { +/// Defined the version of the MdtDriftCircle +typedef MdtDriftCircle_v1 MdtDriftCircle; +} // namespace xAOD + +// Set up a CLID for the class: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF(xAOD::MdtDriftCircle, 92538182, 1) + +#endif // XAODMUONRDO_NRPCRDO_H diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircleAuxContainer.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircleAuxContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..f08090952561d5aab0cd110d1bda89241405200d --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircleAuxContainer.h @@ -0,0 +1,18 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMUONPREPDATA_MDTDRIFTCIRCLEAUXCONTAINER_H +#define XAODMUONPREPDATA_MDTDRIFTCIRCLEAUXCONTAINER_H + +#include "xAODMuonPrepData/versions/MdtDriftCircleAuxContainer_v1.h" + +/// Namespace holding all the xAOD EDM classes +namespace xAOD { +/// Defined the version of the MdtDriftCircle +typedef MdtDriftCircleAuxContainer_v1 MdtDriftCircleAuxContainer; +} // namespace xAOD + +// Set up a CLID for the class: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF(xAOD::MdtDriftCircleAuxContainer, 1108747397, 1) +#endif // XAODMUONRDO_NRPCRDO_H diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircleContainer.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircleContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..2f1b6793f588f1b224f1ff6c7707196a38352362 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/MdtDriftCircleContainer.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODMUONPREPDATA_MDTDRIFTCIRCLECONTAINER_H +#define XAODMUONPREPDATA_MDTDRIFTCIRCLECONTAINER_H + +#include "xAODMuonPrepData/MdtDriftCircle.h" +#include "xAODMuonPrepData/versions/MdtDriftCircleContainer_v1.h" + +/// Namespace holding all the xAOD EDM classes +namespace xAOD { +/// Define the version of the pixel cluster container +typedef MdtDriftCircleContainer_v1 MdtDriftCircleContainer; +} // namespace xAOD + +// Set up a CLID for the class: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF(xAOD::MdtDriftCircleContainer, 1098001914, 1) + +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/selection.xml b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..9b4ebe40cfd83ce7a89feaa7a78b2d79161e9357 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/selection.xml @@ -0,0 +1,13 @@ +<!-- Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration --> +<lcgdict> + + <class name="xAOD::MdtDriftCircle_v1" /> + <class name="xAOD::MdtDriftCircleContainer_v1" + id="A1A37753-0334-4D86-AB45-06DE59AF694E" /> + <typedef name="xAOD::MdtDriftCircle" /> + <typedef name="xAOD::MdtDriftCircleContainer" /> + + <class name="xAOD::MdtDriftCircleAuxContainer_v1" + id="1047F7E4-504B-4277-AB0B-41B5D5775A47" /> + <typedef name = "xAOD::MdtDriftCircleAuxContainer" /> +</lcgdict> diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircleAuxContainer_v1.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircleAuxContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..fd6a8a9cfe68b8899e9840dee35296b79cd45c44 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircleAuxContainer_v1.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODMUONPREPDATA_VERSIONS_MDTDRIFTCIRCLEAUXCONTAINER_V1_H +#define XAODMUONPREPDATA_VERSIONS_MDTDRIFTCIRCLEAUXCONTAINER_V1_H + +#include "Identifier/Identifier.h" +#include "Identifier/IdentifierHash.h" +#include "xAODCore/AuxContainerBase.h" +#include "xAODMeasurementBase/MeasurementDefs.h" + +namespace xAOD { +/// Auxiliary store for Mdt drift circles +/// +class MdtDriftCircleAuxContainer_v1 : public AuxContainerBase { + public: + /// Default constructor + MdtDriftCircleAuxContainer_v1(); + + private: + /// @name Defining Mdt Drift Circle parameters + /// @{ + std::vector<Identifier::value_type> identifier; + std::vector<IdentifierHash::value_type> identifierHash; + std::vector<PosAccessor<1>::element_type> localPosition; + std::vector<CovAccessor<1>::element_type> localCovariance; + + std::vector<int16_t> tdc{}; + std::vector<int16_t> adc{}; + std::vector<uint16_t> driftTube{}; + std::vector<uint8_t> tubeLayer{}; + std::vector<uint8_t> driftCircleStatus{}; + /// @} +}; +} // namespace xAOD + +// Set up the StoreGate inheritance for the class: +#include "xAODCore/BaseInfo.h" +SG_BASE(xAOD::MdtDriftCircleAuxContainer_v1, xAOD::AuxContainerBase); +#endif diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircleContainer_v1.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircleContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..2dd94c8d85fdef7b0902856d137f4504e6596fc8 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircleContainer_v1.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMUONPREPDATA_VERSION_MDTDRIFTCIRCLECONTAINER_V1_H +#define XAODMUONPREPDATA_VERSION_MDTDRIFTCIRCLECONTAINER_V1_H + +// Core include(s): +#include "AthContainers/DataVector.h" +#include "xAODMuonPrepData/versions/MdtDriftCircle_v1.h" + +namespace xAOD { +/// The container is a simple typedef for now +typedef DataVector<xAOD::MdtDriftCircle_v1> MdtDriftCircleContainer_v1; +} // namespace xAOD + +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircle_v1.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircle_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..a707db8ccd96a6cf069b133dd9dcdaf6597cd0c5 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/versions/MdtDriftCircle_v1.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMUONPREPDATA_VERSION_MDTDRIFTCIRCLE_V1_H +#define XAODMUONPREPDATA_VERSION_MDTDRIFTCIRCLE_V1_H + +#include "GeoPrimitives/GeoPrimitives.h" +#include "Identifier/Identifier.h" +#include "Identifier/IdentifierHash.h" +#include "MuonPrepRawData/MdtDriftCircleStatus.h" +#include "xAODMeasurementBase/versions/UncalibratedMeasurement_v1.h" + +namespace xAOD { +/// https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MdtPrepData.h + +class MdtDriftCircle_v1 : public UncalibratedMeasurement_v1 { + + public: + using MdtDriftCircleStatus = Muon::MdtDriftCircleStatus; + /// Default constructor + MdtDriftCircle_v1() = default; + /// Virtual destructor + virtual ~MdtDriftCircle_v1() = default; + + /// Returns the type of the Mdt drift circle as a simple enumeration + xAOD::UncalibMeasType type() const override final { + return xAOD::UncalibMeasType::MdtDriftCircleType; + } + unsigned int numDimensions() const override final { return 1; } + /** @brief Returns the TDC (typically range is 0 to 2500)*/ + int16_t tdc() const; + /** @brief Returns the ADC (typically range is 0 to 250)*/ + int16_t adc() const; + + /** @brief Returns the tube number of the measurement (1-120)*/ + uint16_t driftTube() const; + /** @brief Returns the layer number of the measruement (1-4)*/ + uint8_t tubeLayer() const; + /** @brief Returns the hash of the measurment channel (tube (x) layer) */ + IdentifierHash measurementHash() const; + /** @brief Returns the status of the measurement */ + MdtDriftCircleStatus status() const; + /** @brief Returns the drift radius*/ + float driftRadius() const; + /** @brief Returns the covariance of the drift radius*/ + float driftRadiusCov() const; + /** @brief Returns the uncertainty on the drift radius*/ + float driftRadiusUncert() const; + + /// Setter methods + + /** @brief Sets the TDC counts */ + void setTdc(int16_t tdc); + /** @brief Sets the ADC counts */ + void setAdc(int16_t adc); + /** @brief Sets the tube number */ + void setTube(uint16_t tube_n); + /** @brief Sets the layer number */ + void setLayer(uint8_t layer_n); + /** @brief Sets the status of the drift circle */ + void setStatus(MdtDriftCircleStatus st); + /** @brief Sets the drift radius of the drift circle */ + void setDriftRadius(float r); + /** @brief Sets the covariance on the drift circle */ + void setDriftRadCov(float cov); +}; + +} // namespace xAOD + +#include "AthContainers/DataVector.h" +DATAVECTOR_BASE(xAOD::MdtDriftCircle_v1, xAOD::UncalibratedMeasurement_v1); +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/xAODMuonPrepDataDict.h b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/xAODMuonPrepDataDict.h new file mode 100644 index 0000000000000000000000000000000000000000..6884f220b24069eee512510b62b32b1866ee8eae --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/xAODMuonPrepDataDict.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMUONPREPDATA_DICT_H +#define XAODMUONPREPDATA_DICT_H + +#include "xAODCore/tools/DictHelpers.h" +#include "xAODMuonPrepData/MdtDriftCircle.h" +#include "xAODMuonPrepData/MdtDriftCircleAuxContainer.h" +#include "xAODMuonPrepData/MdtDriftCircleContainer.h" +#include "xAODMuonPrepData/versions/MdtDriftCircleAuxContainer_v1.h" +#include "xAODMuonPrepData/versions/MdtDriftCircleContainer_v1.h" +#include "xAODMuonPrepData/versions/MdtDriftCircle_v1.h" + +// Instantiate all necessary types for the dictionary. +namespace { +struct GCCXML_DUMMY_INSTANTIATION_XAODMUONRDO { + // Type(s) needed for the dictionary generation to succeed. + XAOD_INSTANTIATE_NS_CONTAINER_TYPES(xAOD, MdtDriftCircleContainer_v1); +}; +} // namespace + +#endif // XAODMUONRDO_DICT_H diff --git a/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepDataAthenaPool/CMakeLists.txt b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepDataAthenaPool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3a06ad47c2f54b5e0cebc63a4deb707af261f73 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepDataAthenaPool/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( xAODMuonPrepDataAthenaPool ) + +# External dependencies: +find_package( ROOT COMPONENTS Core ) + +# Component(s) in the package: +atlas_add_poolcnv_library( xAODMuonPrepDataAthenaPoolCnv + FILES xAODMuonPrepData/MdtDriftCircleContainer.h xAODMuonPrepData/MdtDriftCircleAuxContainer.h + TYPES_WITH_NAMESPACE xAOD::MdtDriftCircleContainer xAOD::MdtDriftCircleAuxContainer + CNV_PFX xAOD + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthenaKernel + AthenaPoolCnvSvcLib AthenaPoolUtilities xAODMuonPrepData) diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/CMakeLists.txt b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8e2ba82eefcdeeca689688eee824ed6cc84f30e2 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( xAODMuonTrkPrepDataCnv ) + +# External dependencies: +find_package( xAODUtilities ) + +# Component(s) in the package: +atlas_add_component( xAODMuonTrkPrepDataCnv + src/*.cxx + src/components/*.cxx + LINK_LIBRARIES AthenaBaseComps GeoPrimitives MuonIdHelpersLib + MuonPrepRawData xAODMuonPrepData StoreGateLib) + +atlas_install_python_modules( python/*.py) \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/python/MuonPrepDataCnvCfg.py b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/python/MuonPrepDataCnvCfg.py new file mode 100644 index 0000000000000000000000000000000000000000..925c07e24610ab77af8add6a2ed5adf5276c0b11 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/python/MuonPrepDataCnvCfg.py @@ -0,0 +1,68 @@ + +#Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +def MdtConvAlgCfg(flags,name="MdtPrepDataToxAODCnvAlg", **kwargs): + result = ComponentAccumulator() + the_alg = CompFactory.MdtPrepDataToxAODCnvAlg(name=name, **kwargs) + result.addEventAlgo(the_alg, primary = True) + return result + +def SetupArgParser(): + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument("-t", "--threads", dest="threads", type=int, help="number of threads", default=1) + parser.add_argument("-o", "--output", dest="output", default='PrepDataTest.pool.root', help="Text file containing each cabling channel", metavar="FILE") + parser.add_argument("--inputFile", "-i", default=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/WorkflowReferences/master/q449/v32/myESD.pool.root"], + help="Input file to run on ", nargs="+") + return parser + +def setupTestOutputCfg(flags,**kwargs): + + kwargs.setdefault("streamName","MPRDTestStream") + kwargs.setdefault("AcceptAlgs",[]) + + result = ComponentAccumulator() + ### Setup an xAOD Stream to test the size of the Mdt container + # ============================= + # Define contents of the format + # ============================= + container_items = ["xAOD::MdtDriftCircleContainer#", + "xAOD::MdtDriftCircleAuxContainer#"] + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + from xAODMetaDataCnv.InfileMetaDataConfig import InfileMetaDataCfg + kwargs.setdefault("ItemList", container_items) + result.merge(OutputStreamCfg(flags, **kwargs)) + result.merge(InfileMetaDataCfg(flags, kwargs["streamName"], kwargs["AcceptAlgs"])) + return result + + +if __name__ == "__main__": + from MuonCondTest.MdtCablingTester import setupServicesCfg + from AthenaConfiguration.AllConfigFlags import initConfigFlags + args = SetupArgParser().parse_args() + + flags = initConfigFlags() + flags.Concurrency.NumThreads = args.threads + flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment. + flags.Output.doWriteDAOD = True + flags.Input.Files = args.inputFile + flags.addFlag("Output.MPRDTestStreamFileName", args.output) + flags.addFlag("Output.doWriteMPRDTestStream", True) + flags.lock() + + cfg = setupServicesCfg(flags) + cfg.merge(MdtConvAlgCfg(flags)) + cfg.merge(setupTestOutputCfg(flags)) + + cfg.printConfig(withDetails=True, summariseProps=True) + flags.dump() + + sc = cfg.run(-1) + if not sc.isSuccess(): + import sys + sys.exit("Execution failed") + diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/MdtPrepDataToxAODCnvAlg.cxx b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/MdtPrepDataToxAODCnvAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6f9665d8e0cc68d9f843b3d6780c81af8eebb4aa --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/MdtPrepDataToxAODCnvAlg.cxx @@ -0,0 +1,62 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "MdtPrepDataToxAODCnvAlg.h" + +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" +#include "xAODMuonPrepData/MdtDriftCircleAuxContainer.h" + +MdtPrepDataToxAODCnvAlg::MdtPrepDataToxAODCnvAlg(const std::string& name, + ISvcLocator* pSvcLocator) + : AthReentrantAlgorithm(name, pSvcLocator) {} + +StatusCode MdtPrepDataToxAODCnvAlg::initialize() { + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_inputKey.initialize()); + ATH_CHECK(m_outputKey.initialize()); + ATH_CHECK(m_detMgr.initialize()); + return StatusCode::SUCCESS; +} + +StatusCode MdtPrepDataToxAODCnvAlg::execute(const EventContext& ctx) const { + + SG::ReadHandle<Muon::MdtPrepDataContainer> inputContainer{m_inputKey, ctx}; + if (!inputContainer.isValid()) { + ATH_MSG_FATAL("Failed to retrieve Mdt prepdata collection " + << m_inputKey.fullKey()); + return StatusCode::FAILURE; + } + + SG::WriteHandle<xAOD::MdtDriftCircleContainer> outputContainer{m_outputKey, + ctx}; + ATH_CHECK(outputContainer.record( + std::make_unique<xAOD::MdtDriftCircleContainer>(), + std::make_unique<xAOD::MdtDriftCircleAuxContainer>())); + + const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()}; + /// Loop over all collections and prepdata objects to convert them to + /// xAOD::DriftCicles + for (const Muon::MdtPrepDataCollection* mdt_coll : *inputContainer) { + for (const Muon::MdtPrepData* prd : *mdt_coll) { + xAOD::MdtDriftCircle* new_circle = new xAOD::MdtDriftCircle(); + outputContainer->push_back(new_circle); + /// Electronic properties + new_circle->setAdc(prd->adc()); + new_circle->setTdc(prd->tdc()); + new_circle->setStatus(prd->status()); + /// identifier properties + const Identifier id = prd->identify(); + new_circle->setLayer(idHelper.tubeLayer(id)); + new_circle->setTube(idHelper.tube(id)); + /// local position / covariance / hash + new_circle->setDriftRadius(prd->localPosition()[Trk::locR]); + new_circle->setDriftRadCov( + prd->localCovariance()(Trk::locR, Trk::locR)); + new_circle->setIdentifierHash( + prd->detectorElement()->detectorElementHash()); + } + } + return StatusCode::SUCCESS; +} diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/MdtPrepDataToxAODCnvAlg.h b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/MdtPrepDataToxAODCnvAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..224064b852fa4c5b740fab8d0001c005e689714b --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/MdtPrepDataToxAODCnvAlg.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef XAODMUONTRKPREDATACNV_MDTPREPDATATOXAODCNVALG_H +#define XAODMUONTRKPREDATACNV_MDTPREPDATATOXAODCNVALG_H + +/// Athena includes +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonPrepRawData/MdtPrepDataContainer.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" +#include "xAODMuonPrepData/MdtDriftCircleContainer.h" + +class MdtPrepDataToxAODCnvAlg : public AthReentrantAlgorithm { + public: + MdtPrepDataToxAODCnvAlg(const std::string& name, ISvcLocator* pSvcLocator); + + ~MdtPrepDataToxAODCnvAlg() = default; + + StatusCode execute(const EventContext& ctx) const override; + StatusCode initialize() override; + + private: + SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_inputKey{ + this, "InputContainer", "MDT_DriftCircles", "MDT prep data"}; + SG::WriteHandleKey<xAOD::MdtDriftCircleContainer> m_outputKey{ + this, "OutputContainer", "xAODMdtCircles", "Output container"}; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ + this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_detMgr{ + this, "MuonManagerKey", "MuonDetectorManager"}; +}; +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/components/xAODMuonTrkPrepDataCnv_entries.cxx b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/components/xAODMuonTrkPrepDataCnv_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dd9da2a248457b4230ea655568855080f4c0c620 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonCnv/xAODMuonTrkPrepDataCnv/src/components/xAODMuonTrkPrepDataCnv_entries.cxx @@ -0,0 +1,7 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "../MdtPrepDataToxAODCnvAlg.h" + +DECLARE_COMPONENT(MdtPrepDataToxAODCnvAlg) \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/CMakeLists.txt b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d8c21e2553786413b7720024d9b2d5485aded73 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +################################################################################ +# Package: MuonGeoModelR4 +################################################################################ + +# Declare the package name: +atlas_subdir( MuonGeoModelR4 ) + +# External dependencies: +find_package( GeoModel COMPONENTS GeoModelKernel GeoModelDBManager GeoModelRead ) + +# Component(s) in the package: +atlas_add_library( MuonGeoModelR4Lib + src/*.cxx + PUBLIC_HEADERS MuonGeoModelR4 + INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} + LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaBaseComps AthenaKernel + GeoModelUtilities GaudiKernel MuonReadoutGeometryR4 StoreGateLib CxxUtils ) + +atlas_add_component( MuonGeoModelR4 + src/components/*.cxx + INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} + LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaKernel StoreGateLib GeoModelUtilities + GaudiKernel MuonReadoutGeometryR4 MuonGeoModelR4Lib AthenaPoolUtilities) + +# Install files from the package: +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/IMuonReaoutGeomTool.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/IMuonReaoutGeomTool.h new file mode 100644 index 0000000000000000000000000000000000000000..7830fab13d2d46424911b854c57113d4ff4df9fc --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/IMuonReaoutGeomTool.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONGEOMODELR4_IMUONREAOUDGEOMTOOL_H +#define MUONGEOMODELR4_IMUONREAOUDGEOMTOOL_H + +#include "GaudiKernel/IAlgTool.h" +/*** + * The IMuonReadoutGeomTool provides an Inteface for a class of tools that + * create the ReadoutElements for each Muon Detector and append then to the + * MuonDetectorManager + * **/ + +namespace MuonGMR4 { +class MuonDetectorManager; +class IMuonReadoutGeomTool : virtual public IAlgTool { + public: + /// Gaudi interface ID + DeclareInterfaceID(IMuonReadoutGeomTool, 1, 0); + + /// Retrieves the GeoModel from the GeoModelSvc and append the + /// ReadoutElements of the Given MuonDetectorTechnology to the + /// MuonDetectorManager + virtual StatusCode buildReadOutElements(MuonDetectorManager& mgr) = 0; +}; +} // namespace MuonGMR4 +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MdtReadoutGeomTool.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MdtReadoutGeomTool.h new file mode 100644 index 0000000000000000000000000000000000000000..92efe16191f04106f61a46217d789dd45581c853 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MdtReadoutGeomTool.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONGEOMODELR4_MDTREAOUDGEOMTOOL_H +#define MUONGEOMODELR4_MDTREAOUDGEOMTOOL_H + +#include <AthenaBaseComps/AthAlgTool.h> +#include <MuonReadoutGeometryR4/MdtReadoutElement.h> +#include <MuonReadoutGeometryR4/CutOutArea.h> + +#include <GeoModelInterfaces/IGeoDbTagSvc.h> +#include <MuonGeoModelR4/IMuonReaoutGeomTool.h> +#include <MuonIdHelpers/IMuonIdHelperSvc.h> + +namespace MuonGMR4 { + +class MdtReadoutGeomTool : public AthAlgTool, + virtual public IMuonReadoutGeomTool { + public: + // Constructor + MdtReadoutGeomTool(const std::string &type, const std::string &name, + const IInterface *parent); + + StatusCode initialize() override final; + + StatusCode buildReadOutElements(MuonDetectorManager &mgr) override final; + + private: + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ + this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + ServiceHandle<IGeoDbTagSvc> m_geoDbTagSvc{this, "GeoDbTagSvc", + "GeoDbTagSvc"}; + + using parameterBook = MdtReadoutElement::parameterBook; + + + /// Retrieves the auxillary tables from the database + StatusCode readParameterBook(); + /// Loads the chamber dimensions from GeoModel + StatusCode loadDimensions(MdtReadoutElement::defineArgs& args ); + /// Load the cutouts + StatusCode loadCutouts(MdtReadoutElement::defineArgs& args ); + + + using ParamBookTable = std::map<std::string, parameterBook>; + ParamBookTable m_parBook{}; + + std::map<Identifier, std::vector<CutOutArea>> m_amdbCutOuts{}; + +}; + +} // namespace MuonGMR4 +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h new file mode 100644 index 0000000000000000000000000000000000000000..1eff54df5a9b1451c3ae304fbac491fde1a2f94c --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONGEOMODELR4_MUONDETECTORTOOL_H +#define MUONGEOMODELR4_MUONDETECTORTOOL_H + +#include "CxxUtils/checker_macros.h" +#include "GeoModelInterfaces/IGeoDbTagSvc.h" +#include "GeoModelUtilities/GeoModelTool.h" +#include "MuonGeoModelR4/IMuonReaoutGeomTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" + +namespace MuonGMR4 { +class MuonDetectorManager; +class MuonDetectorTool final : public GeoModelTool { + + public: + // Constructor + MuonDetectorTool(const std::string &type, const std::string &name, + const IInterface *parent); + + // Destructor + virtual ~MuonDetectorTool() override final; + + // Initialize + virtual StatusCode initialize() override final; + + // build the geometry + virtual StatusCode create() override final; + + // Dereference tree tops and drop readout objects + virtual StatusCode clear() override final; + + private: + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ + this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + ToolHandleArray<IMuonReadoutGeomTool> m_detTechTools{ + this, + "ReadoutEleBuilders", + {}, + "SubTools to build the readoutElements for each technology"}; + + ServiceHandle<IGeoDbTagSvc> m_geoDbTagSvc{this, "GeoDbTagSvc", + "GeoDbTagSvc"}; + MuonDetectorManager *m_manager{nullptr}; +}; +} // namespace MuonGMR4 +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/Utils.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/Utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a6aca774533cc2edf55415611f1229b12294a2a7 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/Utils.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONGEOMODELR4_UTILS_H +#define MUONGEOMODELR4_UTILS_H + + +#include "GeoPrimitives/GeoPrimitives.h" +/// Load the Eigen definitions. + +#include "GeoModelKernel/GeoFullPhysVol.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelKernel/GeoShape.h" +#include "AthenaBaseComps/AthMessaging.h" +namespace MuonGMR4{ + + /// Navigates throughs the volume to find a Box / Prd shape + const GeoShape* extractShape(const PVConstLink& physVol, MsgStream& msg); + const GeoShape* extractShape(const GeoShape* inShape, MsgStream& msg); + // Navigates through the bolume to find the shifts / rotations etc. + Amg::Transform3D extractShifts(const PVConstLink& physVol, MsgStream& msg); + Amg::Transform3D extractShifts(const GeoShape* inShape, MsgStream& msg); + + + +} +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/python/MuonGeoModelConfig.py b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/python/MuonGeoModelConfig.py new file mode 100755 index 0000000000000000000000000000000000000000..3c740bb361c59f77948472e69b70c5890274f44d --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/python/MuonGeoModelConfig.py @@ -0,0 +1,22 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + + +def MdtReadoutGeomToolCfg(flags, name="MdtReadoutGeomTool", **kwargs): + result = ComponentAccumulator() + the_tool = CompFactory.MuonGMR4.MdtReadoutGeomTool(name, **kwargs) + result.setPrivateTools(the_tool) + return result + +def MuonDetectorToolCfg(flags, name="MuonDetectorToolR4", **kwargs): + result = ComponentAccumulator() + sub_detTools = [] + if flags.Detector.GeometryMDT: + sub_detTools.append(result.popToolsAndMerge(MdtReadoutGeomToolCfg(flags))) + kwargs.setdefault("ReadoutEleBuilders", sub_detTools) + the_tool = CompFactory.MuonGMR4.MuonDetectorTool(name = name, **kwargs) + result.setPrivateTools(the_tool) + return result + + diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MdtReadoutGeomTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MdtReadoutGeomTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3f9491495df33c90cbc3f8355f086de5abb3090 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MdtReadoutGeomTool.cxx @@ -0,0 +1,288 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonGeoModelR4/MdtReadoutGeomTool.h" + +#include <GaudiKernel/SystemOfUnits.h> +#include <RDBAccessSvc/IRDBAccessSvc.h> +#include <RDBAccessSvc/IRDBRecordset.h> + +#include "EventPrimitives/EventPrimitivesToStringConverter.h" +#include <GeoPrimitives/GeoPrimitivesHelpers.h> +#include "GeoModelKernel/GeoFullPhysVol.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelKernel/GeoTrd.h" +#include "GeoModelKernel/GeoBox.h" + +#include "GeoModelRead/ReadGeoModel.h" +#include "GeoModelKernel/GeoVolumeCursor.h" +#include "MuonReadoutGeometryR4/MuonDetectorManager.h" +#include "MuonReadoutGeometryR4/StringUtils.h" +#include "RDBAccessSvc/IRDBRecord.h" +#include "MuonGeoModelR4/Utils.h" +namespace MuonGMR4 { +MdtReadoutGeomTool::MdtReadoutGeomTool(const std::string& type, + const std::string& name, + const IInterface* parent) + : AthAlgTool{type, name, parent} { + declareInterface<IMuonReadoutGeomTool>(this); +} +StatusCode MdtReadoutGeomTool::initialize() { + ATH_CHECK(m_geoDbTagSvc.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + + return StatusCode::SUCCESS; +} +StatusCode MdtReadoutGeomTool::loadDimensions(MdtReadoutElement::defineArgs& define) { + const GeoShape* shape = extractShape(define.physVol, msgStream()); + if (!shape) { + ATH_MSG_FATAL("Failed to deduce a valid shape for "<<m_idHelperSvc->toString(define.detElId)); + return StatusCode::FAILURE; + } + if (shape->typeID() == GeoTrd::getClassTypeID()){ + const GeoTrd* trd = static_cast<const GeoTrd*>(shape); + ATH_MSG_VERBOSE("Trapezoidal geometry shape: "<<trd->getXHalfLength1() + <<", height: "<<trd->getXHalfLength2()<<" -- short/long tube length: " + <<trd->getYHalfLength1()<<"/" <<trd->getYHalfLength2()<<", chamber width: "<<trd->getZHalfLength()); + define.longHalfX = std::max(trd->getYHalfLength1(), trd->getYHalfLength2()) * Gaudi::Units::mm; + define.shortHalfX = std::min(trd->getYHalfLength1(), trd->getYHalfLength2())* Gaudi::Units::mm; + define.halfY = trd->getZHalfLength()* Gaudi::Units::mm; + define.halfHeight = std::max(trd->getXHalfLength1(), trd->getXHalfLength2()) * Gaudi::Units::mm; + } else { + ATH_MSG_FATAL("Unknown shape type "<<shape->type()); + return StatusCode::FAILURE; + } + /// As a very wise person once said.. We simply take Bikini booottom + /// and push it somewhere elseee + /// Also Rotate the system such that the wire is pointing the Y axis + static const Amg::Transform3D systemRotation = Amg::getRotateY3D(M_PI_2)*Amg::getRotateZ3D(M_PI_2); + define.toVolCenter = extractShifts(define.physVol, msgStream()) * systemRotation; + /// Calculate the number of tubes from the width + /// width = tube pitch x (N + 0.5) <- On one site a half tube of the second layer + /// is visible from the top + define.numTubesPerLay = ( 2. * define.halfY / define.tubePitch - 0.5); + return StatusCode::SUCCESS; +} +StatusCode MdtReadoutGeomTool::loadCutouts(MdtReadoutElement::defineArgs& define) { + const std::vector<CutOutArea>& definedCuts = m_amdbCutOuts[define.detElId]; + if (definedCuts.empty()) { + ATH_MSG_VERBOSE("No cutouts were defiend for "<<m_idHelperSvc->toStringDetEl(define.detElId)); + return StatusCode::SUCCESS; + } + if (m_idHelperSvc->isEndcap(define.detElId)){ + ATH_MSG_FATAL("The cutouts are not yet implemented for endcap chambers"); + return StatusCode::FAILURE; + } + /// Wuhu + ATH_MSG_VERBOSE("Load "<<definedCuts.size()<<" cutout elements for chamber " + <<m_idHelperSvc->toStringDetEl(define.detElId) + <<" tube lengths: "<<define.longHalfX<<", chamber length: "<<define.halfY + <<", n Tubes: "<<define.numTubesPerLay); + + MdtCutOuts cutTubes{}; + for (const CutOutArea& cut : definedCuts) { + ATH_MSG_VERBOSE("Process cut "<<cut); + /// Calculate the boundaries along the tube. If the sign of x is positive, + /// then apply the cut on the right, otherwise on the left + const double minX = cut.origin.x() - cut.halfLengthX; + const double maxX = cut.origin.x() + cut.halfLengthX; + /// Calculate the tube number + for (uint16_t lay = 1; lay <= define.firstTubePos.size(); ++lay){ + const Amg::Vector3D& tubeLay{define.firstTubePos[lay-1]}; + ATH_MSG_VERBOSE("Process cut for layer "<<static_cast<int>(lay)<<". First tube: "<<Amg::toString(tubeLay,1)); + /// Intersect the + std::optional<double> isect = MuonGM::intersect<3>(Amg::Vector3D::Zero(), cut.inclanation, + tubeLay.z() * Amg::Vector3D::UnitZ(), Amg::Vector3D::UnitY()); + + const double minY = (isect ? *isect : 0.) + cut.origin.y(); + const double maxY = (isect ? *isect : 0.) + cut.origin.y() + cut.lengthY; + const uint16_t minTube = (minY - tubeLay.y()) / define.tubePitch; + const uint16_t maxTube = (maxY - tubeLay.y()) / define.tubePitch; + for (uint16_t tube = minTube; tube <= maxTube ; ++tube) { + const IdentifierHash hash = MdtReadoutElement::measurementHash(lay, tube); + MdtCutOut tubeCut{}; + tubeCut.layer = MdtReadoutElement::layerNumber(hash); + tubeCut.firstTube = MdtReadoutElement::tubeNumber(hash); + tubeCut.lastTube = MdtReadoutElement::tubeNumber(hash); + /// Apply the cut on the right-hand side + if (minX > 0 && maxX > 0) { + tubeCut.rightX = (define.longHalfX - minX); + } + /// Apply the cut on the left hand side + else if (minX < 0 && maxX < 0) { + tubeCut.leftX = (define.longHalfX - std::abs(maxX)); + } else if (minX < 0.) { + tubeCut.leftX = (maxX - minX); + } + if (tubeCut.rightX < 0. || tubeCut.leftX <0.) { + ATH_MSG_FATAL("A cut needs to be positive "<<tubeCut<<", "<<m_idHelperSvc->toStringDetEl(define.detElId)); + return StatusCode::FAILURE; + } + MdtCutOuts::const_iterator exist = cutTubes.find(tubeCut); + /// AMDB has the possibility to define cuts that are overlapping... + if (exist != cutTubes.end()) { + ATH_MSG_VERBOSE("Overwrite the exisiting cut values of "<<(*exist)); + tubeCut.rightX = std::max(tubeCut.rightX, (*exist).rightX); + tubeCut.leftX = std::max(tubeCut.leftX, (*exist).leftX); + cutTubes.erase(exist); + } + ATH_MSG_VERBOSE("Add new cut "<<tubeCut); + cutTubes.insert(std::move(tubeCut)); + } + } + } + /// Now we need to summarize the cutouts + std::vector<MdtCutOut> cutVec{}; + cutVec.insert(cutVec.end(), cutTubes.begin(), cutTubes.end()); + std::sort(cutVec.begin(),cutVec.end()); + + for (size_t tC = 0; tC < cutVec.size(); ++tC) { + MdtCutOut& cut = cutVec[tC]; + for(size_t seqTube = tC +1; seqTube < cutVec.size(); ++seqTube) { + MdtCutOut& nextCut = cutVec[seqTube]; + /// Cut applies on a different tube + if (nextCut.layer != cut.layer) break; + // The cuts change + if (std::abs(nextCut.leftX - cut.leftX) > std::numeric_limits<double>::epsilon() || + std::abs(nextCut.rightX - cut.rightX)> std::numeric_limits<double>::epsilon()) break; + /// There is a hole between the cuts? + if (nextCut.firstTube - cut.lastTube > 1 ) break; + cut.lastTube = nextCut.lastTube; + ++tC; + } + define.cutouts.insert(std::move(cut)); + } + return StatusCode::SUCCESS; +} +StatusCode MdtReadoutGeomTool::buildReadOutElements(MuonDetectorManager& mgr) { + + GeoModelIO::ReadGeoModel* sqliteReader = m_geoDbTagSvc->getSqliteReader(); + if (!sqliteReader) { + ATH_MSG_FATAL("Error, the tool works exclusively from sqlite geometry inputs"); + return StatusCode::FAILURE; + } + ATH_CHECK(readParameterBook()); + + const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()}; + // Get the list of full phys volumes from SQLite, and create detector + // elements + std::map<std::string, GeoFullPhysVol*> mapFPV = + sqliteReader->getPublishedNodes<std::string, GeoFullPhysVol*>("Muon"); + + for (auto& [key, pv] : mapFPV) { + /// The keys should be formatted like + /// <STATION_NAME>_<MUON_CHAMBERTYPE>_etc. The <MUON_CHAMBERTYPE> also + /// indicates whether we're dealing with a MDT / TGC / CSC / RPC chamber + /// If we are dealing with a MDT chamber, then there are 3 additional + /// properties encoded into the chamber + /// <STATIONETA>_(<STATIONPHI>-1)_ML + std::vector<std::string> key_tokens = tokenize(key, "_"); + if (key_tokens.size() != 5 || + key_tokens[1].find("MDT") == std::string::npos) + continue; + + MdtReadoutElement::defineArgs define{}; + bool isValid{false}; + define.detElId = idHelper.channelID( + key_tokens[0].substr(0, 3), atoi(key_tokens[2]), + atoi(key_tokens[3]) + 1, atoi(key_tokens[4]), 1, 1, isValid); + if (!isValid) { + ATH_MSG_FATAL("Failed to build a good identifier out of " << key); + // return StatusCode::FAILURE; + continue; + } + ATH_MSG_VERBOSE("Key "<<key<<" brought us "<<m_idHelperSvc->toStringDetEl(define.detElId)); + /// Skip the endcap chambers + /// if (m_idHelperSvc->isEndcap(define.detElId)) continue; + define.physVol = pv; + define.chambDesign = key_tokens[1]; + + /// Load first tube etc. from the parameter book table + ParamBookTable::const_iterator book_itr = m_parBook.find(define.chambDesign); + if (book_itr == m_parBook.end()) { + ATH_MSG_FATAL("There is no chamber called "<<define.chambDesign); + return StatusCode::FAILURE; + } + static_cast<parameterBook&>(define) = book_itr->second; + /// Chamber dimensions are given from the GeoShape + ATH_CHECK(loadDimensions(define)); + /// Cut outs + ATH_CHECK(loadCutouts(define)); + + std::unique_ptr<MdtReadoutElement> mdtDetectorElement = std::make_unique<MdtReadoutElement>(std::move(define)); + mgr.addMdtReadoutElement(std::move(mdtDetectorElement)).ignore(); + + //ATH_CHECK(mgr.addMdtReadoutElement(std::move(mdtDetectorElement))); + } + return StatusCode::SUCCESS; +} +StatusCode MdtReadoutGeomTool::readParameterBook() { + if (m_parBook.size()) + return StatusCode::SUCCESS; + ServiceHandle<IRDBAccessSvc> accessSvc(m_geoDbTagSvc->getParamSvcName(), + name()); + ATH_CHECK(accessSvc.retrieve()); + IRDBRecordset_ptr paramTable = accessSvc->getRecordsetPtr("WMDT", ""); + if (paramTable->size() == 0) { + ATH_MSG_FATAL("Empty parameter book table found"); + return StatusCode::FAILURE; + } + ATH_MSG_VERBOSE("Found the " << paramTable->nodeName() << " [" + << paramTable->tagName() << "] table with " + << paramTable->size() << " records"); + for (IRDBRecord* record : *paramTable) { + parameterBook pars{}; + pars.tubeWall = record->getDouble("TUBWAL") * Gaudi::Units::cm; + pars.tubePitch = record->getDouble("TUBPIT") * Gaudi::Units::cm; + pars.tubeInnerRad = record->getDouble("TUBRAD") * Gaudi::Units::cm; + pars.endPlugLength = record->getDouble("TUBDEA") * Gaudi::Units::cm; + pars.radLengthX0 = record->getDouble("X0"); + /// The following access pattern hopefully changes in the near future + /// such that we can use the array mechanism of the XML file + unsigned int nLay = record->getInt("LAYMDT"); + static const Amg::Transform3D tubeRot =Amg::getRotateY3D(M_PI_2) * Amg::getRotateZ3D(M_PI_2); + const std::vector<double> tubeX{tokenizeDouble(record->getString("TUBXCO"),";")}, + tubeY{tokenizeDouble(record->getString("TUBYCO"),";")}; + for (unsigned int lay = 0; lay < nLay; ++lay) { + /// TUBEXCO -> first tube position in the precision plane + /// TUBEYCO -> layer height + Amg::Vector3D tubePos{tubeX[lay], tubeY[lay], 0.}; + pars.firstTubePos.emplace_back(tubeRot*tubePos * Gaudi::Units::cm); + } + const std::string key {record->getString("WMDT_TYPE")}; + ATH_MSG_DEBUG("Extracted parameters " << pars<<" will be safed under key "<<key); + m_parBook[key] = std::move(pars); + } + /// Next step... Download the AMDB cut out tables + paramTable = accessSvc->getRecordsetPtr("mdtCutouts", ""); + if (paramTable->size() == 0) { + ATH_MSG_FATAL("Empty cutout table found"); + return StatusCode::FAILURE; + } + const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()}; + for (const IRDBRecord* record : *paramTable) { + const std::string stName{record->getString("MDTCUTOUTS_DATA_ID").substr(0,3)}; + const int stationEta{record->getInt("etaIndex")}; + const int stationPhi{record->getInt("phiIndex")+1}; + /// Minor comment: May be rename it to multiLayer? + const int multiLayer{record->getInt("Multilayer")}; + bool is_valid{false}; + Identifier detElId = idHelper.channelID(stName, stationEta, stationPhi, multiLayer, 1, 1, is_valid); + if (!is_valid){ + ATH_MSG_FATAL("Failed to construct Identifier from "<<stName + <<" eta: "<<stationEta<<", phi: "<<stationPhi<<", ml:" <<multiLayer); + return StatusCode::FAILURE; + } + /// Define a new cutout + CutOutArea newCutOut{}; + newCutOut.origin = Amg::Vector3D{record->getDouble("dx"), + record->getDouble("dy"), 0}; + newCutOut.inclanation = Amg::getRotateX3D(record->getDouble("D1") * Gaudi::Units::degree) * Amg::Vector3D::UnitZ(); + newCutOut.halfLengthX = std::max(record->getDouble("W_xS"),record->getDouble("W_xL") ) / 2.; + newCutOut.lengthY = record->getDouble("L_y"); + m_amdbCutOuts[detElId].emplace_back(std::move(newCutOut)); + } + return StatusCode::SUCCESS; +} +} // namespace MuonGMR4 \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..446eb26893e2deb5cc6abac03632fbf295951f58 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx @@ -0,0 +1,78 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonGeoModelR4/MuonDetectorTool.h" + +#include "GeoModelInterfaces/IGeoModelSvc.h" +#include "GeoModelKernel/GeoFullPhysVol.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelKernel/GeoVolumeCursor.h" +#include "GeoModelRead/ReadGeoModel.h" +#include "GeoModelUtilities/GeoModelExperiment.h" +#include "MuonReadoutGeometryR4/MuonDetectorManager.h" +#include "RDBAccessSvc/IRDBAccessSvc.h" +#include "RDBAccessSvc/IRDBRecord.h" +#include "RDBAccessSvc/IRDBRecordset.h" +/** + ** Constructor(s) + **/ + +namespace MuonGMR4 { +MuonDetectorTool::MuonDetectorTool(const std::string &type, + const std::string &name, + const IInterface *parent) + : GeoModelTool(type, name, parent) { + declareInterface<IGeoModelTool>(this); +} + +StatusCode MuonDetectorTool::initialize() { + ATH_MSG_INFO("Initializing ..."); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_detTechTools.retrieve()); + ATH_CHECK(m_geoDbTagSvc.retrieve()); + return StatusCode::SUCCESS; +} + +MuonDetectorTool::~MuonDetectorTool() = default; +/** + ** Create the Detector Node corresponding to this tool + **/ +StatusCode MuonDetectorTool::create() { + + m_manager = new MuonDetectorManager(); + + GeoModelExperiment *theExpt = nullptr; + ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS")); + GeoPhysVol *world = theExpt->getPhysVol(); + + for (auto &readOutTool : m_detTechTools) + ATH_CHECK(readOutTool->buildReadOutElements(*m_manager)); + + GeoVolumeCursor cursor(world); + while (!cursor.atEnd()) { + std::string volName = cursor.getName(); + if (volName == "MuonBarrel") { + m_manager->addTreeTop(GeoPVLink(cursor.getVolume().operator->())); + } + cursor.next(); + } + + ATH_CHECK(detStore()->record(m_manager, m_manager->getName())); + ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS")); + theExpt->addManager(m_manager); + + return StatusCode::SUCCESS; +} + +StatusCode MuonDetectorTool::clear() { + SG::DataProxy *proxy = detStore()->proxy( + ClassID_traits<MuonDetectorManager>::ID(), m_manager->getName()); + if (proxy) { + proxy->reset(); + m_manager = nullptr; + } + return StatusCode::SUCCESS; +} + +} // namespace MuonGMR4 diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/Utils.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/Utils.cxx new file mode 100644 index 0000000000000000000000000000000000000000..786e7e786578adeb90f96bb869610be2bdb64aca --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/Utils.cxx @@ -0,0 +1,70 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "MuonGeoModelR4/Utils.h" +#include "GeoModelKernel/GeoShape.h" +#include "GeoModelKernel/GeoBox.h" +#include "GeoModelKernel/GeoTrd.h" +#include "GeoModelKernel/GeoShapeShift.h" +#include "EventPrimitives/EventPrimitivesToStringConverter.h" +#include <set> + + + +namespace MuonGMR4{ + const GeoShape* extractShape(const PVConstLink& physVol, MsgStream& msg) { + const GeoLogVol* logVol = physVol->getLogVol(); + if (!logVol) { + msg<<MSG::ERROR<<__FILE__<<":"<<__LINE__<<" Physical volume has no logical volume attached "<<endmsg; + return nullptr; + } + return extractShape(logVol->getShape(), msg); + } + const GeoShape* extractShape(const GeoShape* inShape, MsgStream& msg) { + if (!inShape) { + msg << MSG::ERROR<<__FILE__<<":"<<__LINE__<<" "<<__func__<<" nullptr given "<<endmsg; + return nullptr; + } + static const std::set<ShapeType> valid_types{ + GeoTrd::getClassTypeID(), + GeoBox::getClassTypeID(), + }; + if (valid_types.count(inShape->typeID())) { + msg<<MSG::VERBOSE<<"Found valid shape type "<<inShape->type()<<endmsg; + return inShape; + } + if (inShape->typeID() == GeoShapeShift::getClassTypeID()) { + const GeoShapeShift* shift = static_cast<const GeoShapeShift*>(inShape); + msg<<MSG::VERBOSE<<"Shape is a shift by "<<Amg::toString(shift->getX().translation(), 2)<< ". Continue navigation " + " "<<shift<<endmsg; + return extractShape(shift->getOp(), msg); + } + msg<<MSG::ERROR<<"The shape "<<inShape->type()<<" is invalid " <<endmsg; + return nullptr; + } + Amg::Transform3D extractShifts(const PVConstLink& physVol, MsgStream& msg) { + const GeoLogVol* logVol = physVol->getLogVol(); + if (!logVol) { + msg<<MSG::ERROR<<__FILE__<<":"<<__LINE__<<" Physical volume has no logical volume attached "<<endmsg; + return Amg::Transform3D::Identity(); + } + return extractShifts(logVol->getShape(), msg); + } + Amg::Transform3D extractShifts(const GeoShape* inShape, MsgStream& msg) { + if (!inShape) { + msg << MSG::ERROR<<__FILE__<<":"<<__LINE__<<" "<<__func__<<" nullptr given "<<endmsg; + return Amg::Transform3D::Identity(); + } + Amg::Transform3D sumTrans{Amg::Transform3D::Identity()}; + if (inShape->typeID() == GeoShapeShift::getClassTypeID()) { + const GeoShapeShift* shift = static_cast<const GeoShapeShift*>(inShape); + msg<<MSG::VERBOSE<<"Shape is a shift . Continue navigation "<<shift<<endmsg; + sumTrans = extractShifts(shift->getOp(), msg) * shift->getX(); + } + msg<<MSG::VERBOSE<<"Extacted transformation translation: "<<Amg::toString(sumTrans.translation(),2) + <<std::endl<<Amg::toString(sumTrans.linear(),2)<<endmsg; + return sumTrans; + } + +} \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/components/MuonGeoModelR4_entries.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/components/MuonGeoModelR4_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..76f4948e935ef2a66a08041d8f6cf6b2ffb1516b --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/components/MuonGeoModelR4_entries.cxx @@ -0,0 +1,9 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonGeoModelR4/MdtReadoutGeomTool.h" +#include "MuonGeoModelR4/MuonDetectorTool.h" + +DECLARE_COMPONENT(MuonGMR4::MuonDetectorTool) +DECLARE_COMPONENT(MuonGMR4::MdtReadoutGeomTool) diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/CMakeLists.txt b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a64665f8d7778a1b0ca4191cb6d4e8b507f3de16 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +################################################################################ +# Package: MuonReadoutGeometryR4 +################################################################################ + +# Declare the package name: +atlas_subdir( MuonGeoModelTestR4 ) + +atlas_add_component( MuonGeoModelTestR4 + src/components/*.cxx src/*.cxx + INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} + LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaKernel StoreGateLib GeoModelUtilities MuonTesterTreeLib + GaudiKernel MuonReadoutGeometryR4 MuonGeoModelR4Lib AthenaPoolUtilities) + +# Install files from the package: +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/MuonGeoModelTestR4/ATLAS_CHECK_THREAD_SAFETY b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/MuonGeoModelTestR4/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..2aa8140dc63d3b100007798974b6132aa9f9fb29 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/MuonGeoModelTestR4/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTest/ \ No newline at end of file diff --git a/Tracking/Acts/ActsGeantFollowing/python/__init__.py b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/__init__.py similarity index 100% rename from Tracking/Acts/ActsGeantFollowing/python/__init__.py rename to MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/__init__.py diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py new file mode 100644 index 0000000000000000000000000000000000000000..de957242dd200591fd81e50f83399ed780c353e1 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/python/testGeoModel.py @@ -0,0 +1,84 @@ + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +def SetupArgParser(): + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument("--threads", type=int, help="number of threads", default=1) + parser.add_argument("--inputFile", "-i", default=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"], + help="Input file to run on ", nargs="+") + parser.add_argument("--geoModelFile", default ="root://eoshome.cern.ch:1094//eos/user/c/cimuonsw/GeometryFiles/muonsOnlyR4WMDT.db", help="GeoModel SqLite file containing the muon geometry.") + return parser + +def setupServicesCfg(flags): + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + result = MainServicesCfg(flags) + ### Setup the file reading + from AthenaConfiguration.Enums import Format + if flags.Input.Format is Format.POOL: + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + result.merge(PoolReadCfg(flags)) + + from MuonConfig.MuonGeometryConfig import MuonIdHelperSvcCfg + result.merge(MuonIdHelperSvcCfg(flags)) + return result + + +def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", **kwargs): + result = ComponentAccumulator() + the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs) + result.addEventAlgo(the_alg) + return result + + +if __name__=="__main__": + from AthenaConfiguration.AllConfigFlags import initConfigFlags + args = SetupArgParser().parse_args() + + flags = initConfigFlags() + flags.Concurrency.NumThreads = args.threads + flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment. + flags.Input.Files = args.inputFile + from os import path, system + if args.geoModelFile.startswith("root://"): + if not path.exists("MuonGeometryDB.db"): + system("xrdcp {source} MuonGeometryDB.db".format(source = args.geoModelFile)) + args.geoModelFile = "MuonGeometryDB.db" + + flags.GeoModel.SQLiteDB = args.geoModelFile + #flags.GeoModel.AtlasVersion ="ATLAS-P2-RUN4-01-00-00" + + flags.Detector.GeometryCSC = False + flags.Detector.GeometrysTGC = False + flags.Detector.GeometryMM = False + flags.Detector.GeometryTGC = False + flags.Detector.GeometryRPC = False + + + flags.lock() + + cfg = setupServicesCfg(flags) + from AtlasGeoModel.GeoModelConfig import GeoModelCfg + geoModelSvc = cfg.getPrimaryAndMerge(GeoModelCfg(flags)) + from MuonGeoModelR4.MuonGeoModelConfig import MuonDetectorToolCfg + #from AthenaCommon.Constants import VERBOSE + geoModelSvc.DetectorTools =[cfg.popToolsAndMerge(MuonDetectorToolCfg(flags,#OutputLevel= VERBOSE + ))] + #### + DetDescCnvSvc = cfg.getService("DetDescrCnvSvc") + DetDescCnvSvc.IdDictFromRDB = False + DetDescCnvSvc.MuonIDFileName="IdDictParser/IdDictMuonSpectrometer_R.10.00.xml" + DetDescCnvSvc.MuonIDFileName="IdDictParser/IdDictMuonSpectrometer_R.09.03.xml" + + cfg.merge(GeoModelMdtTestCfg(flags)) + + cfg.printConfig(withDetails=True, summariseProps=True) + flags.dump() + + if not cfg.run(1).isSuccess(): + import sys + sys.exit("Execution failed") + \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelMdtTest.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelMdtTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d5d345018cd2884464f764e76564bc5103470457 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelMdtTest.cxx @@ -0,0 +1,132 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "GeoModelMdtTest.h" +#include "ActsGeometryInterfaces/ActsGeometryContext.h" +#include "MuonReadoutGeometryR4/MdtReadoutElement.h" +#include "EventPrimitives/EventPrimitivesToStringConverter.h" +#include "GeoModelKernel/GeoFullPhysVol.h" +#include <fstream> +namespace MuonGMR4{ +GeoModelMdtTest::GeoModelMdtTest(const std::string& name, ISvcLocator* pSvcLocator): +AthHistogramAlgorithm(name,pSvcLocator) {} + +StatusCode GeoModelMdtTest::initialize() { + ATH_CHECK(m_idHelperSvc.retrieve()); + /// Disable the tracking geometry tool. We'll need it later + ATH_CHECK(m_trackingGeometryTool.retrieve(DisableTool{true})); + + const MdtIdHelper& id_helper{m_idHelperSvc->mdtIdHelper()}; + for (const std::string& testCham : m_selectStat){ + if (testCham.size() !=6 ){ + ATH_MSG_FATAL("Wrong format give "<<testCham); + return StatusCode::FAILURE; + } + /// Example string BIL1A3 + std::string statName = testCham.substr(0,3); + unsigned int statEta = std::atoi(testCham.substr(3,1).c_str()) *(testCham[4] == 'A' ? 1 : -1); + unsigned int statPhi = std::atoi(testCham.substr(5,1).c_str()); + bool is_valid{false}; + const Identifier eleId = id_helper.elementID(statName, statEta, statPhi, is_valid); + if (!is_valid) { + ATH_MSG_FATAL("Failed to deduce a station name for "<<statName); + return StatusCode::FAILURE; + } + m_testStations.insert(eleId); + /// Add the second multilayer if possible + const Identifier secMl = id_helper.multilayerID(eleId,2,is_valid); + if (is_valid) m_testStations.insert(secMl); + } + ATH_CHECK(detStore()->retrieve(m_detMgr)); + return StatusCode::SUCCESS; +} + +StatusCode GeoModelMdtTest::execute() { + + ActsGeometryContext gctx{}; + const MdtIdHelper& id_helper{m_idHelperSvc->mdtIdHelper()}; + std::stringstream sstr{}; + for (const Identifier& test_me : m_testStations) { + const int ml = id_helper.multilayer(test_me); + const std::string detStr = m_idHelperSvc->toStringDetEl(test_me); + ATH_MSG_ALWAYS("Test retrieval of Mdt detector element "<<detStr); + const MdtReadoutElement* reElement = m_detMgr->getMdtReadoutElement(test_me); + if (!reElement) { + ATH_MSG_DEBUG("Detector element is invalid"); + continue; + } + /// Check that we retrieved the proper readout element + if (reElement->identify() != test_me) { + ATH_MSG_FATAL("Expected to retrieve "<<detStr<<". But got instead "<<m_idHelperSvc->toStringDetEl(reElement->identify())); + return StatusCode::FAILURE; + } + sstr<<"######################################################################################"<<std::endl; + sstr<<"Found Readout element "<<detStr<<std::endl; + sstr<<"######################################################################################"<<std::endl; + /// location + const Amg::Transform3D& globToLocal{reElement->globalToLocalTrans(gctx)}; + const Amg::Transform3D& localToGlob{reElement->localToGlobalTrans(gctx)}; + sstr<<reElement->getParameters()<<std::endl; + sstr<<"Displacement: "<<Amg::toString(localToGlob.translation(),3)<<std::endl; + sstr<<"x-Axis orientation: "<<Amg::toString(localToGlob.linear()*Amg::Vector3D::UnitX(),3)<<std::endl; + sstr<<"y-Axis orientation: "<<Amg::toString(localToGlob.linear()*Amg::Vector3D::UnitY(),3)<<std::endl; + sstr<<"z-Axis orientation: "<<Amg::toString(localToGlob.linear()*Amg::Vector3D::UnitZ(),3)<<std::endl; + ///Closure test that the transformations actually close + const Amg::Transform3D transClosure = globToLocal * localToGlob; + for (Amg::Vector3D axis :{Amg::Vector3D::UnitX(),Amg::Vector3D::UnitY(),Amg::Vector3D::UnitZ()}){ + const double closure_mag = std::abs( (transClosure*axis).dot(axis) - 1.); + if (closure_mag > std::numeric_limits<float>::epsilon() ) { + ATH_MSG_FATAL("Closure test failed for "<<detStr<<" and axis "<<Amg::toString(axis) + <<". Ended up with "<< Amg::toString(transClosure*axis) ); + return StatusCode::FAILURE; + } + } + for (unsigned int lay = 1 ; lay <= reElement->numLayers() ; ++lay ) { + for (unsigned int tube = 1; tube <=reElement->numTubesInLay(); ++tube ){ + const Identifier tube_id = id_helper.channelID(test_me,ml,lay,tube); + /// Test the forward -> backward conversion + const IdentifierHash measHash = reElement->measurementHash(tube_id); + const Identifier cnv_tube_id = reElement->measurementId(measHash); + if (tube_id != cnv_tube_id) { + ATH_MSG_FATAL("Failed to convert "<<m_idHelperSvc->toString(tube_id)<<" back and forth "<<m_idHelperSvc->toString(cnv_tube_id)); + return StatusCode::FAILURE; + } + if (tube == 0){ + const IdentifierHash layHash = reElement->layerHash(tube_id); + const Amg::Transform3D& layTrans{reElement->localToGlobalTrans(gctx, layHash)}; + const Amg::Transform3D& tubeTrans{reElement->localToGlobalTrans(gctx, measHash)}; + sstr<<"Layer"<<lay<<" displacement : "<<Amg::toString(layTrans.translation(),3)<<std::endl;; + sstr<<"Layer"<<lay<<" x-Axis orientation : "<<Amg::toString(layTrans.linear()*Amg::Vector3D::UnitX(), 3)<<std::endl; + sstr<<"Layer"<<lay<<" y-Axis orientation : "<<Amg::toString(layTrans.linear()*Amg::Vector3D::UnitY(), 3)<<std::endl; + sstr<<"Layer"<<lay<<" z-Axis orientation : "<<Amg::toString(layTrans.linear()*Amg::Vector3D::UnitZ(), 3)<<std::endl; + sstr<<"Tube "<<tube<<" displacement : "<<Amg::toString(tubeTrans.translation(),3)<<std::endl;; + sstr<<"Tube "<<tube<<" x-Axis orientation : "<<Amg::toString(tubeTrans.linear()*Amg::Vector3D::UnitX(), 3)<<std::endl; + sstr<<"Tube "<<tube<<" y-Axis orientation : "<<Amg::toString(tubeTrans.linear()*Amg::Vector3D::UnitY(), 3)<<std::endl; + sstr<<"Tube "<<tube<<" z-Axis orientation : "<<Amg::toString(tubeTrans.linear()*Amg::Vector3D::UnitZ(), 3)<<std::endl; + } + sstr<<" *** (" + <<std::setfill('0') << std::setw(2)<<lay<<", " + <<std::setfill('0') << std::setw(3)<<tube<<") " + <<Amg::toString(reElement->readOutPos(gctx, tube_id), 3)<< " / " + <<Amg::toString(globToLocal*reElement->readOutPos(gctx, tube_id), 3)<<" ---> " + <<Amg::toString(reElement->globalTubePos(gctx, tube_id), 3)<< " / " + <<Amg::toString(globToLocal*reElement->globalTubePos(gctx, tube_id), 3) + <<std::endl; + } + } + + } + + if (!m_outputTxt.empty()) { + std::fstream outStream{m_outputTxt, std::ios_base::out}; + if (!outStream.good()){ + ATH_MSG_FATAL("Failed to create output file "<<m_outputTxt); + return StatusCode::FAILURE; + } + outStream<<sstr.str(); + + } + return StatusCode::SUCCESS; +} +} diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelMdtTest.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelMdtTest.h new file mode 100644 index 0000000000000000000000000000000000000000..9b4801824874097c8f99c45de0b9e56efaf7114b --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/GeoModelMdtTest.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONGEOMODELTESTR4_GEOMODELMDTTEST_H +#define MUONGEOMODELTESTR4_GEOMODELMDTTEST_H + +#include <AthenaBaseComps/AthHistogramAlgorithm.h> +#include <set> +#include <MuonIdHelpers/IMuonIdHelperSvc.h> +#include <ActsGeometryInterfaces/IActsTrackingGeometryTool.h> +#include <MuonTesterTree/MuonTesterTree.h> +#include <MuonReadoutGeometryR4/MuonDetectorManager.h> +namespace MuonGMR4{ + +class GeoModelMdtTest : public AthHistogramAlgorithm{ + public: + GeoModelMdtTest(const std::string& name, ISvcLocator* pSvcLocator); + + ~GeoModelMdtTest() = default; + + StatusCode execute() override; + StatusCode initialize() override; + unsigned int cardinality() const override final {return 1;} + + private: + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ + this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + + ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{ + this, "TrackingGeometryTool", "ActsTrackingGeometryTool"}; + + /// Set of stations to be tested + std::set<Identifier> m_testStations{}; + + /// String should be formated like <stationName><stationEta><A/C><stationPhi> + Gaudi::Property<std::vector<std::string>> m_selectStat{this, "TestStations", {"BIL1A3"}}; + + Gaudi::Property<std::string> m_outputTxt{this, "DumpTxtFile", "MdtGeoDump.txt", + "Dump the basic informations from the Readout geometry into a txt file" }; + const MuonDetectorManager* m_detMgr{nullptr}; +}; + +} +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/components/MuonGeoModelTest_entries.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/components/MuonGeoModelTest_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8e22d438745386e373c1533cec66128a4908df5a --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelTestR4/src/components/MuonGeoModelTest_entries.cxx @@ -0,0 +1,7 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "../GeoModelMdtTest.h" + +DECLARE_COMPONENT(MuonGMR4::GeoModelMdtTest) \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/CMakeLists.txt b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee075fcc0bccdc1a26ecd467795a08c59748d2ee --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +################################################################################ +# Package: MuonReadoutGeometryR4 +################################################################################ + +# Declare the package name: +atlas_subdir( MuonReadoutGeometryR4 ) + +# Extra dependencies, based on the environment (no MuonCondSvc needed in AthSimulation): +set( extra_libs ) + +# External dependencies: +find_package( GeoModel COMPONENTS GeoModelKernel ) + +atlas_add_library( MuonReadoutGeometryR4 + src/*.cxx + PUBLIC_HEADERS MuonReadoutGeometryR4 + INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} + LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel + ActsGeometryInterfacesLib ActsGeometryLib MuonReadoutGeometry MuonIdHelpersLib + StoreGateLib GeoModelUtilities CxxUtils ${extra_libs}) + +# we also add unit tests. +# Build them from the files in test/ +file(GLOB_RECURSE tests "test/*.cxx") + +foreach(_theTestSource ${tests}) + get_filename_component(_theTest ${_theTestSource} NAME_WE) + atlas_add_test( ${_theTest} SOURCES ${_theTestSource} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} MuonReadoutGeometryR4 + POST_EXEC_SCRIPT nopost.sh + ) + + +endforeach() + + diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/CutOutArea.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/CutOutArea.h new file mode 100644 index 0000000000000000000000000000000000000000..333ea3a3a30e5454a620fe234e235f1936e550cb --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/CutOutArea.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRYR4_CUTOUTAREA_H +#define MUONREADOUTGEOMETRYR4_CUTOUTAREA_H +#include <MuonReadoutGeometryR4/MuonDetectorDefs.h> +#include <EventPrimitives/EventPrimitivesToStringConverter.h> + +namespace MuonGMR4{ + + struct CutOutArea{ + /// Center of the cutout to be applied + Amg::Vector3D origin{Amg::Vector3D::Zero()}; + /// Half length a long the X axis + double halfLengthX{0.}; + /// Half length along the Z axis + double lengthY{0.}; + /// + Amg::Vector3D inclanation{Amg::Vector3D::Zero()}; + + }; + inline std::ostream& operator<<(std::ostream& ostr, const CutOutArea& cut){ + ostr<<"Cut center "<<Amg::toString(cut.origin,1)<<", half X: "<<cut.halfLengthX<<", half Y "<<cut.lengthY; + ostr<<", min X: "<<(cut.origin.x() - cut.halfLengthX)<<", max X: "<<(cut.origin.x() + cut.halfLengthX); + ostr<<", min Y: "<<(cut.origin.y() - cut.lengthY)<<", max Y: "<<(cut.origin.y() + cut.lengthY); + return ostr; + } + + +} + +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtCutOut.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtCutOut.h new file mode 100644 index 0000000000000000000000000000000000000000..f85c35625811e068ce8ad2d48e973154162b6a4c --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtCutOut.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRYR4_MDTCUTOUT_H +#define MUONREADOUTGEOMETRYR4_MDTCUTOUT_H + +#include <MuonReadoutGeometryR4/MuonDetectorDefs.h> +#include <Identifier/IdentifierHash.h> +#include <set> +namespace MuonGMR4 { + + struct MdtCutOut { + /// Cutout on the left site of the chamber (positive Y) + double leftX{0.}; + /// Cutout on the right site of the chamber (negative Y) + double rightX{0.}; + /// Layer in which the cut out is applied + uint16_t layer{std::numeric_limits<uint16_t>::max()}; + /// First tube affected by the cutout + uint16_t firstTube{std::numeric_limits<uint16_t>::max()}; + /// Last tube affected by the cutout (Inclusive) + uint16_t lastTube{std::numeric_limits<uint16_t>::max()}; + /// Smaller operator + bool operator<(const MdtCutOut& other) const; + }; + + bool operator<(const MdtCutOut& cutout, const IdentifierHash& hash); + bool operator<(const IdentifierHash& hash, const MdtCutOut& cutout); + std::ostream& operator<<(std::ostream& ostr, const MdtCutOut& cutout); + + using MdtCutOuts = std::set<MdtCutOut, std::less<>>; +} +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h new file mode 100644 index 0000000000000000000000000000000000000000..7cb1c663662010007d58b7f54513308a61f98c41 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h @@ -0,0 +1,153 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRYR4_MDTREADOUTELEMENT_H +#define MUONREADOUTGEOMETRYR4_MDTREADOUTELEMENT_H + +#include <MuonReadoutGeometryR4/MuonReadoutElement.h> +#include <MuonReadoutGeometryR4/MdtCutOut.h> + + +namespace MuonGMR4 { + +class MdtReadoutElement : public MuonReadoutElement { + + public: + + /// Set of parameters to describe a MDT chamber + struct parameterBook { + /// Number of tubes per layer + unsigned int numTubesPerLay{0}; + /// Vector defining the position of the first tube in each tube layer. + /// The Size of the vector reflects the number of tube layers in the + /// multi layer + std::vector<Amg::Vector3D> firstTubePos{}; + /// Thickness of the tube walls + double tubeWall{0.}; + /// Inner radius of the tubes + double tubeInnerRad{0.}; + /// Distance between 2 tubes in the layer + double tubePitch{0.}; + /// Tension parameter Used in the SaggedLine surfaces + double wireTension{0.}; + /// Depth of the endplug into the active tube volume + double endPlugLength{0.}; + /// + double deadLength{0.}; + /// Radiadtion length + double radLengthX0{0.}; + /// The chambers have either a rectangular or a trapezoidal shape to first approximation. + /// The former is mounted in the barrel while the latter can be found on the middle and outer + /// big wheels. In Run 1 & Run 2, the inner wheel also consistet of MDT chambers. + /// The local coordinate system is placed in the center of the chamber and the x-axis + /// is paralell to the long & short edges of the trapezoid as illustrated in + /// https://gitlab.cern.ch/atlas/athena/-/blob/master/docs/images/TrapezoidalBounds.gif + /// For the rectengular barrel chambers, the X length is read from longHalfX + double shortHalfX{0.}; + double longHalfX{0.}; + double halfY{0.}; + /// Height of the chamber ~ number of layers + double halfHeight{0.}; + /// The trapezoidal shape of the endcap chambers is approximate. In fact, the trapezoid is segmented into + /// steps, where nTubes have the same length. + unsigned int tubesPerStep{0}; + /// set of cut outs + MdtCutOuts cutouts{}; + }; + + struct defineArgs : public MuonReadoutElement::defineArgs, + public parameterBook {}; + + MdtReadoutElement(defineArgs&& args); + + const parameterBook& getParameters() const; + /// Overload from the ActsTrk::IDetectorElement + ActsTrk::DetectorType detectorType() const override final { + return ActsTrk::DetectorType::Mdt; + } + /// Overload from the Acts::DetectorElement (2 * halfheight) + double thickness() const override final; + /// Overload from the Acts::DetectorElement (dummy implementation) + const Acts::Surface& surface() const override final; + Acts::Surface& surface() override final; + + StatusCode initElement() override final; + /// Returns the multi layer of the MdtReadoutElement + int multilayer() const; + + /// Returns the number of tube layer + unsigned int numLayers() const; + /// Returns the number of tubes per layer + unsigned int numTubesInLay() const; + + /// Transforms the idenfier hash into a tube number ranging from (0- + /// numTubesInLay()-1) + static unsigned int tubeNumber(const IdentifierHash& hash); + /// Transforms the identifier hash into a layer number ranging from + /// (0-numLayers()-1) + static unsigned int layerNumber(const IdentifierHash& hash); + /// Transform the layer and tube number to the measurementHash + static IdentifierHash measurementHash(unsigned int layerNumber, unsigned int tubeNumber); + + + /// Constructs the identifier hash from the full measurement Identifier. The + /// hash is always defined w.r.t the specific detector element and used to + /// access the information in memory quickly + IdentifierHash measurementHash(const Identifier& measId) const override final; + /// Transforms the Identifier into a layer hash + IdentifierHash layerHash(const Identifier& measId) const override final; + + /// Converts the measurement hash back to the full Identifier + Identifier measurementId(const IdentifierHash& measHash) const override final; + + /// States whether the chamber is built into the barrel or not + bool isBarrel() const; + /// Returns the inner tube radius + double innerTubeRadius() const; + /// Adds the thickness of the tube wall onto the radius + double tubeRadius() const; + + /// Returns the global position of the tube center. + Amg::Vector3D globalTubePos(const ActsGeometryContext& ctx, + const Identifier& measId) const; + + Amg::Vector3D globalTubePos(const ActsGeometryContext& ctx, + const IdentifierHash& hash) const; + /// Returns the global position of the readout card + Amg::Vector3D readOutPos(const ActsGeometryContext& ctx, + const Identifier& measId) const; + + Amg::Vector3D readOutPos(const ActsGeometryContext& ctx, + const IdentifierHash& measId) const; + + /// Returns the Mdt tube length including the dead areas of the endplugs & dead length + double tubeLength(const IdentifierHash& hash) const; + + private: + /// Returns the tube position in the chamber coordinate frame + Amg::Vector3D localTubePos(const IdentifierHash& hash) const; + /// Returns the transformation to go into the chamber layer + /// x-axis: Parallel to the wire layer + /// y-axis: Along the wire + /// z-axis: Pointing outwards the chamber + Amg::Transform3D toChamberLayer(const IdentifierHash& hash) const; + /// Returns the transformation into the rest frame of the tube + /// x-axis: Pointing parallel to the wire layer + /// z-axis: Pointing along the wire + Amg::Transform3D toTubeFrame(const IdentifierHash& hash) const; + + bool m_init{false}; + parameterBook m_pars{}; + const MdtIdHelper& m_idHelper{idHelperSvc()->mdtIdHelper()}; + /// Identifier index of the multilayer (1-2) + int m_stML{m_idHelper.multilayer(identify())}; + /// Flag defining whether the chamber is barrel or not + bool m_isBarrel{m_idHelper.isBarrel(identify())}; +}; + +std::ostream& operator<<( + std::ostream& ostr, const MuonGMR4::MdtReadoutElement::parameterBook& pars); +} // namespace MuonGMR4 + +#include <MuonReadoutGeometryR4/MdtReadoutElement.icc> +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.icc b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.icc new file mode 100644 index 0000000000000000000000000000000000000000..7b22081d332c7ef96ca19471a8c1278988e7f608 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.icc @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRYR4_MDTREADOUTELEMENT_ICC +#define MUONREADOUTGEOMETRYR4_MDTREADOUTELEMENT_ICC + +namespace MuonGMR4 { +inline int MdtReadoutElement::multilayer() const { + return m_stML; +} +inline unsigned int MdtReadoutElement::numLayers() const { + return m_pars.firstTubePos.size(); +} +inline unsigned int MdtReadoutElement::numTubesInLay() const { + return m_pars.numTubesPerLay; +} +inline double MdtReadoutElement::innerTubeRadius() const {return m_pars.tubeInnerRad;} +inline double MdtReadoutElement::tubeRadius() const {return innerTubeRadius() + m_pars.tubeWall;} +inline double MdtReadoutElement::thickness() const {return 2.* m_pars.halfHeight;} + + +inline IdentifierHash MdtReadoutElement::measurementHash(const Identifier& measId) const { + if (idHelperSvc()->detElId(measId) != identify()) { + ATH_MSG_WARNING("The measurement " + << idHelperSvc()->toString(measId) + << " picks the wrong readout element " + << idHelperSvc()->toStringDetEl(identify())); + } + IdentifierHash hash = measurementHash(m_idHelper.tubeLayer(measId), + m_idHelper.tube(measId)); + ATH_MSG_VERBOSE("Translate measurement identifier " + << idHelperSvc()->toString(measId) + << " to measurement hash " << static_cast<int>(hash)); + return hash; +} +inline IdentifierHash MdtReadoutElement::layerHash(const Identifier& measId) const { + if (idHelperSvc()->detElId(measId) != identify()) { + ATH_MSG_WARNING("The measurement " + << idHelperSvc()->toString(measId) + << " picks the wrong readout element " + << idHelperSvc()->toStringDetEl(identify())); + } + IdentifierHash hash = measurementHash(m_idHelper.tubeLayer(measId), 0); + ATH_MSG_VERBOSE("Translate measurement identifier " + << idHelperSvc()->toString(measId) + << " to layer hash hash " << static_cast<int>(hash)); + return hash; +} +inline unsigned int MdtReadoutElement::tubeNumber(const IdentifierHash& hash) { + return (static_cast<unsigned int>(hash) >> 16); +} +/// Transforms the identifier hash into a layer number ranging from +/// (0-numLayers()-1) +inline unsigned int MdtReadoutElement::layerNumber(const IdentifierHash& hash) { + constexpr uint16_t layMask = (~0); + return static_cast<unsigned int>(hash) & layMask; +} +inline IdentifierHash MdtReadoutElement::measurementHash(unsigned int layer, unsigned int tube) { + return IdentifierHash{( (tube-1) << 16) | (layer-1)}; +} +inline bool MdtReadoutElement::isBarrel() const { return m_isBarrel; } + + +inline Amg::Vector3D MdtReadoutElement::globalTubePos(const ActsGeometryContext& ctx, + const Identifier& measId) const { + return globalTubePos(ctx, measurementHash(measId)); +} +inline Amg::Vector3D MdtReadoutElement::readOutPos(const ActsGeometryContext& ctx, + const Identifier& measId) const{ + return readOutPos(ctx, measurementHash(measId)); +} + +} // namespace MuonGMR4 +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorDefs.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorDefs.h new file mode 100644 index 0000000000000000000000000000000000000000..a0efce421ae16bb48b36d1206261e4d1dec36873 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorDefs.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONGEOMODELR4_MUONDETECTORDEFS_H +#define MUONGEOMODELR4_MUONDETECTORDEFS_H + +#include <GeoPrimitives/GeoPrimitives.h> +/// +#include <MuonReadoutGeometry/ArrayHelper.h> +#include <MuonReadoutGeometry/GlobalUtilities.h> + +#include <ActsGeometryInterfaces/ActsGeometryContext.h> +#include <ActsGeometryInterfaces/RawGeomAlignStore.h> + +#include <GeoModelKernel/GeoVAlignmentStore.h> +#include <Identifier/Identifier.h> +#include <Identifier/IdentifierHash.h> + +#include <functional> + +//// This header contains common helper utilities and definitions +namespace MuonGMR4 { + + +} // namespace MuonGMR4 + +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h new file mode 100644 index 0000000000000000000000000000000000000000..8c62c8d7b715b585e763193a566b3ba025b53478 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h @@ -0,0 +1,91 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRY_MUONDETECTORMANAGER_H +#define MUONREADOUTGEOMETRY_MUONDETECTORMANAGER_H + +#include <map> +#include <memory> + +#include "AthenaKernel/CLASS_DEF.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GeoModelKernel/GeoVDetectorManager.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonReadoutGeometryR4/MuonDetectorDefs.h" + +/// The muon detector manager is the central class administrating the readout +/// elements of All muon subdetectors defined in the Geometry. The detector +/// elements are stored in a std::vector and their IdentifierHashes are used as +/// their corresponding position index. For each element type, e.g. CakeElement, +/// it provides one setter method and four getter methods. +/// +/// +/// Add the detector element to the manager. Fails if an element with the same +/// hash has already been added +/// StatusCode addCakeElement(std::unique_ptr<CakeElement> ele_ptr); +/// +/// Return the (const) pointer to the detector element. The input Identifier is +/// the full ATLAS Identifier of the measurement +/// (const) CakeElement* getCakeElement(const Identifier& id) const; +/// +/// Return the (const) pointer to the detector element. The IdentifierHash has +/// to correspond to the hash of the readout element +/// (const) CakeElement* getCakeElement(const IdentifierHash& id) const; + +/// Helper macros to declare the interface +#define DECLARE_GETTERSETTER(ELE_TYPE, GETTER, SETTER) \ + ELE_TYPE* GETTER(const IdentifierHash& hash); \ + ELE_TYPE* GETTER(const Identifier& hash); \ + \ + const ELE_TYPE* GETTER(const IdentifierHash& hash) const; \ + const ELE_TYPE* GETTER(const Identifier& hash) const; \ + \ + StatusCode SETTER(ElementPtr<ELE_TYPE> element); + +#define DECLARE_ELEMENT(ELE_TYPE) \ + DECLARE_GETTERSETTER(ELE_TYPE, get##ELE_TYPE, add##ELE_TYPE) + +namespace MuonGMR4 { +class MdtReadoutElement; + +class MuonDetectorManager : public GeoVDetectorManager, public AthMessaging { + + public: + MuonDetectorManager(); + ~MuonDetectorManager() = default; + + template <class MuonDetectorType> + using ElementPtr = std::unique_ptr<MuonDetectorType>; + template <class MuonDetectorType> + using ElementStorage = std::vector<ElementPtr<MuonDetectorType>>; + + DECLARE_ELEMENT(MdtReadoutElement) + + /// No idea what these things are doing + unsigned int getNumTreeTops() const override final; + PVConstLink getTreeTop(unsigned int i) const override final; + + void addTreeTop(PVConstLink pv); + + private: + /// Returns the detector Identifier Hash + IdentifierHash buildHash(const Identifier& id, + const MuonIdHelper& idHelper) const; + IdentifierHash buildHash(const Identifier& id) const; + + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ + "Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonDetectorManager"}; + + ElementStorage<MdtReadoutElement> m_mdtEles{}; + + std::vector<PVConstLink> m_treeTopVector{}; +}; + +} // namespace MuonGMR4 + +CLASS_DEF(MuonGMR4::MuonDetectorManager, 248531088, 1) +/// Delete the macro again +#undef DECLARE_GETTERSETTER +#undef DECLARE_ELEMENT +#include <MuonReadoutGeometryR4/MuonDetectorManager.icc> +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.icc b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.icc new file mode 100644 index 0000000000000000000000000000000000000000..33d838fefcbe6c599fc579004901ecd6e43cec66 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.icc @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRY_MUONDETECTORMANAGER_ICC +#define MUONREADOUTGEOMETRY_MUONDETECTORMANAGER_ICC + +#include <MuonReadoutGeometryR4/MdtReadoutElement.h> + +#define WRITE_GETTERS(ELE_TYPE, GETTER_FUNC, STORAGE_VEC, ATTR) \ + inline ATTR ELE_TYPE* MuonDetectorManager::GETTER_FUNC( \ + const Identifier& id) ATTR { \ + return GETTER_FUNC(buildHash(id)); \ + } \ + inline ATTR ELE_TYPE* MuonDetectorManager::GETTER_FUNC( \ + const IdentifierHash& hash) ATTR { \ + const size_t idx = static_cast<unsigned int>(hash); \ + if (idx < STORAGE_VEC.size() && STORAGE_VEC[idx]) \ + return STORAGE_VEC[idx].get(); \ + ATH_MSG_WARNING("Failed to retrieve " << #ELE_TYPE << " number " \ + << idx); \ + return nullptr; \ + } +#define ADD_DETECTOR(ELE_TYPE, STORAGE_VEC) \ + WRITE_GETTERS(ELE_TYPE, get##ELE_TYPE, STORAGE_VEC, ) \ + WRITE_GETTERS(ELE_TYPE, get##ELE_TYPE, STORAGE_VEC, const) + +namespace MuonGMR4 { +ADD_DETECTOR(MdtReadoutElement, m_mdtEles); +} +#undef ELEMENT_GETTERSETTER +#undef ADD_DETECTOR +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h new file mode 100644 index 0000000000000000000000000000000000000000..e36ddcc99343e747ba8b7eeecf9543b3e0e113ad --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h @@ -0,0 +1,163 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONGEOMODELR4_MUONREADOUTELEMENT_H +#define MUONGEOMODELR4_MUONREADOUTELEMENT_H + +#include <MuonReadoutGeometryR4/MuonDetectorDefs.h> +//// +#include <AthenaBaseComps/AthMessaging.h> +#include <GaudiKernel/ServiceHandle.h> +#include <GeoModelKernel/GeoVDetectorElement.h> +#include <MuonIdHelpers/IMuonIdHelperSvc.h> +#include <MuonReadoutGeometryR4/MuonTransformCache.h> +#include <ActsGeometryInterfaces/IDetectorElement.h> +#include <mutex> +namespace MuonGMR4 { +/// The MuonReadoutElement is an abstract class representing the geometry +/// representing the muon detector. The segmentation of the detectors varies +/// along the MS subsystems and is documented further in the specific sub +/// detector classes. As rule of thumb, detectors sitting on at a different MS +/// layer or station Index, stationEta or station phi are represented by at +/// least one MuonReadoutElement. The MuonReadout elements are constructed +/// from the RAW geometry provided by GeoModelSvc. The class below is pure +/// virtual and implements the minimal set of methods shared by all muon +/// detector technolgies. + +class MuonReadoutElement : public GeoVDetectorElement, public AthMessaging, public ActsTrk::IDetectorElement { + + public: + /// Helper struct to ship the defining arguments of the detector element + /// around + struct defineArgs { + /// Pointer to the underlying physical volume in GeoModel + GeoVFullPhysVol* physVol{nullptr}; + /// chamber design name (see below for explanation) + std::string chambDesign{""}; + /// ATLAS identifier + Identifier detElId{0}; + /// Basic transformation to be applied on top in order + /// to reach the center of the volume from the GeoModel transform + Amg::Transform3D toVolCenter{Amg::Transform3D::Identity()}; + + }; + + + MuonReadoutElement(defineArgs&& args); + MuonReadoutElement()=delete; + MuonReadoutElement(const MuonReadoutElement&)=delete; + + /// Element initialization + virtual StatusCode initElement() = 0; + /// Cache the alignment + virtual bool storeAlignment(ActsTrk::RawGeomAlignStore& store) const override; + /// Return the athena identifier. + /// The Identifier is identical with the first measurment channel in + /// readout element (E.g. Strip 1 in Layer 1 in the NSW) + Identifier identify() const override final; + + /// Returns the Identifier has of the Element that is Identical to the + /// detElHash from the id_helper class + IdentifierHash identHash() const; + /// Returns the stationName (BIS, BOS, etc) encoded into the integer + int stationIndex() const; + /// Returns the stationEta (positive A site, negative O site) + int stationEta() const; + /// Returns the stationPhi (1-8) -> sector (2*phi - (isSmall)) + int stationPhi() const; + + /// Constructs the identifier hash from the full measurement Identifier. The + /// hash is always defined w.r.t the specific detector element and used to + /// access the information in memory quickly + virtual IdentifierHash measurementHash(const Identifier& measId) const = 0; + + virtual IdentifierHash layerHash(const Identifier& measId) const = 0; + /// Converts the measurement hash back to the full Identifier + virtual Identifier measurementId(const IdentifierHash& measHash) const = 0; + + + /// The chamber design refers to the construction parameters of a readout + /// element. Used for the retrieval of the chamber parameters + /// E.g. the chambers BOL1A8 & BOL2A8 are identical in terms of number of + /// tubes, dimensions etc. + std::string chamberDesign() const; + + /// Returns the pointer to the muonIdHelperSvc + const Muon::IMuonIdHelperSvc* idHelperSvc() const; + + /// Returns the detector center (Which is the same as the detector center of + /// the first measurement layer) + Amg::Vector3D center(const ActsGeometryContext& ctx) const; + /// Returns the center of a given detector layer using the complete + /// Identifier of the measurement + Amg::Vector3D center(const ActsGeometryContext& ctx, + const Identifier& id) const; + /// Returns the center of a given detector layer using the Identifier hash + /// of the measurement + Amg::Vector3D center(const ActsGeometryContext& ctx, + const IdentifierHash& hash) const; + + /// Transformations to translate between local <-> global coordinates. + /// They follow the common ATLAS conventations that the origin is located + /// in the center of the detector layer + /// --- x_axis: Points along the primary coordinate + /// --- y_axis: + /// --- z_axis: Points towards the surface normal + /// The transformations always include the corrections from the A-Lines of + /// the alignment system + /// Returns the global to local transformation into the rest frame of the + /// detector (Coincides with the first measurement layer) + const Amg::Transform3D& globalToLocalTrans(const ActsGeometryContext& ctx) const; + /// Returns the global to local transformation into the rest frame of a + /// given measurement layer + const Amg::Transform3D& globalToLocalTrans(const ActsGeometryContext& ctx, + const Identifier& id) const; + /// Returns the global to local transformation into the rest frame of a + /// given measurement layer + const Amg::Transform3D& globalToLocalTrans(const ActsGeometryContext& ctx, + const IdentifierHash& hash) const; + + /// Returns the local to global transformation into the ATLAS coordinate + /// system + const Amg::Transform3D& localToGlobalTrans(const ActsGeometryContext& ctx) const; + const Amg::Transform3D& localToGlobalTrans(const ActsGeometryContext& ctx, + const Identifier& id) const; + const Amg::Transform3D& localToGlobalTrans(const ActsGeometryContext& ctx, + const IdentifierHash& id) const; + + + const Acts::Transform3& transform(const Acts::GeometryContext& gctx) const override final; + /// Returns the transformation from the origin given by GeoModel to + /// the center of the volume + const Amg::Transform3D& toCenterTrans() const; + + protected: + using TransformMaker = MuonTransformCache::TransformMaker; + + /// Inserts a transfomration for caching + StatusCode insertTransform(const IdentifierHash& hash, + TransformMaker make); + + /// Returns the transformation into the center of the readout volume + Amg::Transform3D toStation(ActsTrk::RawGeomAlignStore* alignStore) const; + private: + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{ + "Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonReadoutElement"}; + + const defineArgs m_args{}; + IdentifierHash m_detElHash{0}; + /// Cache the station index of the identifier + int m_stIdx{-1}; + /// Cache the station eta of the identifier + int m_stEta{-1}; + /// Cache the station phi of the identifier + int m_stPhi{-1}; + + /// Cache all global to local transformations + MuonTransformSet m_globalToLocalCaches{}; + /// Cache all local to gloabl transformations + MuonTransformSet m_localToGlobalCaches{}; +}; +} // namespace MuonGMR4 +#include <MuonReadoutGeometryR4/MuonReadoutElement.icc> +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.icc b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.icc new file mode 100644 index 0000000000000000000000000000000000000000..25a7e0c19e518c4afb5e05d14ccc2b225dc63b35 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.icc @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONGEOMODELR4_MUONREADOUTELEMENT_ICC +#define MUONGEOMODELR4_MUONREADOUTELEMENT_ICC + +namespace MuonGMR4 { + +inline Identifier MuonReadoutElement::identify() const { + return m_args.detElId; +} +inline IdentifierHash MuonReadoutElement::identHash() const { + return m_detElHash; +} +inline std::string MuonReadoutElement::chamberDesign() const { + return m_args.chambDesign; +} +inline const Muon::IMuonIdHelperSvc* MuonReadoutElement::idHelperSvc() const { + return m_idHelperSvc.get(); +} +inline const Amg::Transform3D& MuonReadoutElement::toCenterTrans() const { + return m_args.toVolCenter; +} + +inline int MuonReadoutElement::stationIndex() const { + return m_stIdx; +} +inline int MuonReadoutElement::stationEta() const { + return m_stEta; +} +inline int MuonReadoutElement::stationPhi() const { + return m_stPhi; +} + + +/// Returns the detector center (Which is the same as the detector center of the +/// first measurement layer) +inline Amg::Vector3D MuonReadoutElement::center( + const ActsGeometryContext& ctx) const { + return localToGlobalTrans(ctx).translation(); +} +inline Amg::Vector3D MuonReadoutElement::center(const ActsGeometryContext& ctx, + const Identifier& id) const { + return localToGlobalTrans(ctx, id).translation(); +} +inline Amg::Vector3D MuonReadoutElement::center( + const ActsGeometryContext& ctx, const IdentifierHash& hash) const { + return localToGlobalTrans(ctx, hash).translation(); +} + + +inline const Amg::Transform3D& MuonReadoutElement::globalToLocalTrans( + const ActsGeometryContext& ctx, const Identifier& id) const { + return globalToLocalTrans(ctx, layerHash(id)); +} +inline const Amg::Transform3D& MuonReadoutElement::localToGlobalTrans( + const ActsGeometryContext& ctx, const Identifier& id) const { + return globalToLocalTrans(ctx, layerHash(id)); +} + +} // namespace MuonGMR4 +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonTransformCache.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonTransformCache.h new file mode 100644 index 0000000000000000000000000000000000000000..720137e25816f1df38361eb00fd61a3e762598a1 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonTransformCache.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRY_MUONTRANSFORMCACHE_H +#define MUONREADOUTGEOMETRY_MUONTRANSFORMCACHE_H + +#include <CxxUtils/CachedUniquePtr.h> +#include <MuonReadoutGeometryR4/MuonDetectorDefs.h> + +/// The Muon transform cache is used to hold all geometry +namespace MuonGMR4 { + +class MuonTransformCache { + public: + using TransformMaker = std::function<Amg::Transform3D(ActsTrk::RawGeomAlignStore* store, const IdentifierHash& hash)>; + + MuonTransformCache(const IdentifierHash& hash, TransformMaker maker); + + const Amg::Transform3D& getTransform(const ActsTrk::AlignmentStore* store) const; + + void storeAlignment(ActsTrk::RawGeomAlignStore& alignStore) const; + + IdentifierHash hash() const; + + private: + IdentifierHash m_hash{0}; + TransformMaker m_transform{}; + CxxUtils::CachedUniquePtr<Amg::Transform3D> m_nomCache{}; + + +}; + +inline bool operator<(const std::unique_ptr<MuonTransformCache>& a, + const std::unique_ptr<MuonTransformCache>& b) { + return a->hash() < b->hash(); +} +inline bool operator<(const IdentifierHash& a, + const std::unique_ptr<MuonTransformCache>& b) { + return a < b->hash(); +} +inline bool operator<(const std::unique_ptr<MuonTransformCache>& a, + const IdentifierHash& b) { + return a->hash() < b; +} +using MuonTransformSet = + std::set<std::unique_ptr<MuonTransformCache>, std::less<>>; +} // namespace MuonGMR4 +#endif \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/StringUtils.h b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/StringUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..4b1120f1c5e36b0dbe99d4109eea86d3f399d395 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/StringUtils.h @@ -0,0 +1,26 @@ + + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef MUONREADOUTGEOMETRYR4_STRINGUTILS_H +#define MUONREADOUTGEOMETRYR4_STRINGUTILS_H +#include <string> +#include <string_view> +#include <vector> + +namespace MuonGMR4 { + +/// Searches the string for the given delimiter and constructs a +/// vector of tokens +std::vector<std::string> tokenize(const std::string& the_str, + const std::string& delimiters); + +std::vector<double> tokenizeDouble(const std::string& the_str, + const std::string& delimiter); +int atoi(std::string_view str); + +double atof(std::string_view str); + +} // namespace MuonGMR4 +#endif diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtCutOut.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtCutOut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c9d3c91d88d6d657f44b8eae4f084efaac42e9cd --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtCutOut.cxx @@ -0,0 +1,35 @@ + +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <MuonReadoutGeometryR4/MdtCutOut.h> +#include <MuonReadoutGeometryR4/MdtReadoutElement.h> +namespace MuonGMR4{ + bool MdtCutOut::operator<(const MdtCutOut& other) const { + if (layer != other.layer) return layer < other.layer; + return lastTube < other.firstTube; + } + bool operator<(const MdtCutOut& cutout, const IdentifierHash& hash){ + const uint16_t lay = MdtReadoutElement::layerNumber(hash); + const uint16_t tube = MdtReadoutElement::tubeNumber(hash); + if (lay != cutout.layer) return cutout.layer < lay; + return cutout.lastTube < tube; + } + bool operator<(const IdentifierHash& hash, const MdtCutOut& cutout){ + const uint16_t lay = MdtReadoutElement::layerNumber(hash); + const uint16_t tube = MdtReadoutElement::tubeNumber(hash); + if (lay != cutout.layer) return lay < cutout.layer; + return tube < cutout.firstTube; + } + std::ostream& operator<<(std::ostream& ostr, const MdtCutOut& cutout) { + ostr<<" cut tubes "; + if (cutout.firstTube != cutout.lastTube) ostr<<" ["<< + static_cast<int>(cutout.firstTube)<<"-"<< + static_cast<int>(cutout.lastTube)<<"]"; + else ostr<<static_cast<int>(cutout.firstTube); + ostr<<" in layer "<<static_cast<int>(cutout.layer); + ostr<<" left X: "<<cutout.leftX<<", right X:"<<cutout.rightX; + return ostr; + } + +} \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d9b3b492194be06b95ccd895966ac3c018cb6502 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx @@ -0,0 +1,119 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <EventPrimitives/EventPrimitivesToStringConverter.h> +#include <GeoPrimitives/GeoPrimitivesHelpers.h> +#include <MuonReadoutGeometryR4/MdtReadoutElement.h> +#include <AthenaBaseComps/AthCheckMacros.h> +#include <Acts/Surfaces/PlaneSurface.hpp> +using namespace ActsTrk; + +namespace MuonGMR4 { +std::ostream& operator<<( + std::ostream& ostr, + const MuonGMR4::MdtReadoutElement::parameterBook& pars) { + ostr << std::endl; + ostr << " // tube half-length (min/max): "<<pars.shortHalfX<<"/"<<pars.longHalfX<<", chamber width "<< + pars.halfY<<", multilayer height: "<<pars.halfHeight; + ostr << " // Number of tube layers " << pars.firstTubePos.size()<< std::endl; + ostr << " // Tube pitch: " << pars.tubePitch + << " wall thickness: " << pars.tubeWall + << " inner radius: " << pars.tubeInnerRad << std::endl; + for (const Amg::Vector3D& tube : pars.firstTubePos) + ostr << " // **** " << Amg::toString(tube) << std::endl; + return ostr; +} +MdtReadoutElement::MdtReadoutElement(defineArgs&& args) + : MuonReadoutElement(std::move(args)), + m_pars{std::move(args)} { +} +const MdtReadoutElement::parameterBook& MdtReadoutElement::getParameters() const {return m_pars;} +Identifier MdtReadoutElement::measurementId( + const IdentifierHash& measHash) const { + return m_idHelper.channelID(identify(), multilayer(), + layerNumber(measHash) + 1, + tubeNumber(measHash) + 1); +} +StatusCode MdtReadoutElement::initElement() { + if (m_init) return StatusCode::SUCCESS; + /// First check whether we're having tubes + if (!numLayers() || !numTubesInLay()) { + ATH_MSG_FATAL("The readout element "<< idHelperSvc()->toStringDetEl(identify())<<" has no tubes. Please check "<<std::endl<<m_pars); + return StatusCode::FAILURE; + } + if (m_pars.tubePitch<=tubeRadius()) { + ATH_MSG_FATAL("The tubes of "<<idHelperSvc()->toStringDetEl(identify())<<" will fall together on a single point. Please check "<<std::endl<<m_pars); + return StatusCode::FAILURE; + } + /// Coordinate system of the trapezoid is in the center while the tubes are defined + /// w.r.t. to the chamber edge. Move first tube into the proper position + const Amg::Transform3D tubeShift = toCenterTrans(); + for (Amg::Vector3D& firstTube : m_pars.firstTubePos) { + firstTube -= tubeShift.translation().dot(Amg::Vector3D::UnitX()) *Amg::Vector3D::UnitZ() + + m_pars.halfY * Amg::Vector3D::UnitY(); + } + for (unsigned int lay =1 ; lay <= numLayers() ; ++lay){ + /// Cache the transformations to the chamber layers + ATH_CHECK(insertTransform(measurementHash(lay,0), + [this](RawGeomAlignStore* store, const IdentifierHash& hash){ + return toStation(store) * toChamberLayer(hash); + })); + /// Cache the transformations to the tube layers + for (unsigned int tube = 1; tube <= numTubesInLay(); ++ tube) { + ATH_CHECK(insertTransform(measurementHash(lay,tube), + [this](RawGeomAlignStore* store, const IdentifierHash& hash){ + return toStation(store) * toTubeFrame(hash); + })); + } + } + m_init = true; + return StatusCode::SUCCESS; +} +const Acts::Surface& MdtReadoutElement::surface() const{ + static const std::shared_ptr<Acts::Surface> dummy{Acts::Surface::makeShared<Acts::PlaneSurface>(Amg::Vector3D::UnitX(), + Amg::Vector3D::UnitY())}; + ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<"I am a dummy method "); + return *dummy; +} + +Acts::Surface& MdtReadoutElement::surface() { + std::shared_ptr<Acts::Surface> dummy{Acts::Surface::makeShared<Acts::PlaneSurface>(Amg::Vector3D::UnitX(), + Amg::Vector3D::UnitY())}; + ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<"I am a dummy method "); + return *dummy; +} + +Amg::Vector3D MdtReadoutElement::globalTubePos(const ActsGeometryContext& ctx, + const IdentifierHash& hash) const { + return localToGlobalTrans(ctx) * localTubePos(hash); +} + +Amg::Vector3D MdtReadoutElement::localTubePos(const IdentifierHash& hash) const { + const unsigned int layer = layerNumber(hash); + const unsigned int tube = tubeNumber(hash); + ATH_MSG_VERBOSE("Resolved hash "<<static_cast<unsigned int>(hash)<<" to layer "<<layer<< " and tube "<<tube<<". First tube position "<< + Amg::toString(m_pars.firstTubePos[layer],3)); + return m_pars.firstTubePos[layer] + tube*m_pars.tubePitch * Amg::Vector3D::UnitY(); +} +Amg::Vector3D MdtReadoutElement::readOutPos(const ActsGeometryContext& ctx, + const IdentifierHash& hash) const{ + return localToGlobalTrans(ctx) * ( localTubePos(hash) + (m_pars.longHalfX - m_pars.endPlugLength)*Amg::Vector3D::UnitX()); +} + +Amg::Transform3D MdtReadoutElement::toChamberLayer(const IdentifierHash& hash) const { + static const Amg::Transform3D rotation{Amg::getRotateZ3D(M_PI_2)}; + const unsigned int layer = layerNumber(hash); + const Amg::Vector3D& zeroT{m_pars.firstTubePos[layer]}; + return Amg::Translation3D{zeroT.z()*Amg::Vector3D::UnitZ()}*rotation; +} +Amg::Transform3D MdtReadoutElement::toTubeFrame(const IdentifierHash& hash) const { + static const Amg::Transform3D rotation{Amg::getRotateY3D(-M_PI_2) * Amg::getRotateZ3D(-M_PI_2)}; + return Amg::Translation3D{localTubePos(hash)}*rotation; +} +double MdtReadoutElement::tubeLength(const IdentifierHash& hash) const { + MdtCutOuts::const_iterator cut_itr = m_pars.cutouts.find(hash); + return 2.*m_pars.shortHalfX - (cut_itr != m_pars.cutouts.end() ? cut_itr->leftX + cut_itr->rightX : 0. ); +} + + +} // namespace MuonGMR4 diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorDefs.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorDefs.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8e072b4cad27ebbfc92d1b6ccef7b04751b5c37e --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorDefs.cxx @@ -0,0 +1,8 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <MuonReadoutGeometryR4/MuonDetectorDefs.h> + +namespace MuonGMR4 { + +} // namespace MuonGMR4 diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3dd5f730b0f707f439eb33653bb98f1c141d4f98 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "MuonReadoutGeometryR4/MuonDetectorManager.h" + +#include "MuonReadoutGeometryR4/MdtReadoutElement.h" +#include "AthenaBaseComps/AthCheckMacros.h" +#include <limits> + +#define WRITE_SETTER(ELE_TYPE, SETTER, STORAGE_VEC) \ + StatusCode MuonDetectorManager::SETTER(ElementPtr<ELE_TYPE> element) { \ + if (!element) { \ + ATH_MSG_FATAL(__func__ << " -- nullptr is given."); \ + return StatusCode::FAILURE; \ + } \ + ATH_CHECK(element->initElement()); \ + size_t idx = static_cast<unsigned int>(element->identHash()); \ + if (idx >= STORAGE_VEC.size()) \ + STORAGE_VEC.resize(idx + 1); \ + std::unique_ptr<ELE_TYPE>& new_element = STORAGE_VEC[idx]; \ + if (new_element) { \ + ATH_MSG_FATAL("The detector element " \ + << m_idHelperSvc->toStringDetEl(element->identify()) \ + << " has already been added before " \ + <<m_idHelperSvc->toStringDetEl(new_element->identify())); \ + return StatusCode::FAILURE; \ + } \ + new_element = std::move(element); \ + return StatusCode::SUCCESS; \ + } +#define ADD_DETECTOR(ELE_TYPE, STORAGE_VEC) \ + WRITE_SETTER(ELE_TYPE, add##ELE_TYPE, STORAGE_VEC) + +namespace { + constexpr unsigned int minOne = std::numeric_limits<unsigned int>::max(); +} +namespace MuonGMR4 { +MuonDetectorManager::MuonDetectorManager() + : AthMessaging{"MuonDetectorManagerR4"} { + if (!m_idHelperSvc.retrieve().isSuccess()) { + ATH_MSG_FATAL(__func__ + << "() -- Failed to retrieve the Identifier service"); + throw std::runtime_error("MuonIdHelperSvc does not exists"); + } + setName("MuonR4"); +} +IdentifierHash MuonDetectorManager::buildHash(const Identifier& id) const { + if (m_idHelperSvc->isMdt(id)) + return buildHash(id, m_idHelperSvc->mdtIdHelper()); + else if (m_idHelperSvc->isRpc(id)) + return buildHash(id, m_idHelperSvc->rpcIdHelper()); + else if (m_idHelperSvc->isTgc(id)) + return buildHash(id, m_idHelperSvc->tgcIdHelper()); + else if (m_idHelperSvc->issTgc(id)) + return buildHash(id, m_idHelperSvc->stgcIdHelper()); + else if (m_idHelperSvc->isMM(id)) + return buildHash(id, m_idHelperSvc->mmIdHelper()); + else if (m_idHelperSvc->isCsc(id)) + return buildHash(id, m_idHelperSvc->cscIdHelper()); + return IdentifierHash{minOne}; +} +IdentifierHash MuonDetectorManager::buildHash( + const Identifier& id, const MuonIdHelper& idHelper) const { + IdentifierHash hash{minOne}; + if (idHelper.get_detectorElement_hash(id, hash)) { + ATH_MSG_WARNING("Could not construct an Identifier hash from " + << m_idHelperSvc->toString(id)); + } + return hash; +} +ADD_DETECTOR(MdtReadoutElement, m_mdtEles); + +unsigned int MuonDetectorManager::getNumTreeTops() const { + return m_treeTopVector.size(); +} + +PVConstLink MuonDetectorManager::getTreeTop(unsigned int i) const { + return m_treeTopVector[i]; +} + +void MuonDetectorManager::addTreeTop(PVConstLink pv) { + m_treeTopVector.push_back(pv); +} + +} // namespace MuonGMR4 +#undef WRITE_SETTER +#undef ADD_DETECTOR \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ebd0b9d5805aefd2d3fc3382e1f4661aa1dbb932 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx @@ -0,0 +1,115 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "MuonReadoutGeometryR4/MuonReadoutElement.h" + +using namespace ActsTrk; +using SubDetAlignments = ActsGeometryContext::SubDetAlignments; +namespace { + /// Identifier used to access the transformation into the Detector center + static const IdentifierHash stationHash{static_cast<unsigned>(~0)-1}; + /// Dummy transformation + static const Amg::Transform3D dummyTrans{Amg::Transform3D::Identity()}; + +} +namespace MuonGMR4 { + +MuonReadoutElement::MuonReadoutElement(defineArgs&& args) + : GeoVDetectorElement(args.physVol), + AthMessaging("MuonReadoutElement"), + m_args{std::move(args)} { + if (!m_idHelperSvc.retrieve().isSuccess()) { + ATH_MSG_FATAL("Failed to retrieve the MuonIdHelperSvc"); + } + + auto assignIdFields = [this](const MuonIdHelper& id_helper) { + /// Ensure that the hash can be successfully assigned + if (id_helper.get_detectorElement_hash(identify(), m_detElHash)) { + ATH_MSG_WARNING( + "setIdentifier -- collection hash Id NOT computed for id = " + << idHelperSvc()->toStringDetEl(identify())); + } + m_stIdx = id_helper.stationName(identify()); + m_stEta = id_helper.stationEta(identify()); + m_stPhi = id_helper.stationPhi(identify()); + }; + if (idHelperSvc()->isMdt(identify())) + assignIdFields(idHelperSvc()->mdtIdHelper()); + else if (idHelperSvc()->isRpc(identify())) + assignIdFields(idHelperSvc()->rpcIdHelper()); + else if (idHelperSvc()->isTgc(identify())) + assignIdFields(idHelperSvc()->tgcIdHelper()); + else if (idHelperSvc()->isCsc(identify())) + assignIdFields(idHelperSvc()->cscIdHelper()); + else if (idHelperSvc()->issTgc(identify())) + assignIdFields(idHelperSvc()->stgcIdHelper()); + else if (idHelperSvc()->isMM(identify())) + assignIdFields(idHelperSvc()->mmIdHelper()); + + insertTransform(stationHash,[this](RawGeomAlignStore* store, const IdentifierHash&){ + return toStation(store); + }).ignore(); +} + +const Amg::Transform3D& MuonReadoutElement::globalToLocalTrans(const ActsGeometryContext& ctx, const IdentifierHash& hash) const { + SubDetAlignments::const_iterator map_itr = ctx.alignmentStores.find(detectorType()); + const ActsTrk::AlignmentStore* store = map_itr !=ctx.alignmentStores.end() ? + map_itr->second.get() : nullptr; + + MuonTransformSet::const_iterator cache = m_globalToLocalCaches.find(hash); + if (cache != m_globalToLocalCaches.end()) return (*cache)->getTransform(store); + ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" "<<__func__<<"() -- Hash "<<hash<<" is unknown to "<<idHelperSvc()->toStringDetEl(identify())); + return dummyTrans; +} +const Amg::Transform3D& MuonReadoutElement::localToGlobalTrans(const ActsGeometryContext& ctx, const IdentifierHash& hash) const { + SubDetAlignments::const_iterator map_itr = ctx.alignmentStores.find(detectorType()); + const ActsTrk::AlignmentStore* store = map_itr !=ctx.alignmentStores.end() ? + map_itr->second.get() : nullptr; + + MuonTransformSet::const_iterator cache = m_localToGlobalCaches.find(hash); + if (cache != m_localToGlobalCaches.end()) return (*cache)->getTransform(store); + ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" "<<__func__<<"() -- Hash "<<hash<<" is unknown to "<<idHelperSvc()->toStringDetEl(identify())); + return dummyTrans; +} + +Amg::Transform3D MuonReadoutElement::toStation(RawGeomAlignStore* alignStore) const { + return getMaterialGeom()->getAbsoluteTransform(alignStore ?alignStore->geoModelAlignment.get() : nullptr)*toCenterTrans(); +} +const Acts::Transform3& MuonReadoutElement::transform(const Acts::GeometryContext& anygctx) const { + const ActsGeometryContext *gctx = anygctx.get<const ActsGeometryContext *>(); + return localToGlobalTrans(*gctx, stationHash); +} + +StatusCode MuonReadoutElement::insertTransform(const IdentifierHash& hash, + TransformMaker make) { + + MuonTransformSet::const_iterator cache = m_localToGlobalCaches.find(hash); + if (cache != m_localToGlobalCaches.end()) { + ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" - "<<idHelperSvc()->toString(identify())<<" has already a transformation cached for hash "<<hash); + return StatusCode::FAILURE; + } + m_localToGlobalCaches.insert(std::make_unique<MuonTransformCache>(hash, make)); + m_globalToLocalCaches.insert(std::make_unique<MuonTransformCache>(hash,[make](RawGeomAlignStore* store, const IdentifierHash& hash){ + return make(store,hash).inverse(); + })); + return StatusCode::SUCCESS; +} +bool MuonReadoutElement::storeAlignment(RawGeomAlignStore& store) const{ + if (store.detType != detectorType()) return false; + for (const std::unique_ptr<MuonTransformCache>& cache: m_localToGlobalCaches) { + cache->storeAlignment(store); + } + for (const std::unique_ptr<MuonTransformCache>& cache : m_globalToLocalCaches){ + cache->storeAlignment(store); + } + return true; +} +const Amg::Transform3D& MuonReadoutElement::globalToLocalTrans(const ActsGeometryContext& ctx) const { + return globalToLocalTrans(ctx, stationHash); +} +const Amg::Transform3D& MuonReadoutElement::localToGlobalTrans(const ActsGeometryContext& ctx) const { + return localToGlobalTrans(ctx, stationHash); +} + + +} // namespace MuonGMR4 diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonTransformCache.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonTransformCache.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f58d679b304543d28b9127aacbbe4ad271381768 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonTransformCache.cxx @@ -0,0 +1,35 @@ + +#include <GeoModelKernel/GeoFullPhysVol.h> +#include <MuonReadoutGeometryR4/MuonTransformCache.h> + +namespace MuonGMR4 { +MuonTransformCache::MuonTransformCache(const IdentifierHash& hash, + TransformMaker maker) + : m_hash{hash}, + m_transform{maker} {} + +const Amg::Transform3D& MuonTransformCache::getTransform(const ActsTrk::AlignmentStore* alignStore) const { + /// Alignment store is found defined + if (alignStore){ + const Amg::Transform3D* cache = alignStore->getTransform(this); + if (cache) return *cache; + } + /// Fall back solution to go onto the nominal cache + if (!m_nomCache) { + return (*m_nomCache.set(std::make_unique<Amg::Transform3D>(m_transform(nullptr, m_hash)))); + } + return (*m_nomCache); +} + +void MuonTransformCache::storeAlignment(ActsTrk::RawGeomAlignStore& alignStore) const { + if (!alignStore.trackingAlignment) return; + if (alignStore.trackingAlignment->getTransform(this)){ + throw std::runtime_error("Transformation has already been cached. Being called twice"); + } + alignStore.trackingAlignment->setTransform(this, m_transform(&alignStore, m_hash)); +} +IdentifierHash MuonTransformCache::hash() const { + return m_hash; +} + +} // namespace MuonGMR4 \ No newline at end of file diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/StringUtils.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/StringUtils.cxx new file mode 100644 index 0000000000000000000000000000000000000000..98bbed44b825dd0e0e9acf5d4aa531f31e487493 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/StringUtils.cxx @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <MuonReadoutGeometryR4/StringUtils.h> + +#include <charconv> +#include <limits> +#include <functional> + +namespace MuonGMR4 { +/// We should remove the MdtStringUtils class at some point +/// https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MdtStringUtils.cxx +std::vector<std::string> tokenize(const std::string& str, + const std::string& delimiters) { + + std::vector<std::string> tokens{}; + // Skip delimiters at beginning. + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + // Find first "non-delimiter". + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + + while (std::string::npos != pos || std::string::npos != lastPos) { + // Found a token, add it to the vector. + tokens.push_back(str.substr(lastPos, pos - lastPos)); + // Skip delimiters. Note the "not_of" + lastPos = str.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = str.find_first_of(delimiters, lastPos); + // std::cout << "Added token : " << tokens[tokens.size()-1] << "!" + //<< std::endl; + } + return tokens; +} +std::vector<double> tokenizeDouble(const std::string& the_str, + const std::string& delimiter){ + const std::vector<std::string> strTokens = tokenize(the_str, delimiter); + std::vector<double> toReturn{}; + std::transform(strTokens.begin(), strTokens.end(), std::back_inserter(toReturn), [](const std::string& token){ + return stof(token); + }); + return toReturn; +} +int atoi(std::string_view str) { + int result{std::numeric_limits<int>::max()}; + std::from_chars(str.data(), str.data() + str.size(), result); + return result; +} + +double stof(std::string_view str) { + double result{std::numeric_limits<double>::max()}; + std::from_chars(str.data(), str.data() + str.size(), result); + return result; +} +} // namespace MuonGMR4 diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/test/TestMdtCutOut.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/test/TestMdtCutOut.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e611b5ce0a7fff6d336a94b94e36c23eb17a3c61 --- /dev/null +++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/test/TestMdtCutOut.cxx @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <iostream> +#include <MuonReadoutGeometryR4/MdtCutOut.h> +#include <MuonReadoutGeometryR4/MdtReadoutElement.h> +#include <Identifier/IdentifierHash.h> + + + +int main (int, char**){ + /// Let's define a set with a couple of cutouts + using namespace MuonGMR4; + + MdtCutOuts cutOutSet{}; + + MdtCutOut cutLay1{}; + /// Define a first cut out + const IdentifierHash hash1Start = MdtReadoutElement::measurementHash(1, 45); + const IdentifierHash hash1End = MdtReadoutElement::measurementHash(1, 77); + cutLay1.layer = MdtReadoutElement::layerNumber(hash1Start); + cutLay1.firstTube = MdtReadoutElement::tubeNumber(hash1Start); + cutLay1.lastTube = MdtReadoutElement::tubeNumber(hash1End); + cutLay1.leftX = 123.; + cutLay1.rightX = 456; + /// Insert the cutout into the set + cutOutSet.insert(cutLay1); + /// Define a cutout for the second layer + MdtCutOut cutLay2{}; + const IdentifierHash hash2Start = MdtReadoutElement::measurementHash(2, 23); + const IdentifierHash hash2End = MdtReadoutElement::measurementHash(1, 27); + + cutLay2.layer = MdtReadoutElement::layerNumber(hash2Start); + cutLay2.firstTube = MdtReadoutElement::tubeNumber(hash2Start); + cutLay2.lastTube = MdtReadoutElement::tubeNumber(hash2End); + cutLay2.leftX = 562; + cutLay2.rightX = 421; + /// Insert the cutout + if (!cutOutSet.insert(cutLay2).second){ + std::cerr<<"Failed to add tube cutout "<<cutLay2<<std::endl; + return EXIT_FAILURE; + } + MdtCutOut cutLay1a{}; + const IdentifierHash hash1aStart = MdtReadoutElement::measurementHash(1, 12); + const IdentifierHash hash1aEnd = MdtReadoutElement::measurementHash(1, 33); + cutLay1a.layer = MdtReadoutElement::layerNumber(hash1aStart); + cutLay1a.firstTube = MdtReadoutElement::tubeNumber(hash1aStart); + cutLay1a.lastTube = MdtReadoutElement::tubeNumber(hash1aEnd); + cutLay1a.rightX = 211.; + if (!cutOutSet.insert(cutLay1a).second){ + std::cerr<<"Failed to add tube cutout "<<cutLay1a<<std::endl; + return EXIT_FAILURE; + } + ++cutLay1a.firstTube; + if (cutOutSet.insert(cutLay1a).second) { + std::cerr<<"Should not add overlapping cutout "<<cutLay1a<<std::endl; + } + std::cout<<"Filled cutouts "<<cutOutSet.size()<<std::endl; + /// Test the look up scheme + for (unsigned int tube = 1; tube < 90; ++tube){ + const IdentifierHash hash = MdtReadoutElement::measurementHash(1,tube); + MdtCutOuts::const_iterator itr = cutOutSet.find(hash); + + const unsigned int tubeHash = MdtReadoutElement::tubeNumber(hash); + if (itr != cutOutSet.end()) { + if (itr->layer != MdtReadoutElement::layerNumber(hash) || itr->firstTube > tubeHash || itr->lastTube < tubeHash){ + std::cerr<<"Wrong cutout catched for 1,"<<tube<<". Got "<<(*itr)<<std::endl; + return EXIT_FAILURE; + } + } else if ((tubeHash >= + MdtReadoutElement::tubeNumber(hash1Start) && + tubeHash <= + MdtReadoutElement::tubeNumber(hash1End)) || + + (tubeHash >= + MdtReadoutElement::tubeNumber(hash1aStart) && + tubeHash <= + MdtReadoutElement::tubeNumber(hash1aEnd)) + + ) { + std::cerr<<"Expected to find a cut out for 1,"<<tube<<". Got nothing"<<std::endl; + return EXIT_FAILURE; + } + } + /// Ensure that layer 3 is not returning anything + if (cutOutSet.find(MdtReadoutElement::measurementHash(3,1)) !=cutOutSet.end()){ + std::cerr<<"There should be no cut out registered for 3,1"<<std::endl; + return EXIT_FAILURE; + } + std::cout<<"Mdt cutout test is a great success "<<std::endl; + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py index 8ac758e54f6a3c9ae35d212fcbbc9187b1ce16b8..8acec3d0ead5623a81b7b9d1d2c22b0304298fca 100644 --- a/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py +++ b/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py @@ -163,7 +163,7 @@ def makeSequenceOld (dataType, algSeq, forCompare, isPhyslite, noPhysliteBroken, input = 'Muons' muonSequenceMedium = makeMuonAnalysisSequence( dataType, deepCopyOutput = False, shallowViewOutput = False, - workingPoint = 'Medium.Iso', postfix = 'medium', + workingPoint = 'Medium.Loose_VarRad', postfix = 'medium', enableCutflow=True, enableKinematicHistograms=True, ptSelectionOutput = True ) # FIX ME: the current version of the `MuonSelectionTool` doesn't work # on the current version of PHYSLITE, and needs a new PHYSLITE production @@ -171,31 +171,32 @@ def makeSequenceOld (dataType, algSeq, forCompare, isPhyslite, noPhysliteBroken, if noPhysliteBroken : muonSequenceMedium.__delattr__ ('MuonSelectionAlg_medium') muonSequenceMedium.configure( inputName = input, - outputName = 'AnaMuonsMedium_%SYS%' ) + outputName = 'AnaMuons_%SYS%' ) algSeq += muonSequenceMedium - muonSequenceTight = makeMuonAnalysisSequence( dataType, deepCopyOutput = False, shallowViewOutput = False, - workingPoint = 'Tight.Iso', postfix = 'tight', - enableCutflow=True, enableKinematicHistograms=True, ptSelectionOutput = True ) - muonSequenceTight.removeStage ("calibration") - # FIX ME: the current version of the `MuonSelectionTool` doesn't work - # on the current version of PHYSLITE, and needs a new PHYSLITE production - # campaign - if noPhysliteBroken : - muonSequenceTight.__delattr__ ('MuonSelectionAlg_tight') - muonSequenceTight.configure( inputName = 'AnaMuonsMedium_%SYS%', - outputName = 'AnaMuons_%SYS%') - algSeq += muonSequenceTight + # TODO: MCP should restore this when the recommendations for Tight WP exist in R23 + # muonSequenceTight = makeMuonAnalysisSequence( dataType, deepCopyOutput = False, shallowViewOutput = False, + # workingPoint = 'Tight.Loose_VarRad', postfix = 'tight', + # enableCutflow=True, enableKinematicHistograms=True, ptSelectionOutput = True ) + # muonSequenceTight.removeStage ("calibration") + # # FIX ME: the current version of the `MuonSelectionTool` doesn't work + # # on the current version of PHYSLITE, and needs a new PHYSLITE production + # # campaign + # if noPhysliteBroken : + # muonSequenceTight.__delattr__ ('MuonSelectionAlg_tight') + # muonSequenceTight.configure( inputName = 'AnaMuonsMedium_%SYS%', + # outputName = 'AnaMuons_%SYS%') + # algSeq += muonSequenceTight + vars += [ 'OutMuons_NOSYS.eta -> mu_eta', 'OutMuons_NOSYS.phi -> mu_phi', 'OutMuons_%SYS%.pt -> mu_pt_%SYS%', 'OutMuons_NOSYS.charge -> mu_charge', - 'OutMuons_%SYS%.baselineSelection_medium -> mu_select_medium_%SYS%', - 'OutMuons_%SYS%.baselineSelection_tight -> mu_select_tight_%SYS%', ] + 'OutMuons_%SYS%.baselineSelection_medium -> mu_select_medium_%SYS%', ] + #'OutMuons_%SYS%.baselineSelection_tight -> mu_select_tight_%SYS%', ] if dataType != 'data': - vars += [ 'OutMuons_%SYS%.muon_effSF_medium_%SYS% -> mu_effSF_medium_%SYS%', - 'OutMuons_%SYS%.muon_effSF_tight_%SYS% -> mu_effSF_tight_%SYS%', ] - + vars += [ 'OutMuons_%SYS%.muon_effSF_medium_%SYS% -> mu_effSF_medium_%SYS%', ] + #'OutMuons_%SYS%.muon_effSF_tight_%SYS% -> mu_effSF_tight_%SYS%', ] # Include, and then set up the electron analysis sequence: from EgammaAnalysisAlgorithms.ElectronAnalysisSequence import \ @@ -509,6 +510,8 @@ def makeSequenceBlocks (dataType, algSeq, forCompare, isPhyslite, noPhysliteBrok 'jet_': 'OutJets', 'met_': 'AnaMET'} + # FIXME: this should probably be run on PHYSLITE, but the test fails with: + # overran integrated luminosity for RunNumber=363262 (0.000000 vs 0.000000) if not isPhyslite : campaign, files, prwfiles, lumicalcfiles = None, None, None, None useDefaultConfig = False @@ -604,12 +607,13 @@ def makeSequenceBlocks (dataType, algSeq, forCompare, isPhyslite, noPhysliteBrok configSeq += makeConfig ('Muons', 'AnaMuons') configSeq += makeConfig ('Muons.Selection', 'AnaMuons.medium') configSeq.setOptionValue ('.quality', 'Medium') - configSeq.setOptionValue ('.isolation', 'Iso') - configSeq.setOptionValue ('.isRun3Geo', run3Muons) - configSeq += makeConfig ('Muons.Selection', 'AnaMuons.tight') - configSeq.setOptionValue ('.quality', 'Tight') - configSeq.setOptionValue ('.isolation', 'Iso') + configSeq.setOptionValue ('.isolation', 'Loose_VarRad') configSeq.setOptionValue ('.isRun3Geo', run3Muons) + # TODO: MCP should restore this when the recommendations for Tight WP exist in R23 + # configSeq += makeConfig ('Muons.Selection', 'AnaMuons.tight') + # configSeq.setOptionValue ('.quality', 'Tight') + # configSeq.setOptionValue ('.isolation', 'Loose_VarRad') + # configSeq.setOptionValue ('.isRun3Geo', run3Muons) # Include, and then set up the tau analysis algorithm sequence: @@ -677,14 +681,18 @@ def makeSequenceBlocks (dataType, algSeq, forCompare, isPhyslite, noPhysliteBrok # For an actual analysis that would just be `AnaMuons.medium`, but # since `tight` is a strict subset of `medium` it doesn't matter # if we do an "or" of the two. - configSeq.setOptionValue ('.muons', 'AnaMuons.medium||tight') + # TODO: MCP should restore this when the recommendations for Tight WP exist in R23 + # configSeq.setOptionValue ('.muons', 'AnaMuons.medium||tight') + configSeq.setOptionValue ('.muons', 'AnaMuons.medium') # Include, and then set up the overlap analysis algorithm config: configSeq += makeConfig( 'OverlapRemoval', None ) configSeq.setOptionValue ('.electrons', 'AnaElectrons.loose') configSeq.setOptionValue ('.photons', 'AnaPhotons.tight') - configSeq.setOptionValue ('.muons', 'AnaMuons.medium||tight') + # TODO: MCP should restore this when the recommendations for Tight WP exist in R23 + # configSeq.setOptionValue ('.muons', 'AnaMuons.medium||tight') + configSeq.setOptionValue ('.muons', 'AnaMuons.medium') configSeq.setOptionValue ('.jets', 'AnaJets') configSeq.setOptionValue ('.taus', 'AnaTauJets.tight') configSeq.setOptionValue ('.inputLabel', 'preselectOR') diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h index a3ca251a74d6a44a42b70dfa774670a6e9a82c79..0588bfb459a50ea69ea219cea90c712233107a72 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/AsgAnalysisAlgorithms/SysListDumperAlg.h @@ -33,6 +33,9 @@ namespace CP public: virtual ::StatusCode execute () override; + public: + virtual ::StatusCode finalize () override; + /// \brief make the systematics vector using a regex private: std::vector<CP::SystematicSet> makeSystematicsVector (const std::string ®ex) const; diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx index b299ce4d3a3bb6f4f556568381cc6feb4b32c96b..ff313baf2e5e3990b2573d6e96ff902ee5361e7f 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/PileupReweightingAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /// @author Nils Krumnack @@ -12,9 +12,10 @@ /// Anonymous namespace for helpers namespace { + const static SG::ConstAuxElement::ConstAccessor<unsigned int> accRRN("RandomRunNumber"); const static SG::ConstAuxElement::Decorator<unsigned int> decRRN("RandomRunNumber"); const static SG::ConstAuxElement::Decorator<unsigned int> decRLBN("RandomLumiBlockNumber"); - const static SG::ConstAuxElement::Decorator<unsigned long long> decHash("PRWHash"); + const static SG::ConstAuxElement::Decorator<uint64_t> decHash("PRWHash"); } // @@ -104,7 +105,7 @@ namespace CP // Get random run and lumi block numbers unsigned int rrn = 0; if(decRRN.isAvailable(*evtInfo)) - rrn = decRRN(*evtInfo); + rrn = accRRN(*evtInfo); else{ rrn = m_pileupReweightingTool->getRandomRunNumber(*evtInfo, true); // If it returns 0, try again without the mu dependence diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx index b3dd1f1ac0c3e27ee030f4da2528a20aac0d5fe4..84e2e1f59fd0958d2f984d5dcae1f8c4fb9f3189 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/Root/SysListDumperAlg.cxx @@ -98,4 +98,14 @@ namespace CP return systematicsVector; } -} + + StatusCode SysListDumperAlg :: + finalize () + { + ANA_MSG_INFO("Systematics regex '" << m_regex << "' matched:"); + for(const CP::SystematicSet& mysys : makeSystematicsVector(m_regex)) { + ANA_MSG_INFO (" '" << mysys.name() << "'"); + } + return StatusCode::SUCCESS; + } +} \ No newline at end of file diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py index e87ba436a68675e1ea6377dea81e164520274f12..32849f163c0f9a610ea567cd426dfe34b4e993e0 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisAlgorithmsTest.py @@ -51,7 +51,7 @@ def makeOverlapSequence (dataType) : # Include, and then set up the muon analysis algorithm sequence: from MuonAnalysisAlgorithms.MuonAnalysisSequence import makeMuonAnalysisSequence - muonSequence = makeMuonAnalysisSequence( dataType, 'Tight.Iso' ) + muonSequence = makeMuonAnalysisSequence( dataType, 'Tight.Loose_VarRad' ) muonSequence.configure( inputName = 'Muons', outputName = 'AnalysisMuons_%SYS%' ) algSeq += muonSequence diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py index 18ac43455246ca45d2cfe3426c58a4404c037ecd..30688d6a12a42dd84367a947a1db8c9815a2506d 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py @@ -19,6 +19,8 @@ class ElectronCalibrationConfig (ConfigBlock) : self.addOption ('crackVeto', False, type=bool) self.addOption ('ptSelectionOutput', False, type=bool) self.addOption ('isolationCorrection', False, type=bool) + self.addOption ('trackSelection', True, type=bool) + def makeAlgs (self, config) : @@ -50,14 +52,15 @@ class ElectronCalibrationConfig (ConfigBlock) : bits=(5 if self.crackVeto else 4)) # Set up the track selection algorithm: - alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', - 'ElectronTrackSelectionAlg' + self.postfix ) - alg.selectionDecoration = 'trackSelection' + self.postfix + ',as_bits' - alg.maxD0Significance = 5 - alg.maxDeltaZ0SinTheta = 0.5 - alg.particles = config.readName (self.containerName) - alg.preselection = config.getPreselection (self.containerName, '') - config.addSelection (self.containerName, '', alg.selectionDecoration, + if self.trackSelection : + alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', + 'ElectronTrackSelectionAlg' + self.postfix ) + alg.selectionDecoration = 'trackSelection' + self.postfix + ',as_bits' + alg.maxD0Significance = 5 + alg.maxDeltaZ0SinTheta = 0.5 + alg.particles = config.readName (self.containerName) + alg.preselection = config.getPreselection (self.containerName, '') + config.addSelection (self.containerName, '', alg.selectionDecoration, bits=3) # Select electrons only with good object quality. diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py index 7058102a1a744ef1e9d367a27985b414fbdbc960..a25a71051bcaf2ec4c6f9feae0ed83f8ab6b03d6 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py @@ -19,6 +19,7 @@ def makeElectronAnalysisSequence( dataType, workingPoint, isolationCorrection = False, crackVeto = False, ptSelectionOutput = False, + trackSelection = True, enableCutflow = False, enableKinematicHistograms = False ): """Create an electron analysis algorithm sequence @@ -40,6 +41,7 @@ def makeElectronAnalysisSequence( dataType, workingPoint, crackVeto -- Whether or not to perform eta crack veto ptSelectionOutput -- Whether or not to apply pt selection when creating output containers. + trackSelection -- apply selection on tracks (d0, z0, siHits, etc.) enableCutflow -- Whether or not to dump the cutflow enableKinematicHistograms -- Whether or not to dump the kinematic histograms """ @@ -63,6 +65,7 @@ def makeElectronAnalysisSequence( dataType, workingPoint, makeElectronCalibrationSequence (seq, dataType, postfix=postfix, crackVeto = crackVeto, ptSelectionOutput = ptSelectionOutput, + trackSelection = trackSelection, isolationCorrection = isolationCorrection) makeElectronWorkingPointSequence (seq, dataType, workingPoint, postfix=postfix, recomputeLikelihood = recomputeLikelihood, @@ -83,6 +86,7 @@ def makeElectronAnalysisSequence( dataType, workingPoint, def makeElectronCalibrationSequence( seq, dataType, postfix = '', crackVeto = False, ptSelectionOutput = False, + trackSelection = False, isolationCorrection = False): """Create electron calibration analysis algorithms @@ -129,17 +133,18 @@ def makeElectronCalibrationSequence( seq, dataType, postfix = '', dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNamesOutput"])} ) # Set up the track selection algorithm: - alg = createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', - 'ElectronTrackSelectionAlg' + postfix ) - alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits' - alg.maxD0Significance = 5 - alg.maxDeltaZ0SinTheta = 0.5 - seq.append( alg, inputPropName = 'particles', - stageName = 'selection', - metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], - 'selectionDecorNamesOutput' : [alg.selectionDecoration], - 'selectionDecorCount' : [3]}, - dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNamesOutput"])} ) + if trackSelection: + alg = createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', + 'ElectronTrackSelectionAlg' + postfix ) + alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits' + alg.maxD0Significance = 5 + alg.maxDeltaZ0SinTheta = 0.5 + seq.append( alg, inputPropName = 'particles', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], + 'selectionDecorNamesOutput' : [alg.selectionDecoration], + 'selectionDecorCount' : [3]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNamesOutput"])} ) # Select electrons only with good object quality. alg = createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronObjectQualityAlg' + postfix ) diff --git a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisConfig.py b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisConfig.py index 23315cd72676d9d1d2c31601549c9149a606b596..6988c4b2d05ece5ed21310ebee47e07977f4b43e 100644 --- a/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisConfig.py +++ b/PhysicsAnalysis/Algorithms/FTagAnalysisAlgorithms/python/FTagAnalysisConfig.py @@ -103,7 +103,8 @@ class FTagConfig (ConfigBlock): alg.preselection = config.getPreselection (self.containerName, selectionName) alg.selectionDecoration = 'ftag_select_' + selectionName + ',as_char' alg.particles = config.readName (self.containerName) - config.addOutputVar (self.containerName, 'ftag_select_' + selectionName, selectionName + '_select', noSys=True) + if self.btagWP != 'Continuous': + config.addOutputVar (self.containerName, 'ftag_select_' + selectionName, selectionName + '_select', noSys=True) if self.btagWP == 'Continuous': alg = config.createAlgorithm( 'CP::BTaggingInformationDecoratorAlg', 'FTagInfoAlg' + postfix ) @@ -116,6 +117,7 @@ class FTagConfig (ConfigBlock): alg.preselection = config.getPreselection (self.containerName, selectionName) alg.quantileDecoration = 'ftag_quantile_' + selectionName alg.jets = config.readName (self.containerName) + config.addOutputVar (self.containerName, 'ftag_quantile_' + selectionName, selectionName + '_quantile', noSys=True) if not self.noEfficiency and config.dataType() != 'data': # Set up the efficiency calculation algorithm: diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h index c598d90be184cc57e7a58d99523739fa5e8b0c4a..662d5f7719fae949d850f49698f1a4be3328c808 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithmsDict.h @@ -10,6 +10,7 @@ #include <JetAnalysisAlgorithms/JetCalibrationAlg.h> #include <JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h> +#include <JetAnalysisAlgorithms/JetGhostMergingAlg.h> #include <JetAnalysisAlgorithms/JetModifierAlg.h> #include <JetAnalysisAlgorithms/JetSelectionAlg.h> #include <JetAnalysisAlgorithms/JetUncertaintiesAlg.h> diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetGhostMergingAlg.h b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetGhostMergingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..3d474417b02796c69832bce962703d0de801fff0 --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/JetGhostMergingAlg.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// JetGhostMergingAlg +// +// Ghost merger algorithm merges multiple collections of ghost +// containers into one. This is useful for combining standard and +// LRT ghost tracks into a single collection to pass to +// downstream taggers. +/////////////////////////////////////////////////////////////////// + +/// @author Jackson Burzynski + +#ifndef JET_ANALYSIS_ALGORITHMS__JET_GHOST_MERGING_ALG_H +#define JET_ANALYSIS_ALGORITHMS__JET_GHOST_MERGING_ALG_H + +#include <AnaAlgorithm/AnaAlgorithm.h> +#include <xAODJet/JetContainer.h> +#include <AsgTools/CurrentContext.h> + +#include <AsgTools/PropertyWrapper.h> +#include <AsgDataHandles/WriteHandle.h> +#include <AsgDataHandles/WriteHandleKey.h> +#include <AsgDataHandles/WriteDecorHandleKey.h> +#include <AsgDataHandles/ReadHandle.h> +#include <AsgDataHandles/ReadHandleKey.h> +#include <AsgDataHandles/ReadDecorHandleKey.h> + +#include <string> +#include <vector> + +namespace CP +{ + /// \brief an algorithm for combining multiple ghost collections into one + class JetGhostMergingAlg final : public EL::AnaAlgorithm + { + /// \brief the standard constructor + public: + JetGhostMergingAlg (const std::string& name, + ISvcLocator* pSvcLocator); + + public: + StatusCode initialize () override; + + public: + StatusCode execute () override; + + private: + /// \brief the jet collection we run on + SG::ReadHandleKey<xAOD::JetContainer> m_jetLocation { + this, "JetCollection", "AntiKt4EMTopoJets" + }; + /// \brief the name of the output ghost collection + SG::WriteDecorHandleKey< xAOD::JetContainer > m_mergedGhostContainer { + this, "MergedGhostName", "GhostTrackLRTMerged", "name of the output merged ghost container" + }; + + private: + /// \brief internal vector to hold the ReadDecorHandles for the difference ghosts + std::vector<SG::ReadDecorHandleKey<xAOD::JetContainer> > m_ghostTrackKeys; + + private: + Gaudi::Property<std::vector<std::string> > m_inputGhostTrackNames { + this, "InputGhostTrackNames", {"GhostTrack","GhostTrackLRT"} + }; + + }; +} + +#endif // JET_ANALYSIS_ALGORITHMS__JET_GHOST_MERGING_ALG_H diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml index 9f459bb1bbd8073b9d4eeab16612f4e1230f83e6..1c5c5912bc7bd47bf61b8e9cf397a14637a672e7 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/JetAnalysisAlgorithms/selection.xml @@ -2,6 +2,7 @@ <class name="CP::JetCalibrationAlg" /> <class name="CP::JetGhostMuonAssociationAlg" /> + <class name="CP::JetGhostMergingAlg" /> <class name="CP::JetModifierAlg" /> <class name="CP::JetSelectionAlg" /> <class name="CP::JetUncertaintiesAlg" /> diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetGhostMergingAlg.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetGhostMergingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..604503ded8c6844bd78dc6431c279ebf38ce111d --- /dev/null +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/Root/JetGhostMergingAlg.cxx @@ -0,0 +1,77 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +/// @author Jackson Burzynski + +// +// includes +// +#include <JetAnalysisAlgorithms/JetGhostMergingAlg.h> +#include <AsgDataHandles/WriteDecorHandle.h> +#include <AsgDataHandles/ReadDecorHandle.h> + +namespace CP +{ + JetGhostMergingAlg :: + JetGhostMergingAlg (const std::string& name, + ISvcLocator* pSvcLocator) + : AnaAlgorithm (name, pSvcLocator) + { + } + + StatusCode JetGhostMergingAlg :: + initialize () + { + // containers + ATH_CHECK (m_jetLocation.initialize ()); + + // decorators + ATH_CHECK (m_mergedGhostContainer.initialize ()); + + // accessors + m_ghostTrackKeys.reserve(m_ghostTrackKeys.size() + m_inputGhostTrackNames.size()); + for (const auto& ghostName: m_inputGhostTrackNames) { + std::string full = m_jetLocation.key() + "." + ghostName; + m_ghostTrackKeys.emplace_back( this, ghostName, full, ""); + ATH_CHECK( m_ghostTrackKeys.back().initialize() ); + } + + return StatusCode::SUCCESS; + } + + StatusCode JetGhostMergingAlg :: + execute () + { + const EventContext &ctx = Gaudi::Hive::currentContext(); + + SG::ReadHandle<xAOD::JetContainer> inputJets(m_jetLocation,ctx); + if (!inputJets.isValid()) { + ATH_MSG_FATAL("No jet collection with name " << m_jetLocation.key() << " found in StoreGate!"); + return StatusCode::FAILURE; + } + + // define GhostTrackContainer type (GTC) + using GTC = std::vector<ElementLink<DataVector<xAOD::IParticle> > >; + + // create the accessors for each ghost track collection + std::vector<SG::ReadDecorHandle<xAOD::JetContainer, GTC> > ghostTrackAccs; + ghostTrackAccs.reserve(m_ghostTrackKeys.size()); + for (const auto &key: m_ghostTrackKeys) { + ghostTrackAccs.emplace_back(key, ctx); + } + + SG::WriteDecorHandle<xAOD::JetContainer, GTC > mergedGhostDecor(m_mergedGhostContainer, ctx); + + for(const xAOD::Jet *jet: *inputJets) { + std::vector<ElementLink<xAOD::IParticleContainer>> mergedGhosts; + for (const auto& ghostTrackAcc: ghostTrackAccs) { + const GTC &ghosts = ghostTrackAcc( *jet ); + mergedGhosts.insert(mergedGhosts.end(), ghosts.begin(), ghosts.end()); + } + mergedGhostDecor(*jet) = std::move(mergedGhosts); + } + return StatusCode::SUCCESS; + } + +} diff --git a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx index ad65ed38d9b7a4f18378131d32985bc4fcfdfd4f..8fa4bd7c67f87dec5fe5b5dcd4b7ee65fe29537e 100644 --- a/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx +++ b/PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/src/components/JetAnalysisAlgorithms_entries.cxx @@ -2,6 +2,7 @@ #include <JetAnalysisAlgorithms/JetCalibrationAlg.h> #include <JetAnalysisAlgorithms/JetGhostMuonAssociationAlg.h> +#include <JetAnalysisAlgorithms/JetGhostMergingAlg.h> #include <JetAnalysisAlgorithms/JetModifierAlg.h> #include <JetAnalysisAlgorithms/JetSelectionAlg.h> #include <JetAnalysisAlgorithms/JetUncertaintiesAlg.h> @@ -11,6 +12,7 @@ DECLARE_COMPONENT (CP::JetCalibrationAlg) DECLARE_COMPONENT (CP::JetGhostMuonAssociationAlg) +DECLARE_COMPONENT (CP::JetGhostMergingAlg) DECLARE_COMPONENT (CP::JetModifierAlg) DECLARE_COMPONENT (CP::JetSelectionAlg) DECLARE_COMPONENT (CP::JetUncertaintiesAlg) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py index 5424512d12be41462966451f8eafce6d0ff7e5e1..401e0b5f9686fa18a96bba73948b5815389e326f 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisAlgorithmsTest.py @@ -32,7 +32,7 @@ def makeSequence (dataType) : # Include, and then set up the muon analysis algorithm sequence: from MuonAnalysisAlgorithms.MuonAnalysisSequence import makeMuonAnalysisSequence muonSequenceMedium = makeMuonAnalysisSequence( dataType, deepCopyOutput = True, shallowViewOutput = False, - workingPoint = 'Medium.Iso', postfix = 'medium', + workingPoint = 'Medium.Loose_VarRad', postfix = 'medium', enableCutflow=True, enableKinematicHistograms=True ) muonSequenceMedium.configure( inputName = 'Muons', outputName = 'AnalysisMuonsMedium_%SYS%' ) @@ -41,7 +41,7 @@ def makeSequence (dataType) : algSeq += muonSequenceMedium muonSequenceTight = makeMuonAnalysisSequence( dataType, deepCopyOutput = True, shallowViewOutput = False, - workingPoint = 'Tight.Iso', postfix = 'tight', + workingPoint = 'Tight.Loose_VarRad', postfix = 'tight', enableCutflow=True, enableKinematicHistograms=True ) muonSequenceTight.removeStage ("calibration") muonSequenceTight.configure( inputName = 'AnalysisMuonsMedium_%SYS%', diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfig.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfig.py index 91f8ed0d19b87f75bd33f1f6333a8ba6780eca70..21a7280c5959d5a6eb00ad7c3479abfdfe077d78 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfig.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfig.py @@ -13,6 +13,7 @@ class MuonCalibrationConfig (ConfigBlock): self.containerName = containerName self.addOption ('postfix', "", type=str) self.addOption ('ptSelectionOutput', False, type=bool) + self.addOption ('trackSelection', True, type=bool) def makeAlgs (self, config) : @@ -39,15 +40,16 @@ class MuonCalibrationConfig (ConfigBlock): bits=2) # Set up the track selection algorithm: - alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', - 'MuonTrackSelectionAlg' + self.postfix ) - alg.selectionDecoration = 'trackSelection' + self.postfix + ',as_bits' - alg.maxD0Significance = 3 - alg.maxDeltaZ0SinTheta = 0.5 - alg.particles = config.readName (self.containerName) - alg.preselection = config.getPreselection (self.containerName, '') - config.addSelection (self.containerName, '', alg.selectionDecoration, - bits=3) + if self.trackSelection : + alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', + 'MuonTrackSelectionAlg' + self.postfix ) + alg.selectionDecoration = 'trackSelection' + self.postfix + ',as_bits' + alg.maxD0Significance = 3 + alg.maxDeltaZ0SinTheta = 0.5 + alg.particles = config.readName (self.containerName) + alg.preselection = config.getPreselection (self.containerName, '') + config.addSelection (self.containerName, '', alg.selectionDecoration, + bits=3) # Set up the muon calibration and smearing algorithm: alg = config.createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg', @@ -114,10 +116,6 @@ class MuonWorkingPointConfig (ConfigBlock) : if postfix != '' and postfix[0] != '_' : postfix = '_' + postfix - if self.isolation not in ["Iso", "NonIso"] : - raise ValueError ('invalid muon isolation \"' + self.isolation + - '\", allowed values are Iso, NonIso') - # Setup the muon quality selection alg = config.createAlgorithm( 'CP::MuonSelectionAlgV2', 'MuonSelectionAlg' + postfix ) @@ -137,6 +135,7 @@ class MuonWorkingPointConfig (ConfigBlock) : alg = config.createAlgorithm( 'CP::MuonIsolationAlg', 'MuonIsolationAlg' + postfix ) config.addPrivateTool( 'isolationTool', 'CP::IsolationSelectionTool' ) + alg.isolationTool.MuonWP = self.isolation alg.isolationDecoration = 'isolated_muon' + postfix + ',as_bits' alg.muons = config.readName (self.containerName) alg.preselection = config.getPreselection (self.containerName, self.selectionName) @@ -155,7 +154,7 @@ class MuonWorkingPointConfig (ConfigBlock) : alg.outOfValidityDeco = 'bad_eff' + postfix alg.efficiencyScaleFactorTool.WorkingPoint = self.quality if self.isRun3Geo: - alg.efficiencyScaleFactorTool.CalibrationRelease = '220817_Preliminary_r22run3' + alg.efficiencyScaleFactorTool.CalibrationRelease = '230309_Preliminary_r22run3' alg.muons = config.readName (self.containerName) alg.preselection = config.getPreselection (self.containerName, self.selectionName) config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'effSF' + postfix) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfigTest.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfigTest.py index 4a3004a3019ea3cb63ae9d0d001406c2911d5f71..cf4886cd442249f137e7f5ade31e8e1f5aa7e7e1 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfigTest.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisConfigTest.py @@ -39,8 +39,8 @@ def makeSequence (dataType) : configSeq = ConfigSequence () makeMuonCalibrationConfig (configSeq, 'AnalysisMuons') - makeMuonWorkingPointConfig (configSeq, 'AnalysisMuons', workingPoint='Medium.Iso', postfix='medium') - makeMuonWorkingPointConfig (configSeq, 'AnalysisMuons', workingPoint='Tight.Iso', postfix='tight') + makeMuonWorkingPointConfig (configSeq, 'AnalysisMuons', workingPoint='Medium.Loose_VarRad', postfix='medium') + makeMuonWorkingPointConfig (configSeq, 'AnalysisMuons', workingPoint='Tight.Loose_VarRad', postfix='tight') configAccumulator = ConfigAccumulator (dataType, algSeq) configSeq.fullConfigure (configAccumulator) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py index 7cf0318b03ad60d956bd62ea6a49d84c88d22029..0860f1b50070e64c76ed506d529987376a9fe801 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py @@ -11,6 +11,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, shallowViewOutput = True, postfix = '', ptSelectionOutput = False, + trackSelection = True, qualitySelectionOutput = True, enableCutflow = False, enableKinematicHistograms = False, @@ -30,6 +31,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, names are unique. ptSelectionOutput -- Whether or not to apply pt selection when creating output containers. + trackSelection -- apply selection on tracks (d0, z0, siHits, etc.) qualitySelectionOutput -- Whether or not to apply muon quality selection when creating output containers. enableCutflow -- Whether or not to dump the cutflow @@ -51,7 +53,8 @@ def makeMuonAnalysisSequence( dataType, workingPoint, seq.addMetaConfigDefault ("selectionDecorCount", []) makeMuonCalibrationSequence (seq, dataType, postfix=postfix, - ptSelectionOutput = ptSelectionOutput) + ptSelectionOutput = ptSelectionOutput, + trackSelection = trackSelection) makeMuonWorkingPointSequence (seq, dataType, workingPoint, postfix=postfix, qualitySelectionOutput = qualitySelectionOutput, isRun3Geo = isRun3Geo) makeSharedObjectSequence (seq, deepCopyOutput = deepCopyOutput, @@ -68,7 +71,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, def makeMuonCalibrationSequence( seq, dataType, - postfix = '', ptSelectionOutput = False): + postfix = '', ptSelectionOutput = False, trackSelection = False): """Create muon calibration analysis algorithms This makes all the algorithms that need to be run first befor @@ -108,17 +111,18 @@ def makeMuonCalibrationSequence( seq, dataType, dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNamesOutput"])}) # Set up the track selection algorithm: - alg = createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', - 'MuonTrackSelectionAlg' + postfix ) - alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits' - alg.maxD0Significance = 3 - alg.maxDeltaZ0SinTheta = 0.5 - seq.append( alg, inputPropName = 'particles', - stageName = 'selection', - metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], - 'selectionDecorNamesOutput' : [alg.selectionDecoration], - 'selectionDecorCount' : [3]}, - dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNamesOutput"])}) + if trackSelection: + alg = createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg', + 'MuonTrackSelectionAlg' + postfix ) + alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits' + alg.maxD0Significance = 3 + alg.maxDeltaZ0SinTheta = 0.5 + seq.append( alg, inputPropName = 'particles', + stageName = 'selection', + metaConfig = {'selectionDecorNames' : [alg.selectionDecoration], + 'selectionDecorNamesOutput' : [alg.selectionDecoration], + 'selectionDecorCount' : [3]}, + dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNamesOutput"])}) # Set up the muon calibration and smearing algorithm: alg = createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg', @@ -194,10 +198,6 @@ def makeMuonWorkingPointSequence( seq, dataType, workingPoint, postfix = '', "\", allowed values are Tight, Medium, Loose, " + "VeryLoose, HighPt, LowPtEfficiency") - if not splitWP[1] in ["Iso", "NonIso"] : - raise ValueError ('invalid muon isolation \"' + splitWP[1] + - '\", allowed values are Iso, NonIso') - # Setup the muon quality selection alg = createAlgorithm( 'CP::MuonSelectionAlgV2', 'MuonSelectionAlg' + postfix ) @@ -218,6 +218,7 @@ def makeMuonWorkingPointSequence( seq, dataType, workingPoint, postfix = '', alg = createAlgorithm( 'CP::MuonIsolationAlg', 'MuonIsolationAlg' + postfix ) addPrivateTool( alg, 'isolationTool', 'CP::IsolationSelectionTool' ) + alg.isolationTool.MuonWP = splitWP[1] alg.isolationDecoration = 'isolated_muon' + postfix + ',as_bits' seq.append( alg, inputPropName = 'muons', stageName = 'selection', @@ -237,7 +238,7 @@ def makeMuonWorkingPointSequence( seq, dataType, workingPoint, postfix = '', alg.outOfValidityDeco = 'bad_eff' + postfix alg.efficiencyScaleFactorTool.WorkingPoint = sfWorkingPoint if isRun3Geo: - alg.efficiencyScaleFactorTool.CalibrationRelease = '220817_Preliminary_r22run3' + alg.efficiencyScaleFactorTool.CalibrationRelease = '230309_Preliminary_r22run3' if dataType != 'data': seq.append( alg, inputPropName = 'muons', stageName = 'efficiency', diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx index 46ee143515c437db9c458087fe53608a57753a6b..5dd5e5465a33fa12f987065420af4b861bfd9c14 100644 --- a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx @@ -17,6 +17,7 @@ #include <cassert> #include <cmath> #include <regex> +#include <functional> // // method implementations @@ -266,6 +267,13 @@ namespace CP else ANA_MSG_INFO ("found systematic: " << mysys); } + + if(m_systematicsRegex!=".*") { + ANA_MSG_INFO("Systematics regex '" << m_systematicsRegex << "' matched:"); + for(const CP::SystematicSet& mysys : makeSystematicsVector()) { + ANA_MSG_INFO (" '" << mysys.name() << "'"); + } + } return StatusCode::SUCCESS; } } diff --git a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/ToolBox.cxx b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/ToolBox.cxx index 37321e6a4c2fbfd1544d0739424c6020c45c564f..4a7fbd43500f43640a8760a0a66175ff7560fef2 100644 --- a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/ToolBox.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/Root/ToolBox.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // Local includes @@ -99,10 +99,13 @@ namespace ORUtils ATH_MSG_DEBUG(" type " << handle.type()); ATH_MSG_DEBUG(" isInitialized " << handle.isInitialized()); - // Initialize it - if(!handle.isInitialized()) { - ATH_CHECK( handle.initialize() ); - } + // Initialize the handle - WB: NO DON'T DO THIS ... + // the naming of the tool implies it's a subtool, so it mustn't be created before + // the parent tool is, because otherwise the parent tool doesn't get configured properly + // if the configuration has been done on the C++ side (the state of the joboptionsvc hasn't + // been updated yet) ... triggering the initialization would trigger the creation of the master tool + // because it's deemed to be a parent by the naming convention parent.child + // Add it to the master tool if(!masterTool.empty()) { ATH_CHECK( masterTool.setProperty(key, handle) ); diff --git a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/util/OverlapRemovalTester.cxx b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/util/OverlapRemovalTester.cxx index ce046b40a672ab759bb662d38e2a2587adfef424..13c02441ab2b0744b3e72f108eec8fb964af2245 100644 --- a/PhysicsAnalysis/AnalysisCommon/AssociationUtils/util/OverlapRemovalTester.cxx +++ b/PhysicsAnalysis/AnalysisCommon/AssociationUtils/util/OverlapRemovalTester.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /// @file OverlapRemovalTester.cxx @@ -264,7 +264,7 @@ int main(int argc, char* argv[]) // Print some event information for fun const xAOD::EventInfo* evtInfo = nullptr; CHECK( event.retrieve(evtInfo, "EventInfo") ); - Info(APP_NAME, "===>>> Processing entry %lli, run %u, event %llu <<<===", + Info(APP_NAME, "===>>> Processing entry %lli, run %u, event %lu <<<===", entry, evtInfo->runNumber(), evtInfo->eventNumber()); // Get electrons diff --git a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h index 983f92597a59a1a1c2af26c83d4e3f67527f4c4d..980aba47e6f13e40f188bddabf53febe4bc731a6 100644 --- a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h +++ b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.h @@ -181,13 +181,18 @@ namespace EL TH3 *hist3d (const std::string& name) const; - /// \brief get the 3-d histogram with the given name + /// \brief get the efficiency histogram with the given name + /// + /// This exists with two names, since the originally chosen name doesn't + /// match the name used in Athena. + /// /// \par Guarantee /// strong /// \par Failures /// histogram not found public: TEfficiency *histeff (const std::string& name) const; + TEfficiency *efficiency (const std::string& name) const; /// \brief the histogram worker interface diff --git a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.icc b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.icc index ab355cfcdd0baa68456ede0c3e22268eb6e5dd84..6bd7c6da4a0a8083b992662933234747d1d3e161 100644 --- a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.icc +++ b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithm.icc @@ -28,6 +28,14 @@ namespace EL + inline TEfficiency *AnaAlgorithm :: + efficiency (const std::string& name) const + { + return histeff (name); + } + + + template<> TObject *AnaAlgorithm :: hist<TObject> (const std::string& name) const; #endif diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM1.sh index 7c873b370ad0b5afe30e0e13f2ddd5295c1b0d7e..6c6991c6e0b2cc6a90abd1542b63362d6c3a2437 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM1 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM10.sh index 380c37584ac5301b39ccc9db80614f4d67af63c9..f711762ea0831b608ccd044c61d00f8148c0b889 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM10 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM2.sh index 1033a758fe600eeb4287a6514b4f2f81796f1c28..25cf5831768a6b7b375c12b5d7216fc8a89a2fea 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM2 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM3.sh index 38341a3474e41bac0d25b6aa34ffcef83b1e2134..28bcc2e83dcd1d46e96e1cea3f4c5f2644af72a6 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM3 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM4.sh index dd4bcb29d29f80fd0acca229f125f30dd85fa4da..1182fbac519e5dc3281df701b6741a60b6d27ea9 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM4 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM5.sh index 862d240131c197aea087232c13e6c657c7a1f93d..3e667dc3363244cf058beb6b1acccb4a2b5d68f1 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM5 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM7.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM7.sh index 204db175824df10c70f60d32610174ded79e1b53..69301807591fe7f1228b362551c14afd7d8f565a 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM7.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM7.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM7 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM8.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM8.sh index 4e8240be97b4b8c53da4b58ed2b25081fb5985a2..151fbf00ffe033ca365b36afe9d5d3a93eb9f1ce 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM8.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM8.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM8 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM9.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM9.sh index 21c3b2aec39e1aba6b01a313203a2e88c71dc87d..febf88f5b5fc2d35c333832924c6c03beb06e96c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM9.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data18EGAM9.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM9 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM1.sh index 8e090b9ff0e0ba996a17a367d6d00dcf00d97582..010f4670030c7b1e72196c61feee586c19e86a50 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM1 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM10.sh index 1f5922a61f7f14fb93e6f807a47d26fe2b00fe0a..24f92cac3beef04a5f1d871abb191b005a931a0f 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM10 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM2.sh index cb98121174fcc8cd52799136a8fb0fac3c4d032d..7a35e9d899dd44ee1ece0c6f6fbff2264c5d67c2 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM2 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM3.sh index 25e79739680f5dfc199347d0fb519bf84181f0ba..cf14a3558287d74a53025150739b2c4b870a3760 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM3 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM4.sh index f8b951d94d42d7dee063995be697d199b0034a2a..7a578f5287de0a812c4116333c34bf2d23a3bd2d 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM4 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM5.sh index e9b103efc9062fa2c7c459e32e5305541426bfa9..04c1307fcb1cff9f71ed729164b14cb3b1ca395b 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM5 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM7.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM7.sh index 57c574952a5bc15e437cf25266a04354638a31ad..fa641470f55942b8c921c3f5c6a3c2f2d30d3879 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM7.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM7.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM7 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM8.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM8.sh index 20e0b309e947c72af26ef469f96c4ae214860845..cf775511f116584e9ccabc83061d8067eac2dcf6 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM8.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM8.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM8 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM9.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM9.sh index 7619c41e90ec6a6f99a0fc54ae415564b7e2732e..e7b35046d09a1476eb4a4efa82f63571ee8fba3c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM9.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_data22EGAM9.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM9 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM1.sh index 75be97cfc7b650fb7b84d2481edb9b1fd3ac67db..d55a908a9bc4d3668554203f2f31d27e69a78c26 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM1 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM10.sh index c94ae040b6a52a6f21c142c8859fb05b162e6bf9..91781ec227a1be36279705384939cd562d6f1bb7 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM10 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM2.sh index a1057c5a0c36304c5203467e20623e0dbb2f65af..40b0e1f762c17d4069e236de4fd2a80dcd319f7c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM2 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM3.sh index 60241a546e5ae3f73f105148a0e0137c5a9a8283..989a2deb7171fb0ce60f6a8a995716100b4da1da 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM3 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM4.sh index 1318638ebb2646df2063302b741b643b81dad8c5..b37a5959f199556a6b4b66e875872aa9740b1993 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM4 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM5.sh index 9d4612534f957083c3ae06bc2d4d84787c6664fb..ce7421566c220d4aca1dbd6bbcb3d628753ee3dd 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM5 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM7.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM7.sh index d686bd862ebd62c3273d7537ef83febebf10c265..8b547a11020573ee8324cbb110549a700978abba 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM7.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM7.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM7 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM8.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM8.sh index 7d7d3da1d21e1da51921be76441cf9b0c48821fe..06f68d26e58da589955f96847c16774e5f057351 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM8.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM8.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM8 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM9.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM9.sh index aba64bd4abf9d579b092f4e9f4b9b615b1b89efa..77306136500ca5546280d49577f2c2521e3a41ca 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM9.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc20EGAM9.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM9 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM1.sh index 6df9c5aa1bc2e7d7f7b6b67702cb7483469441c5..f4bb28d02b222b10397cab46c16c5357b2f45edb 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM1 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM10.sh index a48f67a905079d99b8ff7621d6747608e9a259b8..92bea14c762497c56f064b897f3767c0b6e2bca1 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM10 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM2.sh index 26969b1631d5b60b6088126cf7be147805e4b15f..13a8b8c4fd2d0333980ea17e5889ba3b5dbc3297 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM2 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM3.sh index 8fcb032f445786740dafec81ec448a66d61d96d1..e2898dc8c3267532f8088be64803d6d1d8100c35 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM3 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM4.sh index 3f5027f33a3aae0d1c2fa052458d92005c81ed5d..f35546cf1e391a10a6a4c78799d0bde0c4ddd3c9 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM4 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM5.sh index 1728ed3121e77783b28799a10413df4a9ee4947c..84fe82ff5a7aefd7ca7f5f7ef1e42a235c030dea 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM5 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM7.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM7.sh index 5b92a0ccbf5416a223d9ba7dfebf5c1efe1d803a..3ce33be45f0aa75fce5779ea1ba13b28ad774cd9 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM7.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM7.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM7 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM8.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM8.sh index 4ded147a4788a787027b9ff9280cce09bb17f7c9..fe2066dbadd65518a15be8b9e443786fa5bf24c6 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM8.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM8.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM8 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM9.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM9.sh index 2cda9debc9dac96eca4ca75c4d9b16d1f5000e57..1a805feaf86aab606ca00dcb6895d66763bc4328 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM9.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkEgammaART/test/test_mc21EGAM9.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building EGAM9 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data18IDTR2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data18IDTR2.sh index 198bfcf75a41125c0ebcaa640d29bf1f6ee6e8b5..60b44159ac54b85ecd78fd410a83811350ad06b4 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data18IDTR2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data18IDTR2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building IDTR2 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data22IDTR2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data22IDTR2.sh index 3418d6733bff098c108863d0de7bbddbe6793362..dcd52f09caab802efcf79feae75e670d73d6eb2c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data22IDTR2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_data22IDTR2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building IDTR2 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc20IDTR2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc20IDTR2.sh index 810f3dec45e5f222e2e6e3aff0151dc353b7bd40..15cd15590d5530f3fcc4800c33c317917f5fd706 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc20IDTR2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc20IDTR2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building IDTR2 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc21IDTR2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc21IDTR2.sh index fe590bbcb3512d07a8ccb6c1ebdafb013e8ddba9..65513236e3f260ffdc4437066fa6f81d06ca59d3 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc21IDTR2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkInDetART/test/test_mc21IDTR2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building IDTR2 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM1.sh index 45cf3c11045ac5ef1bbe262da6e9c4a592120d45..280b7f98c03ce8e547de53014a69d636019411e2 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM1 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM10.sh index 23fd2328218d1cfc33c95592cd3a73b8fa4d7181..fd02531d7f499aad2f856e0ea7bfd677cc68ed11 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM10 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM11.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM11.sh index 5e855d9df65728aecb8dd804a35cb9e27d58b9d3..ecd9e228f050aeadc572b2548d48f0ca77c6d9e8 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM11.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM11.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM11 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM12.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM12.sh index ace2b0714c8aac3851e00ce810583b50b8f2a55c..b42df498fcf31a1c5096b1d2584174de4769a054 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM12.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM12.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM12 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM14.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM14.sh index 12dbb6d43ba95debcb1d9b34b3787570bc95a8db..431f544d356d2e44764d7cbf02d5dba68f59ebb9 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM14.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM14.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM14 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM2.sh index e9b07506fe05ae9c964e22a908c078c495b3fdfc..bf942487c11648feed9005f0a38b8f05b2e967a0 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM2 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM3.sh index 3b1c63ac398618119e6af13fec7a0497551efd58..600c0af2446581e2689a3013f666eb9b8856d78f 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM3 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM4.sh index 6d77e2a5584eb5162ddf0861a177795a7b598e3c..a1f178bed8b3d2afbea9b12efeb55aef9147f74e 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM4 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM5.sh index cf3d9451af06760a3c934cd683ac7fa4639702f3..d6d2dcd414464ff035431802eaa47fd1551cad78 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM5 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM6.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM6.sh index de8cc34db0ab00b5b81e6a6cfa30c0414e2fdf2c..b3842d20072d428ce93a0c22d4e9f268b042a76b 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM6.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data18JETM6.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM6 data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM1.sh index 95c878b900a1c12bb32e66b08c423facf203549b..1e7ec594020133919bd293f1eef6977a95dac07b 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM1 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM10.sh index 720dc80b0fc617e7c680100a071119d162a84690..05a2c12c137773ceaf12b09908541ac038f7d155 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM10 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM11.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM11.sh index a7ec7d031e07a3682234315f41eb1e53a8dcc4e7..0941f17c153f9b9b19137c79c40e3dc3ef7fe0b8 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM11.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM11.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM11 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM12.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM12.sh index edaa3cb30e3e978d0a7439db93ceb58bd4fdee84..765c4778b13fff9f4e3ddf2518503ef0d8c973b8 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM12.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM12.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM12 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM14.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM14.sh index 59a1f8e45545d72513848d4c57d0bd4a75c806f9..117d56292f93463a469c93e6e323998986f00a34 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM14.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM14.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM14 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM2.sh index d351a6d41aaa7bcbd558339ebed59c132c3f25e2..bea993403eb653bc0463d5a296a5b891c43cbf15 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM2 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM3.sh index a94065a10434b5ce21fb205f3141227db85e4533..732f7355c24fca93961e193605883525c68b2747 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM3 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM4.sh index 6ed4cd021ef2420daad18524699d1ee02c63ac46..9246cf1c0bb0eaccf9945accc9c19977c339489c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM4 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM5.sh index d50700371d7a84a3aff4372e825114a7c330fd96..8f0e77959059e221af9b96f6b41dc01ff0899dc8 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM5 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM6.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM6.sh index 40cdcce82a12c144d72f24f667ba0595743e28d9..91f56bd45e05bfe68e195aa16eb8c8de2c597c0c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM6.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_data22JETM6.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM6 data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM1.sh index 3839bef64315bed9505fb266e2b9f95032533745..665c93225246167418d3740428c98191290fe82f 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM1 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM10.sh index 3124d1fe3b335ba0431fad4c0e9bbb6d3ce6eadc..bb1c3ff2e0482b88183e9f3a031bd9bb3a284974 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM10 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM11.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM11.sh index 9385d5dd4982ce62b2a722fce55bb7b6f54b9db7..c2deb02c5227d9d61e8c43a82b9f5ee4ce401555 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM11.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM11.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM11 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM12.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM12.sh index 750e96224a1996858fd2b5bd9c55fa2d1ef850f7..cd72d40d9165c2f9d98462c3c5d42e6e05bab6ad 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM12.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM12.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM12 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM14.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM14.sh index 7862a5d6eddc309b32e70246a985fa5db9c1371d..ba68fa49c751a6bf2a2b1a99f3c4c6d435110557 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM14.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM14.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM14 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM2.sh index 13da44d21967c72d2370c60a4d1a2aab8da85b55..d4502970a6128b1817b196e06b47fad8b7bca55b 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM2 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM3.sh index cdbf1292cabbc8944517deaf33506cfcc5dcd4a1..e0deb78ce90dab1cbb69b85b9e222a8f6f4ba9b0 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM3 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM4.sh index a514b65f7159509077e3cc54a46d2e297133426f..1cc71a097345fa1ce84eceec845d42837d55b2f3 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM4 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM5.sh index 792ca655f88c17830c16b9162f800ef8906be335..827a805adf0e958c798c7edfd797be247d77ef02 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM5 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM6.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM6.sh index 0f66c6518ee05f17dd0b451c5eb6618fd4ed18dc..a3858988f916ffdfe9dd9308b0acc408923c365d 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM6.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc20JETM6.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM6 mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM1.sh index 696447f2b9180c8307cc85590afa74fa6c2a77c3..f350b4d7650eedcd2921f96f8736ba164cf657f7 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM1.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM1.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM1 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM10.sh index 3a93885c37d90618561a27b6c273316b14bfaff5..f9226b5a5379ce2cefda42120161f424077a68b2 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM10.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM10.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM10 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM11.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM11.sh index 9ebc451c8cd269828d8c6ba75b27f0662a7495ce..e5208a52cbbbd72c68fee9e6d5e720f0653841bf 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM11.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM11.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM11 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM12.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM12.sh index 35eb1ec889828cf27f02e78c6cb48a3f9fd6b826..75732d9d300c0f1d6a28c254085a87ecd0899076 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM12.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM12.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM12 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM14.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM14.sh index 7fba1cde2fa0d017b75ea11a1542030f3ff1f85c..5e67fba629b393b0ad830a423b3b089a98b02ec9 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM14.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM14.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM14 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM2.sh index 8822803f5aa49ab1e061d1bfd6a7c14210d07032..651ab4d39397154dddb4e56cc20e65e372aad28f 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM2.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM2.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM2 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM3.sh index f04f2859a9b4653e6be3d06ed87070f075e80d07..5304dff3125f0fe73a634a0c76b4ab5cb1106945 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM3.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM3.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM3 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM4.sh index 9b2463d7bbe627674dd8f4f6e540af1016e4fcef..3284d1f0e5ab029182950bad045d057622c60c2c 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM4.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM4.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM4 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM5.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM5.sh index 7e14fe708a2784dcdc1b2f6e18182d184648cee5..8eab8e4cd3a045316cbd7cf0a4414e6c8a5d9539 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM5.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM5.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM5 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM6.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM6.sh index 2e4771f76a127c594606b6c65cbd8d1c5c6e3e66..ce01af3c57e65f0d2827c211626ffd1fc6fa786f 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM6.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkJetEtMissART/test/test_mc21JETM6.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building JETM6 mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data18PHYS.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data18PHYS.sh index 99d55291469efe125e092def5f187e28452056a5..3ed169a1d719ab7909b6df282ffd7a0874a116ce 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data18PHYS.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data18PHYS.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYS data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data22PHYS.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data22PHYS.sh index 7d6c6999070572014e19c8f26b63a84e820f647c..d73e52f55fa6987879db68ada8c1a49591cdc784 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data22PHYS.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_data22PHYS.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYS data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc20PHYS.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc20PHYS.sh index ce6920ec18655bd2936e2416ce7297c965947aa8..bd72d26bf42645f874dcf22a0d87d09222ce81d1 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc20PHYS.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc20PHYS.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYS mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc21PHYS.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc21PHYS.sh index be40cd44107e8f69f98c6f3ab95042f82982f976..5557314948fc83944e63f59990ed18c0413f395e 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc21PHYS.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPHYS/test/test_mc21PHYS.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYS mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data18PHYSVAL.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data18PHYSVAL.sh index 85ea031d8a3864e0412e6e35519e27da1ef83010..e88ddd24c6eeeab323c6deb1f762101b825bb718 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data18PHYSVAL.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data18PHYSVAL.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYSVAL data18 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data22PHYSVAL.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data22PHYSVAL.sh index 8eb30868448a4492f02add89188a36503ab62b05..1ca6af56168d08c9bd468f97e43ac31c351dfc2e 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data22PHYSVAL.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_data22PHYSVAL.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYSVAL data22 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc20PHYSVAL.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc20PHYSVAL.sh index c6c82eef37195ff9d535c3d5a587b17b545db7d5..71b8e64ba2277596a3b2dc876715b55a773b71eb 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc20PHYSVAL.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc20PHYSVAL.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYSVAL mc20 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL.sh index 9e447560c4ec3302ac37bf48433410dfd5c2f3a6..6912ddb8914962b0e959e0e2f4f379433193cdbc 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL.sh @@ -1,6 +1,7 @@ #!/bin/sh # art-include: master/Athena +# art-include: 23.0/Athena # art-description: DAOD building PHYSVAL mc21 # art-type: grid # art-output: *.pool.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL_DAOD_NTUP_HIST.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL_DAOD_NTUP_HIST.sh index 9dc7797c3be75dce5ab2a08e730f40a491155c83..77c9f12f25bde5eecca280c9db8f0263100a56cf 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL_DAOD_NTUP_HIST.sh +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkPhysicsValidationART/test/test_mc21PHYSVAL_DAOD_NTUP_HIST.sh @@ -4,6 +4,7 @@ # art-type: grid # art-input: mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.AOD.e8453_s3873_r13829 # art-include: master/Athena +# art-include: 23.0/Athena # art-input-nfiles: 1 # art-output: DAOD_PHYSVAL.OUT.root # art-output: NTUP_PHYSVAL.root diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM1_EGAM2_EGAM5_EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM1_EGAM2_EGAM5_EGAM10.sh deleted file mode 100755 index d8e5299a7d1ab242b2751c7e3de5c75a6140ca4a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM1_EGAM2_EGAM5_EGAM10.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM1 EGAM2 EGAM5 EGAM10 data18 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data18/AOD/data18_13TeV.00357772.physics_Main.merge.AOD.r13286_p4910/1000events.AOD.27655096._000455.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM1 EGAM2 EGAM5 EGAM10 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM1.art.pool.root > checkFile_EGAM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM1.art.pool.root > checkxAOD_EGAM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM1.art.pool.root > checkIndexRefs_EGAM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM2.art.pool.root > checkFile_EGAM2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM2.art.pool.root > checkxAOD_EGAM2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM2.art.pool.root > checkIndexRefs_EGAM2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM5.art.pool.root > checkFile_EGAM5.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM5.art.pool.root > checkxAOD_EGAM5.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM5.art.pool.root > checkIndexRefs_EGAM5.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM10.art.pool.root > checkFile_EGAM10.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM10.art.pool.root > checkxAOD_EGAM10.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM10.art.pool.root > checkIndexRefs_EGAM10.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM3_EGAM4_JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM3_EGAM4_JETM4.sh deleted file mode 100755 index 2abad133efceda2200f785daf22dca5552ea28b5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM3_EGAM4_JETM4.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM3 EGAM4 JETM4 data18 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data18/AOD/data18_13TeV.00357772.physics_Main.merge.AOD.r13286_p4910/1000events.AOD.27655096._000455.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM3 EGAM4 JETM4 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM3.art.pool.root > checkFile_EGAM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM3.art.pool.root > checkxAOD_EGAM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM3.art.pool.root > checkIndexRefs_EGAM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM4.art.pool.root > checkFile_EGAM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM4.art.pool.root > checkxAOD_EGAM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM4.art.pool.root > checkIndexRefs_EGAM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM4.art.pool.root > checkFile_JETM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM4.art.pool.root > checkxAOD_JETM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM4.art.pool.root > checkIndexRefs_JETM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM7_JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM7_JETM3.sh deleted file mode 100755 index f846758082e4cea44c148ca086a3d9668a04b1b1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM7_JETM3.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM7 JETM3 data18 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data18/AOD/data18_13TeV.00357772.physics_Main.merge.AOD.r13286_p4910/1000events.AOD.27655096._000455.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM7 JETM3 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM7.art.pool.root > checkFile_EGAM7.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM7.art.pool.root > checkxAOD_EGAM7.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM7.art.pool.root > checkIndexRefs_EGAM7.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM3.art.pool.root > checkFile_JETM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM3.art.pool.root > checkxAOD_JETM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM3.art.pool.root > checkIndexRefs_JETM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM8_EGAM9_JETM1_LLP1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM8_EGAM9_JETM1_LLP1.sh deleted file mode 100755 index fb02c77eddb1de7ea2e425e453151598ca6f9d10..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18EGAM8_EGAM9_JETM1_LLP1.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM8 EGAM9 JETM1 LLP1 data18 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data18/AOD/data18_13TeV.00357772.physics_Main.merge.AOD.r13286_p4910/1000events.AOD.27655096._000455.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM8 EGAM9 JETM1 LLP1 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM8.art.pool.root > checkFile_EGAM8.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM8.art.pool.root > checkxAOD_EGAM8.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM8.art.pool.root > checkIndexRefs_EGAM8.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM9.art.pool.root > checkFile_EGAM9.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM9.art.pool.root > checkxAOD_EGAM9.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM9.art.pool.root > checkIndexRefs_EGAM9.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM1.art.pool.root > checkFile_JETM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM1.art.pool.root > checkxAOD_JETM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM1.art.pool.root > checkIndexRefs_JETM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_LLP1.art.pool.root > checkFile_LLP1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_LLP1.art.pool.root > checkxAOD_LLP1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_LLP1.art.pool.root > checkIndexRefs_LLP1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18JETM6_FTAG2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18JETM6_FTAG2.sh deleted file mode 100755 index 097ff62c7cf4d4780ec42f3edd60074817290a4b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data18JETM6_FTAG2.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building JETM6 FTAG2 data18 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data18/AOD/data18_13TeV.00357772.physics_Main.merge.AOD.r13286_p4910/1000events.AOD.27655096._000455.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats JETM6 FTAG2 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_JETM6.art.pool.root > checkFile_JETM6.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM6.art.pool.root > checkxAOD_JETM6.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM6.art.pool.root > checkIndexRefs_JETM6.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_FTAG2.art.pool.root > checkFile_FTAG2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_FTAG2.art.pool.root > checkxAOD_FTAG2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_FTAG2.art.pool.root > checkIndexRefs_FTAG2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM1_EGAM2_EGAM5_EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM1_EGAM2_EGAM5_EGAM10.sh deleted file mode 100755 index a1373720de448a59fd4c0c3633dd32debe6e5f49..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM1_EGAM2_EGAM5_EGAM10.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM1 EGAM2 EGAM5 EGAM10 data22 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data22/AOD/data22_13p6TeV.00431906.physics_Main.merge.AOD.r13928_p5279/1000events.AOD.30220215._001367.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM1 EGAM2 EGAM5 EGAM10 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM1.art.pool.root > checkFile_EGAM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM1.art.pool.root > checkxAOD_EGAM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM1.art.pool.root > checkIndexRefs_EGAM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM2.art.pool.root > checkFile_EGAM2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM2.art.pool.root > checkxAOD_EGAM2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM2.art.pool.root > checkIndexRefs_EGAM2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM5.art.pool.root > checkFile_EGAM5.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM5.art.pool.root > checkxAOD_EGAM5.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM5.art.pool.root > checkIndexRefs_EGAM5.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM10.art.pool.root > checkFile_EGAM10.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM10.art.pool.root > checkxAOD_EGAM10.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM10.art.pool.root > checkIndexRefs_EGAM10.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM3_EGAM4_JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM3_EGAM4_JETM4.sh deleted file mode 100755 index 28ed83b75164834cc736781e878e5b7015c19348..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM3_EGAM4_JETM4.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM3 EGAM4 JETM4 data22 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data22/AOD/data22_13p6TeV.00431906.physics_Main.merge.AOD.r13928_p5279/1000events.AOD.30220215._001367.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM3 EGAM4 JETM4 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM3.art.pool.root > checkFile_EGAM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM3.art.pool.root > checkxAOD_EGAM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM3.art.pool.root > checkIndexRefs_EGAM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM4.art.pool.root > checkFile_EGAM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM4.art.pool.root > checkxAOD_EGAM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM4.art.pool.root > checkIndexRefs_EGAM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM4.art.pool.root > checkFile_JETM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM4.art.pool.root > checkxAOD_JETM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM4.art.pool.root > checkIndexRefs_JETM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM7_JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM7_JETM3.sh deleted file mode 100755 index 0a73b3e8bf5c9176271530ca0f559604f4a9b1f2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM7_JETM3.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM7 JETM3 data22 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data22/AOD/data22_13p6TeV.00431906.physics_Main.merge.AOD.r13928_p5279/1000events.AOD.30220215._001367.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM7 JETM3 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM7.art.pool.root > checkFile_EGAM7.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM7.art.pool.root > checkxAOD_EGAM7.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM7.art.pool.root > checkIndexRefs_EGAM7.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM3.art.pool.root > checkFile_JETM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM3.art.pool.root > checkxAOD_JETM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM3.art.pool.root > checkIndexRefs_JETM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM8_EGAM9_JETM1_LLP1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM8_EGAM9_JETM1_LLP1.sh deleted file mode 100755 index 82275fbd3bdd4c47fd6b2b270f445b012f97978e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22EGAM8_EGAM9_JETM1_LLP1.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM8 EGAM9 JETM1 LLP1 data22 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data22/AOD/data22_13p6TeV.00431906.physics_Main.merge.AOD.r13928_p5279/1000events.AOD.30220215._001367.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM8 EGAM9 JETM1 LLP1 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM8.art.pool.root > checkFile_EGAM8.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM8.art.pool.root > checkxAOD_EGAM8.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM8.art.pool.root > checkIndexRefs_EGAM8.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM9.art.pool.root > checkFile_EGAM9.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM9.art.pool.root > checkxAOD_EGAM9.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM9.art.pool.root > checkIndexRefs_EGAM9.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM1.art.pool.root > checkFile_JETM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM1.art.pool.root > checkxAOD_JETM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM1.art.pool.root > checkIndexRefs_JETM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_LLP1.art.pool.root > checkFile_LLP1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_LLP1.art.pool.root > checkxAOD_LLP1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_LLP1.art.pool.root > checkIndexRefs_LLP1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22JETM6_FTAG2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22JETM6_FTAG2.sh deleted file mode 100755 index 2c2c0cba5549b766b9fd7c5d3f5ad6d47989fbd8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_data22JETM6_FTAG2.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building JETM6 FTAG2 data22 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/data22/AOD/data22_13p6TeV.00431906.physics_Main.merge.AOD.r13928_p5279/1000events.AOD.30220215._001367.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats JETM6 FTAG2 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_JETM6.art.pool.root > checkFile_JETM6.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM6.art.pool.root > checkxAOD_JETM6.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM6.art.pool.root > checkIndexRefs_JETM6.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_FTAG2.art.pool.root > checkFile_FTAG2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_FTAG2.art.pool.root > checkxAOD_FTAG2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_FTAG2.art.pool.root > checkIndexRefs_FTAG2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM1_EGAM2_EGAM5_EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM1_EGAM2_EGAM5_EGAM10.sh deleted file mode 100755 index 3240195b17148fbed772f7aab6a0d0402a5a90dc..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM1_EGAM2_EGAM5_EGAM10.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM1 EGAM2 EGAM5 EGAM10 mc20 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc20/AOD/mc20_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.AOD.e6337_s3681_r13145/1000events.AOD.27121237._002005.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM1 EGAM2 EGAM5 EGAM10 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM1.art.pool.root > checkFile_EGAM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM1.art.pool.root > checkxAOD_EGAM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM1.art.pool.root > checkIndexRefs_EGAM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM2.art.pool.root > checkFile_EGAM2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM2.art.pool.root > checkxAOD_EGAM2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM2.art.pool.root > checkIndexRefs_EGAM2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM5.art.pool.root > checkFile_EGAM5.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM5.art.pool.root > checkxAOD_EGAM5.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM5.art.pool.root > checkIndexRefs_EGAM5.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM10.art.pool.root > checkFile_EGAM10.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM10.art.pool.root > checkxAOD_EGAM10.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM10.art.pool.root > checkIndexRefs_EGAM10.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM3_EGAM4_JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM3_EGAM4_JETM4.sh deleted file mode 100755 index 88fcedea8e2c6dcbe7af4783e971b05cec3d7354..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM3_EGAM4_JETM4.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM3 EGAM4 JETM4 mc20 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc20/AOD/mc20_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.AOD.e6337_s3681_r13145/1000events.AOD.27121237._002005.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM3 EGAM4 JETM4 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM3.art.pool.root > checkFile_EGAM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM3.art.pool.root > checkxAOD_EGAM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM3.art.pool.root > checkIndexRefs_EGAM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM4.art.pool.root > checkFile_EGAM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM4.art.pool.root > checkxAOD_EGAM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM4.art.pool.root > checkIndexRefs_EGAM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM4.art.pool.root > checkFile_JETM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM4.art.pool.root > checkxAOD_JETM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM4.art.pool.root > checkIndexRefs_JETM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM7_JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM7_JETM3.sh deleted file mode 100755 index 1a63b7656b4b3ee290518db077e66b4e40f69cf4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM7_JETM3.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM7 JETM3 mc20 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc20/AOD/mc20_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.AOD.e6337_s3681_r13145/1000events.AOD.27121237._002005.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM7 JETM3 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM7.art.pool.root > checkFile_EGAM7.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM7.art.pool.root > checkxAOD_EGAM7.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM7.art.pool.root > checkIndexRefs_EGAM7.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM3.art.pool.root > checkFile_JETM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM3.art.pool.root > checkxAOD_JETM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM3.art.pool.root > checkIndexRefs_JETM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM8_EGAM9_JETM1_LLP1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM8_EGAM9_JETM1_LLP1.sh deleted file mode 100755 index 425e454992b9ab66f0f307cd0bb647b520b0a893..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20EGAM8_EGAM9_JETM1_LLP1.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM8 EGAM9 JETM1 LLP1 mc20 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc20/AOD/mc20_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.AOD.e6337_s3681_r13145/1000events.AOD.27121237._002005.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM8 EGAM9 JETM1 LLP1 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM8.art.pool.root > checkFile_EGAM8.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM8.art.pool.root > checkxAOD_EGAM8.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM8.art.pool.root > checkIndexRefs_EGAM8.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM9.art.pool.root > checkFile_EGAM9.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM9.art.pool.root > checkxAOD_EGAM9.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM9.art.pool.root > checkIndexRefs_EGAM9.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM1.art.pool.root > checkFile_JETM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM1.art.pool.root > checkxAOD_JETM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM1.art.pool.root > checkIndexRefs_JETM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_LLP1.art.pool.root > checkFile_LLP1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_LLP1.art.pool.root > checkxAOD_LLP1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_LLP1.art.pool.root > checkIndexRefs_LLP1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20JETM6_FTAG2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20JETM6_FTAG2.sh deleted file mode 100755 index 923f037a9d3ed97379e838d4c731e9a0b77815f8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc20JETM6_FTAG2.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building JETM6 FTAG2 mc20 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc20/AOD/mc20_13TeV.410470.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.AOD.e6337_s3681_r13145/1000events.AOD.27121237._002005.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats JETM6 FTAG2 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_JETM6.art.pool.root > checkFile_JETM6.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM6.art.pool.root > checkxAOD_JETM6.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM6.art.pool.root > checkIndexRefs_JETM6.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_FTAG2.art.pool.root > checkFile_FTAG2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_FTAG2.art.pool.root > checkxAOD_FTAG2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_FTAG2.art.pool.root > checkIndexRefs_FTAG2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM1_EGAM2_EGAM5_EGAM10.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM1_EGAM2_EGAM5_EGAM10.sh deleted file mode 100755 index 75069048557dead871ab9b99ae1bb46f91d8d5a4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM1_EGAM2_EGAM5_EGAM10.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM1 EGAM2 EGAM5 EGAM10 mc21 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc21/AOD/mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.AOD.e8453_s3873_r13829/1000events.AOD.29787656._000153.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM1 EGAM2 EGAM5 EGAM10 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM1.art.pool.root > checkFile_EGAM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM1.art.pool.root > checkxAOD_EGAM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM1.art.pool.root > checkIndexRefs_EGAM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM2.art.pool.root > checkFile_EGAM2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM2.art.pool.root > checkxAOD_EGAM2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM2.art.pool.root > checkIndexRefs_EGAM2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM5.art.pool.root > checkFile_EGAM5.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM5.art.pool.root > checkxAOD_EGAM5.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM5.art.pool.root > checkIndexRefs_EGAM5.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM10.art.pool.root > checkFile_EGAM10.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM10.art.pool.root > checkxAOD_EGAM10.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM10.art.pool.root > checkIndexRefs_EGAM10.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM3_EGAM4_JETM4.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM3_EGAM4_JETM4.sh deleted file mode 100755 index bbc930b24a21f258ee59e9b3fcb5a28ffef8ef6a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM3_EGAM4_JETM4.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM3 EGAM4 JETM4 mc21 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc21/AOD/mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.AOD.e8453_s3873_r13829/1000events.AOD.29787656._000153.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM3 EGAM4 JETM4 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM3.art.pool.root > checkFile_EGAM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM3.art.pool.root > checkxAOD_EGAM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM3.art.pool.root > checkIndexRefs_EGAM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM4.art.pool.root > checkFile_EGAM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM4.art.pool.root > checkxAOD_EGAM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM4.art.pool.root > checkIndexRefs_EGAM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM4.art.pool.root > checkFile_JETM4.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM4.art.pool.root > checkxAOD_JETM4.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM4.art.pool.root > checkIndexRefs_JETM4.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM7_JETM3.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM7_JETM3.sh deleted file mode 100755 index dff8834e8a3422bc46c03105d4a0dfd35ca1e890..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM7_JETM3.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM7 JETM3 mc21 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc21/AOD/mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.AOD.e8453_s3873_r13829/1000events.AOD.29787656._000153.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM7 JETM3 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM7.art.pool.root > checkFile_EGAM7.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM7.art.pool.root > checkxAOD_EGAM7.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM7.art.pool.root > checkIndexRefs_EGAM7.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM3.art.pool.root > checkFile_JETM3.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM3.art.pool.root > checkxAOD_JETM3.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM3.art.pool.root > checkIndexRefs_JETM3.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM8_EGAM9_JETM1_LLP1.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM8_EGAM9_JETM1_LLP1.sh deleted file mode 100755 index 4277e3442baf8bdf8383ed7159151ca296da120d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21EGAM8_EGAM9_JETM1_LLP1.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building EGAM8 EGAM9 JETM1 LLP1 mc21 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc21/AOD/mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.AOD.e8453_s3873_r13829/1000events.AOD.29787656._000153.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats EGAM8 EGAM9 JETM1 LLP1 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_EGAM8.art.pool.root > checkFile_EGAM8.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM8.art.pool.root > checkxAOD_EGAM8.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM8.art.pool.root > checkIndexRefs_EGAM8.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_EGAM9.art.pool.root > checkFile_EGAM9.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_EGAM9.art.pool.root > checkxAOD_EGAM9.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_EGAM9.art.pool.root > checkIndexRefs_EGAM9.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_JETM1.art.pool.root > checkFile_JETM1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM1.art.pool.root > checkxAOD_JETM1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM1.art.pool.root > checkIndexRefs_JETM1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_LLP1.art.pool.root > checkFile_LLP1.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_LLP1.art.pool.root > checkxAOD_LLP1.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_LLP1.art.pool.root > checkIndexRefs_LLP1.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21JETM6_FTAG2.sh b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21JETM6_FTAG2.sh deleted file mode 100755 index 3badb68614a4223c8597ab3d7fba344bb06002d1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/DerivationFrameworkTrainsART/test/test_mc21JETM6_FTAG2.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# art-include: master/Athena -# art-description: DAOD building JETM6 FTAG2 mc21 -# art-type: grid -# art-output: *.pool.root -# art-output: checkFile*.txt -# art-output: checkxAOD*.txt -# art-output: checkIndexRefs*.txt - -set -e - -Derivation_tf.py \ ---CA True \ ---inputAODFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CampaignInputs/mc21/AOD/mc21_13p6TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.recon.AOD.e8453_s3873_r13829/1000events.AOD.29787656._000153.pool.root.1 \ ---outputDAODFile art.pool.root \ ---formats JETM6 FTAG2 \ ---maxEvents -1 \ - -echo "art-result: $? reco" - -checkFile.py DAOD_JETM6.art.pool.root > checkFile_JETM6.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_JETM6.art.pool.root > checkxAOD_JETM6.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_JETM6.art.pool.root > checkIndexRefs_JETM6.txt 2>&1 - -echo "art-result: $? checkIndexRefs" - -checkFile.py DAOD_FTAG2.art.pool.root > checkFile_FTAG2.txt - -echo "art-result: $? checkfile" - -checkxAOD.py DAOD_FTAG2.art.pool.root > checkxAOD_FTAG2.txt - -echo "art-result: $? checkxAOD" - -checkIndexRefs.py DAOD_FTAG2.art.pool.root > checkIndexRefs_FTAG2.txt 2>&1 - -echo "art-result: $? checkIndexRefs" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/makeARTScripts.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/makeARTScripts.py index 1328deefd9b4fc032d630e668f983a47271e8610..bfba8ad27cae2969ebbc6f25bb0a7f0ef5491ac4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/makeARTScripts.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkART/makeARTScripts.py @@ -11,20 +11,17 @@ formatList = ["PHYSVAL","PHYS","PHYSLITE", "JETM1","JETM2","JETM3","JETM4","JETM5","JETM6","JETM10","JETM11","JETM12","JETM14", "IDTR2", "EGAM1","EGAM2","EGAM3","EGAM4","EGAM5","EGAM7","EGAM8","EGAM9","EGAM10", - "FTAG1","FTAG2", + "FTAG1","FTAG2","FTAG3", "BPHY1","BPHY2","BPHY3","BPHY4","BPHY5","BPHY6","BPHY10","BPHY15","BPHY16","BPHY18","BPHY21","BPHY22", "BPHY23","BPHY24", - "STDM7" + "STDM7", + "TRIG8" ] truthFormatList = ["TRUTH0", "TRUTH1", "TRUTH3"] trainList = [ - ["EGAM1","EGAM2","EGAM5","EGAM10"], - ["EGAM3","EGAM4","JETM4"], - ["EGAM7","JETM3","STDM7"], - ["EGAM8","EGAM9","JETM1","LLP1"], - ["JETM6","FTAG2"] + ["EGAM1","EGAM2","EGAM3","EGAM4","EGAM5","EGAM7","EGAM8","EGAM9","EGAM10","JETM1","JETM3","JETM4","JETM6","FTAG1","FTAG2","FTAG3","IDTR2","TRIG8","LLP1","STDM7","HIGG1D1"] ] @@ -50,6 +47,8 @@ def generateText(formatName,label,inputFile,isTruth,isMC,nEvents,useLegacy): outputFile.write("#!/bin/sh"+"\n") outputFile.write("\n") outputFile.write("# art-include: master/Athena"+"\n") + if (formatName.find("EGAM")!=-1 or formatName.find("JETM")!=-1 or formatName.find("FTAG")!=-1 or formatName.find("IDTR")!=-1 or formatName.find("TRIG")!=-1 or (formatName.find("PHYS")!=-1 and formatName.find("PHYSLITE")==-1)): + outputFile.write("# art-include: 23.0/Athena"+"\n") outputFile.write("# art-description: DAOD building "+formatName+" "+label+"\n") outputFile.write("# art-type: grid"+"\n") outputFile.write("# art-output: *.pool.root"+"\n") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/BPhysPVCascadeTools.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/BPhysPVCascadeTools.h index 0a4aad27575ab82f672d14371e4c4311317fa22e..1cdee3314f425fd450aefa56daa22f57d627fc1d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/BPhysPVCascadeTools.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/BPhysPVCascadeTools.h @@ -104,6 +104,7 @@ namespace DerivationFramework { Amg::Vector3D DocaExtrapToBeamSpot(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj) const; static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const xAOD::TrackParticleContainer* importedTrackCollection); + static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const std::vector<const xAOD::TrackParticleContainer*>& ); StatusCode FillCandwithRefittedVertices( bool refitPV, const xAOD::VertexContainer* pvContainer, xAOD::VertexContainer* refPvContainer, diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/JpsiPlusV0Cascade.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/JpsiPlusV0Cascade.h index 0caf9ea2a5c3d044040b52ba86c52dfba371abb7..ab3b865c0729ee10e75a9a73e7aaf6417e94a20d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/JpsiPlusV0Cascade.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/JpsiPlusV0Cascade.h @@ -16,7 +16,7 @@ #include "JpsiUpsilonTools/PrimaryVertexRefitter.h" #include <vector> #include "xAODEventInfo/EventInfo.h" - +#include "xAODTracking/TrackParticleContainer.h" namespace Trk { class IVertexFitter; @@ -90,6 +90,8 @@ namespace DerivationFramework { StatusCode initialize() override; StatusCode performSearch(std::vector<Trk::VxCascadeInfo*> *cascadeinfoContainer ) const; virtual StatusCode addBranches() const override; + SG::ReadHandleKeyArray<xAOD::TrackParticleContainer> m_RelinkContainers{this, "RelinkTracks", {}, "Track Containers if they need to be relinked through indirect use" }; + }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/LocalVector.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/LocalVector.h deleted file mode 100644 index 1865c520e35f949b66eda6975784ac7bbdd34c85..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/DerivationFrameworkBPhys/LocalVector.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ -#ifndef LOCALVECTOR_H -#define LOCALVECTOR_H - -#include <array> -#include <algorithm> -#include <iterator> - -template <class A_Type, size_t SIZE> -class LocalVector -{ -protected: - std::array<A_Type, SIZE> m_memblock; - size_t m_x; -public: - LocalVector() : m_x(0) { } - size_t size() const noexcept { - return m_x; - } - constexpr size_t max_size() const noexcept { - return SIZE; - } - typename std::array<A_Type, SIZE>::iterator begin() noexcept { - return m_memblock.begin(); - } - typename std::array<A_Type, SIZE>::iterator end() noexcept { - auto it = m_memblock.begin(); - std::advance(it, m_x); - return it; - } - typename std::array<A_Type, SIZE>::const_iterator begin() const noexcept { - return m_memblock.cbegin(); - } - typename std::array<A_Type, SIZE>::const_iterator end() const noexcept { - auto it = m_memblock.cbegin(); - std::advance(it, m_x); - return it; - } - A_Type& operator[]( size_t pos ) { - return m_memblock[pos]; - } - const A_Type& operator[]( size_t pos ) const { - return m_memblock[pos]; - } - bool contains(const A_Type& a) const { - return std::find(begin(), end(), a) != end(); - } - void push_back(const A_Type& a) { - m_memblock[m_x++] = a; - } - void pop_back() { - --m_x; - } - void clear() noexcept { - m_x = 0; - } - A_Type& back( ) { - return m_memblock[m_x-1]; - } - const A_Type& back( ) const { - return m_memblock[m_x-1]; - } - A_Type& front( ) { - return m_memblock.front(); - } - const A_Type& front( ) const { - return m_memblock.front(); - } -}; -#endif diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY24.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY24.py index b2ed91695c8cfb79e143f3e015f724bbaeee181b..a910a28a34f5c90d515bf10156273ae9fb6a7103 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY24.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY24.py @@ -60,10 +60,12 @@ def BPHY24Cfg(ConfigFlags): TrackParticleLocation = ["InDetTrackParticles", "InDetLargeD0TrackParticles"], OutputTrackParticleLocation = "InDetWithLRTTrackParticles", CreateViewColllection = True)) + acc.addPublicTool(BPHY24TrackParticleMergerTool) - LRTMergeAug = CompFactory.DerivationFramework.CommonAugmentation("InDetLRTMerge", AugmentationTools = [BPHY24TrackParticleMergerTool]) + LRTMergeAug = CompFactory.DerivationFramework.CommonAugmentation("BPHY24InDetLRTMerge", AugmentationTools = [BPHY24TrackParticleMergerTool]) acc.addEventAlgo(LRTMergeAug) mainIDInput = "InDetWithLRTTrackParticles" + originalTrackCond = ["InDetTrackParticles", "InDetLargeD0TrackParticles","GSFTrackParticles"] BPHY24_Finder_DiMuon = CompFactory.Analysis.JpsiFinder( name = "BPHY24_Finder_DiMuon", muAndMu = True, muAndTrack = False, @@ -217,7 +219,8 @@ def BPHY24Cfg(ConfigFlags): V0ContainerName = V0ContainerName, KshortContainerName = KshortContainerName, LambdaContainerName = LambdaContainerName, - LambdabarContainerName = LambdabarContainerName)), + LambdabarContainerName = LambdabarContainerName, + RelinkTracks =originalTrackCond)), Decorator = V0Decorator, V0ContainerName = V0ContainerName, KshortContainerName = KshortContainerName, @@ -227,9 +230,11 @@ def BPHY24Cfg(ConfigFlags): augsList += [BPHY24_Reco_V0Finder] outVtxList += ['BPHY24RecoKshortCandidates'] + outVtxList += ["BPHY24RecoV0Candidates"] thinTrkVtxList += ['BPHY24RecoKshortCandidates'] thinPassFlagsList += [ "" ] # TODO: is this really needed? finalCandidateList += ["BPHY24RecoKshortCandidates"] + finalCandidateList += ["BPHY24RecoV0Candidates"] JpsiV0VertexFit = CompFactory.Trk.TrkVKalVrtFitter( name = "JpsiV0VertexFit", Extrapolator = acc.popToolsAndMerge(InDetExtrapolatorCfg(ConfigFlags)), @@ -256,7 +261,9 @@ def BPHY24Cfg(ConfigFlags): RefPVContainerName = "BPHY24RefittedPrimaryVertices_mm", JpsiVertices = "BPHY24_DiMuon_Candidates", CascadeVertexCollections= ["BPHY24JpsimmKshortCascadeSV2", "BPHY24JpsimmKshortCascadeSV1"], - V0Vertices = "BPHY24RecoV0Candidates") + V0Vertices = "BPHY24RecoV0Candidates", + V0TrackContainerName = mainIDInput, + RelinkTracks = originalTrackCond) augsList += [BPHY24JpsimmKshort] outVtxList += BPHY24JpsimmKshort.CascadeVertexCollections @@ -284,7 +291,9 @@ def BPHY24Cfg(ConfigFlags): RefPVContainerName = "BPHY24RefittedPrimaryVertices_ee", JpsiVertices = "BPHY24_DiElectron_Candidates", CascadeVertexCollections= ["BPHY24JpsieeKshortCascadeSV2", "BPHY24JpsieeKshortCascadeSV1"], - V0Vertices = "BPHY24RecoV0Candidates") + V0Vertices = "BPHY24RecoV0Candidates", + V0TrackContainerName = mainIDInput, + RelinkTracks = originalTrackCond) augsList += [BPHY24JpsieeKshort] finalCandidateList += BPHY24JpsieeKshort.CascadeVertexCollections @@ -312,19 +321,18 @@ def BPHY24Cfg(ConfigFlags): TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(ConfigFlags, TrackSelectionTool = TrackSelTool, TTVATool = TTVATool)) - acc.addPublicTool(TrackIsoTool) BPHY24TrackIsolationDecoratorBtoKee = CompFactory.DerivationFramework.VertexTrackIsolation( name = "BPHY24TrackIsolationDecoratorBtoKee", TrackIsoTool = TrackIsoTool, - TrackContainer = mainIDInput, + TrackContainer = "InDetTrackParticles", InputVertexContainer = "BPHY24JpsieeKshortCascadeSV1", FixElecExclusion = True, IncludeV0 = True) BPHY24TrackIsolationDecoratorBtoKmumu = CompFactory.DerivationFramework.VertexTrackIsolation( name = "BPHY24TrackIsolationDecoratorBtoKmumu ", TrackIsoTool = TrackIsoTool, - TrackContainer = mainIDInput, + TrackContainer = "InDetTrackParticles", InputVertexContainer = "BPHY24JpsimmKshortCascadeSV1", FixElecExclusion = False, IncludeV0 = True) @@ -348,16 +356,25 @@ def BPHY24Cfg(ConfigFlags): BPHY24TrackIsolationDecoratorKshort = CompFactory.DerivationFramework.VertexTrackIsolation( name = "BPHY24TrackIsolationDecoratorKshort", TrackIsoTool = TrackIsoTool, - TrackContainer = "InDetLargeD0TrackParticles", + TrackContainer = "InDetTrackParticles", InputVertexContainer = "BPHY24RecoKshortCandidates", FixElecExclusion = False, IncludeV0 = False) + BPHY24TrackIsolationDecoratorV0 = CompFactory.DerivationFramework.VertexTrackIsolation( + name = "BPHY24TrackIsolationDecoratorV0", + TrackIsoTool = TrackIsoTool, + TrackContainer = "InDetTrackParticles", + InputVertexContainer = "BPHY24RecoV0Candidates", + FixElecExclusion = False, + IncludeV0 = False) + augsList += [ BPHY24TrackIsolationDecoratorBtoKee, BPHY24TrackIsolationDecoratorBtoKmumu, BPHY24TrackIsolationDecoratorJpsiee, BPHY24TrackIsolationDecoratorJpsimumu, - BPHY24TrackIsolationDecoratorKshort] + BPHY24TrackIsolationDecoratorKshort, + BPHY24TrackIsolationDecoratorV0] trigger_list = [ # Pure muon triggers "HLT_mu11_mu6_bDimu", @@ -441,10 +458,10 @@ def BPHY24Cfg(ConfigFlags): name = "BPHY24_Thin_Egamma", SGKey = "Electrons", StreamName = streamName, - InDetTrackParticlesKey = "InDetTrackParticles") + InDetTrackParticlesKey = mainIDInput) thinList += [BPHY24_Thin_Egamma] - # Primary vertices + # Primary vertices BPHY24_Thin_PV = CompFactory.DerivationFramework.BPhysPVThinningTool( name = "BPHY24_Thin_PV", CandidateCollections = finalCandidateList, StreamName = streamName, @@ -505,6 +522,7 @@ def BPHY24Cfg(ConfigFlags): BPHY24SlimmingHelper.SmartCollections = [ "Electrons", "Muons", "InDetTrackParticles", "InDetLargeD0TrackParticles" ] # Full combined muon-ID tracks + AllVariables += ["InDetLargeD0TrackParticles"] AllVariables += [ "CombinedMuonTrackParticles" ] AllVariables += [ "ExtrapolatedMuonTrackParticles" ] ExtraVariables += [ "Muons.etaLayer1Hits.etaLayer2Hits.etaLayer3Hits.etaLayer4Hits.phiLayer1Hits.phiLayer2Hits.phiLayer3Hits.phiLayer4Hits", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/V0ToolConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/V0ToolConfig.py index edde05dc261ec3c43748359439e67700a98679bf..5c8bc9c004786bfaf2872c92dd94037d057c85c4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/V0ToolConfig.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/V0ToolConfig.py @@ -2,7 +2,7 @@ def BPHY_InDetV0FinderToolCfg(flags, derivation, V0ContainerName, KshortContainerName, - LambdaContainerName, LambdabarContainerName,TrackParticleCollection="InDetTrackParticles",): + LambdaContainerName, LambdabarContainerName,TrackParticleCollection="InDetTrackParticles",RelinkTracks=[]): from InDetConfig.InDetV0FinderConfig import InDetV0FinderToolCfg return InDetV0FinderToolCfg(flags, name = derivation + "_InDetV0FinderTool", @@ -10,4 +10,5 @@ def BPHY_InDetV0FinderToolCfg(flags, derivation, V0ContainerName=V0ContainerName, KshortContainerName=KshortContainerName, LambdaContainerName=LambdaContainerName, - LambdabarContainerName= LambdabarContainerName) + LambdabarContainerName= LambdabarContainerName, + RelinkTracks = RelinkTracks) \ No newline at end of file diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/BPhysPVCascadeTools.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/BPhysPVCascadeTools.cxx index 372984c3737512bff3ebe9d5e572137420b81f1a..f7a281e13313c07e9e9225acbe96c3601a8a339e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/BPhysPVCascadeTools.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/BPhysPVCascadeTools.cxx @@ -8,7 +8,7 @@ #include "TVector3.h" #include "DerivationFrameworkBPhys/BPhysPVTools.h" #include "TrkVKalVrtFitter/VxCascadeInfo.h" -#include "DerivationFrameworkBPhys/LocalVector.h" +#include <boost/container/static_vector.hpp> #include "JpsiUpsilonTools/PrimaryVertexRefitter.h" #include "HepPDT/ParticleDataTable.hh" #include <limits> @@ -218,6 +218,31 @@ void DerivationFramework::BPhysPVCascadeTools::PrepareVertexLinks(Trk::VxCascade } } +void DerivationFramework::BPhysPVCascadeTools::PrepareVertexLinks(Trk::VxCascadeInfo *result, const std::vector<const xAOD::TrackParticleContainer*>& trackCols ) +{ + auto &collection = result->vertices(); + for(auto v : collection) { + std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector; + for(auto mylink : v->trackParticleLinks()) { + const xAOD::TrackParticle* myptr= *mylink; + const xAOD::TrackParticleContainer* foundcontainer = nullptr; + for(auto col : trackCols){ + if(std::find(col->begin(), col->end(), myptr) != col->end()){ + foundcontainer =col; + break; + } + } + if(foundcontainer == nullptr){ + throw std::runtime_error("Could not find track in original containers"); + } + mylink.setStorableObject(*foundcontainer, true); + newLinkVector.push_back( mylink ); + } + v->clearTracks(); + v->setTrackParticleLinks( newLinkVector ); + } +} + std::vector<const xAOD::TrackParticle*> DerivationFramework::BPhysPVCascadeTools::CollectAllChargedTracks(const std::vector<xAOD::Vertex*> &cascadeVertices) { std::vector<const xAOD::TrackParticle*> exclTrk; @@ -281,8 +306,8 @@ StatusCode DerivationFramework::BPhysPVCascadeTools::FillCandwithRefittedVertice refPVvertexes_toDelete.push_back(refPV); } } - LocalVector<size_t, 4> indexesUsed; - LocalVector<std::pair<size_t, xAOD::BPhysHelper::pv_type>, 4> indexestoProcess; + boost::container::static_vector<size_t, 4> indexesUsed; + boost::container::static_vector<std::pair<size_t, xAOD::BPhysHelper::pv_type>, 4> indexestoProcess; if(doPt){ indexestoProcess.push_back(std::make_pair @@ -310,7 +335,8 @@ StatusCode DerivationFramework::BPhysPVCascadeTools::FillCandwithRefittedVertice auto pvtype = indexestoProcess[i].second; const xAOD::VertexContainer* ParentContainer = (refPVvertexes_toDelete.at(index)) ? refPvContainer : pvContainer; - if(ParentContainer == refPvContainer && !indexesUsed.contains(index)) { + if(ParentContainer == refPvContainer && std::find(indexesUsed.begin(), + indexesUsed.end(), index) == indexesUsed.end()) { // store the new vertex refPvContainer->push_back(refPVvertexes_toDelete.at(index)); indexesUsed.push_back(index); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDpstCascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDpstCascade.cxx index 0ff1e5bbb43088a348bab35def5998abf38875bb..7157e698c0b625b87a9454bc745fec1bef732378 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDpstCascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDpstCascade.cxx @@ -15,7 +15,6 @@ #include "xAODBPhys/BPhysHypoHelper.h" #include <algorithm> #include "xAODTracking/VertexContainer.h" -#include "DerivationFrameworkBPhys/LocalVector.h" #include "HepPDT/ParticleDataTable.hh" #include "TrkVKalVrtFitter/VxCascadeInfo.h" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDs1Cascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDs1Cascade.cxx index dd0f3ee034bb54c4a7f25dec6520b29e2f846803..c06d214e4baf3cef4cfca43fc43a894e8e90c984 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDs1Cascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDs1Cascade.cxx @@ -16,7 +16,6 @@ #include "xAODBPhys/BPhysHypoHelper.h" #include <algorithm> #include "xAODTracking/VertexContainer.h" -#include "DerivationFrameworkBPhys/LocalVector.h" #include "TrkVKalVrtFitter/VxCascadeInfo.h" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDsCascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDsCascade.cxx index ee7a44f8b932d3dd91bec15d881dfd3d71a934a9..deefb2771473a0dbb332217191e1de1684209113 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDsCascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusDsCascade.cxx @@ -15,7 +15,6 @@ #include "xAODBPhys/BPhysHypoHelper.h" #include <algorithm> #include "xAODTracking/VertexContainer.h" -#include "DerivationFrameworkBPhys/LocalVector.h" #include "HepPDT/ParticleDataTable.hh" #include "TrkVKalVrtFitter/VxCascadeInfo.h" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusPsiCascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusPsiCascade.cxx index 1f98805459ab9084e0c6a3817d4419edb49442a8..a42fb65be8a2e4d03d631a6f9aa422cb4723c779 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusPsiCascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusPsiCascade.cxx @@ -142,7 +142,7 @@ namespace DerivationFramework { for(unsigned int ic=0; ic<cascadeinfoContainer.size(); ic++) { Trk::VxCascadeInfo* cascade_info = cascadeinfoContainer[ic]; - if(cascade_info==nullptr) ATH_MSG_ERROR("CascadeInfo is null"); + assert(cascade_info!=nullptr); Trk::VxCascadeInfo* cascade_info_noConstr = cascadeinfoContainer_noConstr[ic]; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusV0Cascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusV0Cascade.cxx index 32c9cd15ba1663316196b2ad354b0398cc4d228b..d47a70159aa25c16cc5beac6918c92db93e73d9b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusV0Cascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/JpsiPlusV0Cascade.cxx @@ -16,7 +16,6 @@ #include "xAODBPhys/BPhysHypoHelper.h" #include <algorithm> #include "xAODTracking/VertexContainer.h" -#include "DerivationFrameworkBPhys/LocalVector.h" #include "HepPDT/ParticleDataTable.hh" #include "TrkVKalVrtFitter/VxCascadeInfo.h" @@ -71,6 +70,7 @@ namespace DerivationFramework { m_mass_jpsi = BPhysPVCascadeTools::getParticleMass(pdt, PDG::J_psi); m_mass_b0 = BPhysPVCascadeTools::getParticleMass(pdt, PDG::B0); m_mass_lambdaB = BPhysPVCascadeTools::getParticleMass(pdt, PDG::Lambda_b0); + ATH_CHECK(m_RelinkContainers.initialize()); return StatusCode::SUCCESS; } @@ -469,6 +469,13 @@ namespace DerivationFramework { mass_v0 = m_mass_lambda; Masses.push_back(m_mass_lambda); } + const EventContext& ctx = Gaudi::Hive::currentContext(); + std::vector<const xAOD::TrackParticleContainer*> trackCols; + for(const auto &str : m_RelinkContainers){ + SG::ReadHandle<xAOD::TrackParticleContainer> handle(str,ctx); + trackCols.push_back(handle.cptr()); + } + for(auto jpsi : *jpsiContainer) { //Iterate over Jpsi vertices @@ -545,19 +552,8 @@ namespace DerivationFramework { if (result != NULL) { // reset links to original tracks - auto &collection = result->vertices(); - std::vector<std::pair<xAOD::Vertex*, const xAOD::TrackParticleContainer*>> zip = {{collection[0], v0TrackContainer},{collection[1], jpsiTrackContainer}}; - for(auto & pair : zip) { - auto& v = pair.first; auto& c = pair.second; - std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector; - for(unsigned int i=0; i< v->trackParticleLinks().size(); i++) { - ElementLink<DataVector<xAOD::TrackParticle> > mylink=v->trackParticleLinks()[i]; // makes a copy (non-const) - mylink.setStorableObject(*c, true); - newLinkVector.push_back( mylink ); - } - v->clearTracks(); - v->setTrackParticleLinks( newLinkVector ); - } + if(trackCols.empty()) BPhysPVCascadeTools::PrepareVertexLinks(result.get(), v0TrackContainer); + else BPhysPVCascadeTools::PrepareVertexLinks(result.get(), trackCols); ATH_MSG_DEBUG("storing tracks " << ((result->vertices())[0])->trackParticle(0) << ", " << ((result->vertices())[0])->trackParticle(1) << ", " @@ -590,6 +586,8 @@ namespace DerivationFramework { return StatusCode::SUCCESS; } + + } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDpstCascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDpstCascade.cxx index 76b4cc68728758f19c4dafaa192a42ab4aa03569..b272e2dd644a6a383264a26ebb2d161b8a5b3340 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDpstCascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDpstCascade.cxx @@ -16,7 +16,6 @@ #include "xAODBPhys/BPhysHypoHelper.h" #include <algorithm> #include "xAODTracking/VertexContainer.h" -#include "DerivationFrameworkBPhys/LocalVector.h" #include "HepPDT/ParticleDataTable.hh" #include "TrkVKalVrtFitter/VxCascadeInfo.h" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDsCascade.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDsCascade.cxx index f3490cfccdca3e1e28f4dab0321f0b6e43713a17..9ecf90be88d1421c49c5323c47113a3f89c92161 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDsCascade.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuPlusDsCascade.cxx @@ -7,7 +7,6 @@ #include "DerivationFrameworkBPhys/MuPlusDsCascade.h" #include "DerivationFrameworkBPhys/CascadeTools.h" #include "DerivationFrameworkBPhys/BPhysPVCascadeTools.h" -#include "DerivationFrameworkBPhys/LocalVector.h" #include "xAODBPhys/BPhysHypoHelper.h" #include "TrkVertexFitterInterfaces/IVertexFitter.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/src/SkimmingToolEXOT14.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/src/SkimmingToolEXOT14.cxx index 03b8ec392ea27be044170e60f2a19b807e04418b..a488c4c702d4d240e9436abda55a479338284600 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/src/SkimmingToolEXOT14.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/src/SkimmingToolEXOT14.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -79,7 +79,7 @@ StatusCode DerivationFramework::SkimmingToolEXOT14::initialize() //////////////////////////// // trigger decision tool - if(m_trigDecisionTool.retrieve().isFailure()) { + if(m_trigDecisionTool.retrieve(DisableTool{!m_reqTrigger}).isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); return StatusCode::FAILURE; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG1D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG1D1.py index 3ab78aedb2fa66ff6b4c561025d68ae4da7d3b42..d1992badecb4a60ff02d74578e6ea50c8639b1e9 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG1D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG1D1.py @@ -13,29 +13,29 @@ from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import MetadataCategory # Main algorithm config -def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): +def HIGG1D1KernelCfg(flags, name='HIGG1D1Kernel', **kwargs): """Configure the derivation framework driving algorithm (kernel) for HIGG1D1""" acc = ComponentAccumulator() # Common augmentations from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg - acc.merge(PhysCommonAugmentationsCfg(ConfigFlags, TriggerListsHelper = kwargs['TriggerListsHelper'])) + acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper'])) # Diphoton Vertex creation from DerivationFrameworkHiggs.HIGG1D1CustomVertexConfig import ZeeVertexRefitterCfg, DiPhotonVertexCfg from DerivationFrameworkHiggs.HIGG1D1CustomJetsConfig import HIGG1D1CustomJetsCfg - acc.merge(ZeeVertexRefitterCfg(ConfigFlags)) - acc.merge(DiPhotonVertexCfg(ConfigFlags)) + acc.merge(ZeeVertexRefitterCfg(flags)) + acc.merge(DiPhotonVertexCfg(flags)) #CustomJetsConfig - acc.merge(HIGG1D1CustomJetsCfg(ConfigFlags)) + acc.merge(HIGG1D1CustomJetsCfg(flags)) from DerivationFrameworkFlavourTag.FtagDerivationConfig import FtagJetCollectionsCfg - acc.merge(FtagJetCollectionsCfg(ConfigFlags, ['AntiKt4EMPFlowCustomVtxJets'], ['HggPrimaryVertices'])) + acc.merge(FtagJetCollectionsCfg(flags, ['AntiKt4EMPFlowCustomVtxJets'], ['HggPrimaryVertices'])) #Custom MET from DerivationFrameworkJetEtMiss.METCommonConfig import METCustomVtxCfg - acc.merge(METCustomVtxCfg(ConfigFlags, 'HggPrimaryVertices', 'AntiKt4EMPFlowCustomVtx', 'CHSGCustomVtxParticleFlowObjects')) + acc.merge(METCustomVtxCfg(flags, 'HggPrimaryVertices', 'AntiKt4EMPFlowCustomVtx', 'CHSGCustomVtxParticleFlowObjects')) # Thinning tools... from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, TauTrackParticleThinningCfg, DiTauTrackParticleThinningCfg @@ -45,7 +45,7 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): thinningTools = [] # Truth thinning - if ConfigFlags.Input.isMC: + if flags.Input.isMC: truth_conditions = ["((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))", # W, Z and Higgs "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))", # Leptons "((abs(TruthParticles.pdgId) == 6))", # Top quark @@ -55,7 +55,7 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): truth_expression = f'({" || ".join(truth_conditions)})' HIGG1D1GenericTruthThinningTool = acc.getPrimaryAndMerge(GenericTruthThinningCfg( - ConfigFlags, + flags, name = "HIGG1D1GenericTruthThinningTool", StreamName = kwargs['StreamName'], ParticleSelectionString = truth_expression, @@ -68,7 +68,7 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/DaodRecommendations HIGG1D1_thinning_expression = "InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta) < 3.0*mm && InDetTrackParticles.pt > 10*GeV" HIGG1D1TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg( - ConfigFlags, + flags, name = "HIGG1D1TrackParticleThinningTool", StreamName = kwargs['StreamName'], SelectionString = HIGG1D1_thinning_expression, @@ -76,7 +76,7 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): # Include inner detector tracks associated with muons HIGG1D1MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg( - ConfigFlags, + flags, name = "HIGG1D1MuonTPThinningTool", StreamName = kwargs['StreamName'], MuonKey = "Muons", @@ -84,7 +84,7 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): # Only keep tau tracks (and associated ID tracks) classified as charged tracks HIGG1D1TauTPThinningTool = acc.getPrimaryAndMerge(TauTrackParticleThinningCfg( - ConfigFlags, + flags, name = "HIGG1D1TauTPThinningTool", StreamName = kwargs['StreamName'], TauKey = "TauJets", @@ -94,21 +94,21 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): # ID tracks associated with high-pt di-tau HIGG1D1DiTauTPThinningTool = acc.getPrimaryAndMerge(DiTauTrackParticleThinningCfg( - ConfigFlags, + flags, name = "HIGG1D1DiTauTPThinningTool", StreamName = kwargs['StreamName'], DiTauKey = "DiTauJets", InDetTrackParticlesKey = "InDetTrackParticles")) ## Low-pt di-tau thinning - HIGG1D1DiTauLowPtThinningTool = acc.getPrimaryAndMerge(GenericObjectThinningCfg(ConfigFlags, + HIGG1D1DiTauLowPtThinningTool = acc.getPrimaryAndMerge(GenericObjectThinningCfg(flags, name = "PHYSDiTauLowPtThinningTool", StreamName = kwargs['StreamName'], ContainerName = "DiTauJetsLowPt", SelectionString = "DiTauJetsLowPt.nSubjets > 1")) # ID tracks associated with low-pt ditau - HIGG1D1DiTauLowPtTPThinningTool = acc.getPrimaryAndMerge(DiTauTrackParticleThinningCfg(ConfigFlags, + HIGG1D1DiTauLowPtTPThinningTool = acc.getPrimaryAndMerge(DiTauTrackParticleThinningCfg(flags, name = "PHYSDiTauLowPtTPThinningTool", StreamName = kwargs['StreamName'], DiTauKey = "DiTauJetsLowPt", @@ -120,22 +120,22 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): from DerivationFrameworkHiggs.SkimmingToolHIGG1Config import SkimmingToolHIGG1Cfg # Requires something in this list of triggers - SkipTriggerRequirement = ConfigFlags.Input.isMC and float(ConfigFlags.Beam.Energy) == 4000000.0 + SkipTriggerRequirement = (flags.Input.isMC and float(flags.Beam.Energy) == 4000000.0) or not flags.Reco.EnableTrigger # 8 TeV MC does not have trigger information print("HIGG1D1.py SkipTriggerRequirement", SkipTriggerRequirement) TriggerExp = [] if not SkipTriggerRequirement: - if float(ConfigFlags.Beam.Energy) == 4000000.0: + if float(flags.Beam.Energy) == 4000000.0: # 8 TeV data TriggerExp = ["EF_g35_loose_g25_loose"] - if float(ConfigFlags.Beam.Energy) == 6500000.0: + if float(flags.Beam.Energy) == 6500000.0: # 13 TeV MC TriggerExp = ["HLT_2g50_loose_L12EM20VH","HLT_2g25_loose_g15_loose","HLT_g35_medium_g25_medium_L12EM20VH","HLT_2g25_tight_L12EM20VH","HLT_2g22_tight_L12EM15VHI","HLT_g35_loose_g25_loose","HLT_g35_medium_g25_medium","HLT_2g50_loose","HLT_2g20_tight","HLT_2g22_tight","HLT_2g20_tight_icalovloose_L12EM15VHI","HLT_2g20_tight_icalotight_L12EM15VHI","HLT_2g22_tight_L12EM15VHI","HLT_2g22_tight_icalovloose_L12EM15VHI","HLT_2g22_tight_icalotight_L12EM15VHI","HLT_2g22_tight_icalovloose","HLT_2g25_tight_L12EM20VH","HLT_2g20_loose","HLT_2g20_loose_L12EM15","HLT_g35_medium_g25_medium","HLT_g35_medium_g25_medium_L12EM15VH","HLT_g35_loose_g25_loose","HLT_g35_loose_g25_loose_L12EM15VH", "HLT_2g20_loose_g15_loose", "HLT_3g20_loose", "HLT_3g15_loose", "HLT_2g6_tight_icalotight_L1J100", "HLT_2g6_loose_L1J100", "HLT_2g6_tight_icalotight_L1J50", "HLT_2g6_loose_L1J50","HLT_g120_loose","HLT_g140_loose"] - if float(ConfigFlags.Beam.Energy) == 6800000.0: + if float(flags.Beam.Energy) == 6800000.0: # 13.6 TeV TriggerExp = ["HLT_2g50_loose_L12EM20VH","HLT_2g25_loose_g15_loose_L12EM20VH","HLT_g35_medium_g25_medium_L12EM20VH","HLT_2g22_tight_L12EM15VHI","HLT_2g20_tight_icaloloose_L12EM15VHI","HLT_2g20_loose_L12EM15VH","HLT_2g9_loose_25dphiAA_invmAA80_L12EM7","HLT_2g15_loose_25dphiAA_invmAA80_L12EM7","HLT_2g15_tight_25dphiAA_invmAA80_L12EM7","HLT_2g15_tight_25dphiAA_L12EM7","HLT_g120_loose_L1EM22VHI","HLT_g140_loose_L1EM22VHI","HLT_2g50_loose_L12eEM24L","HLT_2g25_loose_g15_loose_L12eEM24L","HLT_g35_medium_g25_medium_L12eEM24L","HLT_2g22_tight_L12eEM18M","HLT_2g20_tight_icaloloose_L12eEM18M","HLT_2g20_loose_L12eEM18L","HLT_2g9_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM9","HLT_2g15_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM15M","HLT_2g15_tight_25dphiAA_L1DPHI-M70-2eEM15M","HLT_2g15_tight_L1DPHI-M70-2eEM15M","HLT_g120_loose_L1eEM26M","HLT_g140_loose_L1eEM26M"] print("HIGG1D1.py Skimming Tool Triggers:", ",".join(TriggerExp)) - skimmingTool = acc.popToolsAndMerge( SkimmingToolHIGG1Cfg(ConfigFlags,RequireTrigger=not SkipTriggerRequirement,Triggers=TriggerExp) ) + skimmingTool = acc.popToolsAndMerge( SkimmingToolHIGG1Cfg(flags,RequireTrigger=not SkipTriggerRequirement,Triggers=TriggerExp) ) acc.addPublicTool(skimmingTool) @@ -151,11 +151,11 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): # Max Cell sum decoration tool #==================================================================== from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - acc.merge(LArOnOffIdMappingCfg(ConfigFlags)) + acc.merge(LArOnOffIdMappingCfg(flags)) augmentationTools = [] from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import MaxCellDecoratorCfg - MaxCellDecorator = acc.popToolsAndMerge(MaxCellDecoratorCfg(ConfigFlags)) + MaxCellDecorator = acc.popToolsAndMerge(MaxCellDecoratorCfg(flags)) acc.addPublicTool(MaxCellDecorator) augmentationTools.append(MaxCellDecorator) #==================================================================== @@ -163,7 +163,7 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): #==================================================================== from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import GainDecoratorCfg, ClusterEnergyPerLayerDecoratorCfg - GainDecoratorTool = acc.popToolsAndMerge(GainDecoratorCfg(ConfigFlags)) + GainDecoratorTool = acc.popToolsAndMerge(GainDecoratorCfg(flags)) acc.addPublicTool(GainDecoratorTool) augmentationTools.append(GainDecoratorTool) @@ -171,16 +171,16 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): cluster_sizes = (3,5), (5,7), (7,7), (7,11) for neta, nphi in cluster_sizes: cename = "ClusterEnergyPerLayerDecorator_%sx%s" % (neta, nphi) - ClusterEnergyPerLayerDecorator = acc.popToolsAndMerge( ClusterEnergyPerLayerDecoratorCfg(ConfigFlags, neta = neta, nphi=nphi, name=cename )) + ClusterEnergyPerLayerDecorator = acc.popToolsAndMerge( ClusterEnergyPerLayerDecoratorCfg(flags, neta = neta, nphi=nphi, name=cename )) acc.addPublicTool(ClusterEnergyPerLayerDecorator) augmentationTools.append(ClusterEnergyPerLayerDecorator) #==================================================================== # Truth categories decoration tool #==================================================================== - if ConfigFlags.Input.isMC: + if flags.Input.isMC: from DerivationFrameworkHiggs.TruthCategoriesConfig import TruthCategoriesDecoratorCfg - acc.merge(TruthCategoriesDecoratorCfg(ConfigFlags, name="TruthCategoriesDecorator")) + acc.merge(TruthCategoriesDecoratorCfg(flags, name="TruthCategoriesDecorator")) DerivationKernel = CompFactory.DerivationFramework.DerivationKernel acc.addEventAlgo(DerivationKernel(name, @@ -190,14 +190,14 @@ def HIGG1D1KernelCfg(ConfigFlags, name='HIGG1D1Kernel', **kwargs): return acc -def HIGG1D1Cfg(ConfigFlags): +def HIGG1D1Cfg(flags): acc = ComponentAccumulator() from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper - HIGG1D1TriggerListsHelper = TriggerListsHelper(ConfigFlags) + HIGG1D1TriggerListsHelper = TriggerListsHelper(flags) - acc.merge(HIGG1D1KernelCfg(ConfigFlags, name="HIGG1D1Kernel", StreamName = 'StreamDAOD_HIGG1D1', TriggerListsHelper = HIGG1D1TriggerListsHelper)) + acc.merge(HIGG1D1KernelCfg(flags, name="HIGG1D1Kernel", StreamName = 'StreamDAOD_HIGG1D1', TriggerListsHelper = HIGG1D1TriggerListsHelper)) # ============================ @@ -207,7 +207,7 @@ def HIGG1D1Cfg(ConfigFlags): from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper - HIGG1D1SlimmingHelper = SlimmingHelper("HIGG1D1SlimmingHelper", NamesAndTypes = ConfigFlags.Input.TypedCollections, ConfigFlags = ConfigFlags) + HIGG1D1SlimmingHelper = SlimmingHelper("HIGG1D1SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, ConfigFlags = flags) HIGG1D1SlimmingHelper.SmartCollections = ["EventInfo", "Electrons", "Photons", @@ -250,7 +250,7 @@ def HIGG1D1Cfg(ConfigFlags): HIGG1D1SlimmingHelper.IncludeMinBiasTriggerContent = False # Truth containers - if ConfigFlags.Input.isMC: + if flags.Input.isMC: HIGG1D1SlimmingHelper.AppendToDictionary = {'TruthEvents':'xAOD::TruthEventContainer','TruthEventsAux':'xAOD::TruthEventAuxContainer', 'MET_Truth':'xAOD::MissingETContainer','MET_TruthAux':'xAOD::MissingETAuxContainer', 'TruthElectrons':'xAOD::TruthParticleContainer','TruthElectronsAux':'xAOD::TruthParticleAuxContainer', @@ -293,13 +293,16 @@ def HIGG1D1Cfg(ConfigFlags): HIGG1D1SlimmingHelper.ExtraVariables += ["Electrons.TruthLink", "Muons.TruthLink", "Photons.TruthLink", - "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", - "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", - "TruthPrimaryVertices.t.x.y.z", - "EventInfo.hardScatterVertexLink.timeStampNSOffset", - "TauJets.dRmax.etOverPtLeadTrk", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey", - "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey"] + "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", + "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt", + "TruthPrimaryVertices.t.x.y.z", + "EventInfo.hardScatterVertexLink.timeStampNSOffset", + "TauJets.dRmax.etOverPtLeadTrk"] + if flags.Reco.EnableTrigger: + HIGG1D1SlimmingHelper.ExtraVariables += [ + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey", + "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey" + ] # Additional content for HIGG1D1 HIGG1D1SlimmingHelper.AppendToDictionary.update({"AntiKt4EMPFlowCustomVtxJets": "xAOD::JetContainer", "AntiKt4EMPFlowCustomVtxJetsAux":"xAOD::JetAuxContainer", @@ -325,10 +328,10 @@ def HIGG1D1Cfg(ConfigFlags): "AFPToFTrackContainer"] # Add Btagging information from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent,BTaggingXbbContent - HIGG1D1SlimmingHelper.ExtraVariables += BTaggingStandardContent("AntiKt4EMPFlowCustomVtxJets", ConfigFlags) - HIGG1D1SlimmingHelper.ExtraVariables += BTaggingStandardContent("AntiKt4EMPFlowJets", ConfigFlags) - HIGG1D1SlimmingHelper.ExtraVariables += BTaggingXbbContent("AntiKt4EMPFlowCustomVtxJets", ConfigFlags) - HIGG1D1SlimmingHelper.ExtraVariables += BTaggingXbbContent("AntiKt4EMPFlowJets", ConfigFlags) + HIGG1D1SlimmingHelper.ExtraVariables += BTaggingStandardContent("AntiKt4EMPFlowCustomVtxJets", flags) + HIGG1D1SlimmingHelper.ExtraVariables += BTaggingStandardContent("AntiKt4EMPFlowJets", flags) + HIGG1D1SlimmingHelper.ExtraVariables += BTaggingXbbContent("AntiKt4EMPFlowCustomVtxJets", flags) + HIGG1D1SlimmingHelper.ExtraVariables += BTaggingXbbContent("AntiKt4EMPFlowJets", flags) # is this really needed given Photons are in the AllVariables list ? from DerivationFrameworkEGamma.PhotonsCPDetailedContent import PhotonsCPDetailedContent @@ -400,7 +403,7 @@ def HIGG1D1Cfg(ConfigFlags): # Trigger matching # Run 2 - if ConfigFlags.Trigger.EDMVersion == 2: + if flags.Trigger.EDMVersion == 2: from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = HIGG1D1SlimmingHelper, OutputContainerPrefix = "TrigMatch_", @@ -409,7 +412,7 @@ def HIGG1D1Cfg(ConfigFlags): OutputContainerPrefix = "TrigMatch_", TriggerList = HIGG1D1TriggerListsHelper.Run2TriggerNamesNoTau) # Run 3 - if ConfigFlags.Trigger.EDMVersion == 3: + if flags.Trigger.EDMVersion == 3: from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(HIGG1D1SlimmingHelper) # Run 2 is added here temporarily to allow testing/comparison/debugging @@ -423,7 +426,7 @@ def HIGG1D1Cfg(ConfigFlags): # Output stream HIGG1D1ItemList = HIGG1D1SlimmingHelper.GetItemList() - acc.merge(OutputStreamCfg(ConfigFlags, "DAOD_HIGG1D1", ItemList=HIGG1D1ItemList, AcceptAlgs=["HIGG1D1Kernel"])) - acc.merge(SetupMetaDataForStreamCfg(ConfigFlags, "DAOD_HIGG1D1", AcceptAlgs=["HIGG1D1Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData])) + acc.merge(OutputStreamCfg(flags, "DAOD_HIGG1D1", ItemList=HIGG1D1ItemList, AcceptAlgs=["HIGG1D1Kernel"])) + acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_HIGG1D1", AcceptAlgs=["HIGG1D1Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData])) return acc diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx index fe1b0dafc924f4a090dd0b9288dab6332aa1cf88..dccf4cbe74192b1df644245a3dff28cf359475ae 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -84,7 +84,7 @@ StatusCode DerivationFramework::SkimmingToolHIGG1::initialize() //////////////////////////// // trigger decision tool - if(m_trigDecisionTool.retrieve().isFailure()) { + if(m_trigDecisionTool.retrieve(DisableTool{!m_reqTrigger}).isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); return StatusCode::FAILURE; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx index 20179c5760a7b13bf995507461dc3133c86f962b..32b17ff0231def175a9a24f7ae4575ce2dff2ad8 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -126,7 +126,7 @@ StatusCode DerivationFramework::SkimmingToolHIGG2::initialize() // } // trigger decision tool - if(m_trigDecisionTool.retrieve().isFailure()) { + if(m_trigDecisionTool.retrieve(DisableTool{m_skipTriggerRequirement}).isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); return StatusCode::FAILURE; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx index 54afb7eb1c4f552f049fbc5db054ab3a7c266bdd..cb96307749b006ac7bf9e94ff870493787d7a06a 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -68,7 +68,7 @@ StatusCode DerivationFramework::SkimmingToolHIGG5VBF::initialize() ATH_MSG_VERBOSE("initialize() ..."); // trigger decision tool - if(m_trigDecisionTool.retrieve().isFailure()) { + if(m_trigDecisionTool.retrieve(DisableTool{!m_reqTrigger}).isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); return StatusCode::FAILURE; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/ZeeVertexRefittingTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/ZeeVertexRefittingTool.cxx index bc48ea6e4e0c366d6d9f3f54a3948005353fcb1c..5b6756e7364332bdfc8cb6be790f61dabe5aefab 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/ZeeVertexRefittingTool.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/ZeeVertexRefittingTool.cxx @@ -22,7 +22,10 @@ namespace DerivationFramework { - static const SG::AuxElement::Decorator<float> sumPt2("sumPt2"); + static const SG::AuxElement::Decorator<float> sumPt2("sumPt2"); + static const SG::AuxElement::Decorator<float> vertices_dPhi("vertices_dPhi"); + static const SG::AuxElement::Decorator<float> vertices_sumPt("vertices_sumPt"); + static const SG::AuxElement::Decorator<float> vertices_sumPt2("vertices_sumPt2"); static const SG::AuxElement::Decorator<std::vector<ElementLink<xAOD::TrackParticleContainer> > > electronTrackLinksDecor("ElectronTrackLinks"); ZeeVertexRefittingTool::ZeeVertexRefittingTool(const std::string& t, @@ -125,10 +128,52 @@ namespace DerivationFramework { xAOD::EgammaHelpers::getOriginalTrackParticle( electrons->at(pair[0]) ), xAOD::EgammaHelpers::getOriginalTrackParticle( electrons->at(pair[1]) ) }; + + TLorentzVector v0, v1, egamVec; + if(electrons->at(pair[0])->caloCluster()) + { + v0.SetPtEtaPhiM(electrons->at(pair[0])->e()/cosh(electrons->at(pair[0])->caloCluster()->etaBE(2)), + electrons->at(pair[0])->caloCluster()->etaBE(2), + electrons->at(pair[0])->caloCluster()->phiBE(2), + 0.0); + } + + if(electrons->at(pair[1])->caloCluster()) + { + v1.SetPtEtaPhiM(electrons->at(pair[1])->e()/cosh(electrons->at(pair[1])->caloCluster()->etaBE(2)), + electrons->at(pair[1])->caloCluster()->etaBE(2), + electrons->at(pair[1])->caloCluster()->phiBE(2), + 0.0); + } + + egamVec = v0+v1; + ATH_MSG_DEBUG("Refitting PV for e tracks: " << tps[0] << " " << tps[1]); xAOD::Vertex* pv_ref = m_pvrefitter->refitVertex(pv,tps); if (pv_ref) { refittedPVContainer->push_back(pv_ref); + + int ipv = 0; + for (const xAOD::Vertex* v : *pv_cont) { + xAOD::Vertex * nv = new xAOD::Vertex(); + nv->makePrivateStore(v); + if(ipv !=0 ) refittedPVContainer->push_back(nv); + ipv++; + } + + for ( xAOD::Vertex *v : *refittedPVContainer ) + { + float vert_sumpt = (log10(xAOD::PVHelpers::getVertexSumPt(v))); + float vert_sumpt2 = (log10(xAOD::PVHelpers::getVertexSumPt(v,2, false))); + + TLorentzVector vtxmom = xAOD::PVHelpers::getVertexMomentum(v, true, ""); + float vert_dphi = (fabs(vtxmom.DeltaPhi(egamVec))); + //fill vertex variables + vertices_sumPt(*v) = vert_sumpt; + vertices_sumPt2(*v) = vert_sumpt2; + vertices_dPhi(*v) = vert_dphi; + } + ATH_MSG_DEBUG("refitted PV nTP: " << pv_ref->nTrackParticles() << " -- " << pv->nTrackParticles()); ATH_MSG_DEBUG("refitted PV z: " << pv_ref->z() << " -- " << pv->z()); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetToolsConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetToolsConfig.py index b84c42cf5eeca81e75120fd91cb91a4fd749f2da..66635051968df07c7b90b77b4e5aad3edb553b48 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetToolsConfig.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/python/InDetToolsConfig.py @@ -146,6 +146,18 @@ def ITkTrackStateOnSurfaceDecoratorCfg(flags, name, **kwargs): name, **kwargs), primary=True) return acc + +def ITkSiSPTrackStateOnSurfaceDecoratorCfg( + flags, name="SiSPTrackStateOnSurfaceDecorator", **kwargs): + kwargs.setdefault("ContainerName", "SiSPSeededTracksTrackParticles") + kwargs.setdefault("DecorationPrefix", "SiSP_") + kwargs.setdefault("PixelMsosName", "SiSP_ITkPixel_MSOSs") + kwargs.setdefault("SctMsosName", "SiSP_ITkStrip_MSOSs") + kwargs.setdefault("AddPRD", True) + kwargs.setdefault("StoreHoles", False) + return ITkTrackStateOnSurfaceDecoratorCfg(flags, name, **kwargs) + + # Expression of Z0 at the primary vertex diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JETM1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JETM1.py index 014028583510c9778092879be1d185e8fa82e186..1d7cdd210d670a366155dc4a6e029b10951f99ee 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JETM1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JETM1.py @@ -225,7 +225,7 @@ def JETM1ExtraContentCfg(ConfigFlags): from JetRecConfig.JetRecConfig import JetRecCfg, getModifier from JetRecConfig.JetConfigFlags import jetInternalFlags from JetRecConfig.StandardJetMods import stdJetModifiers - from JetRecConfig.StandardSmallRJets import AntiKt4PV0Track, AntiKt4EMPFlow, AntiKt4EMPFlowNoPtCut, AntiKt4EMTopoLowPt, AntiKt4EMPFlowCSSKNoPtCut, AntiKt4UFOCSSKNoPtCut + from JetRecConfig.StandardSmallRJets import AntiKt4PV0Track, AntiKt4EMPFlow, AntiKt4EMPFlowNoPtCut, AntiKt4EMTopoNoPtCut, AntiKt4EMPFlowCSSKNoPtCut, AntiKt4UFOCSSKNoPtCut #======================================= # Schedule additional jet decorations @@ -244,7 +244,7 @@ def JETM1ExtraContentCfg(ConfigFlags): # SCHEDULE SMALL-R JETS WITH NO PT CUT #======================================= if ConfigFlags.Input.isMC: - jetList += [AntiKt4EMPFlowNoPtCut, AntiKt4EMTopoLowPt] + jetList += [AntiKt4EMPFlowNoPtCut, AntiKt4EMTopoNoPtCut] #======================================= # CSSK R = 0.4 EMPFlow and UFO jets @@ -366,7 +366,7 @@ def JETM1Cfg(ConfigFlags): JETM1SlimmingHelper.IncludeBPhysTriggerContent = False JETM1SlimmingHelper.IncludeMinBiasTriggerContent = False - jetOutputList = ["AntiKt4PV0TrackJets","AntiKt4EMPFlowCSSKNoPtCutJets","AntiKt4UFOCSSKNoPtCutJets","AntiKt4EMPFlowNoPtCutJets","AntiKt4EMTopoLowPtJets"] + jetOutputList = ["AntiKt4PV0TrackJets","AntiKt4EMPFlowCSSKNoPtCutJets","AntiKt4UFOCSSKNoPtCutJets","AntiKt4EMPFlowNoPtCutJets","AntiKt4EMTopoNoPtCutJets"] from DerivationFrameworkJetEtMiss.JetCommonConfig import addJetsToSlimmingTool addJetsToSlimmingTool(JETM1SlimmingHelper, jetOutputList, JETM1SlimmingHelper.SmartCollections) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/CMakeLists.txt index 9224cb3419e72bbc7433f87480c5bf9b8c095f78..6451b5e002ccbec1841588c8354ff9b164864c2b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/CMakeLists.txt @@ -4,13 +4,15 @@ atlas_subdir( DerivationFrameworkLLP ) # External dependencies: +find_package( FastJet ) +find_package( FastJetContrib COMPONENTS Nsubjettiness EnergyCorrelator ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( DerivationFrameworkLLP src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks AthenaBaseComps AthenaKernel AtlasDetDescr CommissionEvent DerivationFrameworkInterfaces ExpressionEvaluationLib FourMomUtils GaudiKernel InDetIdentifier InDetPrepRawData InDetRIO_OnTrack InDetRecToolInterfaces InDetReadoutGeometry InDetTrackSelectionToolLib InDetConditionsSummaryService LArRecEvent PixelConditionsData SCT_CablingLib SCT_ConditionsToolsLib StoreGateLib TRT_ConditionsServicesLib TRT_ElectronPidToolsLib TRT_ReadoutGeometry TrigDecisionToolLib TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkExInterfaces TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkToolInterfaces TrkTrack TrkVertexFitterInterfaces xAODBase xAODCore xAODEgamma xAODEventInfo xAODJet xAODMuon xAODTau xAODTracking ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES} AthLinks AthenaBaseComps AthenaKernel AtlasDetDescr CommissionEvent DerivationFrameworkInterfaces ExpressionEvaluationLib FourMomUtils GaudiKernel InDetIdentifier InDetPrepRawData InDetRIO_OnTrack InDetRecToolInterfaces InDetReadoutGeometry InDetTrackSelectionToolLib InDetConditionsSummaryService LArRecEvent PixelConditionsData SCT_CablingLib SCT_ConditionsToolsLib StoreGateLib TRT_ConditionsServicesLib TRT_ElectronPidToolsLib TRT_ReadoutGeometry TrigDecisionToolLib TrkCompetingRIOsOnTrack TrkEventPrimitives TrkEventUtils TrkExInterfaces TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkToolInterfaces TrkTrack TrkVertexFitterInterfaces xAODBase xAODCore xAODEgamma xAODEventInfo xAODJet xAODMuon xAODTau xAODTracking JetSubStructureUtils ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/DerivationFrameworkLLP/RCJetSubstructureAug.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/DerivationFrameworkLLP/RCJetSubstructureAug.h new file mode 100644 index 0000000000000000000000000000000000000000..e19afd54db062105eb11c31ca19afc226026799d --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/DerivationFrameworkLLP/RCJetSubstructureAug.h @@ -0,0 +1,124 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// RCJetSubstructureAug.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: G. Albouy (galbouy@lpsc.in2p3.fr) +// This tool computes substructure variables for ReClustered jets +// from LCTopo clusters ghost associated to RC jets +// by constructing cluster jets + +#ifndef DERIVATIONFRAMEWORK_RCJetSubstructureAug_H +#define DERIVATIONFRAMEWORK_RCJetSubstructureAug_H + +#include <string> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "DerivationFrameworkInterfaces/IAugmentationTool.h" +#include "xAODJet/JetContainer.h" +#include "StoreGate/ReadHandleKey.h" + +#include "ExpressionEvaluation/ExpressionParserUser.h" + +namespace DerivationFramework { + enum EJetParser { kRCJetSelection , kNumJetParser }; + class RCJetSubstructureAug : public extends<ExpressionParserUser<AthAlgTool, kNumJetParser>, IAugmentationTool> { + public: + RCJetSubstructureAug(const std::string& t, const std::string& n, const IInterface* p); + virtual ~RCJetSubstructureAug(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode addBranches() const override; + + private: + + StringProperty m_streamName + { this, "StreamName", "", "Name of the stream" }; + StringProperty m_ghostName + { this, "GhostClusterName", "GhostLCTopo", "Name of the ghost clusters"}; + StringProperty m_selectionString + { this, "SelectionString", "", "Selection to apply to jet"}; + StringProperty m_suffix + { this, "Suffix", "", "Suffix for variables"}; + + SG::ReadHandleKey< xAOD::JetContainer > m_jetKey{ this, "JetContainerKey", ""}; + + // Struct to hold all decorators + struct moments_t; + + moments_t* m_moments; + + }; + + struct RCJetSubstructureAug::moments_t { + /// Qw decorator + SG::AuxElement::Decorator<float> dec_Qw; + + /// Nsubjetiness decorators + SG::AuxElement::Decorator<float> dec_Tau1; + SG::AuxElement::Decorator<float> dec_Tau2; + SG::AuxElement::Decorator<float> dec_Tau3; + SG::AuxElement::Decorator<float> dec_Tau4; + SG::AuxElement::Decorator<float> dec_Tau21; + SG::AuxElement::Decorator<float> dec_Tau32; + + /// KtSplittingScale decorators + SG::AuxElement::Decorator<float> dec_Split12; + SG::AuxElement::Decorator<float> dec_Split23; + SG::AuxElement::Decorator<float> dec_Split34; + + /// Energy correlation factors decorators + SG::AuxElement::Decorator<float> dec_ECF1; + SG::AuxElement::Decorator<float> dec_ECF2; + SG::AuxElement::Decorator<float> dec_ECF3; + SG::AuxElement::Decorator<float> dec_ECF4; + SG::AuxElement::Decorator<float> dec_C2; + SG::AuxElement::Decorator<float> dec_D2; + + /// Cluster jets informations decorators + SG::AuxElement::Decorator<float> dec_pT; + SG::AuxElement::Decorator<float> dec_m; + SG::AuxElement::Decorator<float> dec_NClusts; + SG::AuxElement::Decorator<float> dec_eta; + SG::AuxElement::Decorator<float> dec_phi; + + /// Timing information + SG::AuxElement::Decorator<float> dec_timing; + + moments_t (const std::string& suffix): + + dec_Qw("Qw_" + suffix), + + dec_Tau1("Tau1_" + suffix), + dec_Tau2("Tau2_" + suffix), + dec_Tau3("Tau3_" + suffix), + dec_Tau4("Tau4_" + suffix), + dec_Tau21("Tau21_" + suffix), + dec_Tau32("Tau32_" + suffix), + + dec_Split12("Split12_" + suffix), + dec_Split23("Split23_" + suffix), + dec_Split34("Split34_" + suffix), + + dec_ECF1("ECF1_" + suffix), + dec_ECF2("ECF2_" + suffix), + dec_ECF3("ECF3_" + suffix), + dec_ECF4("ECF4_" + suffix), + dec_C2("C2_" + suffix), + dec_D2("D2_" + suffix), + + dec_pT("pT_" + suffix), + dec_m("m_" + suffix), + dec_NClusts("NClusts"), + dec_eta("eta_" + suffix), + dec_phi("phi_" + suffix), + + dec_timing("timing_" + suffix){} + + }; + +} + +#endif // DERIVATIONFRAMEWORK_RCJetSubstructureAug_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLP1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLP1.py index 1cdf9ce5a23dad7b4b299050ac2f5d3c8aad0e72..0f0aa52a32a18d46eabed98a179cc798a45e6662 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLP1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLP1.py @@ -85,8 +85,44 @@ def LLP1KernelCfg(ConfigFlags, name='LLP1Kernel', **kwargs): LLP1LRTMaxCellDecoratorTool ] # Common augmentations + from IsolationSelection.IsolationSelectionConfig import IsoCloseByCorrSkimmingAlgCfg, IsoCloseByCaloDecorCfg + acc.merge(IsoCloseByCorrSkimmingAlgCfg(ConfigFlags, ttva_wp = "Nonprompt_All_MaxWeight")) + + ### Associate the close-by pflow objects and the calorimeter clusters + acc.merge(IsoCloseByCaloDecorCfg(ConfigFlags, + containers = ["Electrons", "Muons", "Photons", "LRTElectrons", "MuonsLRT"] )) + + # Reclustered jets definitions + from JetRecConfig.JetRecConfig import registerAsInputConstit, JetRecCfg + from JetRecConfig.StandardSmallRJets import AntiKt4Truth, AntiKt4EMTopo + from JetRecConfig.JetDefinition import JetDefinition + from JetRecConfig.StandardJetConstits import stdConstitDic as cst + from JetRecConfig.JetConfigFlags import jetInternalFlags + + jetInternalFlags.isRecoJob = True + registerAsInputConstit(AntiKt4EMTopo) + registerAsInputConstit(AntiKt4Truth) + cst.AntiKt4EMTopoJets.label = "EMTopoRC" + cst.AntiKt4TruthJets.label = "TruthRC" + + AntiKt10RCEMTopo = JetDefinition( "AntiKt",1.0,cst.AntiKt4EMTopoJets, + ghostdefs = ["Track", "TrackLRT", "LCTopo"], + modifiers = ("Sort", "Filter:200000",), + standardRecoMode = True, + lock = True, + ) + if ConfigFlags.Input.isMC: + AntiKt10RCTruth = JetDefinition("AntiKt",1.0,cst.AntiKt4TruthJets, + ghostdefs = [], + modifiers = ("Sort", "Filter:200000",), + standardRecoMode = True, + lock = True + ) + from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg acc.merge(PhysCommonAugmentationsCfg(ConfigFlags, TriggerListsHelper = kwargs['TriggerListsHelper'])) + acc.merge(JetRecCfg(ConfigFlags,AntiKt10RCEMTopo)) + if ConfigFlags.Input.isMC: acc.merge(JetRecCfg(ConfigFlags,AntiKt10RCTruth)) # LRT Egamma from DerivationFrameworkEGamma.EGammaLRTConfig import EGammaLRTCfg @@ -238,6 +274,14 @@ def LLP1KernelCfg(ConfigFlags, name='LLP1Kernel', **kwargs): SelectionString = "(AntiKt4EMTopoJets.pt > 20.*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.5)", InDetTrackParticlesKey = "InDetTrackParticles")) + LLP1FatJetTPThinningTool = acc.getPrimaryAndMerge(JetTrackParticleThinningCfg( ConfigFlags, + name = "LLP1FatJetTPThinningTool", + StreamName = kwargs['StreamName'], + JetKey = "AntiKt10EMTopoRCJets", + SelectionString = "(AntiKt10EMTopoRCJets.pt > 200.*GeV) && (abs(AntiKt10EMTopoRCJets.eta) < 2.5)", + InDetTrackParticlesKey = "InDetTrackParticles", + )) + # LRT Tracks associated with jets if ConfigFlags.Tracking.doLargeD0: LLP1LRTJetTPThinningTool = acc.getPrimaryAndMerge(JetLargeD0TrackParticleThinningCfg(ConfigFlags, @@ -247,6 +291,14 @@ def LLP1KernelCfg(ConfigFlags, name='LLP1Kernel', **kwargs): SelectionString = "(AntiKt4EMTopoJets.pt > 20.*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.5)", InDetTrackParticlesKey = "InDetLargeD0TrackParticles")) + LLP1LRTFatJetTPThinningTool = acc.getPrimaryAndMerge(JetLargeD0TrackParticleThinningCfg(ConfigFlags, + name = "LLP1LRTFatJetTPThinningTool", + StreamName = kwargs['StreamName'], + JetKey = "AntiKt10EMTopoRCJets", + SelectionString = "(AntiKt10EMTopoRCJets.pt > 200.*GeV) && (abs(AntiKt10EMTopoRCJets.eta) < 2.5)", + InDetTrackParticlesKey = "InDetLargeD0TrackParticles", + )) + # Finally the kernel itself thinningTools = [LLP1TrackParticleThinningTool, LLP1MuonTPThinningTool, @@ -259,10 +311,27 @@ def LLP1KernelCfg(ConfigFlags, name='LLP1Kernel', **kwargs): LLP1DiTauLowPtTPThinningTool, LLP1VSITPThinningTool, LLP1LRTVSITPThinningTool, - LLP1JetTPThinningTool] + LLP1JetTPThinningTool, + LLP1FatJetTPThinningTool] if ConfigFlags.Tracking.doLargeD0: thinningTools.append(LLP1LRTJetTPThinningTool) + thinningTools.append(LLP1LRTFatJetTPThinningTool) + + # Additionnal augmentations + + # Compute RC substructure variables from energy clusters + from DerivationFrameworkLLP.LLPToolsConfig import RCJetSubstructureAugCfg + LLP1RCJetSubstructureAugTool = acc.getPrimaryAndMerge(RCJetSubstructureAugCfg(ConfigFlags, + name = "LLP1RCJetSubstructureAugTool", + StreamName = kwargs['StreamName'], + JetContainerKey = "AntiKt10EMTopoRCJets", + SelectionString = "(AntiKt10EMTopoRCJets.pt > 200.*GeV) && (abs(AntiKt10EMTopoRCJets.eta) < 2.5)", + GhostClusterName = "GhostLCTopo", + Suffix = "cluster" + )) + RCSubstructureAug = CompFactory.DerivationFramework.CommonAugmentation("RCSubstructureAug", AugmentationTools = [LLP1RCJetSubstructureAugTool]) + acc.addEventAlgo(RCSubstructureAug) # Skimming skimmingTools = [] @@ -285,7 +354,6 @@ def LLP1KernelCfg(ConfigFlags, name='LLP1Kernel', **kwargs): def LLP1Cfg(ConfigFlags): acc = ComponentAccumulator() - # Get the lists of triggers needed for trigger matching. # This is needed at this scope (for the slimming) and further down in the config chain # for actually configuring the matching, so we create it here and pass it down @@ -351,13 +419,12 @@ def LLP1Cfg(ConfigFlags): StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData] StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"] StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData] + StaticContent += ["xAOD::JetContainer#AntiKt10EMTopoRCJets","xAOD::JetAuxContainer#AntiKt10EMTopoRCJetsAux.-PseudoJet"] for wp in LLP1VrtSecInclusiveSuffixes: StaticContent += ["xAOD::VertexContainer#VrtSecInclusive_SecondaryVertices" + wp] StaticContent += ["xAOD::VertexAuxContainer#VrtSecInclusive_SecondaryVertices" + wp + "Aux."] - LLP1SlimmingHelper.StaticContent = StaticContent - LLP1SlimmingHelper.ExtraVariables += ["AntiKt10TruthTrimmedPtFrac5SmallR20Jets.Tau1_wta.Tau2_wta.Tau3_wta.D2.GhostBHadronsFinalCount", "Electrons.LHValue.DFCommonElectronsLHVeryLooseNoPixResult.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z.f3", "LRTElectrons.LHValue.DFCommonElectronsLHVeryLooseNoPixResult.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z.f3", @@ -368,12 +435,12 @@ def LLP1Cfg(ConfigFlags): "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.PartonTruthLabelID.DFCommonJets_fJvt.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt.GhostBHadronsFinal.GhostCHadronsFinal", "AntiKtVR30Rmax4Rmin02TrackJets_BTagging201903.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt.GhostTausFinal.GhostTausFinalCount", "AntiKtVR30Rmax4Rmin02TrackJets_BTagging201810.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt.GhostTausFinal.GhostTausFinalCount", - "TruthPrimaryVertices.t.x.y.z", - "PrimaryVertices.t.x.y.z", + "TruthPrimaryVertices.t.x.y.z.sumPt2", + "PrimaryVertices.t.x.y.z.sumPt2.covariance", "InDetTrackParticles.d0.z0.vz.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.hitPattern", "InDetLargeD0TrackParticles.d0.z0.vz.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.hitPattern", - "GSFTrackParticles.d0.z0.vz.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.numberOfPixelHoles.numberOfSCTHoles.numberDoF.chiSquared.hitPattern", - "LRTGSFTrackParticles.d0.z0.vz.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.numberOfPixelHoles.numberOfSCTHoles.numberDoF.chiSquared.hitPattern", + "GSFTrackParticles.d0.z0.vz.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.numberOfPixelHoles.numberOfSCTHoles.numberDoF.chiSquared.hitPattern.truthOrigin.truthType", + "LRTGSFTrackParticles.d0.z0.vz.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.truthParticleLink.truthMatchProbability.radiusOfFirstHit.numberOfPixelHoles.numberOfSCTHoles.numberDoF.chiSquared.hitPattern.truthOrigin.truthType", "EventInfo.hardScatterVertexLink.timeStampNSOffset", "TauJets.dRmax.etOverPtLeadTrk", "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey", @@ -392,19 +459,30 @@ def LLP1Cfg(ConfigFlags): LLP1SlimmingHelper.ExtraVariables += [ "GSFTrackParticles." + '.'.join( [ var + suffix for var in VSITrackAuxVars] ) ] LLP1SlimmingHelper.ExtraVariables += [ "LRTGSFTrackParticles." + '.'.join( [ var + suffix for var in VSITrackAuxVars] ) ] + #Variables to perform close-by-correction to isolation quantities + iso_corr_vars = [ "IsoCloseByCorr_assocClustEta", "IsoCloseByCorr_assocClustPhi", "IsoCloseByCorr_assocClustEnergy", + "IsoCloseByCorr_assocClustDecor", "IsoCloseByCorr_assocPflowEta", "IsoCloseByCorr_assocPflowPhi", "IsoCloseByCorr_assocPflowEnergy", + "IsoCloseByCorr_assocPflowDecor"] + + LLP1SlimmingHelper.ExtraVariables += ["Electrons."+(".".join(iso_corr_vars)), "LRTElectrons."+(".".join(iso_corr_vars)), + "Muons."+(".".join(iso_corr_vars)), "MuonsLRT."+(".".join(iso_corr_vars)) ] + # Truth containers if ConfigFlags.Input.isMC: from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool addTruth3ContentToSlimmerTool(LLP1SlimmingHelper) - LLP1SlimmingHelper.AllVariables += ['TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets'] + LLP1SlimmingHelper.AllVariables += ['TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets', 'AntiKt4TruthJets'] LLP1SlimmingHelper.ExtraVariables += ["Electrons.TruthLink", "LRTElectrons.TruthLink", "Muons.TruthLink", "MuonsLRT.TruthLink", "Photons.TruthLink"] + StaticContent += ["xAOD::JetContainer#AntiKt10TruthRCJets","xAOD::JetAuxContainer#AntiKt10TruthRCJetsAux.-PseudoJet"] + + LLP1SlimmingHelper.StaticContent = StaticContent # Trigger content LLP1SlimmingHelper.IncludeTriggerNavigation = False diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLPToolsConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLPToolsConfig.py index 2ad548e9c0e02496fb0f0beb87cdfe8625a4add6..63bfe3a126e4f30f0f1be6bc27408c6778a07171 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLPToolsConfig.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/python/LLPToolsConfig.py @@ -34,6 +34,15 @@ def JetLargeD0TrackParticleThinningCfg(ConfigFlags, name, **kwargs): primary = True) return acc +# RC jet substructure computation tool +def RCJetSubstructureAugCfg(ConfigFlags, name, **kwargs): + """Configure the RC jet substructure computation tool""" + acc = ComponentAccumulator() + RCJetSubstructureAug = CompFactory.DerivationFramework.RCJetSubstructureAug + acc.addPublicTool(RCJetSubstructureAug(name, **kwargs), + primary = True) + return acc + def LLP1TriggerSkimmingToolCfg(ConfigFlags, name, **kwargs): @@ -48,9 +57,10 @@ def LLP1TriggerSkimmingToolCfg(ConfigFlags, name, **kwargs): trig_elmu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8) trig_mug = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, additionalTriggerType=TriggerType.g, livefraction=0.8) + trig_EJ_Run3 = ["HLT_j200_0eta180_emergingPTF0p08dR1p2_a10sd_cssk_pf_jes_ftf_preselj200_L1J100", "HLT_j460_a10r_L1J100"] trig_VBF_2018 =["HLT_j55_gsc80_bmv2c1070_split_j45_gsc60_bmv2c1085_split_j45_320eta490", "HLT_j45_gsc55_bmv2c1070_split_2j45_320eta490_L1J25.0ETA23_2J15.31ETA49", "HLT_j80_0eta240_j60_j45_320eta490_AND_2j35_gsc45_bmv2c1070_split", "HLT_ht300_2j40_0eta490_invm700_L1HT150-J20s5.ETA31_MJJ-400-CF_AND_2j35_gsc45_bmv2c1070_split", "HLT_j70_j50_0eta490_invm1100j70_dphi20_deta40_L1MJJ-500-NFF"] - triggers = trig_el + trig_mu + trig_g + trig_elmu + trig_mug + trig_VBF_2018 + triggers = trig_el + trig_mu + trig_g + trig_elmu + trig_mug + trig_VBF_2018 + trig_EJ_Run3 #remove duplicates triggers = sorted(list(set(triggers))) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/JetLargeD0TrackParticleThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/JetLargeD0TrackParticleThinning.cxx index 6b5dd4b38aad601558a1ea06e021d2cf35cdb690..c607896434fa2c178188cabf3be578587b634c53 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/JetLargeD0TrackParticleThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/JetLargeD0TrackParticleThinning.cxx @@ -121,7 +121,7 @@ StatusCode DerivationFramework::JetLargeD0TrackParticleThinning::doThinning() co } } } else { // check only jets passing user selection string - for (xAOD::JetContainer::const_iterator jetIt=importedJets->begin(); jetIt!=importedJets->end(); ++jetIt) { + for (std::vector<const xAOD::Jet*>::const_iterator jetIt=jetToCheck.begin(); jetIt!=jetToCheck.end(); ++jetIt) { const std::vector< ElementLink<DataVector<xAOD::IParticle> > > &jetTrackLinks = ghostTrackLRT( **jetIt ); for (const auto &jetTrkIt : jetTrackLinks) { const xAOD::TrackParticle* trackPart = dynamic_cast<const xAOD::TrackParticle*>(*jetTrkIt); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/RCJetSubstructureAug.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/RCJetSubstructureAug.cxx new file mode 100644 index 0000000000000000000000000000000000000000..30895f33d8618195330999bff6687a19f942d6ca --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/RCJetSubstructureAug.cxx @@ -0,0 +1,233 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// RCJetSubstructureAug.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: G. Albouy (galbouy@lpsc.in2p3.fr) +// This tool computes substructure variables for ReClustered jets +// from LCTopo clusters ghost associated to RC jets +// by constructing cluster jets + +#include "DerivationFrameworkLLP/RCJetSubstructureAug.h" +#include "xAODJet/JetContainer.h" +#include "xAODCaloEvent/CaloCluster.h" +#include <vector> + +#include "fastjet/ClusterSequence.hh" +#include "fastjet/JetDefinition.hh" +#include "fastjet/contrib/Nsubjettiness.hh" +#include "JetSubStructureUtils/Qw.h" +#include "JetSubStructureUtils/Nsubjettiness.h" +#include "JetSubStructureUtils/KtSplittingScale.h" +#include "JetSubStructureUtils/EnergyCorrelator.h" + +// Constructor +DerivationFramework::RCJetSubstructureAug::RCJetSubstructureAug(const std::string& t, const std::string& n, const IInterface* p) : +base_class(t, n, p) {} + +// Destructor +DerivationFramework::RCJetSubstructureAug::~RCJetSubstructureAug() +{} + +// Athena initialize and finalize +StatusCode DerivationFramework::RCJetSubstructureAug::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + if (m_jetKey.key().empty()) { + ATH_MSG_FATAL("No jet collection provided for augmentation."); + return StatusCode::FAILURE; + } + ATH_CHECK( m_jetKey.initialize() ); + + // Set up the text-parsing machinery for selectiong the jet directly according to user cuts + if (!m_selectionString.empty()) { + ATH_CHECK( initializeParser( m_selectionString )); + } + + // Init moment struct + m_moments = new moments_t(m_suffix); + + return StatusCode::SUCCESS; +} + +StatusCode DerivationFramework::RCJetSubstructureAug::finalize() +{ + ATH_MSG_VERBOSE("finalize() ..."); + delete m_moments; + return StatusCode::SUCCESS; +} + +StatusCode DerivationFramework::RCJetSubstructureAug::addBranches() const +{ + const EventContext& ctx = Gaudi::Hive::currentContext(); + + SG::ReadHandle<xAOD::JetContainer> jets(m_jetKey,ctx); + if (!jets.isValid()) { + ATH_MSG_ERROR("No jet collection with name " << m_jetKey.key() << " found in StoreGate!"); + return StatusCode::FAILURE; + } + unsigned int nJets(jets->size()); + std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear(); + + // Execute the text parser if requested + if (!m_selectionString.empty()) { + std::vector<int> entries = m_parser->evaluateAsVector(); + unsigned int nEntries = entries.size(); + // check the sizes are compatible + if (nJets != nEntries ) { + ATH_MSG_ERROR("Sizes incompatible! Are you sure your selection string used jets??"); + return StatusCode::FAILURE; + } else { + // identify which jets to keep for the thinning check + for (unsigned int i=0; i<nJets; ++i) if (entries[i]==1) jetToCheck.push_back((*jets)[i]); + } + } else { + for (unsigned int i=0; i<nJets; ++i) jetToCheck.push_back((*jets)[i]); + } + + std::vector<const xAOD::CaloCluster*> clusters; + std::vector<fastjet::PseudoJet> constituents; + + for (const xAOD::Jet* jet : jetToCheck) { + + // Get list of ghost energy clusters + clusters.clear(); + ATH_CHECK(jet->getAssociatedObjects(m_ghostName, clusters)); + + // Construct list of constituent PseudoJets from clusters and compute timing information + constituents.clear(); + double eTot = 0; + double time = 0; + for (auto cluster : clusters){ + constituents.push_back( fastjet::PseudoJet(cluster->p4()) ); + double eConstit = cluster->e()* cluster->e(); + time += cluster->time()* eConstit; + eTot += eConstit; + } + + if (eTot==0) { + m_moments->dec_timing(*jet) = 0; + } else { + m_moments->dec_timing(*jet) = time/eTot; + } + + if (constituents.size()==0) { + m_moments->dec_Qw(*jet) = -999; + + m_moments->dec_Tau1(*jet) = -999; + m_moments->dec_Tau2(*jet) = -999; + m_moments->dec_Tau3(*jet) = -999; + m_moments->dec_Tau4(*jet) = -999; + + m_moments->dec_Tau21(*jet) = -999; + m_moments->dec_Tau32(*jet) = -999; + + m_moments->dec_Split12(*jet) = -999; + m_moments->dec_Split23(*jet) = -999; + m_moments->dec_Split34(*jet) = -999; + + m_moments->dec_ECF1(*jet) = -999; + m_moments->dec_ECF2(*jet) = -999; + m_moments->dec_ECF3(*jet) = -999; + m_moments->dec_ECF4(*jet) = -999; + + m_moments->dec_C2(*jet) = -999; + m_moments->dec_D2(*jet) = -999; + + m_moments->dec_pT(*jet) = 0; + m_moments->dec_m(*jet) = 0; + m_moments->dec_NClusts(*jet) = 0; + m_moments->dec_eta(*jet) = -999; + m_moments->dec_phi(*jet) = -999; + + return StatusCode::SUCCESS; + } + + // Run clustering + auto jet_def = fastjet::JetDefinition(fastjet::antikt_algorithm, 1.5); + fastjet::ClusterSequence cs(constituents, jet_def); + fastjet::PseudoJet LCTopo_jet = cs.inclusive_jets(0.0).front(); + + // Save LCTopo jet infos + m_moments->dec_pT(*jet) = LCTopo_jet.pt(); + m_moments->dec_m(*jet) = LCTopo_jet.m(); + m_moments->dec_NClusts(*jet) = constituents.size(); + m_moments->dec_eta(*jet) = LCTopo_jet.eta(); + m_moments->dec_phi(*jet) = LCTopo_jet.phi() - M_PI; + + // Qw + JetSubStructureUtils::Qw qw; + m_moments->dec_Qw(*jet) = qw.result(LCTopo_jet); + + // Nsubjetiness + fastjet::contrib::WTA_KT_Axes wta_kt_axes; + fastjet::contrib::NormalizedCutoffMeasure normalized_measure(1.0, 1.0, 1000000); + JetSubStructureUtils::Nsubjettiness Tau1_wta(1, wta_kt_axes, normalized_measure); + JetSubStructureUtils::Nsubjettiness Tau2_wta(2, wta_kt_axes, normalized_measure); + JetSubStructureUtils::Nsubjettiness Tau3_wta(3, wta_kt_axes, normalized_measure); + JetSubStructureUtils::Nsubjettiness Tau4_wta(4, wta_kt_axes, normalized_measure); + float tau1_wta = Tau1_wta.result(LCTopo_jet); + float tau2_wta = Tau2_wta.result(LCTopo_jet); + float tau3_wta = Tau3_wta.result(LCTopo_jet); + float tau4_wta = Tau4_wta.result(LCTopo_jet); + float tau21_wta = -999; + float tau32_wta = -999; + + if( tau1_wta > 1e-8 ) { + tau21_wta = tau2_wta / tau1_wta; + } + if( tau2_wta > 1e-8 ) { + tau32_wta = tau3_wta / tau2_wta; + } + + m_moments->dec_Tau1(*jet) = tau1_wta; + m_moments->dec_Tau2(*jet) = tau2_wta; + m_moments->dec_Tau3(*jet) = tau3_wta; + m_moments->dec_Tau4(*jet) = tau4_wta; + m_moments->dec_Tau21(*jet) = tau21_wta; + m_moments->dec_Tau32(*jet) = tau32_wta; + + // KtSplittingScale + JetSubStructureUtils::KtSplittingScale Split12(1); + JetSubStructureUtils::KtSplittingScale Split23(2); + JetSubStructureUtils::KtSplittingScale Split34(3); + float split12 = Split12.result(LCTopo_jet); + float split23 = Split23.result(LCTopo_jet); + float split34 = Split34.result(LCTopo_jet); + + m_moments->dec_Split12(*jet) = split12; + m_moments->dec_Split23(*jet) = split23; + m_moments->dec_Split34(*jet) = split34; + + // EnergyCorrelator + JetSubStructureUtils::EnergyCorrelator ECF1(1, 1.0, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelator ECF2(2, 1.0, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelator ECF3(3, 1.0, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelator ECF4(4, 1.0, JetSubStructureUtils::EnergyCorrelator::pt_R); + float ecf1 = ECF1.result(LCTopo_jet); + float ecf2 = ECF2.result(LCTopo_jet); + float ecf3 = ECF3.result(LCTopo_jet); + float ecf4 = ECF4.result(LCTopo_jet); + float c2 = -999; + float d2 = -999; + + if( ecf2 > 1e-8 ) { + c2 = ecf3 * ecf1 / pow( ecf2, 2.0 ); + d2 = ecf3 * pow( ecf1, 3.0 ) / pow( ecf2, 3.0 ); + } + + m_moments->dec_ECF1(*jet) = ecf1; + m_moments->dec_ECF2(*jet) = ecf2; + m_moments->dec_ECF3(*jet) = ecf3; + m_moments->dec_ECF4(*jet) = ecf4; + m_moments->dec_C2(*jet) = c2; + m_moments->dec_D2(*jet) = d2; + + } + + return StatusCode::SUCCESS; +} + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/components/DerivationFrameworkLLP_entries.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/components/DerivationFrameworkLLP_entries.cxx index a68ec7358ab266ad1ab065e8351c2444e62f647a..fec38259928595f42c767ec9dd9607be9e9ac53b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/components/DerivationFrameworkLLP_entries.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkLLP/src/components/DerivationFrameworkLLP_entries.cxx @@ -1,9 +1,11 @@ #include "DerivationFrameworkLLP/JetLargeD0TrackParticleThinning.h" #include "DerivationFrameworkLLP/VSITrackParticleThinning.h" +#include "DerivationFrameworkLLP/RCJetSubstructureAug.h" using namespace DerivationFramework; DECLARE_COMPONENT( JetLargeD0TrackParticleThinning ) DECLARE_COMPONENT( VSITrackParticleThinning ) +DECLARE_COMPONENT( RCJetSubstructureAug ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt index 73466bfd6c7c42d4a8db6993e98f7ed854b890ea..d436fc6926dc70963b61465ffd9d7057f2036f88 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/CMakeLists.txt @@ -13,7 +13,7 @@ find_package( Boost ) atlas_add_component( DerivationFrameworkMCTruth src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${FASTJET_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AtlasHepMCLib AtlasHepMCsearchLib CxxUtils DerivationFrameworkInterfaces ExpressionEvaluationLib GaudiKernel GenInterfacesLib GeneratorObjects MCTruthClassifierLib StoreGateLib TauAnalysisToolsLib TruthUtils xAODBase xAODEgamma xAODEventInfo xAODEventShape xAODJet xAODMuon xAODTruth AthenaPoolUtilities ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${FASTJET_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AtlasHepMCLib AtlasHepMCsearchLib CxxUtils DerivationFrameworkInterfaces EventInfoMgtLib ExpressionEvaluationLib GaudiKernel GenInterfacesLib GeneratorObjects MCTruthClassifierLib StoreGateLib TauAnalysisToolsLib TruthUtils xAODBase xAODEgamma xAODEventInfo xAODEventShape xAODJet xAODMuon xAODTruth AthenaPoolUtilities ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommonConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommonConfig.py index 14e47b05012db2314b6828a855011a62ad7ad9c5..155204f683a1bc76d683e74815a5e96878e63c3e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommonConfig.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/MCTruthCommonConfig.py @@ -29,7 +29,7 @@ def HepMCtoXAODTruthCfg(flags): isEVNT = False # Ensure EventInfoCnvAlg is scheduled - if "EventInfo#EventInfo" in flags.Input.TypedCollections and "xAOD::EventInfo#EventInfo" not in flags.Input.TypedCollections: + if "EventInfo#McEventInfo" in flags.Input.TypedCollections and "xAOD::EventInfo#EventInfo" not in flags.Input.TypedCollections: from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg acc.merge(EventInfoCnvAlgCfg(flags, inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=True)) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TRUTH0.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TRUTH0.py index 264e0a68a89eae1f4a5ef34667bbe490de39b10a..8c905271bc43f8684ad890e1244a728bfbc8356c 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TRUTH0.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TRUTH0.py @@ -11,7 +11,7 @@ def TRUTH0Cfg(ConfigFlags): acc = ComponentAccumulator() # Ensure EventInfoCnvAlg is scheduled - if "EventInfo#EventInfo" in ConfigFlags.Input.TypedCollections and "xAOD::EventInfo#EventInfo" not in ConfigFlags.Input.TypedCollections: + if "EventInfo#McEventInfo" in ConfigFlags.Input.TypedCollections and "xAOD::EventInfo#EventInfo" not in ConfigFlags.Input.TypedCollections: from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg acc.merge(EventInfoCnvAlgCfg(ConfigFlags, inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=True)) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.cxx index 501f1f5bace90ffb3b98ab43338bfd78d3421ca3..5f71e93f698dd6b0eb36bcdf93a46f6d41435eb4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.cxx @@ -20,6 +20,9 @@ // Service for the weights #include "GenInterfaces/IHepMCWeightSvc.h" +// Service for the metadata (tag info) +#include "EventInfoMgt/ITagInfoMgr.h" + // Constructor DerivationFramework::TruthMetaDataWriter::TruthMetaDataWriter(const std::string& t, const std::string& n, @@ -44,6 +47,7 @@ StatusCode DerivationFramework::TruthMetaDataWriter::initialize() // Initialize the service handles CHECK( m_metaStore.retrieve() ); CHECK( m_weightSvc.retrieve() ); + CHECK( m_tagInfoMgr.retrieve() ); // Create an empty truth meta data container: xAOD::TruthMetaDataAuxContainer* aux = new xAOD::TruthMetaDataAuxContainer(); @@ -93,36 +97,13 @@ StatusCode DerivationFramework::TruthMetaDataWriter::addBranches() const md->setMcChannelNumber(mcChannelNumber); md->setWeightNames( orderedWeightNameVec ); - // Shamelessly stolen from the file meta data tool - const CondAttrListCollection* tagInfo(nullptr); - ATH_CHECK( detStore()->retrieve( tagInfo, "/TagInfo" ) ); - - // Access the first, and only channel of the object: - const CondAttrListCollection::AttributeList& al = tagInfo->attributeList( 0 ); - - if (al.exists("lhefGenerator")){ - md->setLhefGenerator( al["lhefGenerator"].data< std::string >() ); - } - - if (al.exists("generators")){ - md->setGenerators( al["generators"].data< std::string >() ); - } - - if (al.exists("evgenProcess")){ - md->setEvgenProcess( al["evgenProcess"].data< std::string >() ); - } - - if (al.exists("evgenTune")){ - md->setEvgenTune( al["evgenTune"].data< std::string >() ); - } - - if (al.exists("hardPDF")){ - md->setHardPDF( al["hardPDF"].data< std::string >() ); - } - - if (al.exists("softPDF")){ - md->setSoftPDF( al["softPDF"].data< std::string >() ); - } + //// Shamelessly stolen from the file meta data tool; returns empty string if unavailable + md->setLhefGenerator( m_tagInfoMgr->findTag("lhefGenerator") ); + md->setGenerators( m_tagInfoMgr->findTag("generators") ); + md->setEvgenProcess( m_tagInfoMgr->findTag("evgenProcess") ); + md->setEvgenTune( m_tagInfoMgr->findTag("evgenTune") ); + md->setHardPDF( m_tagInfoMgr->findTag("hardPDF") ); + md->setSoftPDF( m_tagInfoMgr->findTag("softPDF") ); // Done getting things from the TagInfo } // Done making the new truth metadata object diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.h index 1d392e5126a88c28f50d000b6c988b903998b110..0b2c3a5d2c9ce9a7c09f14e77200bc9af033dfbb 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/TruthMetaDataWriter.h @@ -12,6 +12,9 @@ // Handles to services #include "GaudiKernel/ServiceHandle.h" +// Service for the metadata (tag info) +#include "EventInfoMgt/ITagInfoMgr.h" + // EDM classes - typedefs, so have to #include them #include "xAODTruth/TruthMetaDataContainer.h" @@ -43,6 +46,9 @@ namespace DerivationFramework { std::string m_metaName; /// Set for tracking the mc channels for which we already added meta data mutable std::unordered_set<uint32_t> m_existingMetaDataChan; + /// TagInfoMgr to get information out of /TagInfo + ServiceHandle< ITagInfoMgr > m_tagInfoMgr{ + "TagInfoMgr", name()}; }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/python/PHYSLITE.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/python/PHYSLITE.py index b004cd225beaef157cbea7b39ad07f250774331c..c5fd59cc7c2674e217c0e67dccaafb092f6d5301 100755 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/python/PHYSLITE.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/python/PHYSLITE.py @@ -82,7 +82,7 @@ def PHYSLITEKernelCfg(ConfigFlags, name='PHYSLITEKernel', **kwargs): # Include, and then set up the electron analysis sequence: from EgammaAnalysisAlgorithms.ElectronAnalysisSequence import makeElectronAnalysisSequence - electronSequence = makeElectronAnalysisSequence( dataType, 'LooseLHElectron.NonIso', shallowViewOutput = False, deepCopyOutput = True ) + electronSequence = makeElectronAnalysisSequence( dataType, 'LooseLHElectron.NonIso', shallowViewOutput = False, deepCopyOutput = True, trackSelection = False ) electronSequence.configure( inputName = 'Electrons', outputName = 'AnalysisElectrons' ) for element in electronSequence.getGaudiConfig2Components(): @@ -101,7 +101,7 @@ def PHYSLITEKernelCfg(ConfigFlags, name='PHYSLITEKernel', **kwargs): isRun3Geo = False from AthenaConfiguration.Enums import LHCPeriod if ConfigFlags.GeoModel.Run >= LHCPeriod.Run3: isRun3Geo = True - muonSequence = makeMuonAnalysisSequence( dataType, shallowViewOutput = False, deepCopyOutput = True, workingPoint = 'Loose.NonIso', isRun3Geo = isRun3Geo) + muonSequence = makeMuonAnalysisSequence( dataType, shallowViewOutput = False, deepCopyOutput = True, workingPoint = 'Loose.NonIso', isRun3Geo = isRun3Geo, trackSelection = False) muonSequence.configure( inputName = 'Muons', outputName = 'AnalysisMuons' ) for element in muonSequence.getGaudiConfig2Components(): @@ -276,7 +276,7 @@ def PHYSLITECfg(ConfigFlags): 'GSFTrackParticles.chiSquared.phi.d0.theta.qOverP.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.z0.vz.charge.vertexLink.numberOfPixelHits.numberOfSCTHits.originalTrackParticle', 'GSFConversionVertices.trackParticleLinks.x.y.z.px.py.pz.pt1.pt2.neutralParticleLinks.minRfirstHit', 'egammaClusters.calE.calEta.calPhi.calM.e_sampl.eta_sampl.ETACALOFRAME.PHICALOFRAME.ETA2CALOFRAME.PHI2CALOFRAME.constituentClusterLinks', - 'AnalysisMuons.pt.eta.phi.truthType.truthOrigin.author.muonType.quality.inDetTrackParticleLink.muonSpectrometerTrackParticleLink.combinedTrackParticleLink.InnerDetectorPt.MuonSpectrometerPt.DFCommonGoodMuon.neflowisol20.TruthLink.truthParticleLink.charge.extrapolatedMuonSpectrometerTrackParticleLink.allAuthors.ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500.numberOfPrecisionLayers.combinedTrackOutBoundsPrecisionHits.numberOfPrecisionLayers.numberOfPrecisionHoleLayers.numberOfGoodPrecisionLayers.innerSmallHits.innerLargeHits.middleSmallHits.middleLargeHits.outerSmallHits.outerLargeHits.extendedSmallHits.extendedLargeHits.extendedSmallHoles.isSmallGoodSectors.cscUnspoiledEtaHits.EnergyLoss.energyLossType.momentumBalanceSignificance.scatteringCurvatureSignificance.scatteringNeighbourSignificance.CaloMuonIDTag.CaloMuonScore', + 'AnalysisMuons.pt.eta.phi.truthType.truthOrigin.author.muonType.quality.inDetTrackParticleLink.muonSpectrometerTrackParticleLink.combinedTrackParticleLink.InnerDetectorPt.MuonSpectrometerPt.DFCommonGoodMuon.neflowisol20.topoetcone20.TruthLink.truthParticleLink.charge.extrapolatedMuonSpectrometerTrackParticleLink.allAuthors.ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500.numberOfPrecisionLayers.combinedTrackOutBoundsPrecisionHits.numberOfPrecisionLayers.numberOfPrecisionHoleLayers.numberOfGoodPrecisionLayers.innerSmallHits.innerLargeHits.middleSmallHits.middleLargeHits.outerSmallHits.outerLargeHits.extendedSmallHits.extendedLargeHits.extendedSmallHoles.isSmallGoodSectors.cscUnspoiledEtaHits.EnergyLoss.energyLossType.momentumBalanceSignificance.scatteringCurvatureSignificance.scatteringNeighbourSignificance.CaloMuonIDTag.CaloMuonScore', 'CombinedMuonTrackParticles.qOverP.d0.z0.vz.phi.theta.truthOrigin.truthType.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.numberOfPixelDeadSensors.numberOfPixelHits.numberOfPixelHoles.numberOfSCTDeadSensors.numberOfSCTHits.numberOfSCTHoles.numberOfTRTHits.numberOfTRTOutliers.chiSquared.numberDoF', 'ExtrapolatedMuonTrackParticles.d0.z0.vz.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.truthOrigin.truthType.qOverP.theta.phi', 'MuonSpectrometerTrackParticles.phi.d0.z0.vz.definingParametersCovMatrixDiag.definingParametersCovMatrixOffDiag.vertexLink.theta.qOverP.truthParticleLink', diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL1.py index c41bd493eaf32ee5f1c14853c68f769880719238..68058852037376f18da3cf4325301aa99edf5497 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL1.py @@ -37,6 +37,7 @@ def TCAL1TileCellsMuonDecoratorCfg(flags, **kwargs): kwargs.setdefault('MinMuonPt', 10 * GeV) kwargs.setdefault('MaxAbsMuonEta', 1.7) kwargs.setdefault('IsoCone', 0.4) + kwargs.setdefault('MaxRelETrkInIsoCone', 100000) kwargs.setdefault('TrackTools', acc.popToolsAndMerge(TCAL1TrackToolsCfg(flags)) ) @@ -60,7 +61,12 @@ def TCAL1StringSkimmingToolCfg(flags, **kwargs): acc = ComponentAccumulator() tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags)) - selectionExpression = f'Muons.{prefix}SelectedMuon' if flags.Beam.Type is BeamType.Collisions else 'abs(Muons.eta) < 1.7' + selectionExpression = "" + if flags.Beam.Type is BeamType.Collisions: + selectionExpression = f'(Muons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500 + 0.4 * Muons.neflowisol20) / Muons.pt < 0.18 && Muons.{prefix}SelectedMuon' + else: + selectionExpression = 'abs(Muons.eta) < 1.7' + skimmingExpression = f'count({selectionExpression}) > 0' kwargs.setdefault('name', 'TCAL1StringSkimmingTool') @@ -97,7 +103,7 @@ def TCAL1KernelCfg(flags, name='TCAL1Kernel', **kwargs): acc = ComponentAccumulator() prefix = kwargs.pop('Prefix', 'TCAL1_') - streamName = kwargs.pop('StreamName', 'OutputStreamDAOD_TCAL1') + streamName = kwargs.pop('StreamName', 'StreamDAOD_TCAL1') # Common augmentations triggerListsHelper = kwargs.pop('TriggerListsHelper', 'TriggerListsHelper') @@ -127,7 +133,7 @@ def TCAL1Cfg(ConfigFlags): TCAL1TriggerListsHelper = TriggerListsHelper(ConfigFlags) acc = ComponentAccumulator() - acc.merge(TCAL1KernelCfg(ConfigFlags, name="TCAL1Kernel", StreamName="OutputStreamDAOD_TCAL1", Prefix=TCAL1Prefix, TriggerListsHelper=TCAL1TriggerListsHelper)) + acc.merge(TCAL1KernelCfg(ConfigFlags, name="TCAL1Kernel", StreamName="StreamDAOD_TCAL1", Prefix=TCAL1Prefix, TriggerListsHelper=TCAL1TriggerListsHelper)) from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg @@ -166,15 +172,6 @@ def TCAL1Cfg(ConfigFlags): if ConfigFlags.Trigger.EDMVersion == 3: from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(TCAL1SlimmingHelper) - # Run 2 is added here temporarily to allow testing/comparison/debugging - from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper - AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TCAL1SlimmingHelper, - OutputContainerPrefix = "TrigMatch_", - TriggerList = TCAL1TriggerListsHelper.Run3TriggerNamesTau) - AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = TCAL1SlimmingHelper, - OutputContainerPrefix = "TrigMatch_", - TriggerList = TCAL1TriggerListsHelper.Run3TriggerNamesNoTau) - TCAL1ItemList = TCAL1SlimmingHelper.GetItemList() acc.merge(OutputStreamCfg(ConfigFlags, "DAOD_TCAL1", ItemList=TCAL1ItemList, AcceptAlgs=["TCAL1Kernel"])) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL2.py index 54ddf8f30a1ee10da04db24ae2f6481202ff9a91..09990af022b53499462f24690e7a452b0da961ca 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/python/TCAL2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -73,7 +73,7 @@ def TCAL2Cfg(ConfigFlags): TCAL2Prefix = 'TCAL2_' acc = ComponentAccumulator() - acc.merge(TCAL2KernelCfg(ConfigFlags, name="TCAL2Kernel", StreamName = "OutputStreamDAOD_TCAL2", Prefix=TCAL2Prefix)) + acc.merge(TCAL2KernelCfg(ConfigFlags, name="TCAL2Kernel", StreamName = "StreamDAOD_TCAL2", Prefix=TCAL2Prefix)) from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TileCellsDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TileCellsDecorator.cxx index 34bb7a4a11ee5684dd0769f1e966468c55e4a151..d2efbbfa18385281f5e18671ab5f6a12a719c06d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TileCellsDecorator.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTileCal/src/TileCellsDecorator.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // TileCellsDecorator.cxx @@ -297,13 +297,22 @@ namespace DerivationFramework { // Tile PMT information const TileCell* tile_cell = dynamic_cast<const TileCell*> (cell); + IdentifierHash hash1 = cell_dde->onl1(); + IdentifierHash hash2 = cell_dde->onl2(); + // Tile cell positioning - int ros1 = m_tileHWID->ros(m_tileHWID->adc_id(cell_dde->onl1(), tile_cell->gain1())); - int ros2 = m_tileHWID->ros(m_tileHWID->adc_id(cell_dde->onl2(), tile_cell->gain2())); - int drawer1 = m_tileHWID->drawer(m_tileHWID->adc_id(cell_dde->onl1(), tile_cell->gain1())); - int drawer2 = m_tileHWID->drawer(m_tileHWID->adc_id(cell_dde->onl2(), tile_cell->gain2())); - int channel1 = m_tileHWID->channel(m_tileHWID->adc_id(cell_dde->onl1(), tile_cell->gain1())); - int channel2 = m_tileHWID->channel(m_tileHWID->adc_id(cell_dde->onl2(), tile_cell->gain2())); + int ros1 = m_tileHWID->ros(m_tileHWID->adc_id(hash1, tile_cell->gain1())); + int drawer1 = m_tileHWID->drawer(m_tileHWID->adc_id(hash1, tile_cell->gain1())); + int channel1 = m_tileHWID->channel(m_tileHWID->adc_id(hash1, tile_cell->gain1())); + + int ros2 = -1; + int drawer2 = -1; + int channel2 = -1; + if (hash2 != TileHWID::NOT_VALID_HASH) { + ros2 = m_tileHWID->ros(m_tileHWID->adc_id(hash2, tile_cell->gain2())); + drawer2 = m_tileHWID->drawer(m_tileHWID->adc_id(hash2, tile_cell->gain2())); + channel2 = m_tileHWID->channel(m_tileHWID->adc_id(hash2, tile_cell->gain2())); + } cells_pmt1_ros.push_back( ros1 ); cells_pmt2_ros.push_back( ros2 ); diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h index dff22adf3f8f588e31ac5643974585f74b7916c3..fab0bddea4b14879e514a1891a399c4daf615d1b 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h @@ -13,7 +13,7 @@ implements the underlying logic of accessing the ROOT files containing the recommendations. @authors Kristin Lohwasser, Karsten Koeneke, Felix Buehrer - @updated by Christos Anastopoulos 2017-2018 + @updated by Christos Anastopoulos 2017-2022 */ // STL includes @@ -79,14 +79,14 @@ public: /// Initialize this class int initialize(); - /** The main calculate method: the actual cuts are applied here + /** The main calculate method: * @c dataType PATCore::ParticleDataType::DataType (e.g DATA,FULL etc) - * @ runnumber the run number 1st dimension of the stored measurements - * @ cluster_eta the cluster eta 2nd dimension of the stored measurements - * @ et third dimension of the stored measurments + * @ runnumber the run number. 1st dimension of the stored measurements + * @ cluster_eta the cluster eta. 2nd dimension of the stored measurements + * @ electron et. third dimension of the stored measurments * @ result struct filled with * SF, Total uncertainty, Stat uncertainty, Uncorr uncertainty - * @ index_of_corr systematic + * @ onlyTotal do only the "total" systematic * returns 0 in failure * * Toy production is controlled by internal flags diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronTestAlg.h b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronTestAlg.h index 167611580c5c69851e29402ba43f2b7e541afd40..b4299195c0f1307d6362a8b445af613a7130e865 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronTestAlg.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/ElectronEfficiencyCorrection/TElectronTestAlg.h @@ -52,6 +52,12 @@ class TElectronTestAlg : public EL::AnaReentrantAlgorithm { Gaudi::Property<std::string> m_idKey{ this, "IdKey", "", "Key associated with identification working point"}; + Gaudi::Property<std::string> m_isoKey{ + this, "IsoKey", "", "Key associated with isolation working point"}; + + Gaudi::Property<std::string> m_triggerKey{ + this, "TriggerKey", "", "Key associated with trigger working point"}; + Gaudi::Property<int> m_dataType{this, "dataType", PATCore::ParticleDataType::Full, "Particle Data Type Full/Fast"}; diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/AsgElectronEfficiencyCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/AsgElectronEfficiencyCorrectionTool.cxx index 6e2e189cbcd4910417c1991acfb086a64545e396..dc9b02576e66f8bb41637b14b4eb6f102f9be130 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/AsgElectronEfficiencyCorrectionTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/AsgElectronEfficiencyCorrectionTool.cxx @@ -80,7 +80,7 @@ AsgElectronEfficiencyCorrectionTool::AsgElectronEfficiencyCorrectionTool( "List of file names that store the correction factors for simulation."); declareProperty("MapFilePath", m_mapFile = "ElectronEfficiencyCorrection/2015_2025/rel22.2/" - "2022_Summer_Prerecom_v1/map2.txt", + "2022_Summer_Prerecom_v1/map4.txt", "Full path to the map file"); declareProperty( "RecoKey", m_recoKey = "", "Key associated with reconstruction"); diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronEfficiencyCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronEfficiencyCorrectionTool.cxx index 32bcdce3ba8b287238c395e3cc04d0d8d2c61cc7..94d4321a379d3412a9fa88248df5d60c60ba22ca 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronEfficiencyCorrectionTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronEfficiencyCorrectionTool.cxx @@ -340,9 +340,8 @@ Root::TElectronEfficiencyCorrectionTool::calculate( result.UnCorr = val; /* * Do the correlated part - * The previous setup is becoming cumbersome - * for the N~16 systematic variations. - * So we keep them in a vector of vector of HistArray + * For the N~16 systematic variations + * we keep them in a vector of vector of HistArray * The first vector index being the runnumber * The second the systematic * And them the HistArray for high low etc. @@ -362,7 +361,7 @@ Root::TElectronEfficiencyCorrectionTool::calculate( } } /* - * Do the toys if requested and exit early + * Do the toys if requested */ if (m_doToyMC || m_doCombToyMC) { result.toys.resize(static_cast<size_t>(m_nToyMC)); diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronTestAlg.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronTestAlg.cxx index 5489c15a91d95652b26e261f189f7160184443d7..18463bc0611861d5b17e057171c61362fae4cf42 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronTestAlg.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/Root/TElectronTestAlg.cxx @@ -27,8 +27,8 @@ StatusCode CP::TElectronTestAlg::initialize() { m_pimpl->msg().setLevel(this->msg().level()); // std::string mapFileName = PathResolverFindCalibFile(m_mapFile); - std::string key = - ElRecomFileHelpers::convertToOneKey(m_recoKey, m_idKey, "", ""); + std::string key = ElRecomFileHelpers::convertToOneKey(m_recoKey, m_idKey, + m_isoKey, m_triggerKey); std::string value = ElRecomFileHelpers::getValueByKey(mapFileName, key); std::string filename = PathResolverFindCalibFile(value); if (filename.empty()) { diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/share/ut_TestFunctionality.ref b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/share/ut_TestFunctionality.ref index 4bcbc7ab9a2c606804877df0f6107dd2b6dbb936..84eac10992f5cc71ecd394e6a646f329f0502b58 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/share/ut_TestFunctionality.ref +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/share/ut_TestFunctionality.ref @@ -6,7 +6,7 @@ EgEfficiencyCorr_testE...INFO ===> Model : SIMPLIFIED| electron : Pt = 41212. EgEfficiencyCorr_testEgEfficiencyCorrWithoutFile -t FullSim -r 428648 -c FULL -e -0.94 -p 41212.10 -d Medium | grep SF 2>&1 EgEfficiencyCorr_testE...INFO ===> Model : FULL| electron : Pt = 41212.1 : eta = -0.94 : Bin index = 124 : SF = 0.994283 + 0.00814953 - 0.00814953 <=== EgEfficiencyCorr_testEgEfficiencyCorrWithoutFile -t FullSim -r 428648 -c TOTAL -e -0.94 -p 41212.10 -d Medium -l 0 | grep map 2>&1 -ToolSvc.ElEffCorrectionTool.MapFilePath = 'ElectronEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map2.txt' +ToolSvc.ElEffCorrectionTool.MapFilePath = 'ElectronEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map4.txt' ==== CHECK II: DEFAULT MAP ==== ---> map looks good! ==== CHECK III: ID LVL ==== @@ -35,5 +35,5 @@ EgEfficiencyCorr_testE...INFO ===> Model : TOTAL| electron : Pt = 41212.1 : e EgEfficiencyCorr_testEgEfficiencyCorrWithoutFile -t FullSim -r 428648 -c TOTAL -e -0.94 -p 41212.10 -d Tight -i Tight_VarRad| grep SF 2>&1 EgEfficiencyCorr_testE...INFO ===> Model : TOTAL| electron : Pt = 41212.1 : eta = -0.94 : Bin index = -999 : SF = 1 + 0.00729424 - 0.00729424 <=== EgEfficiencyCorr_testEgEfficiencyCorrWithoutFile -t FullSim -r 428648 -c TOTAL -e -0.94 -p 41212.10 -d Tight -i Tight_VarRad -g 2022_e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI| grep SF 2>&1 -EgEfficiencyCorr_testE...INFO ===> Model : TOTAL| electron : Pt = 41212.1 : eta = -0.94 : Bin index = -999 : SF = 0.996027 + 0.00629086 - 0.00629086 <=== +EgEfficiencyCorr_testE...INFO ===> Model : TOTAL| electron : Pt = 41212.1 : eta = -0.94 : Bin index = -999 : SF = 0.989869 + 0.00818184 - 0.00818184 <=== ==== DONE ==== diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h index d98c0094a897742a4b53df30a6604575e6690466..8a55117bf6c97dfd4ab974ca0938784c61f58e88 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h @@ -9,12 +9,14 @@ // Atlas includes #include "AsgDataHandles/ReadHandleKey.h" +#include "AsgDataHandles/ReadDecorHandleKey.h" #include "AsgTools/AsgTool.h" #include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h" #include "PATCore/AcceptData.h" #include "xAODEgamma/ElectronFwd.h" #include "xAODHIEvent/HIEventShapeContainer.h" #include "xAODTracking/VertexContainer.h" +#include "xAODEventInfo/EventInfo.h" class EventContext; @@ -129,9 +131,15 @@ public: // Private methods private: + /// Get IP variable based on user configuration + double getIpVariable(double mu, const EventContext& ctx) const; + /// Get the number of primary vertices unsigned int getNPrimVertices(const EventContext& ctx) const; + /// Get the average mu + double getAverageMu(const EventContext& ctx) const; + /// Get the FCal ET for centrality determination (for HI collisions) double getFcalEt(const EventContext& ctx) const; @@ -173,6 +181,9 @@ private: /// Flag to toggle the correction of deltaEta1 for the pear shape distortion of the LAr bool m_correctDeltaEta = false; + // Whether to use average mu instead of NPV + bool m_useAverageMu = false; + /// read handle key to heavy ion container SG::ReadHandleKey<xAOD::HIEventShapeContainer> m_HIESContKey{ this, @@ -189,6 +200,12 @@ private: "The primary vertex container name" }; + /// read handle key to averager mu + SG::ReadDecorHandleKey<xAOD::EventInfo> m_avgMuKey { + this, "averageInteractionsPerCrossingKey", + "EventInfo.averageInteractionsPerCrossing", + "Decoration for Average Interaction Per Crossing" + }; }; // End: class definition #endif diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/AsgElectronLikelihoodTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/AsgElectronLikelihoodTool.cxx index f4cd1f2237628ffe92758a11dac990702dc8f127..996637faed5f5a4f0035060d6aa38d2428ce53ca 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/AsgElectronLikelihoodTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/AsgElectronLikelihoodTool.cxx @@ -26,6 +26,7 @@ #include "xAODTracking/Vertex.h" // Framework includes #include "AsgDataHandles/ReadHandle.h" +#include "AsgDataHandles/ReadDecorHandle.h" #include "AsgTools/CurrentContext.h" #include "PathResolver/PathResolver.h" #include "TEnv.h" @@ -64,6 +65,9 @@ AsgElectronLikelihoodTool::AsgElectronLikelihoodTool(const std::string& myname) declareProperty("skipDeltaPoverP", m_skipDeltaPoverP = false, "If true, it wil skip the check of deltaPoverP"); + declareProperty("useAverageMu", + m_useAverageMu=false, + "Whether to use average mu instead of NPV." ); } AsgElectronLikelihoodTool::~AsgElectronLikelihoodTool() @@ -210,6 +214,12 @@ AsgElectronLikelihoodTool::initialize() // if true, deltaEta1 will be corrected for the pear shape distortion of the // LAr m_correctDeltaEta = env.GetValue("doCorrectDeltaEta", false); + + if (m_rootTool->m_doCentralityTransform && m_useAverageMu) { + ATH_MSG_ERROR("Cannot use centrality transform and average mu " + << "at the same time as they affect the same variable"); + return StatusCode::FAILURE; + } } else { // Error if it cant find the conf ATH_MSG_ERROR("Could not find configuration file"); return StatusCode::FAILURE; @@ -218,6 +228,9 @@ AsgElectronLikelihoodTool::initialize() // Setup primary vertex key handle ATH_CHECK(m_primVtxContKey.initialize(m_usePVCont)); + // Setup average mu key handle + ATH_CHECK(m_avgMuKey.initialize(m_useAverageMu)); + // Setup HI container key handle (must come after init from env) bool doCentralityTransform = m_rootTool->m_doCentralityTransform; ATH_CHECK( @@ -361,18 +374,10 @@ AsgElectronLikelihoodTool::accept(const EventContext& ctx, } // if not calo ONly - // Get the number of primary vertices or FCal ET in this event - bool doCentralityTransform = m_rootTool->m_doCentralityTransform; - if (mu < 0) { // use npv if mu is negative (not given) - if (doCentralityTransform) - ip = static_cast<double>(m_useCaloSumsCont ? this->getFcalEt(ctx) - : m_fcalEtDefault); - else - ip = static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx) - : m_nPVdefault); - } else { - ip = mu; - } + // Get the number of primary vertices, + // avg mu or FCal ET in this event, + // depending on user configuration + ip = getIpVariable(mu, ctx); // for now don't cache. double likelihood = calculate(ctx, el, ip); @@ -450,20 +455,8 @@ AsgElectronLikelihoodTool::accept(const EventContext& ctx, uint8_t ambiguityBit(0); // Get the pileup or centrality information - double ip(0); + double ip = getIpVariable(mu, ctx); - bool doCentralityTransform = m_rootTool->m_doCentralityTransform; - if (mu < 0) { // use npv if mu is negative (not given) - if (doCentralityTransform) - ip = static_cast<double>(m_useCaloSumsCont ? this->getFcalEt(ctx) - : m_fcalEtDefault); - else - ip = static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx) - : m_nPVdefault); - - } else { - ip = mu; - } // for now don't cache. double likelihood = calculate(ctx, eg, ip); @@ -693,20 +686,11 @@ AsgElectronLikelihoodTool::calculate(const EventContext& ctx, } } - // Get the number of primary vertices or FCal ET in this event + // Get the number of primary vertices, avg mu or FCal ET in this event, + // depending on user configuration double ip = static_cast<double>(m_nPVdefault); - bool doCentralityTransform = m_rootTool->m_doCentralityTransform; - if (mu < 0) { // use npv if mu is negative (not given) - if (doCentralityTransform) - ip = static_cast<double>(m_useCaloSumsCont ? this->getFcalEt(ctx) - : m_fcalEtDefault); - else - ip = static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx) - : m_nPVdefault); - } else { - ip = mu; - } + ip = getIpVariable(mu, ctx); if (!allFound) { ATH_MSG_ERROR( @@ -844,19 +828,7 @@ AsgElectronLikelihoodTool::calculate(const EventContext& ctx, } // Get the pileup or centrality information - double ip(0); - - bool doCentralityTransform = m_rootTool->m_doCentralityTransform; - if (mu < 0) { // use npv if mu is negative (not given) - if (doCentralityTransform) - ip = static_cast<double>(m_useCaloSumsCont ? this->getFcalEt(ctx) - : m_fcalEtDefault); - else - ip = static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx) - : m_nPVdefault); - } else { - ip = mu; - } + double ip = getIpVariable(mu, ctx); if (!allFound) { ATH_MSG_ERROR( @@ -925,6 +897,25 @@ AsgElectronLikelihoodTool::calculate(const EventContext& ctx, return -999; } +// Helper method to get IP variable +// Can be either NPV, <mu> or fcal Et +// depending on user configuration. +double AsgElectronLikelihoodTool::getIpVariable(double mu, const EventContext& ctx) const +{ + if (mu < 0) { // determine variable if mu is negative (not given) + bool doCentralityTransform = m_rootTool->m_doCentralityTransform; + if (doCentralityTransform) + return static_cast<double>(m_useCaloSumsCont ? this->getFcalEt(ctx) + : m_fcalEtDefault); + else if (m_useAverageMu) + return this->getAverageMu(ctx); + else + return static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx) + : m_nPVdefault); + } + return mu; +} + // Helper method to get the number of primary vertices // We don't want to iterate over all vertices in the event for each electron!!! unsigned int @@ -944,6 +935,19 @@ AsgElectronLikelihoodTool::getNPrimVertices(const EventContext& ctx) const return nVtx; } +// Helper method to get the average mu +// Defined to use the same definition as +// TrigEgammaPrecisionElectronHypoAlg +double AsgElectronLikelihoodTool::getAverageMu(const EventContext &ctx) const +{ + SG::ReadDecorHandle<xAOD::EventInfo,float> eventInfoDecor(m_avgMuKey, ctx); + if(!eventInfoDecor.isPresent()) { + ATH_MSG_WARNING("Cannot find " << m_avgMuKey.key() + << ", returning 0"); + } + return eventInfoDecor(0); +} + // Helper method to get FCal ET for centrality determination double AsgElectronLikelihoodTool::getFcalEt(const EventContext& ctx) const diff --git a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/IsolationCorrections/IsolationCorrection.h b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/IsolationCorrections/IsolationCorrection.h index 9aa5a897327a4c2b4949fdeec4d7d49b6ae9ef03..fc3be0c402d4e4b419810931c37867acaf1817c4 100644 --- a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/IsolationCorrections/IsolationCorrection.h +++ b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/IsolationCorrections/IsolationCorrection.h @@ -30,7 +30,7 @@ class IsolationCorrection : public asg::AsgMessaging{ StatusCode initialize(); typedef enum { ELECTRON=0, PHOTON=1 } ParticleType; - typedef enum { REL17=1, REL17_2=2, REL20=6, REL20_2=7, REL21=8 } Version; + typedef enum { REL17_2=1, REL20_2=2, REL21=3, REL22=4 } Version; void SetCorrectionFile( const std::string& corr_file, const std::string& corr_ddshift_file, const std::string& corr_ddsmearing_file); void SetToolVer(CP::IsolationCorrection::Version); diff --git a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx index 645b7be0bea7d4b3fd13b066ef201c7caa59ac91..a88ea6e75f33839c877019ad062de0279664c399 100644 --- a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx @@ -103,7 +103,7 @@ namespace CP { - Etcone_value: value of uncorrected EtconeXX variable (ph_EtconeXX) *** in MeV! - isConversion: photons only: conversion flag (ph_isConv) - parttype: ELECTRON or PHOTON, enum defined below - - version: REL21, REL20_2, REL17_2, REL17 or REL16, enum defined below + - version: REL22, REL21, REL20_2, REL17_2, REL17 or REL16, enum defined below */ float isolation_ptcorrection = 0; float energy = 0; @@ -113,7 +113,7 @@ namespace CP { ATH_MSG_WARNING("The associated cluster of the object does not exist ! Maybe the thinning was too agressive... No leakage correction computed."); return 0.; } - if (m_tool_ver == REL21 || m_tool_ver == REL20_2) + if (m_tool_ver == REL22 || m_tool_ver == REL21 || m_tool_ver == REL20_2) energy = input.caloCluster()->energyBE(1) + input.caloCluster()->energyBE(2) + input.caloCluster()->energyBE(3); else energy = input.caloCluster()->e(); @@ -431,7 +431,7 @@ StatusCode IsolationCorrection::setupDD(const std::string& year) { set2011Corr(); // in fact, this is for etcone set2012Corr(); setDDCorr(); - } else if (m_tool_ver == REL20_2 || m_tool_ver == REL21) + } else if (m_tool_ver == REL20_2 || m_tool_ver == REL21 || m_tool_ver == REL22) set2015Corr(); } @@ -849,7 +849,7 @@ StatusCode IsolationCorrection::setupDD(const std::string& year) { FreeClear( m_graph_dd_cone40_photon_shift ); FreeClear( m_graph_dd_cone40_photon_smearing ); - } else if (m_tool_ver == REL20_2 || m_tool_ver == REL21) { + } else if (m_tool_ver == REL20_2 || m_tool_ver == REL21 || m_tool_ver == REL22) { //---- Rel 20_2 pT leakage correction file @@ -1096,7 +1096,7 @@ StatusCode IsolationCorrection::setupDD(const std::string& year) { double correction_value = 0.; if (ver== REL17_2) { correction_value = GetPtCorrection_FromGraph(energy,etaS2,etaPointing,etaCluster,radius,isConversion,parttype); - } else if (m_tool_ver == REL20_2 || m_tool_ver == REL21){ + } else if (m_tool_ver == REL20_2 || m_tool_ver == REL21 || m_tool_ver == REL22){ correction_value = GetPtCorrection_FromGraph_2015(energy, etaS2, radius, convFlag_int, author, conv_radius, conv_ratio, parttype); } diff --git a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrectionTool.cxx index 68074421625bc84295a8594f38029eee32c42db2..0794b97c6c54614279eee9c0817e607c5e563c69 100644 --- a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrectionTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrectionTool.cxx @@ -22,7 +22,7 @@ namespace CP { IsolationCorrectionTool::IsolationCorrectionTool( const std::string &name ) : asg::AsgMetadataTool(name), m_systDDonoff("PH_Iso_DDonoff") { - declareProperty("CorrFile", m_corr_file = "IsolationCorrections/v5/isolation_ptcorrections_rel20_2.root"); + declareProperty("CorrFile", m_corr_file = "IsolationCorrections/v5/isolation_ptcorrections_rel20_2.root") ; declareProperty("CorrFile_ddshift", m_corr_ddshift_file = "IsolationCorrections/v3/isolation_ddcorrection_shift.root"); declareProperty("CorrFile_ddsmearing", m_corr_ddsmearing_file = "IsolationCorrections/v1/isolation_ddcorrection_smearing.root", "a run I smearing for MC calo iso"); declareProperty("ToolVer", m_tool_ver_str = "REL21"); @@ -33,12 +33,12 @@ namespace CP { declareProperty("Trouble_categories", m_trouble_categories = true); declareProperty("LogLogFitForLeakage", m_useLogLogFit = false); declareProperty("ForcePartType", m_forcePartType = false); - declareProperty("Apply_ddshifts", m_apply_ddDefault = true); + declareProperty("Apply_ddshifts", m_apply_ddDefault = false); declareProperty("Apply_SC_leakcorr", m_apply_SC_leak_corr = false); declareProperty("Apply_etaEDParPU_correction", m_apply_etaEDParPU_corr = false); declareProperty("Apply_etaEDPar_mc_correction", m_apply_etaEDParPU_mc_corr = false); - declareProperty("CorrFile_etaEDParPU_correction", m_corr_etaEDParPU_file = "IsolationCorrections/v4/zetas.root"); - declareProperty("CorrFile_etaEDPar_mc_correction", m_corr_etaEDPar_mc_corr_file = "IsolationCorrections/v4/zetas_correction.root"); + declareProperty("CorrFile_etaEDParPU_correction", m_corr_etaEDParPU_file = "IsolationCorrections/v6/zetas.root"); + declareProperty("CorrFile_etaEDPar_mc_correction", m_corr_etaEDPar_mc_corr_file = "IsolationCorrections/v6/zetas_correction.root"); m_isol_corr = new IsolationCorrection(name); } @@ -76,11 +76,12 @@ namespace CP { CP::IsolationCorrection::Version tool_ver; - if (m_tool_ver_str == "REL21") tool_ver = CP::IsolationCorrection::REL21; + if (m_tool_ver_str == "REL22") tool_ver = CP::IsolationCorrection::REL22; + else if (m_tool_ver_str == "REL21") tool_ver = CP::IsolationCorrection::REL21; else if (m_tool_ver_str == "REL20_2") tool_ver = CP::IsolationCorrection::REL20_2; else if (m_tool_ver_str == "REL17_2") tool_ver = CP::IsolationCorrection::REL17_2; else { - ATH_MSG_WARNING("Tool version not recognized: "<<m_tool_ver_str<<"\nAllowed versions: REL21, REL20_2, REL17_2"); + ATH_MSG_WARNING("Tool version not recognized: "<<m_tool_ver_str<<"\nAllowed versions: REL22, REL21, REL20_2, REL17_2"); return StatusCode::FAILURE; } @@ -93,6 +94,10 @@ namespace CP { ATH_MSG_WARNING("The specified correction file is not for "<<m_tool_ver_str<<" please use proper correction file"); return StatusCode::FAILURE; } + if (TString(corrFileNameList[0]).Contains("isolation_ptcorrections_rel22_") && m_tool_ver_str != "REL22" ){ + ATH_MSG_WARNING("The specified correction file is not for "<<m_tool_ver_str<<" please use proper correction file"); + return StatusCode::FAILURE; + } m_isol_corr->SetCorrectionFile(m_corr_file, m_corr_ddshift_file, m_corr_ddsmearing_file); m_isol_corr->SetToolVer(tool_ver); @@ -233,6 +238,7 @@ namespace CP { } static const std::vector<xAOD::Iso::IsolationType> topoisolation_types = {xAOD::Iso::topoetcone20, + xAOD::Iso::topoetcone30, xAOD::Iso::topoetcone40}; for (auto type : topoisolation_types) { float oldleak = 0.; diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h index c8b46752e4b66d69fbbd266adee85cfe60241fd2..e62998c07ace93ace824630ced814168598ead82 100644 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h @@ -26,7 +26,7 @@ #include "PATInterfaces/ISystematicsTool.h" #include "PATInterfaces/SystematicRegistry.h" #include "PATInterfaces/CorrectionCode.h" -#include "PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h" +#include "ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h" #include "EgammaAnalysisInterfaces/IAsgPhotonEfficiencyCorrectionTool.h" #include "xAODEgamma/Egamma.h" @@ -79,13 +79,13 @@ public: // Private member variables private: - typedef Root::TPhotonEfficiencyCorrectionTool::Result Result; + typedef Root::TElectronEfficiencyCorrectionTool::Result Result; /// I think these calculate methods are only used internally CP::CorrectionCode calculate( const xAOD::Egamma* egam, Result& result ) const; /// Pointer to the underlying ROOT based tool - Root::TPhotonEfficiencyCorrectionTool* m_rootTool_unc; - Root::TPhotonEfficiencyCorrectionTool* m_rootTool_con; + Root::TElectronEfficiencyCorrectionTool* m_rootTool_unc; + Root::TElectronEfficiencyCorrectionTool* m_rootTool_con; /// Systematics filter map std::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter; diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h deleted file mode 100644 index 3197d7166852e62c90a3c954526f0d1dc37500ad..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - */ - -#ifndef __TPHOTONEFFICIENCYCORRECTIONTOOL__ -#define __TPHOTONEFFICIENCYCORRECTIONTOOL__ - -/** - @class TPhotonEfficiencyCorrectionTool - @brief Calculate the egamma scale factors in pure ROOT, inherit the structure - from TElectronEfficiencyCorrection tool For each photon type declare a tool - and use addFileName to add root files containing scale factors for this - specific type. After adding root files call initialize() In the event loop use - calculate(const PATCore::ParticleDataType::DataType dataType, const unsigned - int runnumber, const double cluster_eta, const double et) This returns a - TResult. The scale factor and its uncertainty are obtained by calling - getScaleFactor() or getTotalUncertainty (See header file of TResult in package - PATCore) For a short documentation see the included README file - - @author Karsten Koeneke, Felix Buehrer, Michael Pitt - @date January 2014 - */ - -// STL includes -#include <string> -#include <vector> -// Include the return object and the base class -#include "ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h" -#include "PATCore/PATCoreEnums.h" - -namespace Root { -class TPhotonEfficiencyCorrectionTool - : public Root::TElectronEfficiencyCorrectionTool { - - public: - struct Result { - double scaleFactor = -999.0; - double totalUncertainty = -999.0; - }; - - TPhotonEfficiencyCorrectionTool( - const char* name = "TPhotonEfficiencyCorrectionTool"); - ~TPhotonEfficiencyCorrectionTool(); - int initialize(); - // Additional public methods - int calculate(const PATCore::ParticleDataType::DataType dataType, - const unsigned int runnumber, const double cluster_eta, - const double et, /* in MeV */ - Result& sf_and_err) const; - - private: -}; - -} // namespace Root - -#endif - diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx index 5f62760f48c4c129cbc7678dcee31c1cc9ba2512..b070f4659f725779ce9ac8b1b54132ef67b874f8 100644 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/AsgPhotonEfficiencyCorrectionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** @@ -33,7 +33,7 @@ #define MAXETA 2.47 #define MIN_ET 7000.0 -using Result = Root::TPhotonEfficiencyCorrectionTool::Result; +using Result = Root::TElectronEfficiencyCorrectionTool::Result; // ============================================================================= @@ -48,8 +48,8 @@ AsgPhotonEfficiencyCorrectionTool::AsgPhotonEfficiencyCorrectionTool( const std: { // Create an instances of the underlying ROOT tools - m_rootTool_unc = new Root::TPhotonEfficiencyCorrectionTool(); - m_rootTool_con = new Root::TPhotonEfficiencyCorrectionTool(); + m_rootTool_unc = new Root::TElectronEfficiencyCorrectionTool(); + m_rootTool_con = new Root::TElectronEfficiencyCorrectionTool(); // Declare the needed properties declareProperty( "CorrectionFileNameConv", m_corrFileNameConv="", @@ -161,7 +161,7 @@ StatusCode AsgPhotonEfficiencyCorrectionTool::initialize() // We need to initialize the underlying ROOT TSelectorTool if ( (0 == m_rootTool_con->initialize()) || (0 == m_rootTool_unc->initialize()) ) { - ATH_MSG_ERROR("Could not initialize the TPhotonEfficiencyCorrectionTool!"); + ATH_MSG_ERROR("Could not initialize the TElectronEfficiencyCorrectionTool!"); return StatusCode::FAILURE; } @@ -225,70 +225,73 @@ CP::CorrectionCode AsgPhotonEfficiencyCorrectionTool::calculate( const xAOD::Ega // Check if photon in the range to get the SF if (std::abs(eta2) > MAXETA) { - result.scaleFactor = 1; - result.totalUncertainty = 1; + result.SF = 1; + result.Total = 1; ATH_MSG_DEBUG("No correction factor provided for eta " << eta2 << " Returning SF = 1 + / - 1"); return CP::CorrectionCode::OutOfValidityRange; } if (et < MIN_ET) { - result.scaleFactor = 1; - result.totalUncertainty = 1; + result.SF = 1; + result.Total = 1; ATH_MSG_DEBUG("No correction factor provided for eT " << et << " Returning SF = 1 + / - 1"); return CP::CorrectionCode::OutOfValidityRange; } if (itr_pt != m_pteta_bins.end() && et < itr_pt->first) { - result.scaleFactor = 1; - result.totalUncertainty = 1; + result.SF = 1; + result.Total = 1; ATH_MSG_DEBUG("No scale factor uncertainty provided for et " << et / 1e3 << "GeV Returning SF = 1 + / - 1"); return CP::CorrectionCode::OutOfValidityRange; } // Get the run number - const xAOD::EventInfo* eventInfo = evtStore()->retrieve< const xAOD::EventInfo> ("EventInfo"); - if(!eventInfo){ - ATH_MSG_ERROR ( "Could not retrieve EventInfo object!" ); + const xAOD::EventInfo* eventInfo = + evtStore()->retrieve<const xAOD::EventInfo>("EventInfo"); + if (!eventInfo) { + ATH_MSG_ERROR("Could not retrieve EventInfo object!"); return CP::CorrectionCode::Error; } - //Retrieve the proper random Run Number + // Retrieve the proper random Run Number unsigned int runnumber = m_defaultRandomRunNumber; if (m_useRandomRunNumber) { - static const SG::AuxElement::Accessor<unsigned int> randomrunnumber("RandomRunNumber"); + static const SG::AuxElement::Accessor<unsigned int> randomrunnumber( + "RandomRunNumber"); if (!randomrunnumber.isAvailable(*eventInfo)) { ATH_MSG_WARNING( "Pileup tool not run before using PhotonEfficiencyTool! SFs do not " "reflect PU distribution in data"); return CP::CorrectionCode::Error; } - runnumber = randomrunnumber(*(eventInfo)); + runnumber = randomrunnumber(*(eventInfo)); } - - // Get the DataType of the current egamma object -//! PATCore::ParticleDataType::DataType dataType = (PATCore::ParticleDataType::DataType) (egam->dataType()); -//! ATH_MSG_VERBOSE( "The egamma object with author=" << egam->author() -//! << " has PATCore::ParticleDataType::DataType=" << dataType -//! << " and EventKernel::ParticleDataType::DataType=" << egam->dataType() ); - /* For now the dataType must be set by the user. May be added to the IParticle class later. */ + + /* For now the dataType must be set by the user. May be added to the IParticle + * class later. */ // probably event info should be able to tell us if it's data, fullsim, AF,.. - PATCore::ParticleDataType::DataType dataType = PATCore::ParticleDataType::DataType::Data; - if ( m_dataTypeOverwrite >= 0 ) dataType = (PATCore::ParticleDataType::DataType)m_dataTypeOverwrite; + PATCore::ParticleDataType::DataType dataType = + PATCore::ParticleDataType::DataType::Data; + if (m_dataTypeOverwrite >= 0) + dataType = (PATCore::ParticleDataType::DataType)m_dataTypeOverwrite; // check if converted - const bool isConv=xAOD::EgammaHelpers::isConvertedPhoton(egam); + const bool isConv = xAOD::EgammaHelpers::isConvertedPhoton(egam); - // Call the ROOT tool to get an answer, check if the SF is for isolation or ID - const int status = isConv ? m_rootTool_con->calculate( dataType,runnumber,eta2,et,result) : m_rootTool_unc->calculate( dataType,runnumber,eta2,et,result); + // Call the ROOT tool to get an answer (for photons we need just the total) + const int status = isConv ? m_rootTool_con->calculate(dataType, runnumber, + eta2, et, result, true) + : m_rootTool_unc->calculate(dataType, runnumber, + eta2, et, result, true); // if status 0 something went wrong if (!status) { - result.scaleFactor = 1; - result.totalUncertainty = 1; + result.SF = 1; + result.Total = 1; return CP::CorrectionCode::OutOfValidityRange; } - + return CP::CorrectionCode::Ok; } @@ -302,14 +305,14 @@ CP::CorrectionCode AsgPhotonEfficiencyCorrectionTool::getEfficiencyScaleFactor(c } if(m_appliedSystematics==nullptr){ - efficiencyScaleFactor=sfresult.scaleFactor; + efficiencyScaleFactor=sfresult.SF; return CP::CorrectionCode::Ok; } //Get the result + the uncertainty float sigma(0); sigma=appliedSystematics().getParameterByBaseName("PH_EFF_"+m_sysSubstring+"Uncertainty"); - efficiencyScaleFactor=sfresult.scaleFactor+sigma*sfresult.totalUncertainty; + efficiencyScaleFactor=sfresult.SF+sigma*sfresult.Total; return CP::CorrectionCode::Ok; } @@ -322,7 +325,7 @@ CP::CorrectionCode AsgPhotonEfficiencyCorrectionTool::getEfficiencyScaleFactorEr return status; } - efficiencyScaleFactorError=sfresult.totalUncertainty; + efficiencyScaleFactorError=sfresult.Total; return CP::CorrectionCode::Ok; } @@ -387,14 +390,12 @@ applySystematicVariation ( const CP::SystematicSet& systConfig ) // If it's a new input set, we need to filter it if( itr == m_systFilter.end() ){ - // New systematic. We need to parse it. MP 26.11.15 remove the static from <<< static CP::SystematicSet affectingSys = affectingSystematics(); >>> CP::SystematicSet affectingSys = affectingSystematics(); CP::SystematicSet filteredSys; - if (!CP::SystematicSet::filterForAffectingSystematics(systConfig, affectingSys, filteredSys)){ + if (!CP::SystematicSet::filterForAffectingSystematics(systConfig, affectingSys, filteredSys)){ ATH_MSG_ERROR("Unsupported combination of systematics passed to the tool!"); return StatusCode::FAILURE; } - // Insert filtered set into the map itr = m_systFilter.insert(std::make_pair(systConfig, filteredSys)).first; } @@ -450,6 +451,3 @@ std::string AsgPhotonEfficiencyCorrectionTool::getFileName(const std::string& is return value; } - - - diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/TPhotonEfficiencyCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/TPhotonEfficiencyCorrectionTool.cxx deleted file mode 100644 index 2b2a20908f1daf61490c2d8bdc7c054f40ff9c84..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/Root/TPhotonEfficiencyCorrectionTool.cxx +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -/** - @class TPhotonEfficiencyCorrectionTool - @brief Calculate the photon scale factors and assosiated errors in pure ROOT - - @author Michael Pitt - @date April 2014 -*/ - - -// This class header -#include "PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h" - -Root::TPhotonEfficiencyCorrectionTool::TPhotonEfficiencyCorrectionTool( - const char* name) - : Root::TElectronEfficiencyCorrectionTool(name) {} - -Root::TPhotonEfficiencyCorrectionTool::~TPhotonEfficiencyCorrectionTool() = - default; - -int Root::TPhotonEfficiencyCorrectionTool::initialize() { - return Root::TElectronEfficiencyCorrectionTool::initialize(); -} - -int Root::TPhotonEfficiencyCorrectionTool::calculate( - const PATCore::ParticleDataType::DataType dataType, - const unsigned int runnumber, const double cluster_eta, - const double et, /* in MeV */ - Root::TPhotonEfficiencyCorrectionTool::Result& sf_and_err) const { - - Root::TElectronEfficiencyCorrectionTool::Result result; - const int status = Root::TElectronEfficiencyCorrectionTool::calculate( - dataType, runnumber, cluster_eta, et, /* in MeV */ - result,true); - - // if status 0 something went wrong - if (!status) { - sf_and_err.scaleFactor = -999; - sf_and_err.totalUncertainty = 1; - ATH_MSG_DEBUG( - "Something went wrong ... for debugging, " - << "look for a message from TElectronEfficiencyCorrectionTool"); - return 0; - } - // For Photons we only support one correlation model - sf_and_err.scaleFactor = result.SF; - sf_and_err.totalUncertainty = result.Total; - return status; -} diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/util/PrintPhotonSF.cxx b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/util/PrintPhotonSF.cxx index 412a44a8e87ce726dde7d6dfbfa4bedd6ee2c717..4fbe7500cedbb97d8f21213a673fd40ae17e2a74 100644 --- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/util/PrintPhotonSF.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/util/PrintPhotonSF.cxx @@ -18,7 +18,7 @@ #include "TH2F.h" // Local include(s): -#include "PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h" +#include "ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h" #include "AsgMessaging/MessageCheck.h" #include "AsgTools/StandaloneToolHandle.h" #define GEV 1000.0 @@ -72,10 +72,10 @@ int main (int argc, const char * argv[]) { if(getenv("ROOTCOREDIR")==nullptr){ cout << "Please setup RootCore before running the PrintPhotonSF [file]"<<endl; return 0.; - } + } // Create and initialize an instance for both types of photons - Root::TPhotonEfficiencyCorrectionTool tool_SF; + Root::TElectronEfficiencyCorrectionTool tool_SF; tool_SF.addFileName(file.Data()); if(!tool_SF.initialize()){ @@ -112,9 +112,9 @@ int main (int argc, const char * argv[]) { else printf("|%2.0f-%2.0f\t\t|",pTbounds[i-1]/GEV,pTbounds[i]/GEV); for(int j=1;j<=nEtabins;j++){ eta=0.5*(Etabounds[j-1]+Etabounds[j]); - Root::TPhotonEfficiencyCorrectionTool::Result sf; - tool_SF.calculate(datatype,run_number,eta,pt,sf); - printf("%2.2f+/-%2.4f\t|",sf.scaleFactor,sf.totalUncertainty); + Root::TElectronEfficiencyCorrectionTool::Result sf; + tool_SF.calculate(datatype,run_number,eta,pt,sf,true); + printf("%2.2f+/-%2.4f\t|",sf.SF,sf.Total); } cout << endl; } cout << dash_line.Data() <<endl; diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/python/PhysValMonitoringConfig.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/python/PhysValMonitoringConfig.py index 4db39457cb120ce7d212480c2c6e4a7344a84962..67bc14fa60b29df5c361307a8d31bb5e3a773388 100644 --- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/python/PhysValMonitoringConfig.py +++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/python/PhysValMonitoringConfig.py @@ -79,7 +79,7 @@ def PhysValMonitoringCfg(flags, name="PhysValMonManager", tools=[], **kwargs): from MuonPhysValMonitoring.MuonPhysValConfig import PhysValMuonCfg tools.append(acc.popToolsAndMerge(PhysValMuonCfg(flags))) if flags.PhysVal.doActs: - from ActsTrkAnalysisTools.ActsTrkAnalysisToolsConfig import PhysValActsCfg + from ActsConfig.ActsTrkAnalysisConfig import PhysValActsCfg tools.append(acc.popToolsAndMerge(PhysValActsCfg(flags))) if flags.PhysVal.doLLPSecVtx: from InDetSecVertexValidation.InDetSecVertexValidationConfig import PhysValSecVtxCfg diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/CMakeLists.txt b/PhysicsAnalysis/SUSYPhys/SUSYTools/CMakeLists.txt index 885445cff17f3288d75ff8858820bcae64054faf..4b585fe7ef39729ccaf978bcc9ab747aebb4c150 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/CMakeLists.txt +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/CMakeLists.txt @@ -16,7 +16,7 @@ find_package( GTest ) # Libraries in the package: atlas_add_library( SUSYToolsLib - SUSYTools/*.h Root/*.cxx src/SUSYToolsAlg.cxx src/SUSYToolsAlg.h + Root/*.cxx PUBLIC_HEADERS SUSYTools src PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} LINK_LIBRARIES AsgTools xAODCore xAODEgamma xAODEventInfo @@ -40,48 +40,56 @@ atlas_add_library( SUSYToolsLib if( NOT XAOD_STANDALONE ) atlas_add_component( SUSYTools - src/*.h src/*.cxx src/components/*.cxx + src/*.cxx src/components/*.cxx NOCLID - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel - AthenaKernel AthAnalysisBaseCompsLib xAODEventInfo xAODMuon xAODPrimitives - xAODJet xAODBTagging xAODEgamma xAODMissingET xAODTracking xAODTau - TauAnalysisToolsLib xAODCore AthContainers AsgTools xAODBase xAODCutFlow - PATInterfaces PathResolver SUSYToolsLib MuonAnalysisInterfacesLib JetAnalysisInterfacesLib EgammaAnalysisInterfacesLib ) + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthAnalysisBaseCompsLib SUSYToolsLib TauAnalysisToolsLib ) + atlas_add_dictionary( SUSYToolsDict + SUSYTools/SUSYToolsDict.h + SUSYTools/selection.xml + LINK_LIBRARIES SUSYToolsLib ) +else() + atlas_add_library( SUSYTools src/SUSYToolsAlg.cxx src/SUSYToolsAlg.h + NO_PUBLIC_HEADERS + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES SUSYToolsLib TauAnalysisToolsLib + ) + atlas_add_dictionary( SUSYToolsDict + SUSYTools/SUSYToolsDict.h + SUSYTools/selection.xml + LINK_LIBRARIES SUSYToolsLib SUSYTools ) endif() -atlas_add_dictionary( SUSYToolsDict - SUSYTools/SUSYToolsDict.h - SUSYTools/selection.xml - LINK_LIBRARIES SUSYToolsLib ) + # Executable(s) in the package: set( extra_libs ) if( NOT XAOD_STANDALONE ) set( extra_libs POOLRootAccessLib ) endif() -atlas_add_executable( SUSYToolsTester - util/SUSYToolsTester.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODMuon - xAODEgamma xAODTau xAODTruth xAODJet xAODCaloEvent xAODCore xAODMissingET - FTagAnalysisInterfacesLib xAODBase TauAnalysisToolsLib GoodRunsListsLib - PileupReweightingLib PATInterfaces PathResolver METUtilitiesLib xAODCutFlow - SUSYToolsLib ${extra_libs} ) -atlas_add_executable( SUSYTruthTester - util/SUSYTruthTester.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo - xAODTruth xAODCore xAODBase PATInterfaces PathResolver xAODCutFlow - SUSYToolsLib ${extra_libs} ) +if( XAOD_STANDALONE ) + atlas_add_executable( SUSYToolsTester + util/SUSYToolsTester.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODMuon + xAODEgamma xAODTau xAODTruth xAODJet xAODCaloEvent xAODCore xAODMissingET + FTagAnalysisInterfacesLib xAODBase TauAnalysisToolsLib GoodRunsListsLib + PileupReweightingLib PATInterfaces PathResolver METUtilitiesLib xAODCutFlow + SUSYToolsLib ${extra_libs} ) -atlas_add_executable( SUSYTools_check_xsections - util/check_xsections.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} SUSYToolsLib ) + atlas_add_executable( SUSYTruthTester + util/SUSYTruthTester.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo + xAODTruth xAODCore xAODBase PATInterfaces PathResolver xAODCutFlow + SUSYToolsLib ${extra_libs} ) + + atlas_add_executable( SUSYTools_check_xsections + util/check_xsections.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} SUSYToolsLib ) -if( XAOD_STANDALONE ) atlas_add_executable( SUSYTools_check_syst util/check_syst.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} @@ -95,32 +103,49 @@ set (extra_patterns " (Entire loop|Excluding first event|First event).*ms|cvmfs # Test(s) in the package: if( XAOD_STANDALONE ) atlas_add_test( ut_SUSYToolsTester_data - SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYS.data18_13TeV.00356250_p5511.pool.root + SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/data18_13TeV.00356250_p5631.PHYS.pool.root maxEvents=500 isData=1 isAtlfast=0 Debug=0 LOG_IGNORE_PATTERN ${extra_patterns} - PROPERTIES TIMEOUT 300 ) atlas_add_test( ut_SUSYToolsTester_data_Run3 - SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYS.data22_13p6TeV.00440543_p5514.pool.root + SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/data22_13p6TeV.00440543_p5632.PHYS.pool.root maxEvents=1000 isData=1 isAtlfast=0 Debug=0 LOG_IGNORE_PATTERN ${extra_patterns} - PROPERTIES TIMEOUT 300 ) atlas_add_test( ut_SUSYToolsTester_mc - SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYS.mc20_13TeV.410470.FS_mc20e_p5511.PHYS.pool.root + SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/mc20_13TeV.410470.FS_mc20e_p5631.PHYS.pool.root maxEvents=100 isData=0 isAtlfast=0 Debug=0 NoSyst=0 PRWFile=dev/PileupReweighting/mc16_13TeV/pileup_mc16e_dsid410470_FS.root ilumicalcFile=GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root LOG_IGNORE_PATTERN ${extra_patterns} - PROPERTIES TIMEOUT 300 ) atlas_add_test( ut_SUSYToolsTester_mc_Run3 - SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYS.mc21_13p6TeV.601229.FS_mc21a_p5511.PHYS.pool.root + SCRIPT SUSYToolsTester /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/mc21_13p6TeV.601229.FS_mc21a_p5631.PHYS.pool.root maxEvents=100 isData=0 isAtlfast=0 Debug=0 NoSyst=0 PRWFile=dev/PileupReweighting/mc16_13TeV/pileup_mc21a_dsid601229_FS.root ilumicalcFile=GoodRunsLists/data22_13p6TeV/20230116/ilumicalc_histograms_None_431810-440613_OflLumi-Run3-002.root LOG_IGNORE_PATTERN ${extra_patterns} + ) +else() + atlas_add_test( ut_SUSYToolsAlg_data + SCRIPT "athena SUSYTools/jobOptions.py --evtMax 500 - --testCampaign data18" + PROPERTIES TIMEOUT 300 + LOG_IGNORE_PATTERN ${extra_patterns} + ) + atlas_add_test( ut_SUSYToolsAlg_data_Run3 + SCRIPT "athena SUSYTools/jobOptions.py --evtMax 500 - --testCampaign data22" PROPERTIES TIMEOUT 300 + LOG_IGNORE_PATTERN ${extra_patterns} + ) + atlas_add_test( ut_SUSYToolsAlg_mc + SCRIPT "athena SUSYTools/jobOptions.py --evtMax 100 - --prwFiles dev/PileupReweighting/share/DSID410xxx/pileup_mc16e_dsid410470_FS.root --testCampaign mc20e" + PROPERTIES TIMEOUT 300 + LOG_IGNORE_PATTERN ${extra_patterns} + ) + atlas_add_test( ut_SUSYToolsAlg_mc_Run3 + SCRIPT "athena SUSYTools/jobOptions.py --evtMax 100 - --prwFiles dev/PileupReweighting/share/DSID601xxx/pileup_mc21a_dsid601229_FS.root --testCampaign mc21a" + PROPERTIES TIMEOUT 300 + LOG_IGNORE_PATTERN ${extra_patterns} ) endif() diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/README.md b/PhysicsAnalysis/SUSYPhys/SUSYTools/README.md index 0cf36207b7f88446c439c23639645522bda7e593..185b5ed26a7d35870b28107f648f2ee42e15b09c 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/README.md +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/README.md @@ -21,16 +21,14 @@ Set up the latest recommended AnalysisBase release: ```bash setupATLAS lsetup git -asetup "AnalysisBase,22.2.110" -# or the nightly: asetup "AnalysisBase,22.2,latest" +asetup "AnalysisBase,24.2.2" ``` Or the latest AthAnalysis release:: ```bash setupATLAS -asetup "AthAnalysis,22.2.110" -# or the nightly: asetup "AthAnalysis,22.2,latest" +asetup "AthAnalysis,24.2.2" ``` For working with code, a sparse checkout is pretty straightforward. @@ -128,6 +126,24 @@ cp ut_SUSYToolsTester_data.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnaly cp ut_SUSYToolsTester_data_Run3.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data_Run3.ref cp ut_SUSYToolsTester_mc.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc.ref cp ut_SUSYToolsTester_mc_Run3.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc_Run3.ref +``` +Or if you are using AthAnalysis these are the current test: +```bash +ctest -R SUSYTools_ut_SUSYToolsAlg_data_ctest +ctest -R SUSYTools_ut_SUSYToolsAlg_data_Run3_ctest +ctest -R SUSYTools_ut_SUSYToolsAlg_mc_ctest +ctest -R SUSYTools_ut_SUSYToolsAlg_mc_Run3_ctest +``` +3) Before copying the files, check that all the changes are expected. +```bash +cd $WorkDir_DIR/../PhysicsAnalysis/SUSYPhys/SUSYTools/CMakeFiles/unitTestRun/ +cp ut_SUSYToolsAlg_data.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data.ref +cp ut_SUSYToolsAlg_data_Run3.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data_Run3.ref +cp ut_SUSYToolsAlg_mc.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc.ref +cp ut_SUSYToolsAlg_mc_Run3.log-todiff $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc_Run3.ref +``` +4) Add the new reference file on git: +```bash cd $WorkDir_DIR/../../src/athena/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ git add ut_SUSYToolsTester* ``` diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Electrons.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Electrons.cxx index 333893ea36dec62a6bc0221092da7e7a1ea35f97..8920325ac06fbe05faff14449c18c941076bbf9e 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Electrons.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Electrons.cxx @@ -391,7 +391,7 @@ float SUSYObjDef_xAOD::GetSignalElecSF(const xAOD::Electron& el, const bool triggerSF, const bool isoSF, const std::string& trigExpr, - const bool ecidsSF, + const bool ecidsSF, const bool cidSF ) { if ((m_eleId == "VeryLooseLLH" || m_eleId == "LooseLLH" || m_eleId == "Loose" || m_eleId == "Medium" || m_eleId == "Tight") && (idSF || triggerSF || isoSF)) { @@ -449,10 +449,11 @@ float SUSYObjDef_xAOD::GetSignalElecSF(const xAOD::Electron& el, std::vector<std::string> trigMChains={}; std::string theExpr (""); if(trigExpr==singleLepStr) { - if (this->treatAsYear()==2015) trigMChains = v_trigs15_cache_singleEle; - else if (this->treatAsYear()==2016) trigMChains = v_trigs16_cache_singleEle; - else if (this->treatAsYear()==2017) trigMChains = v_trigs17_cache_singleEle; - else trigMChains = v_trigs18_cache_singleEle; + if (this->treatAsYear()==2015) trigMChains = m_v_trigs15_cache_singleEle; + else if (this->treatAsYear()==2016) trigMChains = m_v_trigs16_cache_singleEle; + else if (this->treatAsYear()==2017) trigMChains = m_v_trigs17_cache_singleEle; + else if (this->treatAsYear()==2018) trigMChains = m_v_trigs18_cache_singleEle; + else trigMChains = m_v_trigs22_cache_singleEle; theExpr=m_electronTriggerSFStringSingle; } else{ @@ -523,20 +524,72 @@ float SUSYObjDef_xAOD::GetSignalElecSF(const xAOD::Electron& el, double SUSYObjDef_xAOD::GetEleTriggerEfficiencySF(const xAOD::Electron& el, const std::string& trigExpr) const { double trig_sf(1.); - if (!acc_passOR(el)) trig_sf =1; - ATH_MSG_DEBUG( "ELECTRON TRIGGER SF ARE NOT YET SUPPORTED IN R22 FOR (" << trigExpr << "), RETURNING 1"); + + std::string single_str = "SINGLE_E"; + std::string single_str_2022 = "2022_"; + std::string dilep_str = "DI_E"; + std::string multi_str = "MULTI_L"; + + CP::CorrectionCode result; + if ( trigExpr.find(single_str) != std::string::npos || trigExpr.find(single_str_2022) != std::string::npos) + result = m_elecEfficiencySFTool_trig_singleLep->getEfficiencyScaleFactor(el, trig_sf); + else if ( trigExpr.find(dilep_str) != std::string::npos ) + ATH_MSG_ERROR( "Use GetTriggerGlobalEfficiency for logical OR of lepton triggers"); + else if ( trigExpr.find(multi_str) != std::string::npos ) + ATH_MSG_ERROR( "Use GetTriggerGlobalEfficiency for logical OR of lepton triggers"); + else + ATH_MSG_ERROR( "The trigger expression (" << trigExpr << ") is not supported by the electron trigger SF!"); + + switch (result) { + case CP::CorrectionCode::Error: + ATH_MSG_ERROR( "Failed to retrieve signal electron trigger SF"); + return 1.; + case CP::CorrectionCode::OutOfValidityRange: + ATH_MSG_VERBOSE( "OutOfValidityRange found for signal electron trigger SF"); + return 1.; + default: + break; + } + return trig_sf; } + double SUSYObjDef_xAOD::GetEleTriggerEfficiency(const xAOD::Electron& el, const std::string& trigExpr) const { - + + std::string single_str = "SINGLE_E"; + std::string single_str_2022 = "2022_"; + std::string dilep_str = "DI_E"; + std::string multi_str = "MULTI_L"; + double trig_eff(1.); - if (!acc_passOR(el)) trig_eff =1; - ATH_MSG_DEBUG( "ELECTRON TRIGGER EFFICIENCIES ARE NOT YET SUPPORTED IN R22 FOR (" << trigExpr << "), RETURNING 1"); + + CP::CorrectionCode result; + if ( trigExpr.find(single_str) != std::string::npos || trigExpr.find(single_str_2022) != std::string::npos) + result = m_elecEfficiencySFTool_trigEff_singleLep->getEfficiencyScaleFactor(el, trig_eff); + else if ( trigExpr.find(dilep_str) != std::string::npos ) + ATH_MSG_ERROR( "Use GetTriggerGlobalEfficiency for logical OR of lepton triggers"); + else if ( trigExpr.find(multi_str) != std::string::npos ) + ATH_MSG_ERROR( "Use GetTriggerGlobalEfficiency for logical OR of lepton triggers"); + else + ATH_MSG_ERROR( "The trigger expression (" << trigExpr << ") is not supported by the electron trigger efficiency!"); + + switch (result) { + case CP::CorrectionCode::Error: + ATH_MSG_ERROR( "Failed to retrieve signal electron trigger efficiency"); + return 1.; + case CP::CorrectionCode::OutOfValidityRange: + ATH_MSG_VERBOSE( "OutOfValidityRange found for signal electron trigger efficiency"); + return 1.; + default: + break; + } + return trig_eff; } + float SUSYObjDef_xAOD::GetTotalElectronSF(const xAOD::ElectronContainer& electrons, const bool recoSF, const bool idSF, const bool triggerSF, const bool isoSF, const std::string& trigExpr, const bool ecidsSF, const bool cidSF) { float sf(1.); @@ -564,6 +617,10 @@ double SUSYObjDef_xAOD::GetEleTriggerEfficiency(const xAOD::Electron& el, const ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (id) for systematic var. " << systConfig.name() ); } + ret = m_elecEfficiencySFTool_trig_singleLep->applySystematicVariation(systConfig); + if (ret != StatusCode::SUCCESS) { + ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (trigger) for systematic var. " << systConfig.name() ); + } ret = m_elecEfficiencySFTool_iso->applySystematicVariation(systConfig); if (ret != StatusCode::SUCCESS) { @@ -595,6 +652,11 @@ double SUSYObjDef_xAOD::GetEleTriggerEfficiency(const xAOD::Electron& el, const ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (id) back to default."); } + ret = m_elecEfficiencySFTool_trig_singleLep->applySystematicVariation(m_currentSyst); + if (ret != StatusCode::SUCCESS) { + ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (trigger) back to default."); + } + ret = m_elecEfficiencySFTool_iso->applySystematicVariation(m_currentSyst); if (ret != StatusCode::SUCCESS) { ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (iso) back to default."); diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Jets.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Jets.cxx index 15cbb14913e4f20392d65411ddb93d3a677eb8be..4d8e8dfcb2d65325f291a920ac42297f772672a4 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Jets.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Jets.cxx @@ -118,8 +118,10 @@ namespace ST { // Note that for PHYSLITE jets we don't need the nominal calibration if (jetkey!="AnalysisJets") { ATH_CHECK(m_jetCalibTool->applyCalibration(*copy)); - ATH_CHECK(m_jetJvtEfficiencyTool->recalculateScores(*copy)); - } + } + + // Re-calculate NNJvt scores + if (m_applyJVTCut) ATH_CHECK(m_jetJvtEfficiencyTool->recalculateScores(*copy)); // Update the jets for (const auto& jet : *copy) { @@ -392,9 +394,9 @@ namespace ST { dec_ztagged(input) = -1; dec_toptagged(input) = -1; if (doLargeRdecorations) { - if (!m_WtagConfig.empty()) dec_wtagged(input) = m_WTaggerTool->tag(input); - if (!m_ZtagConfig.empty()) dec_ztagged(input) = m_ZTaggerTool->tag(input); - if (!m_ToptagConfig.empty()) dec_toptagged(input) = m_TopTaggerTool->tag(input); + if (!m_WtagConfig.empty()) dec_wtagged(input) = m_WTaggerTool->tag(input).isSuccess(); + if (!m_ZtagConfig.empty()) dec_ztagged(input) = m_ZTaggerTool->tag(input).isSuccess(); + if (!m_ToptagConfig.empty()) dec_toptagged(input) = m_TopTaggerTool->tag(input).isSuccess(); } // If a user hasn't specified an uncertainty config, then this tool will be empty @@ -695,7 +697,8 @@ namespace ST { bool isbjet = bool(m_btagSelTool->accept(input)); dec_bjet(input) = isbjet; - ATH_CHECK( SetBtagWeightDecorations(input, m_btagSelTool, m_BtagTagger) ); + if (SetBtagWeightDecorations(input, m_btagSelTool, m_BtagTagger).isFailure()) + ANA_MSG_ERROR("Couldn't set b-tag decorations for jet, is-b = " << (isbjet?"true":"false") << ", pT = " << input.pt()/1000.); return isbjet; } @@ -705,7 +708,8 @@ namespace ST { bool isbjet = bool(m_btagSelTool_trkJet->accept(input)); dec_bjet(input) = isbjet; - ATH_CHECK( SetBtagWeightDecorations(input, m_btagSelTool_trkJet, m_BtagTagger_trkJet) ); + if(SetBtagWeightDecorations(input, m_btagSelTool_trkJet, m_BtagTagger_trkJet).isFailure()) + ANA_MSG_ERROR("Couldn't set b-tag decorations for trackjet, is-b = " << (isbjet?"true":"false") << ", pT = " << input.pt()/1000.); return isbjet; } @@ -725,7 +729,8 @@ namespace ST { int isbjet = m_btagSelTool->getQuantile(input); dec_bjet(input) = isbjet; - ATH_CHECK( SetBtagWeightDecorations(input, m_btagSelTool, m_BtagTagger) ); + if(SetBtagWeightDecorations(input, m_btagSelTool, m_BtagTagger).isFailure()) + ANA_MSG_ERROR("Couldn't set continuous b-tag decorations for jet, is-b = " << isbjet << ", pT = " << input.pt()/1000.); return isbjet; } @@ -735,7 +740,8 @@ namespace ST { int isbjet = m_btagSelTool_trkJet->getQuantile(input); dec_bjet(input) = isbjet; - ATH_CHECK( SetBtagWeightDecorations(input, m_btagSelTool_trkJet, m_BtagTagger_trkJet) ); + if(SetBtagWeightDecorations(input, m_btagSelTool_trkJet, m_BtagTagger_trkJet).isFailure()) + ANA_MSG_ERROR("Couldn't set continuous b-tag decorations for trackjet, is-b = " << isbjet << ", pT = " << input.pt()/1000.); return isbjet; } @@ -907,7 +913,8 @@ namespace ST { float totalSF = 1.; if (!m_applyJVTCut) return totalSF; - ANA_CHECK(m_jetJvtEfficiencyTool->recalculateScores(*jets)); + if(m_jetJvtEfficiencyTool->recalculateScores(*jets).isFailure()) + ATH_MSG_ERROR("Couldn't recalculate JvtEfficiencyScores."); ConstDataVector<xAOD::JetContainer> jvtjets(SG::VIEW_ELEMENTS); for (const xAOD::Jet* jet : *jets) { @@ -1039,28 +1046,11 @@ namespace ST { return totalSF; } - StatusCode SUSYObjDef_xAOD::BendBTaggingLinks(xAOD::JetContainer* to_container , const std::string& bTagKey) const { - const xAOD::JetContainer* b_tag_jets = nullptr; - ATH_CHECK(evtStore()->retrieve(b_tag_jets,bTagKey)); - if (b_tag_jets->size() != to_container->size()) { - ATH_MSG_FATAL("Size of the original jet container and of the btagg container do not match"); - return StatusCode::FAILURE; - } - xAOD::JetContainer::const_iterator btag_begin = b_tag_jets->begin(); - xAOD::JetContainer::const_iterator btag_end = b_tag_jets->end(); - - xAOD::JetContainer::iterator to_begin = to_container->begin(); - xAOD::JetContainer::iterator to_end = to_container->end(); - for ( ; to_begin != to_end && btag_begin != btag_end ; ++to_begin, ++btag_begin) { - xAOD::BTaggingUtilities::setBTaggingLink(*(*to_begin), xAOD::BTaggingUtilities::getBTaggingLink(*(*btag_begin))); - } - return StatusCode::SUCCESS; - } - StatusCode SUSYObjDef_xAOD::SetBtagWeightDecorations(const xAOD::Jet& input, const asg::AnaToolHandle<IBTaggingSelectionTool>& btagSelTool, const std::string& btagTagger) const { double weight = 0.; if ( btagSelTool->getTaggerWeight(input, weight, false/*useVetoWP=false*/) != CP::CorrectionCode::Ok ) { ATH_MSG_ERROR( btagSelTool->name() << ": could not retrieve b-tag weight (" << btagTagger << ")." ); + return StatusCode::FAILURE; } dec_btag_weight(input) = weight; ATH_MSG_DEBUG( btagSelTool->name() << " b-tag weight: " << weight ); @@ -1079,5 +1069,4 @@ namespace ST { } return StatusCode::SUCCESS; } - } diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Muons.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Muons.cxx index 1a5d1fca9228b616f31d3d97a306a5772f6978b0..2e72ee7625d185b7dd3e3cb7a21c658a7d1529a7 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Muons.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Muons.cxx @@ -204,7 +204,6 @@ StatusCode SUSYObjDef_xAOD::FillMuon(xAOD::Muon& input, float ptcut, float etacu const xAOD::EventInfo* evtInfo = nullptr; ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); - const xAOD::Vertex* pv = this->GetPrimVtx(); double primvertex_z = pv ? pv->z() : 0; //const xAOD::TrackParticle* track = input.primaryTrackParticle(); diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYObjDef_xAOD.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYObjDef_xAOD.cxx index 3ec77a512933fd25fde5e5c389d798655125f419..eb29bad005ee76d5e35154397b7ec07c305c1687 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYObjDef_xAOD.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYObjDef_xAOD.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // Local include(s): @@ -146,7 +146,6 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) m_autoconfigPRWFile(""), m_autoconfigPRWCombinedmode(false), m_autoconfigPRWRPVmode(false), - m_autoconfigPRWHFFilter(""), m_autoconfigPRWRtags(""), m_mcCampaign(""), m_mcChannel(-99), @@ -337,6 +336,8 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) // m_elecEfficiencySFTool_reco(""), m_elecEfficiencySFTool_id(""), + m_elecEfficiencySFTool_trig_singleLep(""), + m_elecEfficiencySFTool_trigEff_singleLep(""), m_elecEfficiencySFTool_iso(""), m_elecEfficiencySFTool_isoHighPt(""), // @@ -373,20 +374,27 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) m_trig2016combination_singleLep(""), m_trig2017combination_singleLep(""), m_trig2018combination_singleLep(""), + m_trig2022combination_singleLep(""), + m_trigNToys_diLep(-99), m_trig2015combination_diLep(""), m_trig2016combination_diLep(""), m_trig2017combination_diLep(""), m_trig2018combination_diLep(""), + m_trig2022combination_diLep(""), m_trigGlobalEffCorrTool_diLep(""), + m_trigNToys_multiLep(-99), m_trig2015combination_multiLep(""), m_trig2016combination_multiLep(""), m_trig2017combination_multiLep(""), m_trig2018combination_multiLep(""), + m_trig2022combination_multiLep(""), m_trigGlobalEffCorrTool_multiLep(""), + m_trigNToys_diPhoton(-99), m_trig2015combination_diPhoton(""), m_trig2016combination_diPhoton(""), m_trig2017combination_diPhoton(""), m_trig2018combination_diPhoton(""), + m_trig2022combination_diPhoton(""), m_trigGlobalEffCorrTool_diPhoton(""), m_trigConfTool(""), m_trigDecTool(""), @@ -585,11 +593,10 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) //--- Tools configuration //PRW declareProperty( "AutoconfigurePRWTool", m_autoconfigPRW ); - declareProperty( "AutoconfigurePRWToolPath", m_autoconfigPRWPath ); // e.g. dev/PileupReweighting/share/ + declareProperty( "AutoconfigurePRWToolPath", m_autoconfigPRWPath ); // e.g. dev/PileupReweighting/share/ declareProperty( "AutoconfigurePRWToolFile", m_autoconfigPRWFile ); // e.g. DSID407xxx/pileup_mc16a_dsid407352_FS.root declareProperty( "AutoconfigurePRWToolCombinedmode", m_autoconfigPRWCombinedmode ); declareProperty( "AutoconfigurePRWToolRPVmode", m_autoconfigPRWRPVmode ); - declareProperty( "AutoconfigurePRWToolHFFilter", m_autoconfigPRWHFFilter ); declareProperty( "AutoconfigurePRWToolRtags", m_autoconfigPRWRtags ); declareProperty( "mcCampaign", m_mcCampaign ); declareProperty( "mcChannel", m_mcChannel ); @@ -597,6 +604,7 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) declareProperty( "PRWLumiCalcFiles", m_prwLcalcFiles ); declareProperty( "PRWActualMu2017File", m_prwActualMu2017File ); declareProperty( "PRWActualMu2018File", m_prwActualMu2018File ); + declareProperty( "PRWActualMu2022File", m_prwActualMu2022File ); declareProperty( "PRWDataScaleFactor", m_prwDataSF); declareProperty( "PRWDataScaleFactorUP", m_prwDataSF_UP); declareProperty( "PRWDataScaleFactorDOWN", m_prwDataSF_DW); @@ -621,7 +629,7 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) declareProperty( "EleEffCorrFNList", m_EG_corrFNList ); declareProperty( "IsRun3", m_isRun3 ); declareProperty( "IsPHYSLITE", m_isPHYSLITE ); - + //For electron trigger SF tools declareProperty( "ElectronTriggerSFStringSingle", m_electronTriggerSFStringSingle); @@ -657,6 +665,7 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) m_muonLRTORTool.declarePropertyFor( this, "MuonLRTOverlapRemovalTool", "Prompt/LRT muon OR Tool" ); // m_elecEfficiencySFTool_reco.declarePropertyFor( this, "ElectronEfficiencyCorrectionTool_reco", "The ElectronEfficiencyCorrectionTool for reconstruction SFs" ); + m_elecEfficiencySFTool_trig_singleLep.declarePropertyFor( this, "ElectronEfficiencyCorrectionTool_trig_singleLep", "The ElectronEfficiencyCorrectionTool for single-e triggers" ); m_elecEfficiencySFTool_id.declarePropertyFor( this, "ElectronEfficiencyCorrectionTool_id", "The ElectronEfficiencyCorrectionTool for ID SFs" ); m_elecEfficiencySFTool_iso.declarePropertyFor( this, "ElectronEfficiencyCorrectionTool_iso" , "The ElectronEfficiencyCorrectionTool for iso SFs" ); m_elecEfficiencySFTool_isoHighPt.declarePropertyFor( this, "ElectronEfficiencyCorrectionTool_isoHigPt" , "The ElectronEfficiencyCorrectionTool for iso high-pt SFs" ); @@ -757,7 +766,7 @@ SUSYObjDef_xAOD::SUSYObjDef_xAOD( const std::string& name ) m_mu_iso_support = { "PflowLoose_FixedRad", "PflowLoose_VarRad", "PflowTight_FixedRad", "PflowTight_VarRad", // PFlow (new naming) recommended WPs "TightTrackOnly_FixedRad", "TightTrackOnly_VarRad", "HighPtTrackOnly", // TrackOnly (new naming) recommended WPs - "PLVLoose", "PLVTight", // PLV recommended WPs + "PLVLoose", "PLVTight", // PLV recommended WPs "Loose_VarRad", "Loose_FixedRad", "Tight_VarRad", "Tight_FixedRad", // Other WPs (new naming) "PLImprovedTight", "PLImprovedVeryTight" // New PLIV WPs, fallback support below b/o SFs }; @@ -819,29 +828,22 @@ StatusCode SUSYObjDef_xAOD::initialize() { bool autoconf(false); #ifndef XAOD_STANDALONE // For now metadata is Athena-only if ( m_dataSource < 0 ) { - bool local_isData(false), local_isAtlfast(false); autoconf = true; - ATH_MSG_INFO("Autoconfigure isData and isAtlfast"); + ATH_MSG_INFO("Autoconfiguring: dataSource, mcCampaign, isPHYSLITE"); std::string projectName = ""; ATH_CHECK( AthAnalysisHelper::retrieveMetadata("/TagInfo", "project_name", projectName, inputMetaStore() ) ); - if ( projectName == "IS_SIMULATION" ) local_isData = false; - else if (projectName.compare(0, 4, "data") == 0 ) local_isData = true; - else { + if ( projectName == "IS_SIMULATION" ) { + std::string simFlavour = ""; + ATH_CHECK( AthAnalysisHelper::retrieveMetadata("/Simulation/Parameters", "SimulationFlavour", simFlavour, inputMetaStore() ) ); + TString s(simFlavour); s.ToUpper(); + m_dataSource = s.Contains("ATLFAST") ? AtlfastII : FullSim; + } else if (projectName.compare(0, 4, "data") == 0 ) { + m_dataSource = Data; + } else { ATH_MSG_ERROR("Failed to autoconfigure -- project_name matches neither IS_SIMULATION nor data!"); return StatusCode::FAILURE; } - if (!local_isData) { - std::string simFlavour = ""; - ATH_CHECK( AthAnalysisHelper::retrieveMetadata("/Simulation/Parameters", "SimulationFlavour", simFlavour, inputMetaStore() ) ); - boost::to_upper(simFlavour); - local_isAtlfast = (simFlavour.find("ATLFASTII") != std::string::npos); - } - if (local_isData) {m_dataSource = Data;} - else { - if (local_isAtlfast) {m_dataSource = AtlfastII;} - else {m_dataSource = FullSim;} - } } #endif @@ -889,7 +891,7 @@ StatusCode SUSYObjDef_xAOD::initialize() { m_inputMETCore = m_isPHYSLITE? "MET_Core_AnalysisMET":"MET_Core_" + m_inputMETSuffix; m_inputMETMap = m_isPHYSLITE? "METAssoc_AnalysisMET":"METAssoc_" + m_inputMETSuffix; - + ATH_MSG_DEBUG ( "Build MET Core: " << m_inputMETCore); ATH_MSG_DEBUG ( "Build MET with map: " << m_inputMETMap); @@ -914,10 +916,13 @@ StatusCode SUSYObjDef_xAOD::initialize() { // autoconfigure PRW tool if m_autoconfigPRW==true if (m_autoconfigPRWPath == "dev/PileupReweighting/share/") - ATH_CHECK( autoconfigurePileupRWTool(m_autoconfigPRWPath, m_autoconfigPRWFile, true, m_autoconfigPRWRPVmode, m_autoconfigPRWCombinedmode, m_autoconfigPRWHFFilter) ); + ATH_CHECK( autoconfigurePileupRWTool(m_autoconfigPRWPath, m_autoconfigPRWFile, true, m_autoconfigPRWRPVmode, m_autoconfigPRWCombinedmode) ); else // need to set a full path if you don't use the one in CVMFS - ATH_CHECK( autoconfigurePileupRWTool(m_autoconfigPRWPath, m_autoconfigPRWFile, false, m_autoconfigPRWRPVmode, m_autoconfigPRWCombinedmode, m_autoconfigPRWHFFilter) ); + ATH_CHECK( autoconfigurePileupRWTool(m_autoconfigPRWPath, m_autoconfigPRWFile, false, m_autoconfigPRWRPVmode, m_autoconfigPRWCombinedmode) ); + + ATH_CHECK( m_outElectronLocation.initialize() ); + ATH_CHECK( m_outMuonLocation.initialize() ); ATH_CHECK( this->SUSYToolsInit() ); @@ -929,7 +934,7 @@ StatusCode SUSYObjDef_xAOD::initialize() { return StatusCode::SUCCESS; } -StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfilesDir, const std::string& PRWfileName, bool usePathResolver, bool RPVLLmode, bool Combinedmode, const std::string& HFFilter ) { +StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfilesDir, const std::string& PRWfileName, bool usePathResolver, bool RPVLLmode, bool Combinedmode, const std::string& /* HFFilter */ ) { std::string prwConfigFile(""); @@ -940,13 +945,14 @@ StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfile float dsid = -999; std::string amiTag(""); std::string mcCampaignMD(""); - std::string simType = (isAtlfast() ? "AFII" : "FS"); + std::string simFlavour(""); + std::string simType(""); const xAOD::FileMetaData* fmd = nullptr; // configure PRW rtag options from m_autoconfigPRWRtags string - // e.g. "mc16a:r9364_r11505_r11285,mc16c:r9781,mc16d:r10201_r11506_r11279,mc16e:r10724_r11507_r11249,mc16ans:r10740_r10832_r10847_r11008_r11036,mc16dns:r10739_r10833_r10848_r11009_r11037,mc16ens:r10790_r11038_r11265" + // e.g. "mc20a:r13167_r13297,mc20d_r13144_r13298,mc20e:r13145,mc21a:r13829,mc23a:r14622" std::map<std::string,std::vector<std::string>> PRWRtags = {}; - std::string allcampaigns = "mc16a.mc16c.mc16d.mc16e.mc20a.mc20d.mc20e.mc21a.mc16ans.mc16dns.mc16ens"; + std::string allcampaigns = "mc20a.mc20d.mc20e.mc21a.mc23a"; bool standard_like = true; for ( const auto& campaign_rtags : split( m_autoconfigPRWRtags, "," ) ) { // split string by "," std::string icampaign = campaign_rtags.substr(0, campaign_rtags.find(":")); // first field = campaign, split by ":" @@ -966,6 +972,12 @@ StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfile if ( inputMetaStore()->contains<xAOD::FileMetaData>("FileMetaData") && inputMetaStore()->retrieve(fmd,"FileMetaData").isSuccess() ) { fmd->value(xAOD::FileMetaData::mcProcID, dsid); fmd->value(xAOD::FileMetaData::amiTag, amiTag); + fmd->value(xAOD::FileMetaData::simFlavour, simFlavour); + + if(simFlavour.find("ATLFASTII")==0) simType = "AFII"; + else if(simFlavour.find("ATLFAST3")==0) simType = "AF3"; + else simType = "FS"; + bool found = false; while ( mcCampaignMD.empty() ) { for ( const auto& campaign_rtags : PRWRtags ) { // consider all campaigns @@ -994,7 +1006,7 @@ StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfile return StatusCode::FAILURE; #else - if ( m_mcCampaign == "mc16a" || m_mcCampaign == "mc16c" || m_mcCampaign == "mc16d" || m_mcCampaign == "mc16e") { + if ( m_mcCampaign == "mc20a" || m_mcCampaign == "mc20d" || m_mcCampaign == "mc20e" || m_mcCampaign == "mc21a" || m_mcCampaign == "mc23a") { // First see if the user set the mcCampaign/run number by property (hopefully temporary workaround) if ( m_mcChannel > 0) { ATH_MSG_WARNING( "autoconfigurePileupRWTool(): access to FileMetaData failed -> getting the mc channel number (DSID) and campaign from configuration." ); @@ -1010,8 +1022,7 @@ StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfile } else { // OK, this is a fall-back option without using MetaData but one has to manually set 'mcCampaign' property ATH_MSG_WARNING( "autoconfigurePileupRWTool(): access to FileMetaData failed -> getting the mc channel number (DSID) from the event store." ); - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); dsid = evtInfo->mcChannelNumber(); std::string NoMetadataButPropertyOK(""); @@ -1035,45 +1046,36 @@ StatusCode SUSYObjDef_xAOD::autoconfigurePileupRWTool(const std::string& PRWfile if (RPVLLmode) prwConfigFile = TString(prwConfigFile).ReplaceAll(".root","_rpvll.root").Data(); // PRW file specified by user - // e.g. DSID407xxx/pileup_mc16a_dsid407352_FS.root + // e.g. DSID700xxx/pileup_mc20a_dsid700015_FS.root if (!PRWfileName.empty()) { prwConfigFile = PRWfilesDir + PRWfileName; ATH_MSG_INFO( "autoconfigurePileupRWTool(): PRW file was specifed by user: " << prwConfigFile.data() ); } - // Patch for MC16 Znunu metadata bug (updated 2019.05.30) - if (!HFFilter.empty() && dsid>=366001 && dsid<= 366008) { - ATH_MSG_WARNING ("Samples metadata for Znunu samples is corrupted! Remapping to grab the correct RPW file. Only MC16e is supported for now."); - if (HFFilter == "BFilter") { - prwConfigFile = TString(prwConfigFile).ReplaceAll(std::to_string(DSID_INT),std::to_string(DSID_INT+9)).Data(); - } else if (HFFilter == "CFilterBVeto") { - prwConfigFile = TString(prwConfigFile).ReplaceAll(std::to_string(DSID_INT),std::to_string(DSID_INT+18)).Data(); - } else if (HFFilter == "CVetoBVeto") { - prwConfigFile = TString(prwConfigFile).ReplaceAll(std::to_string(DSID_INT),std::to_string(DSID_INT+27)).Data(); - } else { - ATH_MSG_ERROR ("Heavy flavor filter naming is wrong and cannot re-map dsid! SHould be BFilter, CFilterBVeto, or CVetoBVeto."); - return StatusCode::FAILURE; - } - } - m_prwConfFiles.clear(); // Combined mode can be only used when running with full data with the same MC samples if (Combinedmode) { - prwConfigFile = TString(prwConfigFile).ReplaceAll(mcCampaignMD,"mc16a").Data(); + if (mcCampaignMD.find("mc20") == std::string::npos) { + ATH_MSG_ERROR( "autoconfigurePileupRWTool(): combined mode currently onlys supported for mc20! Impossible to autoconfigure PRW. Aborting." ); + return StatusCode::FAILURE; + } + prwConfigFile = TString(prwConfigFile).ReplaceAll(mcCampaignMD,"mc20a").Data(); m_prwConfFiles.push_back( prwConfigFile ); - prwConfigFile = TString(prwConfigFile).ReplaceAll("mc16a","mc16d").Data(); + prwConfigFile = TString(prwConfigFile).ReplaceAll("mc20a","mc20d").Data(); m_prwConfFiles.push_back( prwConfigFile ); - prwConfigFile = TString(prwConfigFile).ReplaceAll("mc16d","mc16e").Data(); + prwConfigFile = TString(prwConfigFile).ReplaceAll("mc20d","mc20e").Data(); m_prwConfFiles.push_back( prwConfigFile ); m_prwConfFiles.push_back( PathResolverFindCalibFile(m_prwActualMu2017File) ); m_prwConfFiles.push_back( PathResolverFindCalibFile(m_prwActualMu2018File) ); } else { m_prwConfFiles.push_back( prwConfigFile ); - if ( mcCampaignMD == "mc16c" || mcCampaignMD == "mc16d") { + if ( mcCampaignMD == "mc20d") { m_prwConfFiles.push_back( PathResolverFindCalibFile(m_prwActualMu2017File) ); - } else if (mcCampaignMD == "mc16e") { + } else if (mcCampaignMD == "mc20e") { m_prwConfFiles.push_back( PathResolverFindCalibFile(m_prwActualMu2018File) ); + } else if (mcCampaignMD == "mc21a" || mcCampaignMD == "mc23a") { + m_prwConfFiles.push_back( PathResolverFindCalibFile(m_prwActualMu2022File) ); } } prwConfigFile = usePathResolver ? PathResolverFindCalibFile(prwConfigFile) : prwConfigFile; @@ -1350,23 +1352,30 @@ StatusCode SUSYObjDef_xAOD::readConfig() configFromFile(m_EG_corrModel, "Ele.EffNPcorrModel", rEnv, "TOTAL"); configFromFile(m_EG_corrFNList, "Ele.EffCorrFNList", rEnv, "None"); configFromFile(m_electronTriggerSFStringSingle, "Ele.TriggerSFStringSingle", rEnv, "SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"); - configFromFile(m_eleEffMapFilePath, "Ele.EffMapFilePath", rEnv, "ElectronEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map1.txt"); - configFromFile(m_trig2015combination_singleLep, "Trig.Singlelep2015", rEnv, "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50"); - configFromFile(m_trig2016combination_singleLep, "Trig.Singlelep2016", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50"); - configFromFile(m_trig2017combination_singleLep, "Trig.Singlelep2017", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50"); - configFromFile(m_trig2018combination_singleLep, "Trig.Singlelep2018", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50"); - configFromFile(m_trig2015combination_diLep, "Trig.Dilep2015", rEnv, "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50 || 2e12_lhloose_L12EM10VH || e17_lhloose_mu14 || e7_lhmedium_mu24 || mu18_mu8noL1 || 2mu10"); - configFromFile(m_trig2016combination_diLep, "Trig.Dilep2016", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e17_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_L1EM22VHI_mu8noL1 || mu22_mu8noL1 || 2mu14"); - configFromFile(m_trig2017combination_diLep, "Trig.Dilep2017", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || mu22_mu8noL1 || 2mu14"); - configFromFile(m_trig2018combination_diLep, "Trig.Dilep2018", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || mu22_mu8noL1 || 2mu14"); - configFromFile(m_trig2015combination_multiLep, "Trig.Multi2015", rEnv, "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50 || 2e12_lhloose_L12EM10VH || e17_lhloose_2e9_lhloose || 2e12_lhloose_mu10 || e12_lhloose_2mu10 || e17_lhloose_mu14 || e7_lhmedium_mu24 || mu18_mu8noL1 || 2mu10 || 3mu6"); - configFromFile(m_trig2016combination_multiLep, "Trig.Multi2016", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e17_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_L1EM22VHI_mu8noL1 || e17_lhloose_nod0_2e9_lhloose_nod0 || e12_lhloose_nod0_2mu10 || 2e12_lhloose_nod0_mu10 || mu22_mu8noL1 || 2mu14 || 3mu6"); - configFromFile(m_trig2017combination_multiLep, "Trig.Multi2017", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || e24_lhvloose_nod0_2e12_lhvloose_nod0_L1EM20VH_3EM10VH || e12_lhloose_nod0_2mu10 || 2e12_lhloose_nod0_mu10 || mu22_mu8noL1 || 2mu14 || 3mu6"); - configFromFile(m_trig2018combination_multiLep, "Trig.Multi2018", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || e24_lhvloose_nod0_2e12_lhvloose_nod0_L1EM20VH_3EM10VH || e12_lhloose_nod0_2mu10 || 2e12_lhloose_nod0_mu10 || mu22_mu8noL1 || 2mu14 || 3mu6"); + configFromFile(m_eleEffMapFilePath, "Ele.EffMapFilePath", rEnv, "ElectronEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map4.txt"); + configFromFile(m_trig2015combination_singleLep, "Trig.Singlelep2015", rEnv, "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50"); + configFromFile(m_trig2016combination_singleLep, "Trig.Singlelep2016", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50"); + configFromFile(m_trig2017combination_singleLep, "Trig.Singlelep2017", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50"); + configFromFile(m_trig2018combination_singleLep, "Trig.Singlelep2018", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50"); + configFromFile(m_trig2022combination_singleLep, "Trig.Singlelep2022", rEnv, "e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI || HLT_mu24_ivarmedium_L1MU14FCH_OR_HLT_mu50_L1MU14FCH"); + configFromFile(m_trigNToys_diLep, "Trig.DilepNToys", rEnv, 250); // 0 means calculate from formula instead - needs to be supported for the trigger combination + configFromFile(m_trig2015combination_diLep, "Trig.Dilep2015", rEnv, "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50 || 2e12_lhloose_L12EM10VH || e17_lhloose_mu14 || e7_lhmedium_mu24 || mu18_mu8noL1 || 2mu10"); + configFromFile(m_trig2016combination_diLep, "Trig.Dilep2016", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e17_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_L1EM22VHI_mu8noL1 || mu22_mu8noL1 || 2mu14"); + configFromFile(m_trig2017combination_diLep, "Trig.Dilep2017", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || mu22_mu8noL1 || 2mu14"); + configFromFile(m_trig2018combination_diLep, "Trig.Dilep2018", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || mu22_mu8noL1 || 2mu14"); + // configFromFile(m_trig2022combination_diLep, "Trig.Dilep2022", rEnv, ""); + configFromFile(m_trigNToys_multiLep, "Trig.MultiNToys", rEnv, 250); // 0 means calculate from formula instead - needs to be supported for the trigger combination + configFromFile(m_trig2015combination_multiLep, "Trig.Multi2015", rEnv, "e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15_OR_mu50 || 2e12_lhloose_L12EM10VH || e17_lhloose_2e9_lhloose || 2e12_lhloose_mu10 || e12_lhloose_2mu10 || e17_lhloose_mu14 || e7_lhmedium_mu24 || mu18_mu8noL1 || 2mu10 || 3mu6"); + configFromFile(m_trig2016combination_multiLep, "Trig.Multi2016", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e17_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_L1EM22VHI_mu8noL1 || e17_lhloose_nod0_2e9_lhloose_nod0 || e12_lhloose_nod0_2mu10 || 2e12_lhloose_nod0_mu10 || mu22_mu8noL1 || 2mu14 || 3mu6"); + configFromFile(m_trig2017combination_multiLep, "Trig.Multi2017", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || e24_lhvloose_nod0_2e12_lhvloose_nod0_L1EM20VH_3EM10VH || e12_lhloose_nod0_2mu10 || 2e12_lhloose_nod0_mu10 || mu22_mu8noL1 || 2mu14 || 3mu6"); + configFromFile(m_trig2018combination_multiLep, "Trig.Multi2018", rEnv, "e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium_OR_mu50 || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || e7_lhmedium_nod0_mu24 || e26_lhmedium_nod0_mu8noL1 || e24_lhvloose_nod0_2e12_lhvloose_nod0_L1EM20VH_3EM10VH || e12_lhloose_nod0_2mu10 || 2e12_lhloose_nod0_mu10 || mu22_mu8noL1 || 2mu14 || 3mu6"); + // configFromFile(m_trig2022combination_multiLep, "Trig.Multi2022", rEnv, ""); + configFromFile(m_trigNToys_diPhoton, "Trig.DiphotonNToys", rEnv, 250); // 0 means calculate from formula instead - needs to be supported for the trigger combination configFromFile(m_trig2015combination_diPhoton, "Trig.Diphoton2015", rEnv, "g35_loose_g25_loose"); - configFromFile(m_trig2016combination_diPhoton, "Trig.Diphotonp2016", rEnv, "g35_loose_g25_loose"); - configFromFile(m_trig2017combination_diPhoton, "Trig.Diphotonp2017", rEnv, "g35_medium_g25_medium_L12EM20VH"); - configFromFile(m_trig2018combination_diPhoton, "Trig.Diphotonp2018", rEnv, "g35_medium_g25_medium_L12EM20VH"); + configFromFile(m_trig2016combination_diPhoton, "Trig.Diphotonp2016", rEnv, "g35_loose_g25_loose"); + configFromFile(m_trig2017combination_diPhoton, "Trig.Diphotonp2017", rEnv, "g35_medium_g25_medium_L12EM20VH"); + configFromFile(m_trig2018combination_diPhoton, "Trig.Diphotonp2018", rEnv, "g35_medium_g25_medium_L12EM20VH"); + // configFromFile(m_trig2018combination_diPhoton, "Trig.Diphotonp2022", rEnv, ""); // configFromFile(m_muBaselinePt, "MuonBaseline.Pt", rEnv, 10000.); configFromFile(m_muBaselineEta, "MuonBaseline.Eta", rEnv, 2.7); @@ -1392,7 +1401,7 @@ StatusCode SUSYObjDef_xAOD::readConfig() // // LRT muons configFromFile(m_muLRT, "Muon.LRTOR", rEnv, false); - // + // configFromFile(m_badmuQoverP, "BadMuon.qoverp", rEnv, 0.4); // configFromFile(m_muCalibrationMode, "Muon.CalibrationMode", rEnv, 1); // 0: "setup1"(correctData), 1: "setup2"(additionalMCSys) @@ -1428,11 +1437,11 @@ StatusCode SUSYObjDef_xAOD::readConfig() configFromFile(m_JvtWP, "Jet.JvtWP", rEnv, "FixedEffPt"); // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/PileupJetRecommendations configFromFile(m_JvtPtMax, "Jet.JvtPtMax", rEnv, 60.0e3); configFromFile(m_JvtConfig, "Jet.JvtConfig", rEnv, "Moriond2018/"); - configFromFile(m_jetUncertaintiesConfig, "Jet.UncertConfig", rEnv, "rel22/Winter2023_PreRec/R4_CategoryReduction_FullJER.config"); // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel22/ + configFromFile(m_jetUncertaintiesConfig, "Jet.UncertConfig", rEnv, "rel22/Summer2023_PreRec/R4_CategoryReduction_FullJER.config"); // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel22/ configFromFile(m_jetUncertaintiesAnalysisFile, "Jet.AnalysisFile", rEnv, "default"); // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertaintiesRel21Summer2018SmallR configFromFile(m_jetUncertaintiesCalibArea, "Jet.UncertCalibArea", rEnv, "default"); // Defaults to default area set by tool configFromFile(m_jetUncertaintiesPDsmearing, "Jet.UncertPDsmearing", rEnv, false); // for non "SimpleJER" config, run the PDSmear systematics. This are labelled with an __2 if they are being used, but otherwise will have the same tree name as the JET_JER systematic trees. - configFromFile(m_fatJets, "Jet.LargeRcollection", rEnv, "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"); // set to "None" to turn off large jets + configFromFile(m_fatJets, "Jet.LargeRcollection", rEnv, "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"); // set to "None" to turn off large jets configFromFile(m_fatJetUncConfig, "Jet.LargeRuncConfig", rEnv, ""); // waiting for rec configFromFile(m_fatJetUncVars, "Jet.LargeRuncVars", rEnv, "default"); // do all if not specified configFromFile(m_WtagConfig, "Jet.WtaggerConfig", rEnv, "SmoothedContainedWTagger_AntiKt10UFOCSSKSoftDrop_FixedSignalEfficiency80_20220221.dat"); @@ -1458,7 +1467,7 @@ StatusCode SUSYObjDef_xAOD::readConfig() configFromFile(m_badJetCut, "BadJet.Cut", rEnv, "LooseBad"); // configFromFile(m_doFwdJVT, "FwdJet.doJVT", rEnv, false); // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/PileupJetRecommendations - configFromFile(m_fJvtWP, "FwdJet.JvtWP", rEnv, "Loose"); + configFromFile(m_fJvtWP, "FwdJet.JvtWP", rEnv, "Loose"); configFromFile(m_fJvtPtMax, "FwdJet.JvtPtMax", rEnv, 120e3); configFromFile(m_fJvtEtaMin, "FwdJet.JvtEtaMin", rEnv, 2.5); configFromFile(m_fJvtConfig, "FwdJet.JvtConfig", rEnv, "May2020/"); @@ -1469,7 +1478,7 @@ StatusCode SUSYObjDef_xAOD::readConfig() configFromFile(m_BtagTagger, "Btag.Tagger", rEnv, "DL1r"); configFromFile(m_BtagWP, "Btag.WP", rEnv, "FixedCutBEff_77"); configFromFile(m_BtagMinPt, "Btag.MinPt", rEnv, -1.); // Not calibrated below 20 - + configFromFile(m_bTaggingCalibrationFilePath, "Btag.CalibPath", rEnv, "xAODBTaggingEfficiency/13TeV/2022-22-13TeV-MC20-CDI-2022-07-28_v1.root"); configFromFile(m_BtagSystStrategy, "Btag.SystStrategy", rEnv, "Envelope"); @@ -1544,7 +1553,7 @@ StatusCode SUSYObjDef_xAOD::readConfig() configFromFile(m_trkMETsyst, "MET.DoTrkSyst", rEnv, true); configFromFile(m_caloMETsyst, "MET.DoCaloSyst", rEnv, false); configFromFile(m_trkJetsyst, "MET.DoTrkJetSyst", rEnv, false); - configFromFile(m_metsysConfigPrefix, "METSys.ConfigPrefix", rEnv, "METUtilities/data17_13TeV/prerec_Jan16"); + configFromFile(m_metsysConfigPrefix, "METSys.ConfigPrefix", rEnv, "METUtilities/R22_PreRecs"); configFromFile(m_metJetSelection, "MET.JetSelection", rEnv, "Tight"); // Loose, Tight (default), Tighter, Tenacious configFromFile(m_softTermParam, "METSig.SoftTermParam", rEnv, met::Random); configFromFile(m_treatPUJets, "METSig.TreatPUJets", rEnv, true); @@ -1552,6 +1561,7 @@ StatusCode SUSYObjDef_xAOD::readConfig() // configFromFile(m_prwActualMu2017File, "PRW.ActualMu2017File", rEnv, "GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root"); configFromFile(m_prwActualMu2018File, "PRW.ActualMu2018File", rEnv, "GoodRunsLists/data18_13TeV/20190219/purw.actualMu.root"); + configFromFile(m_prwActualMu2022File, "PRW.ActualMu2022File", rEnv, "GoodRunsLists/data22_13p6TeV/20230207/purw.actualMu.2022.root"); configFromFile(m_prwDataSF, "PRW.DataSF", rEnv, 1./1.03); // default for mc16, see: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ExtendedPileupReweighting#Tool_Properties configFromFile(m_prwDataSF_UP, "PRW.DataSF_UP", rEnv, 1./0.99); // mc16 uncertainty? defaulting to the value in PRWtool configFromFile(m_prwDataSF_DW, "PRW.DataSF_DW", rEnv, 1./1.07); // mc16 uncertainty? defaulting to the value in PRWtool @@ -1560,8 +1570,7 @@ StatusCode SUSYObjDef_xAOD::readConfig() configFromFile(m_autoconfigPRWFile, "PRW.autoconfigPRWFile", rEnv, "None"); configFromFile(m_autoconfigPRWCombinedmode, "PRW.autoconfigPRWCombinedmode", rEnv, false); configFromFile(m_autoconfigPRWRPVmode, "PRW.autoconfigPRWRPVmode", rEnv, false); - configFromFile(m_autoconfigPRWHFFilter, "PRW.autoconfigPRWHFFilter", rEnv, "None"); - configFromFile(m_autoconfigPRWRtags, "PRW.autoconfigPRWRtags", rEnv, "mc16a:r9364_r11505_r11285,mc16c:r9781,mc16d:r10201_r11506_r11279,mc16e:r10724_r11507_r11249,mc20a:r13167,mc20d:r13144,mc20e:r13145,mc21a:r13829,mc16ans:r10740_r10832_r10847_r11008_r11036,mc16dns:r10739_r10833_r10848_r11009_r11037,mc16ens:r10790_r11038_r11265"); + configFromFile(m_autoconfigPRWRtags, "PRW.autoconfigPRWRtags", rEnv, "mc20a:r13167,mc20d:r13144,mc20e:r13145,mc21a:r13752_r13829,mc23a:r14622"); // configFromFile(m_strictConfigCheck, "StrictConfigCheck", rEnv, false); @@ -1625,23 +1634,28 @@ StatusCode SUSYObjDef_xAOD::readConfig() ATH_CHECK( validConfig(m_strictConfigCheck) ); //** cache trigger chains for electron matching - GetTriggerTokens(m_electronTriggerSFStringSingle, v_trigs15_cache_singleEle, v_trigs16_cache_singleEle, v_trigs17_cache_singleEle, v_trigs18_cache_singleEle); + GetTriggerTokens(m_electronTriggerSFStringSingle, m_v_trigs15_cache_singleEle, m_v_trigs16_cache_singleEle, m_v_trigs17_cache_singleEle, m_v_trigs18_cache_singleEle,m_v_trigs22_cache_singleEle); //** cache trigger chains for matching (both electrons and muons) - GetTriggerTokens(m_electronTriggerSFStringSingle, v_trigs15_cache_singleEle, v_trigs16_cache_singleEle, v_trigs17_cache_singleEle, v_trigs18_cache_singleEle); - - v_trigs15_cache_singleLep = GetTriggerOR(m_trig2015combination_singleLep); - v_trigs16_cache_singleLep = GetTriggerOR(m_trig2016combination_singleLep); - v_trigs17_cache_singleLep = GetTriggerOR(m_trig2017combination_singleLep); - v_trigs18_cache_singleLep = GetTriggerOR(m_trig2018combination_singleLep); - v_trigs15_cache_diLep = GetTriggerOR(m_trig2015combination_diLep); - v_trigs16_cache_diLep = GetTriggerOR(m_trig2016combination_diLep); - v_trigs17_cache_diLep = GetTriggerOR(m_trig2017combination_diLep); - v_trigs18_cache_diLep = GetTriggerOR(m_trig2018combination_diLep); - v_trigs15_cache_multiLep = GetTriggerOR(m_trig2015combination_multiLep); - v_trigs16_cache_multiLep = GetTriggerOR(m_trig2016combination_multiLep); - v_trigs17_cache_multiLep = GetTriggerOR(m_trig2017combination_multiLep); - v_trigs18_cache_multiLep = GetTriggerOR(m_trig2018combination_multiLep); + GetTriggerTokens(m_electronTriggerSFStringSingle, m_v_trigs15_cache_singleEle, m_v_trigs16_cache_singleEle, m_v_trigs17_cache_singleEle, m_v_trigs18_cache_singleEle,m_v_trigs22_cache_singleEle); + + m_v_trigs15_cache_singleLep = GetTriggerOR(m_trig2015combination_singleLep); + m_v_trigs16_cache_singleLep = GetTriggerOR(m_trig2016combination_singleLep); + m_v_trigs17_cache_singleLep = GetTriggerOR(m_trig2017combination_singleLep); + m_v_trigs18_cache_singleLep = GetTriggerOR(m_trig2018combination_singleLep); + m_v_trigs22_cache_singleLep = GetTriggerOR(m_trig2022combination_singleLep); + + m_v_trigs15_cache_diLep = GetTriggerOR(m_trig2015combination_diLep); + m_v_trigs16_cache_diLep = GetTriggerOR(m_trig2016combination_diLep); + m_v_trigs17_cache_diLep = GetTriggerOR(m_trig2017combination_diLep); + m_v_trigs18_cache_diLep = GetTriggerOR(m_trig2018combination_diLep); + m_v_trigs22_cache_diLep = GetTriggerOR(m_trig2022combination_diLep); + + m_v_trigs15_cache_multiLep = GetTriggerOR(m_trig2015combination_multiLep); + m_v_trigs16_cache_multiLep = GetTriggerOR(m_trig2016combination_multiLep); + m_v_trigs17_cache_multiLep = GetTriggerOR(m_trig2017combination_multiLep); + m_v_trigs18_cache_multiLep = GetTriggerOR(m_trig2018combination_multiLep); + m_v_trigs22_cache_multiLep = GetTriggerOR(m_trig2022combination_multiLep); return StatusCode::SUCCESS; } @@ -1651,7 +1665,7 @@ const std::vector<std::string> SUSYObjDef_xAOD::split(const std::string& s, cons assert(delim.length() == 1); std::vector<std::string> retval; retval.reserve(std::count(s.begin(), s.end(), delim[0]) + 1); - // if only 1 + // if only 1 if (s.find(delim)==std::string::npos) { retval.emplace_back(s); return retval; @@ -1697,8 +1711,8 @@ void SUSYObjDef_xAOD::getTauConfig(const std::string& tauConfigPath, std::vector static const std::string trueBool = "TRUE"; // Now find the pT and eta window - std::vector<std::string> _pT_window; - std::vector<std::string> _eta_window; + std::vector<std::string> v_pT_window; + std::vector<std::string> v_eta_window; pT_window.clear(); eta_window.clear(); float pT_min = -99.0; @@ -1707,9 +1721,9 @@ void SUSYObjDef_xAOD::getTauConfig(const std::string& tauConfigPath, std::vector float eta_max = -99.0; for (const auto& cut : cuts) { if(cut == "PtRegion") { - _pT_window = split(rEnv.GetValue("PtRegion", ""), ";"); - std::transform(std::begin(_pT_window), - std::end(_pT_window), + v_pT_window = split(rEnv.GetValue("PtRegion", ""), ";"); + std::transform(std::begin(v_pT_window), + std::end(v_pT_window), std::back_inserter(pT_window), [](const std::string& s) { return std::stof(s); } ); @@ -1718,9 +1732,9 @@ void SUSYObjDef_xAOD::getTauConfig(const std::string& tauConfigPath, std::vector } else if (cut == "PtMax") { pT_max = rEnv.GetValue("PtMax", NAN); } else if (cut == "AbsEtaRegion") { - _eta_window = split(rEnv.GetValue("AbsEtaRegion", ""), ";"); - std::transform(std::begin(_eta_window), - std::end(_eta_window), + v_eta_window = split(rEnv.GetValue("AbsEtaRegion", ""), ";"); + std::transform(std::begin(v_eta_window), + std::end(v_eta_window), std::back_inserter(eta_window), [](const std::string& s) { return std::stof(s); } ); @@ -1988,7 +2002,7 @@ StatusCode SUSYObjDef_xAOD::applySystematicVariation( const CP::SystematicSet& s m_currentSyst = systConfig; // NB: SystematicSet typically has only one component (see SUSYToolsTester macro) - // The PDSmear systematics have been initialised as the second component of the JET_JER systematic, here we'll catch the uncertainties which are to use the PDSmear initialised tool. + // The PDSmear systematics have been initialised as the second component of the JET_JER systematic, here we'll catch the uncertainties which are to use the PDSmear initialised tool. if (!m_jetUncertaintiesTool.empty() && systConfig.name().find("__2") == std::string::npos) { StatusCode ret = m_jetUncertaintiesTool->applySystematicVariation(systConfig); if ( ret != StatusCode::SUCCESS) { @@ -2126,10 +2140,28 @@ StatusCode SUSYObjDef_xAOD::applySystematicVariation( const CP::SystematicSet& s ATH_MSG_VERBOSE("AsgElectronEfficiencyCorrectionTool (id) configured for systematic var. " << systConfig.name() ); } } + if (!m_elecEfficiencySFTool_trig_singleLep.empty()) { + StatusCode ret = m_elecEfficiencySFTool_trig_singleLep->applySystematicVariation(systConfig); + if (ret != StatusCode::SUCCESS) { + ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (trigger) for systematic var. " << systConfig.name() ); + return ret; + } else { + ATH_MSG_VERBOSE("AsgElectronEfficiencyCorrectionTool (trigger) configured for systematic var. " << systConfig.name() ); + } + } + if (!m_elecEfficiencySFTool_trigEff_singleLep.empty()) { + StatusCode ret = m_elecEfficiencySFTool_trigEff_singleLep->applySystematicVariation(systConfig); + if (ret != StatusCode::SUCCESS) { + ATH_MSG_ERROR("Cannot configure AsgElectronEfficiencyCorrectionTool (trigger SFTool) for systematic var. " << systConfig.name() ); + return ret; + } else { + ATH_MSG_VERBOSE("AsgElectronEfficiencyCorrectionTool (trigger SFTool) configured for systematic var. " << systConfig.name() ); + } + } if (!m_trigGlobalEffCorrTool_diLep.empty()) { StatusCode ret = m_trigGlobalEffCorrTool_diLep->applySystematicVariation(systConfig); for(auto &sfop : m_elecTrigEffTools){ - StatusCode ret1 = sfop->applySystematicVariation(systConfig); + StatusCode ret1 = sfop->applySystematicVariation(systConfig); if (ret1 != StatusCode::SUCCESS) { ATH_MSG_ERROR("Cannot configure m_elecTrigEffTools (dilepton trigger) for systematic var. " << systConfig.name() ); return ret1; } } for(auto &sfop : m_elecTrigSFTools){ @@ -2150,7 +2182,7 @@ StatusCode SUSYObjDef_xAOD::applySystematicVariation( const CP::SystematicSet& s if (!m_trigGlobalEffCorrTool_multiLep.empty()) { StatusCode ret = m_trigGlobalEffCorrTool_multiLep->applySystematicVariation(systConfig); for(auto &sfop : m_elecTrigEffTools){ - StatusCode ret1 = sfop->applySystematicVariation(systConfig); + StatusCode ret1 = sfop->applySystematicVariation(systConfig); if (ret1 != StatusCode::SUCCESS) { ATH_MSG_ERROR("Cannot configure m_elecTrigEffTools (multilep trigger) for systematic var. " << systConfig.name() ); return ret1; } } for(auto &sfop : m_elecTrigSFTools){ @@ -2225,7 +2257,7 @@ StatusCode SUSYObjDef_xAOD::applySystematicVariation( const CP::SystematicSet& s if (!m_trigGlobalEffCorrTool_diPhoton.empty()) { StatusCode ret = m_trigGlobalEffCorrTool_diPhoton->applySystematicVariation(systConfig); for(auto &sfop : m_photonTrigEffTools){ - StatusCode ret1 = sfop->applySystematicVariation(systConfig); + StatusCode ret1 = sfop->applySystematicVariation(systConfig); if (ret1 != StatusCode::SUCCESS) { ATH_MSG_ERROR("Cannot configure m_photonTrigEffTools (diphoton trigger) for systematic var. " << systConfig.name() ); return ret1; } } for(auto &sfop : m_photonTrigSFTools){ @@ -2348,7 +2380,7 @@ std::vector<ST::SystInfo> SUSYObjDef_xAOD::getSystInfoList() const { infodef.affectsType = Unknown; infodef.affectedWeights.clear(); sysInfoList.push_back(infodef); - + // add all recommended systematics for (const auto& systSet : CP::make_systematics_vector(recommendedSystematics)) { @@ -2361,7 +2393,7 @@ std::vector<ST::SystInfo> SUSYObjDef_xAOD::getSystInfoList() const { CP::SystematicVariation sys_JER(JER_systematicName); sysInfoList.push_back(getSystInfo(sys_JER)); } - } + } } @@ -2441,6 +2473,20 @@ ST::SystInfo SUSYObjDef_xAOD::getSystInfo(const CP::SystematicVariation& sys) co sysInfo.affectsType = SystObjType::Muon; } } + if (!m_elecEfficiencySFTool_trig_singleLep.empty()) { + if ( m_elecEfficiencySFTool_trig_singleLep->isAffectedBySystematic(sys) ) { + sysInfo.affectsWeights = true; + sysInfo.affectsType = SystObjType::Electron; + sysInfo.affectedWeights.insert(ST::Weights::Electron::Trigger); + } + } + if (!m_elecEfficiencySFTool_trigEff_singleLep.empty()) { + if ( m_elecEfficiencySFTool_trigEff_singleLep->isAffectedBySystematic(sys) ) { + sysInfo.affectsWeights = true; + sysInfo.affectsType = SystObjType::Electron; + sysInfo.affectedWeights.insert(ST::Weights::Electron::Trigger); + } + } if (!m_muonEfficiencySFTool.empty()) { if ( m_muonEfficiencySFTool->isAffectedBySystematic(sys) ) { sysInfo.affectsWeights = true; @@ -2745,13 +2791,17 @@ StatusCode SUSYObjDef_xAOD::NearbyLeptonCorrections(xAOD::ElectronContainer *ele return StatusCode::SUCCESS; } - +const xAOD::EventInfo* SUSYObjDef_xAOD::GetEventInfo() const { + const xAOD::EventInfo* evtInfo = nullptr; + if ( evtStore()->retrieve( evtInfo, "EventInfo" ).isFailure() ) { + throw std::runtime_error("Unable to fetch EventInfo."); + } + return evtInfo; +} float SUSYObjDef_xAOD::GetPileupWeight() { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); - + const xAOD::EventInfo* evtInfo = GetEventInfo(); float pu_weight = m_prwTool->getCombinedWeight(*evtInfo); if(!isfinite(pu_weight)) pu_weight = 1.; @@ -2766,9 +2816,7 @@ float SUSYObjDef_xAOD::GetPileupWeightPrescaledTrigger(const std::string & trigg https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ExtendedPileupReweighting#Prescaling%20MC */ - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); - + const xAOD::EventInfo* evtInfo = GetEventInfo(); float pu_weight = m_prwTool->getCombinedWeight(*evtInfo,trigger_expr); if(!isfinite(pu_weight)) pu_weight = 1.; @@ -2777,26 +2825,22 @@ float SUSYObjDef_xAOD::GetPileupWeightPrescaledTrigger(const std::string & trigg } ULong64_t SUSYObjDef_xAOD::GetPileupWeightHash() { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); return m_prwTool->getPRWHash( *evtInfo ); } float SUSYObjDef_xAOD::GetDataWeight(const std::string& trig) { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); return m_prwTool->getDataWeight( *evtInfo, trig ); } float SUSYObjDef_xAOD::GetCorrectedAverageInteractionsPerCrossing(bool includeDataSF) { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); return m_prwTool->getCorrectedAverageInteractionsPerCrossing( *evtInfo, includeDataSF ); } float SUSYObjDef_xAOD::GetCorrectedActualInteractionsPerCrossing(bool includeDataSF) { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); return m_prwTool->getCorrectedActualInteractionsPerCrossing( *evtInfo, includeDataSF ); } @@ -2806,8 +2850,7 @@ double SUSYObjDef_xAOD::GetSumOfWeights(int channel) { unsigned int SUSYObjDef_xAOD::GetRandomRunNumber(bool muDependentRRN) { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); if (randomrunnumber.isAvailable(*(evtInfo)) && muDependentRRN) { return randomrunnumber(*(evtInfo)); } @@ -2821,8 +2864,7 @@ unsigned int SUSYObjDef_xAOD::GetRandomRunNumber(bool muDependentRRN) { StatusCode SUSYObjDef_xAOD::ApplyPRWTool(bool muDependentRRN) { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); if(!evtInfo->isAvailable<unsigned int>("RandomRunNumber")) ATH_CHECK( m_prwTool->apply( *evtInfo, muDependentRRN ) ); return StatusCode::SUCCESS; @@ -2830,8 +2872,7 @@ StatusCode SUSYObjDef_xAOD::ApplyPRWTool(bool muDependentRRN) { unsigned int SUSYObjDef_xAOD::GetRunNumber() const { - const xAOD::EventInfo* evtInfo = nullptr; - ATH_CHECK( evtStore()->retrieve( evtInfo, "EventInfo" ) ); + const xAOD::EventInfo* evtInfo = GetEventInfo(); // For data, we can just directly use the run number if (isData()) { return evtInfo->runNumber(); } diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYToolsInit.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYToolsInit.cxx index b3fe67bc25cf2572d87b8711387709f124388a50..4bc0c06d5eccda307e1317f89a3ddf056a422ec5 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYToolsInit.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/SUSYToolsInit.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "SUSYTools/SUSYObjDef_xAOD.h" @@ -151,30 +151,30 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["jet"]) { /////////////////////////////////////////////////////////////////////////////////////////// // Initialise jet calibration tool - + // pick the right config file for the JES tool : https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ApplyJetCalibrationR21 jetname = "AntiKt4" + xAOD::JetInput::typeName(xAOD::JetInput::Type(m_jetInputType)); jetcoll = jetname + "Jets"; - + if (!m_jetCalibTool.isUserConfigured()) { toolName = "JetCalibTool_" + jetname; m_jetCalibTool.setTypeAndName("JetCalibrationTool/"+toolName); std::string JES_config_file, calibseq; - + if (m_jetInputType != xAOD::JetInput::EMPFlow) { ATH_MSG_ERROR("Unknown (unsupported) jet collection is used, (m_jetInputType = " << m_jetInputType << ")"); return StatusCode::FAILURE; } - + std::string JESconfig = isAtlfast() ? m_jesConfigAFII : m_jesConfig; if(isAtlfast()) { ATH_MSG_WARNING("Jet rec currently not available for fast sim, temporary fallback to full sim version"); JESconfig = m_jesConfig; } - + calibseq = m_jesCalibSeq; JES_config_file = JESconfig; - + // remove Insitu if it's in the string if not data if (!isData()) { std::string insitu("_Insitu"); @@ -183,13 +183,13 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() calibseq.erase(found, insitu.length()); } } - + // JMS calibration (if requested) - if (m_JMScalib){ + if (m_JMScalib){ ATH_MSG_ERROR("JMS calibration is not supported yet for R22. Please modify your settings."); return StatusCode::FAILURE; } - + // now instantiate the tool ATH_CHECK( m_jetCalibTool.setProperty("JetCollection", jetname) ); ATH_CHECK( m_jetCalibTool.setProperty("ConfigFile", JES_config_file) ); @@ -208,15 +208,15 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_MSG_DEBUG("Fall back to calibration for AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets, original name for AnalysisLargeRJets"); fatjetcoll = "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"; } - if (fatjetcoll.size()>3)fatjetcoll.erase(fatjetcoll.size()-4,4); + if (fatjetcoll.size()>3)fatjetcoll.erase(fatjetcoll.size()-4,4); if (!m_jetFatCalibTool.isUserConfigured() && !m_fatJets.empty()) { toolName = "JetFatCalibTool_" + m_fatJets; m_jetFatCalibTool.setTypeAndName("JetCalibrationTool/"+toolName); - + std::string jesConfigFat = m_jesConfigFat; std::string jesCalibSeqFat = m_jesCalibSeqFat; // add Insitu if data (currently missing) - + // now instantiate the tool ATH_CHECK( m_jetFatCalibTool.setProperty("JetCollection", fatjetcoll) ); ATH_CHECK( m_jetFatCalibTool.setProperty("ConfigFile", jesConfigFat) ); @@ -239,6 +239,9 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_WTaggerTool.setProperty("IsMC",!isData())); ATH_CHECK( m_WTaggerTool.setProperty("TruthBosonContainerName", "TruthBoson") ); // Set this if you are using a TRUTH3 style truth boson container; ATH_CHECK( m_WTaggerTool.setProperty("TruthTopQuarkContainerName", "TruthTop") ); // Set this if you are using a TRUTH3 style truth boson container; +#ifndef XAOD_STANDALONE + ATH_CHECK( m_WTaggerTool.setProperty("SuppressOutputDependence", true) ); +#endif ATH_CHECK( m_WTaggerTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_WTaggerTool.retrieve() ); } else if (m_WTaggerTool.isUserConfigured()) ATH_CHECK(m_WTaggerTool.retrieve()); @@ -251,6 +254,9 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_ZTaggerTool.setProperty("IsMC",!isData())); ATH_CHECK( m_ZTaggerTool.setProperty("TruthBosonContainerName", "TruthBoson") ); // Set this if you are using a TRUTH3 style truth boson container; ATH_CHECK( m_ZTaggerTool.setProperty("TruthTopQuarkContainerName", "TruthTop") ); // Set this if you are using a TRUTH3 style truth boson container; +#ifndef XAOD_STANDALONE + ATH_CHECK( m_ZTaggerTool.setProperty("SuppressOutputDependence", true) ); +#endif ATH_CHECK( m_ZTaggerTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_ZTaggerTool.retrieve() ); } else if (m_ZTaggerTool.isUserConfigured()) ATH_CHECK(m_ZTaggerTool.retrieve()); @@ -263,6 +269,9 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_TopTaggerTool.setProperty("IsMC",!isData())); ATH_CHECK( m_TopTaggerTool.setProperty("TruthBosonContainerName", "TruthBoson") ); // Set this if you are using a TRUTH3 style truth boson container; ATH_CHECK( m_TopTaggerTool.setProperty("TruthTopQuarkContainerName", "TruthTop") ); // Set this if you are using a TRUTH3 style truth boson container; +#ifndef XAOD_STANDALONE + ATH_CHECK( m_TopTaggerTool.setProperty("SuppressOutputDependence", true) ); +#endif ATH_CHECK( m_TopTaggerTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_TopTaggerTool.retrieve() ); } else if (m_TopTaggerTool.isUserConfigured()) ATH_CHECK(m_TopTaggerTool.retrieve()); @@ -288,7 +297,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() } if (m_slices["jet"] || m_slices["fjet"]) { - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise jet uncertainty tool @@ -391,7 +400,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() // Won't initialise Wtagger uncertainty tool for fat jets until we get rec for UFO /* if (!m_WTagjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_WtagConfig.empty() && !m_WTagUncConfig.empty()) { - + toolName = "WTagJetUncertaintiesTool_" + m_fatJets; m_WTagjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName); ATH_CHECK( m_WTagjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) ); @@ -406,7 +415,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() // Won't initialise Ztagger uncertainty tool for fat jets until we get rec for UFO /* if (!m_ZTagjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_ZtagConfig.empty() && !m_ZTagUncConfig.empty()) { - + toolName = "ZTagJetUncertaintiesTool_" + m_fatJets; m_ZTagjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName); ATH_CHECK( m_ZTagjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) ); @@ -421,13 +430,13 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() // Won't initialise top-tagger uncertainty tool for fat jets until we get rec for UFO /* if (!m_TopTagjetUncertaintiesTool.isUserConfigured() && !m_fatJets.empty() && !m_ToptagConfig.empty() && !m_TopTagUncConfig.empty()) { - + toolName = "TopTagJetUncertaintiesTool_" + m_fatJets; m_TopTagjetUncertaintiesTool.setTypeAndName("JetUncertaintiesTool/"+toolName); ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("JetDefinition", fatjetcoll) ); ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("MCType", "MC16") ); ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("IsData", isData()) ); - ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("ConfigFile", "rel21/Fall2020/"+m_TopTagUncConfig) ); + ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("ConfigFile", "rel21/Fall2020/"+m_TopTagUncConfig) ); ATH_CHECK( m_TopTagjetUncertaintiesTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_TopTagjetUncertaintiesTool.retrieve() ); } else if (m_TopTagjetUncertaintiesTool.isUserConfigured()) ATH_CHECK(m_TopTagjetUncertaintiesTool.retrieve()); @@ -471,6 +480,10 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() return StatusCode::FAILURE; } +#ifndef XAOD_STANDALONE + ATH_CHECK( m_jetJvtEfficiencyTool.setProperty("SuppressInputDependence", true) ); + ATH_CHECK( m_jetJvtEfficiencyTool.setProperty("SuppressOutputDependence", true) ); +#endif ATH_CHECK( m_jetJvtEfficiencyTool.setProperty("WorkingPoint", m_JvtWP) ); ATH_CHECK( m_jetJvtEfficiencyTool.setProperty("MaxPtForJvt", m_JvtPtMax) ); ATH_CHECK( m_jetJvtEfficiencyTool.setProperty("ScaleFactorDecorationName", "jvtscalefact") ); // set decoration name @@ -513,7 +526,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["mu"]) { /////////////////////////////////////////////////////////////////////////////////////////// // Check muon baseline ID - + std::string muQualBaseline = ""; switch (m_muIdBaseline) { case xAOD::Muon::VeryLoose: muQualBaseline = "VeryLoose"; @@ -531,16 +544,17 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() return StatusCode::FAILURE; break; } - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise muon calibration tool // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MuonMomentumCorrectionsSubgroup#CP_MuonCalibrationAndSmearingToo - + if (!m_muonCalibTool.isUserConfigured()) { m_muonCalibTool.setTypeAndName("CP::MuonCalibTool/ST_MuonCalibrationTool"); if (m_isRun3) ATH_CHECK( m_muonCalibTool.setProperty("IsRun3Geo", true )); ATH_CHECK( m_muonCalibTool.setProperty("calibMode", m_muCalibrationMode) ); ATH_CHECK( m_muonCalibTool.setProperty("OutputLevel", this->msg().level()) ); + ATH_CHECK( m_muonCalibTool.setProperty("release", m_isRun3 ? "Recs2023_03_22_Run3" : "Recs2022_08_16_Run3PreRecs" )); int IdBaselineInt = m_muIdBaseline; if (IdBaselineInt == 4) { ATH_CHECK( m_muonCalibTool.setProperty("do2StationsHighPt", true) ); @@ -548,15 +562,15 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_muonCalibTool.setProperty("doExtraSmearing", m_muHighPtExtraSmear) ); ATH_CHECK( m_muonCalibTool.retrieve() ); } else ATH_CHECK( m_muonCalibTool.retrieve() ); - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise muon selection tool - + if (!m_muonSelectionToolBaseline.isUserConfigured()) { toolName = "MuonSelectionTool_Baseline_" + muQualBaseline; m_muonSelectionToolBaseline.setTypeAndName("CP::MuonSelectionTool/"+toolName); if (m_isRun3) ATH_CHECK( m_muonSelectionToolBaseline.setProperty("IsRun3Geo", true )); - + if (m_muBaselineEta<m_muEta){ // Test for inconsistent configuration ATH_MSG_ERROR( "Requested a baseline eta cut for muons (" << m_muBaselineEta << ") that is tighter than the signal cut (" << m_muEta << "). Please check your config." ); @@ -569,13 +583,13 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "UseMVALowPt", true)); } else if (IdBaselineInt == 7){ ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "MuQuality", 4 ) ); - ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "Use2stationMuonsHighPt", false)); + ATH_CHECK( m_muonSelectionToolBaseline.setProperty( "Use2stationMuonsHighPt", false)); } else ATH_CHECK(m_muonSelectionToolBaseline.setProperty( "MuQuality", m_muIdBaseline )); ATH_CHECK( m_muonSelectionToolBaseline.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonSelectionToolBaseline.retrieve() ); } else ATH_CHECK( m_muonSelectionToolBaseline.retrieve() ); - - + + std::string muQual = ""; switch (m_muId) { case xAOD::Muon::VeryLoose: muQual = "VeryLoose"; @@ -593,7 +607,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() return StatusCode::FAILURE; break; } - + if (!m_muonSelectionTool.isUserConfigured()) { toolName = "MuonSelectionTool_" + muQual; m_muonSelectionTool.setTypeAndName("CP::MuonSelectionTool/"+toolName); @@ -605,13 +619,13 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_muonSelectionTool.setProperty( "UseMVALowPt", true)); } else if (IdInt == 7){ ATH_CHECK( m_muonSelectionTool.setProperty( "MuQuality", 4 ) ); - ATH_CHECK( m_muonSelectionTool.setProperty( "Use2stationMuonsHighPt", false)); + ATH_CHECK( m_muonSelectionTool.setProperty( "Use2stationMuonsHighPt", false)); } else ATH_CHECK(m_muonSelectionTool.setProperty( "MuQuality", m_muId )); ATH_CHECK( m_muonSelectionTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonSelectionTool.retrieve() ); } else ATH_CHECK( m_muonSelectionTool.retrieve() ); - - + + if (!m_muonSelectionHighPtTool.isUserConfigured()) { //Fixed to HighPt WP toolName = "MuonSelectionHighPtTool_" + muQual; m_muonSelectionHighPtTool.setTypeAndName("CP::MuonSelectionTool/"+toolName); @@ -621,66 +635,66 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_muonSelectionHighPtTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonSelectionHighPtTool.retrieve() ); } else ATH_CHECK( m_muonSelectionHighPtTool.retrieve() ); - + ////////////// - // Initialise prompt/LRT muon OR tool + // Initialise prompt/LRT muon OR tool if (!m_muonLRTORTool.isUserConfigured()) { toolName = "MuonLRTOverlapRemovalTool"; m_muonLRTORTool.setTypeAndName("CP::MuonLRTOverlapRemovalTool/"+toolName); ATH_CHECK( m_muonLRTORTool.setProperty("overlapStrategy", CP::IMuonLRTOverlapRemovalTool::defaultStrategy) ); ATH_CHECK( m_muonLRTORTool.retrieve() ); } else ATH_CHECK( m_muonLRTORTool.retrieve() ); - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise muon efficiency tools if (!m_muonEfficiencySFTool.isUserConfigured() && m_muId != xAOD::Muon::VeryLoose) { toolName = "MuonEfficiencyScaleFactors_" + muQual; m_muonEfficiencySFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName); ATH_CHECK( m_muonEfficiencySFTool.setProperty("WorkingPoint", muQual) ); - ATH_CHECK( m_muonEfficiencySFTool.setProperty("CalibrationRelease", m_isRun3? "230123_Preliminary_r22run3":"220725_Preliminary_r22run2") ); + ATH_CHECK( m_muonEfficiencySFTool.setProperty("CalibrationRelease", m_isRun3? "230309_Preliminary_r22run3":"230213_Preliminary_r22run2") ); if (m_isRun3) { - ATH_CHECK( m_muonEfficiencySFTool.setProperty("LowPtThreshold", 10) ); //very preliminary Run3 rec! to be updated + ATH_CHECK( m_muonEfficiencySFTool.setProperty("LowPtThreshold", 5) ); } ATH_CHECK( m_muonEfficiencySFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonEfficiencySFTool.retrieve() ); } else ATH_CHECK( m_muonEfficiencySFTool.retrieve() ); - - + + if (!m_muonEfficiencyBMHighPtSFTool.isUserConfigured()){ toolName = "MuonEfficiencyScaleFactorsBMHighPt_" + muQual; m_muonEfficiencyBMHighPtSFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName); ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("WorkingPoint", "BadMuonVeto_HighPt") ); if (m_isRun3) { - ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("LowPtThreshold", 10) ); //very preliminary Run3 rec! to be updated + ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("LowPtThreshold", 5) ); } - ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("CalibrationRelease", m_isRun3? "220817_Preliminary_r22run3":"220725_Preliminary_r22run2") ); //BadMuonVeto_HighPt currently not available for 230123_Preliminary_r22run3 + ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("CalibrationRelease", m_isRun3? "220817_Preliminary_r22run3":"230213_Preliminary_r22run2") ); //BadMuonVeto_HighPt currently not available for 230123_Preliminary_r22run3 ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.retrieve() ); } else ATH_CHECK( m_muonEfficiencyBMHighPtSFTool.retrieve() ); - - + + if (m_doTTVAsf && m_mud0sig<0 && m_muz0<0){ ATH_MSG_WARNING("Requested TTVA SFs without d0sig and z0 cuts. Disabling scale factors as they will not make sense."); m_doTTVAsf=false; } - + if (m_doTTVAsf && !m_muonTTVAEfficiencySFTool.isUserConfigured()) { toolName = "MuonTTVAEfficiencyScaleFactors"; m_muonTTVAEfficiencySFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName); ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("WorkingPoint", "TTVA") ); - ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("CalibrationRelease", m_isRun3? "230123_Preliminary_r22run3":"220725_Preliminary_r22run2") ); + ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("CalibrationRelease", m_isRun3? "230309_Preliminary_r22run3":"230213_Preliminary_r22run2") ); ATH_CHECK( m_muonTTVAEfficiencySFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonTTVAEfficiencySFTool.retrieve() ); } else if (m_muonTTVAEfficiencySFTool.isUserConfigured()) ATH_CHECK( m_muonTTVAEfficiencySFTool.retrieve() ); - - - + + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise muon isolation tool if (!m_muonIsolationSFTool.isUserConfigured() && !m_muIso_WP.empty()) { toolName = "MuonIsolationScaleFactors_" + m_muIso_WP; - + std::string tmp_muIso_WP = m_muIso_WP; if ( !check_isOption(m_muIso_WP, m_mu_iso_support) ) { //check if supported ATH_MSG_WARNING("Your selected muon Iso WP (" @@ -698,22 +712,22 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() return StatusCode::FAILURE; } } - + m_muonIsolationSFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName); ATH_CHECK( m_muonIsolationSFTool.setProperty("WorkingPoint", tmp_muIso_WP + "Iso") ); - ATH_CHECK( m_muonIsolationSFTool.setProperty("CalibrationRelease", m_isRun3? "230123_Preliminary_r22run3":"220725_Preliminary_r22run2") ); + ATH_CHECK( m_muonIsolationSFTool.setProperty("CalibrationRelease", m_isRun3? "230309_Preliminary_r22run3":"230213_Preliminary_r22run2") ); if (m_isRun3) { - ATH_CHECK( m_muonIsolationSFTool.setProperty("LowPtThreshold", 10) ); //very preliminary Run3 rec! to be updated - } + ATH_CHECK( m_muonIsolationSFTool.setProperty("LowPtThreshold", 5) ); + } ATH_CHECK( m_muonIsolationSFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonIsolationSFTool.retrieve() ); - + } else if (m_muonIsolationSFTool.isUserConfigured()) ATH_CHECK( m_muonIsolationSFTool.retrieve() ); - - + + if (!m_muonHighPtIsolationSFTool.isUserConfigured() && !m_muIsoHighPt_WP.empty()) { toolName = "MuonHighPtIsolationScaleFactors_" + m_muIsoHighPt_WP; - + std::string tmp_muIsoHighPt_WP = m_muIsoHighPt_WP; if ( !check_isOption(m_muIsoHighPt_WP, m_mu_iso_support) ) { //check if supported ATH_MSG_WARNING("Your selected muon high-pt Iso WP (" @@ -731,20 +745,20 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() return StatusCode::FAILURE; } } - + m_muonHighPtIsolationSFTool.setTypeAndName("CP::MuonEfficiencyScaleFactors/"+toolName); // Use for the low-pt WP a dedicated set of isolation scale-factors having an extra uncertainty in place ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("WorkingPoint", tmp_muIsoHighPt_WP + "Iso") ); - ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("CalibrationRelease", m_isRun3? "230123_Preliminary_r22run3":"220725_Preliminary_r22run2") ); + ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("CalibrationRelease", m_isRun3? "230309_Preliminary_r22run3":"230213_Preliminary_r22run2") ); ATH_CHECK( m_muonHighPtIsolationSFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_muonHighPtIsolationSFTool.retrieve() ); - + } else if (m_muonHighPtIsolationSFTool.isUserConfigured()) ATH_CHECK( m_muonHighPtIsolationSFTool.retrieve() ); - - + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise muon trigger scale factor tools - + if (!m_muonTriggerSFTool.isUserConfigured()) { toolName = "MuonTriggerScaleFactors_" + muQual; m_muonTriggerSFTool.setTypeAndName("CP::MuonTriggerScaleFactors/"+toolName); @@ -767,12 +781,12 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["ele"]) { // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise electron selector tools - + // Signal Electrons if (!m_elecSelLikelihood.isUserConfigured()) { toolName = "EleSelLikelihood_" + m_eleId; m_elecSelLikelihood.setTypeAndName("AsgElectronLikelihoodTool/"+toolName); - + if (! m_eleConfig.empty() ){ ATH_MSG_INFO("Overriding specified Ele.Id working point in favour of configuration file"); ATH_CHECK( m_elecSelLikelihood.setProperty("ConfigFile", m_eleConfig) ); @@ -789,16 +803,16 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() } else { ATH_CHECK( m_elecSelLikelihood.setProperty("WorkingPoint", EG_WP(m_eleId) )); } - + ATH_CHECK( m_elecSelLikelihood.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_elecSelLikelihood.retrieve() ); } else ATH_CHECK( m_elecSelLikelihood.retrieve() ); - + // Baseline Electrons if (!m_elecSelLikelihoodBaseline.isUserConfigured()) { toolName = "EleSelLikelihoodBaseline_" + m_eleIdBaseline; m_elecSelLikelihoodBaseline.setTypeAndName("AsgElectronLikelihoodTool/"+toolName); - + if (! m_eleConfigBaseline.empty() ){ ATH_MSG_INFO("Overriding specified EleBaseline.Id working point in favour of configuration file"); ATH_CHECK( m_elecSelLikelihoodBaseline.setProperty("ConfigFile", m_eleConfigBaseline )); @@ -808,14 +822,14 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() } else { ATH_CHECK( m_elecSelLikelihoodBaseline.setProperty("WorkingPoint", EG_WP(m_eleIdBaseline)) ); } - + ATH_CHECK( m_elecSelLikelihoodBaseline.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_elecSelLikelihoodBaseline.retrieve() ); } else ATH_CHECK( m_elecSelLikelihoodBaseline.retrieve() ); } ////////////// - // Initialise prompt/LRT electron OR tool + // Initialise prompt/LRT electron OR tool if (!m_elecLRTORTool.isUserConfigured()) { toolName = "ElectronLRTOverlapRemovalTool"; m_elecLRTORTool.setTypeAndName("CP::ElectronLRTOverlapRemovalTool/"+toolName); @@ -827,30 +841,30 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["pho"]) { // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise photon selector tools - + if (!m_photonSelIsEM.isUserConfigured()) { toolName = "PhotonSelIsEM_" + m_photonId; m_photonSelIsEM.setTypeAndName("AsgPhotonIsEMSelector/"+toolName); - + if (!check_isOption(m_photonId, m_ph_id_support)){ //check if supported ATH_MSG_ERROR("Invalid photon ID selected: " << m_photonId); return StatusCode::FAILURE; } - + ATH_CHECK( m_photonSelIsEM.setProperty("WorkingPoint", m_photonId+"Photon") ); ATH_CHECK( m_photonSelIsEM.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_photonSelIsEM.retrieve() ); } else ATH_CHECK( m_photonSelIsEM.retrieve() ); - + if (!m_photonSelIsEMBaseline.isUserConfigured()) { toolName = "PhotonSelIsEMBaseline_" + m_photonIdBaseline; m_photonSelIsEMBaseline.setTypeAndName("AsgPhotonIsEMSelector/"+toolName); - + if(!check_isOption(m_photonIdBaseline, m_ph_id_support)){ //check if supported ATH_MSG_ERROR("Invalid photon ID selected: " << m_photonIdBaseline); return StatusCode::FAILURE; } - + ATH_CHECK( m_photonSelIsEMBaseline.setProperty("WorkingPoint", m_photonIdBaseline+"Photon") ); ATH_CHECK( m_photonSelIsEMBaseline.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_photonSelIsEMBaseline.retrieve() ); @@ -870,44 +884,50 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["ele"]) { /////////////////////////////////////////////////////////////////////////////////////////// // Initialise electron efficiency tool - + PATCore::ParticleDataType::DataType data_type(PATCore::ParticleDataType::Data); if (!isData()) { if (isAtlfast()) data_type = PATCore::ParticleDataType::Fast; else data_type = PATCore::ParticleDataType::Full; ATH_MSG_DEBUG( "Setting data type to " << data_type); } - + toolName = "AsgElectronEfficiencyCorrectionTool_reco"; CONFIG_EG_EFF_TOOL_KEY(m_elecEfficiencySFTool_reco, toolName, "RecoKey", "Reconstruction"); - + //-- get KEYS supported by egamma SF tools - std::vector<std::string> eSF_keys = getElSFkeys(m_eleEffMapFilePath); + m_eleEffMapFilePathRun2 = "ElectronEfficiencyCorrection/2015_2018/rel21.2/Precision_Summer2020_v1/map4.txt"; + + if(!m_isRun3) { + ATH_MSG_INFO( "Running on Run2 samples; Using egamma SF tools from R21 map "); + ATH_MSG_INFO( m_eleEffMapFilePathRun2); + } + + std::vector<std::string> eSF_keys = getElSFkeys( m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2); - if (m_eleId.find("NoPix") != std::string::npos || m_eleId == "VeryLooseLLH" || m_eleId == "LooseLLH" || m_eleId == "Loose" || m_eleId == "Medium" || m_eleId == "Tight") { + if (m_eleId.find("NoPix") != std::string::npos || m_eleId == "VeryLooseLLH" || m_eleId == "LooseLLH" || m_eleId == "Medium") { ATH_MSG_WARNING("Not configuring electron ID and trigger scale factors for " << m_eleId); } else { - // This needs to be formatted for the scale factors: no _Rel20, no LH label, etc. std::string eleId = TString(m_eleId).ReplaceAll("AndBLayer", "BLayer").ReplaceAll("LLH", "").Data(); - + // electron id toolName = "AsgElectronEfficiencyCorrectionTool_id_" + m_eleId; CONFIG_EG_EFF_TOOL_KEY(m_elecEfficiencySFTool_id, toolName, "IdKey", eleId); - + // override map file use if correction file list is set for WP std::map<std::string,std::string> corrFNList; if ( !m_EG_corrFNList.empty() ) { for ( const auto& WP_fname : split( m_EG_corrFNList, "," ) ) { std::string WP = WP_fname.substr(0,WP_fname.find(":")); std::string fname = WP_fname.substr(WP_fname.find(":")+1); - corrFNList[WP] = fname; + corrFNList[WP] = fname; ATH_MSG_WARNING( "Correction file list defined for WP " << WP << ": " << fname << "." ); ATH_MSG_WARNING( "Will use correction file rather than central map file." ); } } - + // electron iso std::string EleIso(""); if (std::find(eSF_keys.begin(), eSF_keys.end(), eleId+"_"+m_eleIso_WP) != eSF_keys.end()){ @@ -927,11 +947,11 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() } toolName = "AsgElectronEfficiencyCorrectionTool_iso_" + m_eleId + EleIso; - + // if running with correction file list if ( (!m_EG_corrFNList.empty()) && corrFNList.find(EleIso)!=corrFNList.end() ) { // overriding central map file CONFIG_EG_EFF_TOOL( m_elecEfficiencySFTool_iso, toolName, corrFNList[EleIso] ); - } + } // can't do the iso tool via the macro, it needs two properties set else { // default: use map file if ( !m_elecEfficiencySFTool_iso.isUserConfigured() ) { @@ -942,7 +962,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() m_elecEfficiencySFTool_iso.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName); if ( m_EG_corrFNList.empty() ) { - ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("MapFilePath", m_eleEffMapFilePath) ); + ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) ); } else { ATH_CHECK( m_elecEfficiencySFTool_iso.setProperty("CorrectionFileNameList", corrFNList) ); } @@ -963,7 +983,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_elecEfficiencySFTool_iso.initialize() ); } else ATH_CHECK( m_elecEfficiencySFTool_iso.initialize() ); } - + // electron iso high-pt std::string EleIsohighPt(""); if (std::find(eSF_keys.begin(), eSF_keys.end(), eleId+"_"+m_eleIsoHighPt_WP) != eSF_keys.end()){ @@ -983,22 +1003,22 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() } toolName = "AsgElectronEfficiencyCorrectionTool_isoHigPt_" + m_eleId + EleIsohighPt; - + // if running with correction file list if ( (!m_EG_corrFNList.empty()) && corrFNList.find(EleIsohighPt)!=corrFNList.end() ) { // overriding central map file CONFIG_EG_EFF_TOOL( m_elecEfficiencySFTool_isoHighPt, toolName, corrFNList[EleIsohighPt] ); - } + } // can't do the iso tool via the macro, it needs two properties set else { // default: use map file if ( !m_elecEfficiencySFTool_isoHighPt.isUserConfigured() ) { - + if ( !check_isOption(EleIsohighPt, m_el_iso_support) ) { //check if supported ATH_MSG_WARNING( "(" << toolName << ") Your electron high-pt Iso WP: " << EleIsohighPt << " is no longer supported. This will almost certainly cause a crash now."); } - + m_elecEfficiencySFTool_isoHighPt.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName); - - ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("MapFilePath", m_eleEffMapFilePath) ); + + ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) ); ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("IdKey", eleId) ); ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.setProperty("IsoKey", EleIsohighPt) ); if (!isData()) { @@ -1009,27 +1029,158 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.initialize() ); } else ATH_CHECK( m_elecEfficiencySFTool_isoHighPt.initialize() ); } - - - ATH_MSG_WARNING("*** THE ELECTRON TRIGGER SF ARE CURRENTY NOT SUPPORTED ***"); - // all the iinitialisation of the related tools have been cleaned up - ATH_MSG_WARNING("*** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED ***"); - // all the iinitialisation of the related tools have been cleaned up + // electron triggers - first SFs (but we need to massage the id string since all combinations are not supported) + //single lepton + ATH_MSG_INFO("eSF_keys: " << m_electronTriggerSFStringSingle<< "_"<<eleId<<"_"<<m_eleIso_WP); + std::string triggerEleIso(""); + if (std::find(eSF_keys.begin(), eSF_keys.end(), m_electronTriggerSFStringSingle+"_"+eleId+"_"+m_eleIso_WP) != eSF_keys.end()){ + triggerEleIso = m_eleIso_WP; + } else if (std::find(eSF_keys.begin(), eSF_keys.end(), m_electronTriggerSFStringSingle+"_"+eleId+"_"+m_el_iso_fallback[m_eleIso_WP]) != eSF_keys.end()){ + //--- Check to see if the only issue is an unknown isolation working point + triggerEleIso = m_el_iso_fallback[m_eleIso_WP]; + ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool_trig_singleLep_*) Your selected electron Iso WP (" + << m_eleIso_WP + << ") does not have trigger SFs defined. Falling back to " + << triggerEleIso + << " for SF calculations"); + } + else{ + ATH_MSG_ERROR("*** THE SINGLE ELECTRON TRIGGER SF YOU SELECTED (" << m_electronTriggerSFStringSingle << ") GOT NO SUPPORT FOR YOUR ID+ISO WPs (" << m_eleId << "+" << m_eleIso_WP << ") ***"); + return StatusCode::FAILURE; + } + + toolName = "AsgElectronEfficiencyCorrectionTool_trig_singleLep_" + m_eleId; + if ( !m_elecEfficiencySFTool_trig_singleLep.isUserConfigured() ) { + m_elecEfficiencySFTool_trig_singleLep.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName); + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) ); + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("TriggerKey", m_electronTriggerSFStringSingle) ); + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("IdKey", eleId) ); + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("IsoKey", triggerEleIso) ); + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("CorrelationModel", m_EG_corrModel) ); + if (!isData()) { + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) ); + } + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.setProperty("OutputLevel", this->msg().level()) ); + ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.initialize() ); + } else ATH_CHECK( m_elecEfficiencySFTool_trig_singleLep.retrieve() ); + + + toolName = "AsgElectronEfficiencyCorrectionTool_trigEff_singleLep_" + m_eleId; + if ( !m_elecEfficiencySFTool_trigEff_singleLep.isUserConfigured() ) { + m_elecEfficiencySFTool_trigEff_singleLep.setTypeAndName("AsgElectronEfficiencyCorrectionTool/"+toolName); + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) ); + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("TriggerKey", "Eff_"+m_electronTriggerSFStringSingle) ); + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("IdKey", eleId) ); + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("IsoKey", triggerEleIso) ); + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("CorrelationModel", m_EG_corrModel) ); + if (!isData()) { + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) ); + } + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.setProperty("OutputLevel", this->msg().level()) ); + ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.initialize() ); + } else ATH_CHECK( m_elecEfficiencySFTool_trigEff_singleLep.retrieve() ); + + if (!m_isRun3){ + //mixed-leptons + std::map<std::string,std::string> electronTriggerSFMapMixedLepton { + // legs, Trigger keys, + {"e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose,e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0", m_electronTriggerSFStringSingle}, + {"e24_lhvloose_nod0_L1EM20VH,e17_lhvloose_nod0,e12_lhloose_L1EM10VH","DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e24_lhvloose_nod0_L1EM20VH"}, + {"e26_lhmedium_nod0_L1EM22VHI,e26_lhmedium_nod0","MULTI_L_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhmedium_nod0_L1EM22VHI_2017_2018_e26_lhmedium_nod0"}, + {"e17_lhloose,e17_lhloose_nod0","MULTI_L_2015_e17_lhloose_2016_2018_e17_lhloose_nod0"}, + {"e12_lhloose,e12_lhloose_nod0","MULTI_L_2015_e12_lhloose_2016_2018_e12_lhloose_nod0"}, + {"e7_lhmedium,e7_lhmedium_nod0","MULTI_L_2015_e7_lhmedium_2016_2018_e7_lhmedium_nod0"}, + {"e9_lhloose,e9_lhloose_nod0,e12_lhvloose_nod0_L1EM10VH","TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod0_2017_2018_e12_lhvloose_nod0_L1EM10VH"} + + }; + + // 2e17 trigger is used in 2017 or 2018? + std::string triglist_2017to2018 = m_trig2017combination_diLep + "_" + m_trig2018combination_diLep + "_" + m_trig2017combination_multiLep + "_" + m_trig2018combination_multiLep; + if (triglist_2017to2018.find("2e17_lhvloose_nod0_L12EM15VHI") != std::string::npos) { + electronTriggerSFMapMixedLepton["e17_lhvloose_nod0_L1EM15VHI"] = "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0_2017_2018_e17_lhvloose_nod0_L1EM15VHI"; + } + + std::string triggerMixedEleIso(""); + + for(auto const& item : electronTriggerSFMapMixedLepton){ + + if (std::find(eSF_keys.begin(), eSF_keys.end(), item.second+"_"+eleId+"_"+m_eleIso_WP) != eSF_keys.end()){ + triggerMixedEleIso = m_eleIso_WP; + } else if (std::find(eSF_keys.begin(), eSF_keys.end(), item.second+"_"+eleId+"_"+m_el_iso_fallback[m_eleIso_WP]) != eSF_keys.end()){ + //--- Check to see if the only issue is an unknown isolation working point + triggerMixedEleIso = m_el_iso_fallback[m_eleIso_WP]; + ATH_MSG_WARNING("(AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (" + << m_eleIso_WP + << ") does not have trigger SFs defined. Falling back to " + << triggerMixedEleIso + << " for SF calculations"); + } else { + ATH_MSG_ERROR("*** THE MIXED ELECTRON TRIGGER SF YOU SELECTED (" << item.second << ") GOT NO SUPPORT FOR YOUR ID+ISO WPs (" << m_eleId << "+" << m_eleIso_WP << "). The fallback options failed as well sorry! ***"); + return StatusCode::FAILURE; + } + + ATH_MSG_VERBOSE ("Selected WP: " << item.second << "_" << eleId << "_" << triggerMixedEleIso); + + toolName = "AsgElectronEfficiencyCorrectionTool_trig_mixLep_" + (item.first).substr(0,8) + m_eleId; + auto t_sf = m_elecEfficiencySFTool_trig_mixLep.emplace(m_elecEfficiencySFTool_trig_mixLep.end(), "AsgElectronEfficiencyCorrectionTool/"+toolName); + ATH_CHECK( t_sf->setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) ); + ATH_CHECK( t_sf->setProperty("TriggerKey", item.second) ); + ATH_CHECK( t_sf->setProperty("IdKey", eleId) ); + ATH_CHECK( t_sf->setProperty("IsoKey", triggerMixedEleIso) ); + ATH_CHECK( t_sf->setProperty("CorrelationModel", m_EG_corrModel) ); + if (!isData()) { + ATH_CHECK( t_sf->setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) ); + } + ATH_CHECK( t_sf->setProperty("OutputLevel", this->msg().level()) ); + ATH_CHECK( t_sf->initialize() ); + m_elecTrigSFTools.push_back(t_sf->getHandle()); + #ifndef XAOD_STANDALONE + m_legsPerTool[toolName] = item.first; + #else + m_legsPerTool["ToolSvc."+toolName] = item.first; + #endif + + toolName = "AsgElectronEfficiencyCorrectionTool_trigEff_mixLep_" + (item.first).substr(0,8) + m_eleId; + auto t_eff = m_elecEfficiencySFTool_trigEff_mixLep.emplace(m_elecEfficiencySFTool_trigEff_mixLep.end(), "AsgElectronEfficiencyCorrectionTool/"+toolName); + ATH_CHECK( t_eff->setProperty("MapFilePath", m_isRun3? m_eleEffMapFilePath : m_eleEffMapFilePathRun2) ); + ATH_CHECK( t_eff->setProperty("TriggerKey", "Eff_"+item.second) ); + ATH_CHECK( t_eff->setProperty("IdKey", eleId) ); + ATH_CHECK( t_eff->setProperty("IsoKey", triggerMixedEleIso) ); + ATH_CHECK( t_eff->setProperty("CorrelationModel", m_EG_corrModel) ); + if (!isData()) { + ATH_CHECK( t_eff->setProperty("ForceDataType", (int) (data_type==PATCore::ParticleDataType::Fast)? PATCore::ParticleDataType::Full : data_type) ); + } + ATH_CHECK( t_eff->setProperty("OutputLevel", this->msg().level()) ); + ATH_CHECK( t_eff->initialize() ); + m_elecTrigEffTools.push_back(t_eff->getHandle()); + #ifndef XAOD_STANDALONE + m_legsPerTool[toolName] = item.first; + #else + m_legsPerTool["ToolSvc."+toolName] = item.first; + #endif + + } + } + else ATH_MSG_WARNING("*** THE ELECTRON TRIGGER SF MIXED AND SF DILEP ARE CURRENTY NOT SUPPORTED IN RUN3 ***"); + + ATH_MSG_WARNING("*** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED ***"); + // all the iinitialisation of the related tools have been cleaned up + } if (m_slices["pho"]) { // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise photon efficiency tool - + if (!m_photonEfficiencySFTool.isUserConfigured() && !isData()) { m_photonEfficiencySFTool.setTypeAndName("AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool_" + m_photonId); - + if (m_photonId != "Tight" ) { ATH_MSG_WARNING( "No Photon efficiency available for " << m_photonId << ", using Tight instead..." ); } - + ATH_CHECK( m_photonEfficiencySFTool.setProperty("MapFilePath", m_isRun3? "PhotonEfficiencyCorrection/2015_2025/rel22.2/2022_Summer_Prerecom_v1/map0.txt":"PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); ATH_CHECK( m_photonEfficiencySFTool.setProperty("ForceDataType", 1) ); // Set data type: 1 for FULLSIM, 3 for AF2 ATH_CHECK( m_photonEfficiencySFTool.setProperty("OutputLevel", this->msg().level()) ); @@ -1038,63 +1189,63 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (!m_photonIsolationSFTool.isUserConfigured() && !isData()) { m_photonIsolationSFTool.setTypeAndName("AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool_isol" + m_photonIso_WP); - + if (m_photonIso_WP != "FixedCutTight" && m_photonIso_WP != "FixedCutLoose" && m_photonIso_WP != "FixedCutTightCaloOnly") { ATH_MSG_WARNING( "No Photon efficiency available for " << m_photonIso_WP); } - + ATH_CHECK( m_photonIsolationSFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); ATH_CHECK( m_photonIsolationSFTool.setProperty("IsoKey", m_photonIso_WP.substr(8) )); // Set isolation WP: Loose,Tight,TightCaloOnly ATH_CHECK( m_photonIsolationSFTool.setProperty("ForceDataType", 1) ); // Set data type: 1 for FULLSIM, 3 for AF2 ATH_CHECK( m_photonIsolationSFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_photonIsolationSFTool.retrieve() ); } else if (m_photonEfficiencySFTool.isUserConfigured()) ATH_CHECK( m_photonIsolationSFTool.retrieve() ); - - // trigger scale factors + + // trigger scale factors if (!m_photonTriggerSFTool.isUserConfigured() && !isData()) { m_photonTriggerSFTool.setTypeAndName("AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool_trig" + m_photonTriggerName); - + // Fallback to TightCaloOnly if Tight is selected std::string photonIso_forTrigSF = m_photonIso_WP; if (m_photonIso_WP == "FixedCutTight") { - ATH_MSG_WARNING( "No Photon trigger SF available for " << m_photonIso_WP << ", using TightCaloOnly instead... Use at your own risk" ); + ATH_MSG_WARNING( "No Photon trigger SF available for " << m_photonIso_WP << ", using TightCaloOnly instead... Use at your own risk" ); photonIso_forTrigSF = "TightCaloOnly"; } else { // isolation WP supported: Loose or TightCaloOnly, removing "FixedCut" suffix.. photonIso_forTrigSF = TString(m_photonIso_WP).ReplaceAll("FixedCut","").Data(); - } - + } + // "symmetric" diphoton triggers (year dependent) - ATH_CHECK( m_photonTriggerSFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); - ATH_CHECK( m_photonTriggerSFTool.setProperty("IsoKey", photonIso_forTrigSF )); // Set isolation WP: Loose,TightCaloOnly - ATH_CHECK( m_photonTriggerSFTool.setProperty("TriggerKey", m_photonTriggerName )); + ATH_CHECK( m_photonTriggerSFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); + ATH_CHECK( m_photonTriggerSFTool.setProperty("IsoKey", photonIso_forTrigSF )); // Set isolation WP: Loose,TightCaloOnly + ATH_CHECK( m_photonTriggerSFTool.setProperty("TriggerKey", m_photonTriggerName )); ATH_CHECK( m_photonTriggerSFTool.setProperty("ForceDataType", 1) ); // Set data type: 1 for FULLSIM, 3 for AF2 ATH_CHECK( m_photonTriggerSFTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_photonTriggerSFTool.retrieve() ); - + // "asymmetric" diphoton triggers std::map<std::string,std::string> diphotonTriggerSFMapAsymmetric { - // legs, Trigger keys, + // legs, Trigger keys, {"g25_loose,g25_medium_L1EM20VH", "DI_PH_2015_g25_loose_2016_g25_loose_2017_g25_medium_L1EM20VH_2018_g25_medium_L1EM20VH"}, {"g35_loose,g35_medium_L1EM20VH", "DI_PH_2015_g35_loose_2016_g35_loose_2017_g35_medium_L1EM20VH_2018_g35_medium_L1EM20VH"}, }; - + for(auto const& item : diphotonTriggerSFMapAsymmetric){ - + toolName = "AsgPhotonEfficiencyCorrectionTool_trigSF_asymm_diphoton_" + (item.first).substr(0,9) + photonIso_forTrigSF; auto ph_trigSF = m_photonEfficiencySFTool_trigSF_AsymDiphoton.emplace(m_photonEfficiencySFTool_trigSF_AsymDiphoton.end(), "AsgPhotonEfficiencyCorrectionTool/"+toolName); - ATH_CHECK( ph_trigSF->setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); + ATH_CHECK( ph_trigSF->setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); ATH_CHECK( ph_trigSF->setProperty("IsoKey", photonIso_forTrigSF) ); ATH_CHECK( ph_trigSF->setProperty("TriggerKey", item.second) ); ATH_CHECK( ph_trigSF->setProperty("ForceDataType", 1) ); // Set DataType: 1 for FullSim and 3 for AFII ATH_CHECK( ph_trigSF->setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( ph_trigSF->initialize() ); m_photonTrigSFTools.push_back(ph_trigSF->getHandle()); - #ifndef XAOD_STANDALONE - m_legsPerTool_ph[toolName] = item.first; - #else - m_legsPerTool_ph["ToolSvc."+toolName] = item.first; - #endif - + #ifndef XAOD_STANDALONE + m_legsPerTool_ph[toolName] = item.first; + #else + m_legsPerTool_ph["ToolSvc."+toolName] = item.first; + #endif + toolName = "AsgPhotonEfficiencyCorrectionTool_trigEff_asymm_diphoton_" + (item.first).substr(0,9) + photonIso_forTrigSF; auto ph_trigEff = m_photonEfficiencySFTool_trigEff_AsymDiphoton.emplace(m_photonEfficiencySFTool_trigEff_AsymDiphoton.end(), "AsgPhotonEfficiencyCorrectionTool/"+toolName); ATH_CHECK( ph_trigEff->setProperty("MapFilePath", "PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map1.txt") ); @@ -1104,34 +1255,34 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( ph_trigEff->setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( ph_trigEff->initialize() ); m_photonTrigEffTools.push_back(ph_trigEff->getHandle()); - #ifndef XAOD_STANDALONE - m_legsPerTool_ph[toolName] = item.first; - #else - m_legsPerTool_ph["ToolSvc."+toolName] = item.first; - #endif - + #ifndef XAOD_STANDALONE + m_legsPerTool_ph[toolName] = item.first; + #else + m_legsPerTool_ph["ToolSvc."+toolName] = item.first; + #endif + + } } } - } } if (m_slices["ele"] || m_slices["pho"]) { /////////////////////////////////////////////////////////////////////////////////////////// // Initialize the MC fudge tool - + if (!m_electronPhotonShowerShapeFudgeTool.isUserConfigured()) { m_electronPhotonShowerShapeFudgeTool.setTypeAndName("ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool"); - + int FFset = 22; ATH_CHECK( m_electronPhotonShowerShapeFudgeTool.setProperty("Preselection", FFset) ); ATH_CHECK( m_electronPhotonShowerShapeFudgeTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_electronPhotonShowerShapeFudgeTool.retrieve() ); } else ATH_CHECK( m_electronPhotonShowerShapeFudgeTool.retrieve() ); - - + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialize the EgammaAmbiguityTool - + if (!m_egammaAmbiguityTool.isUserConfigured()) { m_egammaAmbiguityTool.setTypeAndName("EGammaAmbiguityTool/EGammaAmbiguityTool"); ATH_CHECK( m_egammaAmbiguityTool.setProperty("OutputLevel", this->msg().level()) ); @@ -1143,9 +1294,9 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["ele"]) { //disable /////////////////////////////////////////////////////////////////////////////////////////// //disable // Initialize the AsgElectronChargeIDSelector - + //disable if (!m_elecChargeIDSelectorTool.isUserConfigured()) { - + //disable // For the selector, can use the nice function //disable std::string eleId = EG_WP(m_eleId); //disable m_elecChargeIDSelectorTool.setTypeAndName("AsgElectronChargeIDSelectorTool/ElectronChargeIDSelectorTool_"+eleId); @@ -1154,18 +1305,18 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() //disable if (m_eleChID_WP != "Loose" && !m_eleChID_WP.empty()) { //disable ATH_MSG_ERROR("Only Loose WP is supported in R21. Invalid ChargeIDSelector WP selected : " << m_eleChID_WP); //disable return StatusCode::FAILURE; - //disable } - + //disable } + //disable ATH_CHECK( m_elecChargeIDSelectorTool.setProperty("TrainingFile", "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root")); //disable ATH_CHECK( m_elecChargeIDSelectorTool.setProperty("CutOnBDT", BDTcut)); //disable ATH_CHECK( m_elecChargeIDSelectorTool.setProperty("OutputLevel", this->msg().level()) ); //disable ATH_CHECK( m_elecChargeIDSelectorTool.retrieve() ); //disable } else ATH_CHECK( m_elecChargeIDSelectorTool.retrieve() ); - - + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise egamma calibration tool - + if (!m_egammaCalibTool.isUserConfigured()) { m_egammaCalibTool.setTypeAndName("CP::EgammaCalibrationAndSmearingTool/EgammaCalibrationAndSmearingTool"); ATH_MSG_DEBUG( "Initialising EgcalibTool " ); @@ -1181,10 +1332,10 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["tau"]) { /////////////////////////////////////////////////////////////////////////////////////////// // No tau score re-decorator in R21; might come back some day, would go here - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise tau selection tools - + if (!m_tauSelTool.isUserConfigured()) { std::string inputfile = ""; if (!m_tauConfigPath.empty() && (m_tauConfigPath!="default")) inputfile = m_tauConfigPath; @@ -1202,8 +1353,8 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_tauSelTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_tauSelTool.retrieve() ); } else ATH_CHECK( m_tauSelTool.retrieve() ); - - + + if (!m_tauSelToolBaseline.isUserConfigured()) { std::string inputfile = ""; if (!m_tauConfigPathBaseline.empty() && (m_tauConfigPathBaseline!="default")) inputfile = m_tauConfigPathBaseline; @@ -1218,12 +1369,12 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() toolName = "TauSelectionToolBaseline_" + m_tauIdBaseline; m_tauSelToolBaseline.setTypeAndName("TauAnalysisTools::TauSelectionTool/"+toolName); ATH_CHECK( m_tauSelToolBaseline.setProperty("ConfigPath", inputfile) ); - + ATH_CHECK( m_tauSelToolBaseline.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_tauSelToolBaseline.retrieve() ); } else ATH_CHECK( m_tauSelToolBaseline.retrieve() ); - - + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise tau efficiency tool @@ -1242,10 +1393,10 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() // TODO: add SF tool for baseline tau id as well? /CO - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise tau trigger efficiency tool(s) - + if (!isData()) { int iTauID = (int) TauAnalysisTools::JETIDNONEUNCONFIGURED; if (m_tauId == "VeryLoose") iTauID = (int) TauAnalysisTools::JETIDRNNVERYLOOSE; @@ -1256,7 +1407,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_MSG_ERROR("Invalid tau ID selected: " << m_tauId); return StatusCode::FAILURE; } - + // map format: SF file name, corresponding single-tau leg (comma-separated in case of OR) m_tau_trig_support = { {"HLT_tau25_medium1_tracktwo", "HLT_tau25_medium1_tracktwo"}, @@ -1282,7 +1433,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() {"HLT_tau80L1TAU60_medium1_tracktwoEF_OR_mediumRNN_tracktwoMVA", "HLT_tau80_medium1_tracktwoEF_L1TAU60,HLT_tau80_mediumRNN_tracktwoMVA_L1TAU60"}, {"HLT_tau160L1TAU100_medium1_tracktwoEF_OR_mediumRNN_tracktwoMVA", "HLT_tau160_medium1_tracktwoEF_L1TAU100,HLT_tau160_mediumRNN_tracktwoMVA_L1TAU100"} }; - + for(auto const& trigger : m_tau_trig_support) { toolName = "TauTrigEffTool_" + m_tauId + "_" + trigger.first; auto tau_trigSF = m_tauTrigEffTool.emplace(m_tauTrigEffTool.end(), "TauAnalysisTools::TauEfficiencyCorrectionsTool/"+toolName); @@ -1295,11 +1446,11 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( tau_trigSF->initialize() ); } } - - + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise tau smearing tool - + if (!m_tauSmearingTool.isUserConfigured()) { m_tauSmearingTool.setTypeAndName("TauAnalysisTools::TauSmearingTool/TauSmearingTool"); ATH_CHECK( m_tauSmearingTool.setProperty("RecommendationTag", m_tauSmearingToolRecommendationTag) ); @@ -1310,11 +1461,11 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_tauSmearingTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_tauSmearingTool.retrieve() ); } else ATH_CHECK( m_tauSmearingTool.retrieve() ); - - + + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise tau truth matching tool - + if (!m_tauTruthMatch.isUserConfigured() && m_tauDoTTM) { m_tauTruthMatch.setTypeAndName("TauAnalysisTools::TauTruthMatchingTool/TauTruthMatch"); ATH_CHECK( m_tauTruthMatch.setProperty("WriteTruthTaus", true) ); @@ -1330,19 +1481,19 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["bjet"]) { /////////////////////////////////////////////////////////////////////////////////////////// // Initialise B-tagging tools - + // btagSelectionTool std::string jetcollBTag = jetcoll; if (jetcoll == "AntiKt4LCTopoJets") { ATH_MSG_WARNING(" *** HACK *** Treating LCTopoJets jets as EMTopo -- use at your own risk!"); jetcollBTag = "AntiKt4EMTopoJets"; } - + if (m_useBtagging && !m_btagSelTool.isUserConfigured() && !m_BtagWP.empty()) { if (jetcollBTag.find("AntiKt4EMTopoJets") == std::string::npos && jetcollBTag.find("AntiKt4EMPFlowJets")==std::string::npos) { ATH_MSG_WARNING("** Only AntiKt4EMTopoJets and AntiKt4EMPFlowJets are supported with FTAG scale factors!"); return StatusCode::FAILURE; - } + } toolName = "BTagSel_" + jetcollBTag + m_BtagTagger + m_BtagWP; @@ -1373,12 +1524,12 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_btagSelTool_OR.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_btagSelTool_OR.retrieve() ); } else if (m_btagSelTool_OR.isUserConfigured()) ATH_CHECK( m_btagSelTool_OR.retrieve() ); - - + + std::string trkjetcoll = m_defaultTrackJets; const std::string& BTagColl_TrkJet = trkjetcoll; if (m_slices["tjet"]) { - if ( m_useBtagging_trkJet && m_defaultTrackJets.empty()) { + if ( m_useBtagging_trkJet && m_defaultTrackJets.empty()) { m_useBtagging_trkJet = false; ATH_MSG_INFO("TrackJet collection set to None: disabling btagging for TrackJets."); } @@ -1402,8 +1553,8 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_btagSelTool_trkJet.retrieve() ); } else if (m_btagSelTool_trkJet.isUserConfigured()) ATH_CHECK( m_btagSelTool_trkJet.retrieve() ); } - - + + // Set MCshowerType for FTAG MC/MC SFs // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagCalibrationRecommendationsRelease21#MC_MC_Scale_Factors_for_Analysis std::string MCshowerID = "410470"; // Powheg+Pythia8 (default) - PhPy8EG_A14 @@ -1426,7 +1577,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (jetcollBTag == "AntiKt4EMPFlowJets" && MCshowerID == "426131") { // sherpa 2.1 isn't available ATH_MSG_WARNING ("MC/MC SFs for AntiKt4EMPFlowJets are not available yet! Falling back to AntiKt4EMTopoJets for the SFs."); jetcollBTag = "AntiKt4EMTopoJets"; - } + } toolName = "BTagSF_" + jetcollBTag + m_BtagTagger + m_BtagWP; m_btagEffTool.setTypeAndName("BTaggingEfficiencyTool/"+toolName); @@ -1443,8 +1594,8 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_btagEffTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_btagEffTool.retrieve() ); } else ATH_CHECK( m_btagEffTool.retrieve() ); - - + + if (m_slices["tjet"]) { if (m_useBtagging_trkJet && !m_btagEffTool_trkJet.isUserConfigured() && !m_BtagWP_trkJet.empty()) { if (trkjetcoll.find("AntiKt2PV0TrackJets")==std::string::npos && trkjetcoll.find("AntiKtVR30Rmax4Rmin02TrackJets")==std::string::npos) { @@ -1474,11 +1625,11 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_slices["met"]) { /////////////////////////////////////////////////////////////////////////////////////////// // Initialise MET tools - + if (!m_metMaker.isUserConfigured()) { toolName = m_doFwdJVT ? m_metJetSelection+"_fJVT" : m_metJetSelection+"_NOfJVT"; m_metMaker.setTypeAndName("met::METMaker/METMaker_ST_"+toolName); - + ATH_CHECK( m_metMaker.setProperty("ORCaloTaggedMuons", m_metRemoveOverlappingCaloTaggedMuons) ); ATH_CHECK( m_metMaker.setProperty("DoSetMuonJetEMScale", m_metDoSetMuonJetEMScale) ); ATH_CHECK( m_metMaker.setProperty("DoRemoveMuonJets", m_metDoRemoveMuonJets) ); @@ -1486,7 +1637,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_metMaker.setProperty("DoMuonEloss", m_metDoMuonEloss) ); ATH_CHECK( m_metMaker.setProperty("GreedyPhotons", m_metGreedyPhotons) ); ATH_CHECK( m_metMaker.setProperty("VeryGreedyPhotons", m_metVeryGreedyPhotons) ); - + // set the jet selection if default empty string is overridden through config file if (m_metJetSelection.size()) { ATH_CHECK( m_metMaker.setProperty("JetSelection", m_metJetSelection) ); @@ -1494,60 +1645,47 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() if (m_jetInputType == xAOD::JetInput::EMPFlow) { ATH_CHECK( m_metMaker.setProperty("DoPFlow", true) ); } - + ATH_CHECK( m_metMaker.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_metMaker.retrieve() ); } else ATH_CHECK( m_metMaker.retrieve() ); - - + + if (!m_metSystTool.isUserConfigured()) { m_metSystTool.setTypeAndName("met::METSystematicsTool/METSystTool"); ATH_CHECK( m_metSystTool.setProperty("ConfigPrefix", m_metsysConfigPrefix) ); - + if (m_trkMETsyst && m_caloMETsyst){ ATH_MSG_ERROR( "Can only have CST *or* TST configured for MET maker. Please unset either METDoCaloSyst or METDoTrkSyst in your config file" ); return StatusCode::FAILURE; } - + if (m_trkMETsyst) { ATH_CHECK( m_metSystTool.setProperty("ConfigSoftCaloFile", "") ); - ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "TrackSoftTerms.config") ); - if (m_jetInputType == xAOD::JetInput::EMPFlow) { - ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "TrackSoftTerms-pflow.config") ); - } - if (isAtlfast()) { - ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "TrackSoftTerms_AFII.config") ); - } + ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "TrackSoftTerms-pflow.config") ); } - + if (m_caloMETsyst) { ATH_MSG_WARNING( "CST is no longer recommended by Jet/MET group"); ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile", "") ); - // Recommendations from a thread with TJ. CST is not officially supported, but might be used for cross-checks - ATH_CHECK( m_metSystTool.setProperty("DoIsolMuonEloss",true) ); - ATH_CHECK( m_metSystTool.setProperty("DoMuonEloss",true) ); - if ("AntiKt4EMTopoJets"==jetcoll) { - // Recommendation from TJ: if we are using EM topo jets, make sure the clusters are considered at LC scale - ATH_CHECK( m_metSystTool.setProperty("JetConstitScaleMom","JetLCScaleMomentum") ); - } - } - + } + if (m_trkJetsyst) { ATH_CHECK( m_metSystTool.setProperty("ConfigJetTrkFile", "JetTrackSyst.config") ); } - + ATH_CHECK( m_metSystTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_metSystTool.retrieve()); } else ATH_CHECK( m_metSystTool.retrieve()); - - + + if (!m_metSignif.isUserConfigured()) { - // See https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MetSignificance + // See https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MetSignificance m_metSignif.setTypeAndName("met::METSignificance/metSignificance_"+jetname); ATH_CHECK( m_metSignif.setProperty("SoftTermParam", m_softTermParam) ); ATH_CHECK( m_metSignif.setProperty("TreatPUJets", m_treatPUJets) ); ATH_CHECK( m_metSignif.setProperty("DoPhiReso", m_doPhiReso) ); - ATH_CHECK( m_metSignif.setProperty("IsAFII", isAtlfast()) ); + ATH_CHECK( m_metSignif.setProperty("IsAFII", isAtlfast()) ); if(jetname == "AntiKt4EMTopo" || jetname =="AntiKt4EMPFlow"){ ATH_CHECK( m_metSignif.setProperty("JetCollection", jetname) ); } else { @@ -1559,7 +1697,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_metSignif.retrieve() ); } else ATH_CHECK( m_metSignif.retrieve() ); } - + /////////////////////////////////////////////////////////////////////////////////////////// // Initialise trigger tools @@ -1601,13 +1739,13 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() m_trigMatchingTool.setTypeAndName("Trig::MatchFromCompositeTool/TrigMatchFromCompositeTool"); ATH_CHECK( m_trigMatchingTool.setProperty("InputPrefix", m_trigMatchingPrefix) ); ATH_CHECK( m_trigMatchingTool.setProperty("RemapBrokenLinks", true) ); - } + } else { if (m_isRun3){ m_trigMatchingTool.setTypeAndName("Trig::R3MatchingTool/TrigR3MatchingTool"); ATH_CHECK( m_trigMatchingTool.setProperty("ScoringTool", m_trigDRScoringTool.getHandle()) ); ATH_CHECK( m_trigMatchingTool.setProperty("TrigDecisionTool", m_trigDecTool.getHandle()) ); - } + } else { m_trigMatchingTool.setTypeAndName("Trig::MatchingTool/TrigMatchingTool"); ATH_CHECK( m_trigMatchingTool.setProperty("TrigDecisionTool", m_trigDecTool.getHandle()) ); @@ -1625,7 +1763,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() std::string no2e17(""); if (m_trig2017combination_diLep.find("||2e17_lhvloose_nod0_L12EM15VHI") != std::string::npos) { auto pos_2e17 = m_trig2017combination_diLep.find("||2e17_lhvloose_nod0_L12EM15VHI"); - no2e17 = m_trig2017combination_diLep.substr(0, pos_2e17) + m_trig2017combination_diLep.substr(pos_2e17+31, m_trig2017combination_diLep.size()); + no2e17 = m_trig2017combination_diLep.substr(0, pos_2e17) + m_trig2017combination_diLep.substr(pos_2e17+31, m_trig2017combination_diLep.size()); } else if (m_trig2017combination_diLep.find("2e17_lhvloose_nod0_L12EM15VHI||") != std::string::npos) { auto pos_2e17 = m_trig2017combination_diLep.find("2e17_lhvloose_nod0_L12EM15VHI||"); no2e17 = m_trig2017combination_diLep.substr(0, pos_2e17) + m_trig2017combination_diLep.substr(pos_2e17+31, m_trig2017combination_diLep.size()); @@ -1641,7 +1779,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() triggers_diLep["326834-328393"] = no2e17; // 2017 during accidental prescale triggers_diLep["329385-340453"] = m_trig2017combination_diLep; // 2017 after accidental prescale triggers_diLep["2018"] = m_trig2018combination_diLep; - + m_trigGlobalEffCorrTool_diLep.setTypeAndName("TrigGlobalEfficiencyCorrectionTool/TrigGlobal_diLep"); ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("ElectronEfficiencyTools", m_elecTrigEffTools) ); ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("ElectronScaleFactorTools", m_elecTrigSFTools) ); @@ -1649,18 +1787,18 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("TriggerCombination", triggers_diLep) ); ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("TriggerMatchingTool", m_trigMatchingTool.getHandle()) ); ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("ListOfLegsPerTool", m_legsPerTool) ); - ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("NumberOfToys", 250) ); + ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("NumberOfToys", m_trigNToys_diLep) ); ATH_CHECK( m_trigGlobalEffCorrTool_diLep.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_trigGlobalEffCorrTool_diLep.initialize() ); } else ATH_CHECK( m_trigGlobalEffCorrTool_diLep.initialize() ); - + if (!m_trigGlobalEffCorrTool_multiLep.isUserConfigured()) { std::string no2e17(""); if (m_trig2017combination_multiLep.find("||2e17_lhvloose_nod0_L12EM15VHI") != std::string::npos) { auto pos_2e17 = m_trig2017combination_multiLep.find("||2e17_lhvloose_nod0_L12EM15VHI"); - no2e17 = m_trig2017combination_multiLep.substr(0, pos_2e17) + m_trig2017combination_multiLep.substr(pos_2e17+31, m_trig2017combination_multiLep.size()); + no2e17 = m_trig2017combination_multiLep.substr(0, pos_2e17) + m_trig2017combination_multiLep.substr(pos_2e17+31, m_trig2017combination_multiLep.size()); } else if (m_trig2017combination_multiLep.find("2e17_lhvloose_nod0_L12EM15VHI||") != std::string::npos) { auto pos_2e17 = m_trig2017combination_multiLep.find("2e17_lhvloose_nod0_L12EM15VHI||"); no2e17 = m_trig2017combination_multiLep.substr(0, pos_2e17) + m_trig2017combination_multiLep.substr(pos_2e17+31, m_trig2017combination_multiLep.size()); @@ -1684,11 +1822,11 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("TriggerCombination", triggers_multiLep) ); ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("TriggerMatchingTool", m_trigMatchingTool.getHandle()) ); ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("ListOfLegsPerTool", m_legsPerTool) ); - ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("NumberOfToys", 250) ); + ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("NumberOfToys", m_trigNToys_multiLep) ); ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.initialize() ); } else ATH_CHECK( m_trigGlobalEffCorrTool_multiLep.initialize() ); - + if (!m_trigGlobalEffCorrTool_diPhoton.isUserConfigured()) { m_trigGlobalEffCorrTool_diPhoton.setTypeAndName("TrigGlobalEfficiencyCorrectionTool/TrigGlobal_diPhoton"); @@ -1699,16 +1837,16 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("TriggerCombination2017", m_trig2017combination_diPhoton) ); ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("TriggerCombination2018", m_trig2018combination_diPhoton) ); ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("ListOfLegsPerTool", m_legsPerTool_ph) ); - ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("NumberOfToys", 250) ); + ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("NumberOfToys", m_trigNToys_diPhoton) ); ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.initialize() ); } else ATH_CHECK( m_trigGlobalEffCorrTool_diPhoton.initialize() ); - + if (m_slices["ele"] || m_slices["pho"] || m_slices["mu"]) { // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise Isolation Correction Tool - + if ( !m_isoCorrTool.isUserConfigured() ) { m_isoCorrTool.setTypeAndName("CP::IsolationCorrectionTool/IsoCorrTool"); ATH_CHECK( m_isoCorrTool.setProperty( "IsMC", !isData()) ); @@ -1716,8 +1854,8 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_isoCorrTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_isoCorrTool.retrieve() ); } else ATH_CHECK( m_isoCorrTool.retrieve() ); - - + + // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise Isolation Tool if (!m_isoTool.isUserConfigured()) { @@ -1728,14 +1866,14 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_isoTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_isoTool.retrieve() ); } else ATH_CHECK( m_isoTool.retrieve() ); - + //disable if (!m_isoToolLowPtPLV.isUserConfigured()) { //disable m_isoToolLowPtPLV.setTypeAndName("CP::IsolationLowPtPLVTool/IsoToolLowPtPLV"); //disable ATH_CHECK( m_isoToolLowPtPLV.setProperty("OutputLevel", this->msg().level()) ); //disable ATH_CHECK( m_isoToolLowPtPLV.retrieve() ); //disable } else ATH_CHECK( m_isoToolLowPtPLV.retrieve() ); - - + + if (!m_isoBaselineTool.isUserConfigured()) { m_isoBaselineTool.setTypeAndName("CP::IsolationSelectionTool/IsoBaselineTool"); ATH_CHECK( m_isoBaselineTool.setProperty("ElectronWP", m_eleBaselineIso_WP.empty() ? "Loose_VarRad" : m_eleBaselineIso_WP ) ); @@ -1744,8 +1882,8 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_isoBaselineTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_isoBaselineTool.retrieve() ); } else ATH_CHECK( m_isoBaselineTool.retrieve() ); - - + + if (!m_isoHighPtTool.isUserConfigured()) { m_isoHighPtTool.setTypeAndName("CP::IsolationSelectionTool/IsoHighPtTool"); ATH_CHECK( m_isoHighPtTool.setProperty("ElectronWP", m_eleIsoHighPt_WP.empty() ? "Loose_VarRad" : m_eleIsoHighPt_WP) ); @@ -1754,7 +1892,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_isoHighPtTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_isoHighPtTool.retrieve() ); } else ATH_CHECK( m_isoHighPtTool.retrieve() ); - + // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise IsolationCloseByCorrectionTool Tool @@ -1768,12 +1906,12 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_isoCloseByTool.setProperty("BackupPrefix", "ORIG") ); // The isolation selection decorator is updated as well by the tool ATH_CHECK( m_isoCloseByTool.setProperty("IsolationSelectionDecorator", "isol") ); - + ATH_CHECK( m_isoCloseByTool.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_isoCloseByTool.retrieve() ); } else ATH_CHECK( m_isoCloseByTool.retrieve() ); } - + // ///////////////////////////////////////////////////////////////////////////////////////// // Initialise Overlap Removal Tool @@ -1866,12 +2004,12 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() // propagate the calo muon setting for EleMuORT ATH_CHECK(m_orToolbox.eleMuORT.setProperty("RemoveCaloMuons", m_orRemoveCaloMuons) ); - + // Use electron-muon DR matching to remove electrons within DR < 0.01 of Muons. if (m_orDoElMu){ ATH_CHECK(m_orToolbox.eleMuORT.setProperty("UseDRMatching", m_orDoElMu) ); } - + // propagate the fatjets OR settings if(m_orDoFatjets){ if(m_EleFatJetDR>0) ATH_CHECK(m_orToolbox.eleFatJetORT.setProperty("DR", m_EleFatJetDR)); @@ -1902,7 +2040,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_orToolbox.initialize() ); - } + } // Done with the OR toolbox setup! // ///////////////////////////////////////////////////////////////////////////////////////// @@ -1921,7 +2059,7 @@ StatusCode SUSYObjDef_xAOD::SUSYToolsInit() ATH_CHECK( m_pmgSHnjetWeighterWZ.setProperty("OutputLevel", this->msg().level()) ); ATH_CHECK( m_pmgSHnjetWeighterWZ.retrieve() ); } else ATH_CHECK( m_pmgSHnjetWeighterWZ.retrieve() ); - + // prevent these initialiation snippets from being run again m_subtool_init = true; diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Trigger.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Trigger.cxx index dfd29a07bb769e6344f01038f15c23e582d65f19..eae4387791549152f7c8519e861e144e58a03935 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Trigger.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/Root/Trigger.cxx @@ -66,17 +66,17 @@ bool SUSYObjDef_xAOD::IsMETTrigPassed(const std::string& triggerName, bool j400_ bool L1_XE55 = m_trigDecTool->isPassed("L1_XE55"); bool HLT_noalg_L1J400 = m_trigDecTool->isPassed("HLT_noalg_L1J400"); if (!L1_XE50 && j400_OR && HLT_noalg_L1J400) { - return m_emulateHLT(triggerName); + return emulateHLT(triggerName); } else if (L1_XE50 || L1_XE55) { // See if the TDT knows about this - if (m_isTrigInTDT(triggerName) ) return m_trigDecTool->isPassed(triggerName); - else return m_emulateHLT(triggerName); + if (isTrigInTDT(triggerName) ) return m_trigDecTool->isPassed(triggerName); + else return emulateHLT(triggerName); } return false; } -bool SUSYObjDef_xAOD::m_isTrigInTDT(const std::string& triggerName) const { +bool SUSYObjDef_xAOD::isTrigInTDT(const std::string& triggerName) const { auto mapItr = m_checkedTriggers.find(triggerName); if ( mapItr == m_checkedTriggers.end() ) { const auto *cg = m_trigDecTool->getChainGroup(triggerName); @@ -88,7 +88,7 @@ bool SUSYObjDef_xAOD::m_isTrigInTDT(const std::string& triggerName) const { } -bool SUSYObjDef_xAOD::m_emulateHLT(const std::string& triggerName) const { +bool SUSYObjDef_xAOD::emulateHLT(const std::string& triggerName) const { // First, check if we've already tried using this trigger auto funcItr = m_metTriggerFuncs.find(triggerName); if (funcItr != m_metTriggerFuncs.end() ) @@ -188,7 +188,7 @@ bool SUSYObjDef_xAOD::m_emulateHLT(const std::string& triggerName) const { // We can't get the exact trigger decision :( . Look for an alternative std::vector<std::string> replacementTriggers({"HLT_xe110_mht_L1XE50", "HLT_xe100_mht_L1XE50", "HLT_xe90_mht_L1XE50", "HLT_xe70_mht"}); for (const std::string& trigName : replacementTriggers) { - if (m_isTrigInTDT(trigName) ) { + if (isTrigInTDT(trigName) ) { ATH_MSG_WARNING( "Trigger " << triggerName << " not available and direct emulation impossible! Will use " << trigName << " instead!"); m_metTriggerFuncs[triggerName] = [this, trigName] () { return m_trigDecTool->isPassed(trigName); @@ -326,7 +326,7 @@ const Trig::ChainGroup* SUSYObjDef_xAOD::GetTrigChainGroup(const std::string& tr return trigchains; } - void SUSYObjDef_xAOD::GetTriggerTokens(std::string trigExpr, std::vector<std::string>& v_trigs15_cache, std::vector<std::string>& v_trigs16_cache, std::vector<std::string>& v_trigs17_cache, std::vector<std::string>& v_trigs18_cache) const { + void SUSYObjDef_xAOD::GetTriggerTokens(std::string trigExpr, std::vector<std::string>& v_trigs15_cache, std::vector<std::string>& v_trigs16_cache, std::vector<std::string>& v_trigs17_cache, std::vector<std::string>& v_trigs18_cache, std::vector<std::string>& v_trigs22_cache) const { // e.g. SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 @@ -334,11 +334,12 @@ const Trig::ChainGroup* SUSYObjDef_xAOD::GetTrigChainGroup(const std::string& tr static std::string del16 = "_2016_"; static std::string del17 = "_2017_"; static std::string del18 = "_2018_"; + static std::string del22 = "_2022_"; size_t pos = 0; - std::string token15, token16, token17, token18; + std::string token15, token16, token17, token18, token22; - //get trigger tokens for 2015, 2016, 2017, and 2018 + //get trigger tokens for 2015, 2016, 2017, 2018 and 2022 if ( (pos = trigExpr.find(del15)) != std::string::npos) { trigExpr.erase(0, pos + del15.length()); @@ -352,24 +353,32 @@ const Trig::ChainGroup* SUSYObjDef_xAOD::GetTrigChainGroup(const std::string& tr } } - //redefine in case of custom user input - if(token15.empty()) - token15 = trigExpr; - - if(token16.empty()) - token16 = trigExpr; - - if(token17.empty()) - token17 = trigExpr; + if ( (pos = trigExpr.find(del22)) != std::string::npos) { + trigExpr.erase(0, pos + del22.length()); + } - if(token18.empty()) - token18 = trigExpr; + //redefine in case of custom user input + if(!m_isRun3){ + if(token15.empty()) token15 = trigExpr; + if(token16.empty()) token16 = trigExpr; + if(token17.empty()) token17 = trigExpr; + if(token18.empty()) token18 = trigExpr; + } + else{ + if(token22.empty()) token22 = trigExpr; + } - //get trigger chains for matching in 2015 and 2016 - v_trigs15_cache = GetTriggerOR(token15); - v_trigs16_cache = GetTriggerOR(token16); - v_trigs17_cache = GetTriggerOR(token17); - v_trigs18_cache = GetTriggerOR(token18); + //get trigger chains for matching in 2015 and 2018 + if(!m_isRun3){ + v_trigs15_cache = GetTriggerOR(token15); + v_trigs16_cache = GetTriggerOR(token16); + v_trigs17_cache = GetTriggerOR(token17); + v_trigs18_cache = GetTriggerOR(token18); + } + //get trigger chains for matching in 2022 + else{ + v_trigs22_cache = GetTriggerOR(token22); + } } Trig::FeatureContainer SUSYObjDef_xAOD::GetTriggerFeatures(const std::string& chainName, unsigned int condition) const diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/ISUSYObjDef_xAODTool.h b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/ISUSYObjDef_xAODTool.h index b09438f82f9627dc4f053a80b112de9d51eba1aa..c27a8d113e59c35977ef7f93be0206d18468d1e9 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/ISUSYObjDef_xAODTool.h +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/ISUSYObjDef_xAODTool.h @@ -12,6 +12,7 @@ // EDM include(s): // Note that these are type defs, so we must include headers here +#include "xAODEventInfo/EventInfo.h" #include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" #include "xAODMuon/Muon.h" @@ -217,6 +218,11 @@ namespace ST { virtual bool isData() const = 0; virtual bool isAtlfast() const = 0; + // method to access properties of the tool + template<typename T> const T* getProperty(const std::string& name) { + return dynamic_cast<asg::AsgTool&>(*this).getProperty<T>(name); + } + // override the AsgTool setProperty function for booleans virtual StatusCode setBoolProperty(const std::string& name, const bool& property) = 0; @@ -230,8 +236,6 @@ namespace ST { virtual const xAOD::Vertex* GetPrimVtx() const = 0; - virtual StatusCode BendBTaggingLinks(xAOD::JetContainer* , const std::string& bTagKey) const = 0; - virtual StatusCode SetBtagWeightDecorations(const xAOD::Jet& input, const asg::AnaToolHandle<IBTaggingSelectionTool>& btagSelTool, const std::string& btagTagger) const = 0; virtual StatusCode GetJets(xAOD::JetContainer*& copy,xAOD::ShallowAuxContainer*& copyaux,const bool recordSG=true, const std::string& jetkey="", const xAOD::JetContainer* containerToBeCopied = nullptr) = 0; virtual StatusCode GetTrackJets(xAOD::JetContainer*& copy,xAOD::ShallowAuxContainer*& copyaux,const bool recordSG=true, const std::string& jetkey="", const xAOD::JetContainer* containerToBeCopied = nullptr) = 0; virtual StatusCode GetJetsSyst(const xAOD::JetContainer& calibjets,xAOD::JetContainer*& copy,xAOD::ShallowAuxContainer*& copyaux, const bool recordSG=true, const std::string& jetkey="") = 0; @@ -264,6 +268,7 @@ namespace ST { virtual StatusCode MergeElectrons(const xAOD::ElectronContainer & electrons, xAOD::ElectronContainer* outputCol, const std::set<const xAOD::Electron *> &ElectronsToRemove) const = 0; + virtual StatusCode SetBtagWeightDecorations(const xAOD::Jet& input, const asg::AnaToolHandle<IBTaggingSelectionTool>& btagSelTool, const std::string& btagTagger) const = 0; virtual bool IsPFlowCrackVetoCleaning(const xAOD::ElectronContainer* elec = nullptr, const xAOD::PhotonContainer* gamma = nullptr) const = 0; virtual bool IsSignalJet(const xAOD::Jet& input, const float ptcut, const float etacut) const = 0; @@ -393,6 +398,8 @@ namespace ST { virtual const Trig::ChainGroup* GetTrigChainGroup(const std::string&) const = 0; + virtual const xAOD::EventInfo* GetEventInfo() const = 0; + virtual float GetPileupWeight() = 0; virtual float GetPileupWeightPrescaledTrigger(const std::string & trigger_expr) = 0; diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYCrossSection.h b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYCrossSection.h index d05de9c7652744d7990d96c9525840efcd523974..c0e727aa8cf549cdd19c5e8baa082fc03ff365da 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYCrossSection.h +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYCrossSection.h @@ -67,16 +67,16 @@ public: }; class Key { - int sample_id; - int proc_id; + int m_sample_id; + int m_proc_id; public: - Key(): sample_id(0), proc_id(0) {} - Key(int _sample_id, int _proc_id): sample_id(_sample_id), proc_id(_proc_id) {} - Key(int _sample_id, std::string name): sample_id(_sample_id) { - proc_id = atoi(name.c_str()); + Key(): m_sample_id(0), m_proc_id(0) {} + Key(int _sample_id, int _proc_id): m_sample_id(_sample_id), m_proc_id(_proc_id) {} + Key(int _sample_id, std::string name): m_sample_id(_sample_id) { + m_proc_id = atoi(name.c_str()); } bool operator<(const Key & k) const { - return this->sample_id < k.sample_id || (this->sample_id == k.sample_id && this->proc_id < k.proc_id); + return this->m_sample_id < k.m_sample_id || (this->m_sample_id == k.m_sample_id && this->m_proc_id < k.m_proc_id); } }; diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYObjDef_xAOD.h b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYObjDef_xAOD.h index 5e33a812b5f7bcfcb40189a1b0086ad19e4b5add..762ffd5148443b83e316cee658b9cb82c68df2dd 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYObjDef_xAOD.h +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYObjDef_xAOD.h @@ -158,8 +158,6 @@ namespace ST { const xAOD::Vertex* GetPrimVtx() const override final; - StatusCode BendBTaggingLinks(xAOD::JetContainer* to_container , const std::string& bTagKey) const override final; - StatusCode SetBtagWeightDecorations(const xAOD::Jet& input, const asg::AnaToolHandle<IBTaggingSelectionTool>& btagSelTool, const std::string& btagTagger) const override final; StatusCode GetJets(xAOD::JetContainer*& copy, xAOD::ShallowAuxContainer*& copyaux, const bool recordSG = true, const std::string& jetkey = "", const xAOD::JetContainer* containerToBeCopied = nullptr) override final; StatusCode GetTrackJets(xAOD::JetContainer*& copy, xAOD::ShallowAuxContainer*& copyaux, const bool recordSG = true, const std::string& jetkey = "", const xAOD::JetContainer* containerToBeCopied = nullptr) override final; StatusCode GetJetsSyst(const xAOD::JetContainer& calibjets, xAOD::JetContainer*& copy, xAOD::ShallowAuxContainer*& copyaux, const bool recordSG = true, const std::string& jetkey = "") override final; @@ -199,6 +197,7 @@ namespace ST { const xAOD::ElectronContainer* lrt_electrons = nullptr; mutable xAOD::Electron* newElectron = nullptr; + StatusCode SetBtagWeightDecorations(const xAOD::Jet& input, const asg::AnaToolHandle<IBTaggingSelectionTool>& btagSelTool, const std::string& btagTagger) const override final; bool IsPFlowCrackVetoCleaning(const xAOD::ElectronContainer* elec = nullptr, const xAOD::PhotonContainer* gamma = nullptr) const override final; bool IsSignalJet(const xAOD::Jet& input, const float ptcut, const float etacut) const override final; @@ -336,9 +335,11 @@ namespace ST { float GetTrigPrescale(const std::string&) const override final; const Trig::ChainGroup* GetTrigChainGroup(const std::string&) const override final; std::vector<std::string> GetTriggerOR(const std::string& trigExpr) const; - void GetTriggerTokens(std::string, std::vector<std::string>& , std::vector<std::string>& , std::vector<std::string>& , std::vector<std::string>& ) const; + void GetTriggerTokens(std::string, std::vector<std::string>& , std::vector<std::string>& , std::vector<std::string>& , std::vector<std::string>& ,std::vector<std::string>& ) const; Trig::FeatureContainer GetTriggerFeatures(const std::string& chainName = "EF_.*", unsigned int condition = TrigDefs::Physics) const; + const xAOD::EventInfo* GetEventInfo() const override final; + float GetPileupWeight() override final; float GetPileupWeightPrescaledTrigger(const std::string & trigger_expr) override final; @@ -421,26 +422,33 @@ namespace ST { mutable std::map<std::string, std::function<bool()>> m_metTriggerFuncs; // Store whether the trigger was in the TDT mutable std::map<std::string, bool> m_checkedTriggers; - bool m_emulateHLT(const std::string& triggerName) const; - bool m_isTrigInTDT(const std::string& triggerName) const; + bool emulateHLT(const std::string& triggerName) const; + bool isTrigInTDT(const std::string& triggerName) const; //book trigger chains for matching - std::vector<std::string> v_trigs15_cache_singleEle; - std::vector<std::string> v_trigs16_cache_singleEle; - std::vector<std::string> v_trigs17_cache_singleEle; - std::vector<std::string> v_trigs18_cache_singleEle; - std::vector<std::string> v_trigs15_cache_singleLep; - std::vector<std::string> v_trigs16_cache_singleLep; - std::vector<std::string> v_trigs17_cache_singleLep; - std::vector<std::string> v_trigs18_cache_singleLep; - std::vector<std::string> v_trigs15_cache_diLep; - std::vector<std::string> v_trigs16_cache_diLep; - std::vector<std::string> v_trigs17_cache_diLep; - std::vector<std::string> v_trigs18_cache_diLep; - std::vector<std::string> v_trigs15_cache_multiLep; - std::vector<std::string> v_trigs16_cache_multiLep; - std::vector<std::string> v_trigs17_cache_multiLep; - std::vector<std::string> v_trigs18_cache_multiLep; + std::vector<std::string> m_v_trigs15_cache_singleEle; + std::vector<std::string> m_v_trigs16_cache_singleEle; + std::vector<std::string> m_v_trigs17_cache_singleEle; + std::vector<std::string> m_v_trigs18_cache_singleEle; + std::vector<std::string> m_v_trigs22_cache_singleEle; + + std::vector<std::string> m_v_trigs15_cache_singleLep; + std::vector<std::string> m_v_trigs16_cache_singleLep; + std::vector<std::string> m_v_trigs17_cache_singleLep; + std::vector<std::string> m_v_trigs18_cache_singleLep; + std::vector<std::string> m_v_trigs22_cache_singleLep; + + std::vector<std::string> m_v_trigs15_cache_diLep; + std::vector<std::string> m_v_trigs16_cache_diLep; + std::vector<std::string> m_v_trigs17_cache_diLep; + std::vector<std::string> m_v_trigs18_cache_diLep; + std::vector<std::string> m_v_trigs22_cache_diLep; + + std::vector<std::string> m_v_trigs15_cache_multiLep; + std::vector<std::string> m_v_trigs16_cache_multiLep; + std::vector<std::string> m_v_trigs17_cache_multiLep; + std::vector<std::string> m_v_trigs18_cache_multiLep; + std::vector<std::string> m_v_trigs22_cache_multiLep; protected: @@ -549,7 +557,6 @@ namespace ST { std::string m_autoconfigPRWFile; bool m_autoconfigPRWCombinedmode; bool m_autoconfigPRWRPVmode; - std::string m_autoconfigPRWHFFilter; std::string m_autoconfigPRWRtags; std::string m_mcCampaign; int m_mcChannel; @@ -558,6 +565,7 @@ namespace ST { std::vector<std::string> m_prwLcalcFiles; std::string m_prwActualMu2017File; std::string m_prwActualMu2018File; + std::string m_prwActualMu2022File; double m_prwDataSF; double m_prwDataSF_UP; @@ -597,7 +605,7 @@ namespace ST { std::string m_eleIsoHighPt_WP; double m_eleIsoHighPtThresh; std::string m_eleChID_WP; - bool m_eleLRT; + bool m_eleLRT; int m_eleLRT_strat; bool m_eleChIso; // use Charge ID SF with/without Iso applied bool m_eleChID_signal; // allows to run ECID but remove it from signal definition @@ -632,6 +640,7 @@ namespace ST { double m_elebaselined0sig; double m_elebaselinez0; std::string m_eleEffMapFilePath; + std::string m_eleEffMapFilePathRun2; double m_muBaselinePt; double m_muBaselineEta; @@ -646,7 +655,7 @@ namespace ST { double m_muCosmicd0; double m_badmuQoverP; int m_muCalibrationMode; - bool m_muLRT; + bool m_muLRT; double m_photonBaselinePt; double m_photonBaselineEta; @@ -860,21 +869,32 @@ namespace ST { std::string m_trig2016combination_singleLep; std::string m_trig2017combination_singleLep; std::string m_trig2018combination_singleLep; + std::string m_trig2022combination_singleLep; + // + int m_trigNToys_diLep; std::string m_trig2015combination_diLep; std::string m_trig2016combination_diLep; std::string m_trig2017combination_diLep; std::string m_trig2018combination_diLep; + std::string m_trig2022combination_diLep; asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> m_trigGlobalEffCorrTool_diLep; + // + int m_trigNToys_multiLep; std::string m_trig2015combination_multiLep; std::string m_trig2016combination_multiLep; std::string m_trig2017combination_multiLep; std::string m_trig2018combination_multiLep; + std::string m_trig2022combination_multiLep; asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> m_trigGlobalEffCorrTool_multiLep; + // + int m_trigNToys_diPhoton; std::string m_trig2015combination_diPhoton; std::string m_trig2016combination_diPhoton; std::string m_trig2017combination_diPhoton; std::string m_trig2018combination_diPhoton; + std::string m_trig2022combination_diPhoton; asg::AnaToolHandle<ITrigGlobalEfficiencyCorrectionTool> m_trigGlobalEffCorrTool_diPhoton; + // asg::AnaToolHandle<TrigConf::ITrigConfigTool> m_trigConfTool; asg::AnaToolHandle<Trig::TrigDecisionTool> m_trigDecTool; asg::AnaToolHandle<Trig::IMatchingTool> m_trigMatchingTool; diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYToolsDict.h b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYToolsDict.h index a8f6a610ab7572bd0c0f4ed4e33f9c0598bc092f..1a23b106bbff4fe04c897d33cec2ee3ade0f36c3 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYToolsDict.h +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/SUSYTools/SUSYToolsDict.h @@ -7,5 +7,11 @@ #include "SUSYTools/SUSYObjDef_xAOD.h" #include "SUSYTools/SUSYCrossSection.h" + +// AthAnalysis doesn't need dictionaries building for components (such as algorithms) +// So only do this overhead for AnalysisBase +#ifdef XAOD_STANDALONE #include "src/SUSYToolsAlg.h" +#endif + #endif // not SUSYTOOLS_SUSYTOOLSDICT_H diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default.conf b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default.conf index 6251f4b73809c4de6f1058d5ca13b5f2557a5fec..37a5a04abb7a57641ffb21d9bbfe685fe47de834 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default.conf +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default.conf @@ -34,7 +34,7 @@ Ele.LRTOR: false # MuonBaseline.Pt: 10000. MuonBaseline.Eta: 2.7 -MuonBaseline.Id: 1 # Medium +MuonBaseline.Id: 1 # Medium MuonBaseline.z0: 0.5 # Muon.Pt: 10000. @@ -46,7 +46,7 @@ Muon.d0sig: 3. Muon.z0: 0.5 # Muon.LRTOR: false -# +# MuonCosmic.z0: 1. MuonCosmic.d0: 0.2 # @@ -72,16 +72,16 @@ TauBaseline.ConfigPath: default # default: default # Jet.Pt: 20000. Jet.Eta: 2.8 -Jet.InputType: 9 # EMTopo 1, PFlow: 9. PFlow is new recommended for everything. +Jet.InputType: 9 # EMTopo 1, PFlow: 9. PFlow is new recommended for everything. Jet.UncertConfig: rel22/Winter2023_PreRec/R4_CategoryReduction_FullJER.config # This is the uncertainty for analyses going to perform combinations. Otherwise rel21/Summer2019/R4_SR_Scenario1_SimpleJER.conf can be used if insensitive to JES. If you are wanting to do the fullJER (with PDSmear) please use : rel21/Summer2019/R4_CategoryReduction_FullJER.config and PDSmearing below set to true). Jet.JvtWP: FixedEffPt # choose between FixedEffPt (Default) and TightFwd Jet.JvtPtMax: 60.0e3 -Jet.JMSCalib: false -#Jet.AnalysisFile: -Jet.UncertPDsmearing: false # set this to true for pseudo-data smearing for FullJER if using the FullJER or AllJER. This will produce two version of the JET_JER systematics (differing with __1 for the non-PDSmear systematic, and __2 for the PDSmear systematic). This should be false if using SimpleJER (SUSYTools will report an error message) +Jet.JMSCalib: false +#Jet.AnalysisFile: +Jet.UncertPDsmearing: false # set this to true for pseudo-data smearing for FullJER if using the FullJER or AllJER. This will produce two version of the JET_JER systematics (differing with __1 for the non-PDSmear systematic, and __2 for the PDSmear systematic). This should be false if using SimpleJER (SUSYTools will report an error message) # FwdJet.doJVT: false -FwdJet.JvtEtaMin: 2.5 +FwdJet.JvtEtaMin: 2.5 FwdJet.JvtWP: Loose # R22 prerec FwdJet.JvtPtMax: 60.0e3 # @@ -134,10 +134,10 @@ OR.DoMuonJetGhostAssociation: true OR.DoTau: false OR.DoPhoton: false OR.Bjet: false -OR.ElBjet: false +OR.ElBjet: false OR.ElEl: false OR.ElMu: false -OR.MuBjet: false +OR.MuBjet: false OR.TauBjet: false OR.MuJetApplyRelPt: false OR.MuJetPtRatio: -999. @@ -160,7 +160,7 @@ MET.JetTerm: RefJet MET.MuonTerm: Muons MET.OutputTerm: Final MET.JetSelection: Tight # Loose, Tight, Tighter, Tenacious -MET.RemoveOverlappingCaloTaggedMuons: true +MET.RemoveOverlappingCaloTaggedMuons: true MET.DoRemoveMuonJets: true MET.UseGhostMuons: false MET.DoMuonEloss: false @@ -180,8 +180,5 @@ Ele.TriggerSFStringSingle: SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_O # actual Mu files have to be set in SUSYTools PRW.ActualMu2017File: GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root PRW.ActualMu2018File: GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root -# default to None but do set to BFilter (366010-366017), CFilterBVeto (366019-366026), or CVetoBVeto (366028-366035) to remap MC16e Znunu dsid -PRW.autoconfigPRWHFFilter: None -PRW.autoconfigPRWRtags:mc16a:r9364_r11505_r11285,mc16c:r9781,mc16d:r10201_r11506_r11279,mc16e:r10724_r11507_r11249_r12020_r12034_r12405_r12627,mc20a:r13167,mc20d:r13144,mc20e:r13145,mc21a:r13752_r13829,mc16ans:r10740_r10832_r10847_r11008_r11036,mc16dns:r10739_r10833_r10848_r11009_r11037,mc16ens:r10790_r11038_r11265 # StrictConfigCheck: true diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_LITE.conf b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_LITE.conf index 342c61bb65b294219cb2005619af4c20c4c41fc3..44dcddc6d427b4fdaa979bff4a31716cd64ca646 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_LITE.conf +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_LITE.conf @@ -22,7 +22,7 @@ EleBaseline.z0: 0.5 Ele.Et: 10000. Ele.Eta: 2.47 Ele.CrackVeto: false -Ele.Iso: Loose_VarRad #(PflowLoose_VarRad for p5511 not working) +Ele.Iso: Loose_VarRad Ele.IsoHighPt: HighPtCaloOnly # tight iso required for electrons pt > 200 GeV Ele.Id: TightLLH Ele.d0sig: 5. @@ -40,8 +40,8 @@ MuonBaseline.z0: 0.5 Muon.Pt: 10000. Muon.Eta: 2.7 Muon.Id: 1 # Medium -Muon.Iso: Loose_VarRad -Muon.IsoHighPt: Loose_VarRad # change WP if you want +Muon.Iso: PflowLoose_VarRad +Muon.IsoHighPt: PflowLoose_VarRad # change WP if you want Muon.d0sig: 3. Muon.z0: 0.5 # @@ -180,8 +180,5 @@ Ele.TriggerSFStringSingle: SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_O # actual Mu files have to be set in SUSYTools PRW.ActualMu2017File: GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root PRW.ActualMu2018File: GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root -# default to None but do set to BFilter (366010-366017), CFilterBVeto (366019-366026), or CVetoBVeto (366028-366035) to remap MC16e Znunu dsid -PRW.autoconfigPRWHFFilter: None -PRW.autoconfigPRWRtags:mc16a:r9364_r11505_r11285,mc16c:r9781,mc16d:r10201_r11506_r11279,mc16e:r10724_r11507_r11249_r12020_r12034_r12405_r12627,mc20a:r13167,mc20d:r13144,mc20e:r13145,mc21a:r13752_r13829,mc16ans:r10740_r10832_r10847_r11008_r11036,mc16dns:r10739_r10833_r10848_r11009_r11037,mc16ens:r10790_r11038_r11265 # StrictConfigCheck: true diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3.conf b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3.conf index 418017489cf8412e181eeca0da83bfaaed922040..0545acf74db89883e05edc97df64b0d11e73d884 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3.conf +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3.conf @@ -22,8 +22,8 @@ EleBaseline.z0: 0.5 Ele.Et: 10000. Ele.Eta: 2.47 Ele.CrackVeto: false -Ele.Iso: Loose_VarRad -Ele.IsoHighPt: HighPtCaloOnly # tight iso required for electrons pt > 200 GeV +Ele.Iso: Tight_VarRad +Ele.IsoHighPt: Tight_VarRad # tight iso required for electrons pt > 200 GeV Ele.Id: TightLLH Ele.d0sig: 5. Ele.z0: 0.5 @@ -174,14 +174,9 @@ Trigger.UpstreamMatching: false Trigger.MatchingPrefix: TrigMatch_ # # Trigger SFs configuration -Ele.TriggerSFStringSingle: SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 -#Ele.TriggerSFStringSingle: +Ele.TriggerSFStringSingle: 2022_e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI # # actual Mu files have to be set in SUSYTools -PRW.ActualMu2017File: GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root -PRW.ActualMu2018File: GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root -# default to None but do set to BFilter (366010-366017), CFilterBVeto (366019-366026), or CVetoBVeto (366028-366035) to remap MC16e Znunu dsid -PRW.autoconfigPRWHFFilter: None -PRW.autoconfigPRWRtags:mc16a:r9364_r11505_r11285,mc16c:r9781,mc16d:r10201_r11506_r11279,mc16e:r10724_r11507_r11249_r12020_r12034_r12405_r12627,mc20a:r13167,mc20d:r13144,mc20e:r13145,mc21a:r13752_r13829,mc16ans:r10740_r10832_r10847_r11008_r11036,mc16dns:r10739_r10833_r10848_r11009_r11037,mc16ens:r10790_r11038_r11265 +PRW.ActualMu2022File: GoodRunsLists/data22_13p6TeV/20230207/purw.actualMu.2022.root # StrictConfigCheck: true diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3_LITE.conf b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3_LITE.conf index ee5e3d0367c15891d5992a90f21e78f91bccf99b..60c064b32672c748f980035a080fba2aac10fb50 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3_LITE.conf +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/data/SUSYTools_Default_Run3_LITE.conf @@ -22,8 +22,8 @@ EleBaseline.z0: 0.5 Ele.Et: 10000. Ele.Eta: 2.47 Ele.CrackVeto: false -Ele.Iso: Loose_VarRad #(PflowLoose_VarRad for p5511 not working) -Ele.IsoHighPt: HighPtCaloOnly # tight iso required for electrons pt > 200 GeV +Ele.Iso: Tight_VarRad +Ele.IsoHighPt: Tight_VarRad # tight iso required for electrons pt > 200 GeV Ele.Id: TightLLH Ele.d0sig: 5. Ele.z0: 0.5 @@ -41,8 +41,8 @@ MuonBaseline.z0: 0.5 Muon.Pt: 10000. Muon.Eta: 2.7 Muon.Id: 1 # Medium -Muon.Iso: Loose_VarRad -Muon.IsoHighPt: Loose_VarRad # change WP if you want +Muon.Iso: PflowLoose_VarRad +Muon.IsoHighPt: PflowLoose_VarRad # change WP if you want Muon.d0sig: 3. Muon.z0: 0.5 # @@ -174,14 +174,9 @@ Trigger.UpstreamMatching: false Trigger.MatchingPrefix: AnalysisTrigMatch_ # # Trigger SFs configuration -Ele.TriggerSFStringSingle: SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 -#Ele.TriggerSFStringSingle: +Ele.TriggerSFStringSingle: 2022_e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI # # actual Mu files have to be set in SUSYTools -PRW.ActualMu2017File: GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root -PRW.ActualMu2018File: GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root -# default to None but do set to BFilter (366010-366017), CFilterBVeto (366019-366026), or CVetoBVeto (366028-366035) to remap MC16e Znunu dsid -PRW.autoconfigPRWHFFilter: None -PRW.autoconfigPRWRtags:mc16a:r9364_r11505_r11285,mc16c:r9781,mc16d:r10201_r11506_r11279,mc16e:r10724_r11507_r11249_r12020_r12034_r12405_r12627,mc20a:r13167,mc20d:r13144,mc20e:r13145,mc21a:r13752_r13829,mc16ans:r10740_r10832_r10847_r11008_r11036,mc16dns:r10739_r10833_r10848_r11009_r11037,mc16ens:r10790_r11038_r11265 +PRW.ActualMu2022File: GoodRunsLists/data22_13p6TeV/20230207/purw.actualMu.2022.root # StrictConfigCheck: true diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/scripts/TestSUSYToolsAlg.py b/PhysicsAnalysis/SUSYPhys/SUSYTools/scripts/TestSUSYToolsAlg.py index 49ee2ff9035a59e278d6c66d7e5ab36abfa2018d..c3f6c2e7f1d581c55d9e8cac1d78207dde9df902 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/scripts/TestSUSYToolsAlg.py +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/scripts/TestSUSYToolsAlg.py @@ -21,10 +21,10 @@ parser.add_option('--log-level', dest = 'log_level', default = 'INFO', choices = parser.add_option('--dosyst', dest = 'dosyst', default = False, action = 'store_true') parser.add_option( '-s', '--submission-dir', dest = 'submission_dir', default = 'submitDir', help = 'Submission directory for EventLoop' ) parser.add_option('-t', '--type', dest = 'type', default = 'mc20e', help = 'Job type. (mc20a, mc20d, mc20e, mc21a, data18, data22)', choices = ['mc20a', 'mc20d', 'mc20e', 'mc21a', 'data18', 'data22']) -parser.add_option('--AFII', dest = 'AFII', default = False, action = 'store_true' ) +parser.add_option('--AF', dest = 'AF', default = False, action = 'store_true' ) parser.add_option('-d', '--daod', dest = 'daod', type = 'int', default = 0, help = 'input DAOD type. Do not specify for xAOD input' ) -parser.add_option('-f', '--flav', dest = 'flav', default = 'PHYSVAL', help = 'input DAOD flavour' ) -parser.add_option('-m', '--maxEvts', dest = 'maxEvts', type = 'int', default = 500, help = 'Max events (-1 is all)' ) +parser.add_option('-f', '--flav', dest = 'flav', default = 'PHYS', help = 'input DAOD flavour' ) +parser.add_option('-m', '--maxEvts', dest = 'maxEvts', type = 'int', default = -1, help = 'Max events (-1 is all)' ) parser.add_option('-M', '--maxEvtsManual', dest = 'maxEvtsManual', type = 'int') parser.add_option('-p', '--ptag', dest = 'ptag', default = 'p5226', help = 'ptag' ) parser.add_option('--grl', dest = 'grl') @@ -35,13 +35,13 @@ parser.add_option('--inputXRD', dest = 'inputXRD') parser.add_option('--overwrite', dest = 'overwrite', default = False, action = 'store_true' ) ( options, args ) = parser.parse_args() print("Configured input data ptag: %s"%(options.ptag)) -ptageqdata = {'p5226':'p5226','p5278':'p5267'} -if 'data' in options.type and options.ptag in ptageqdata: +ptageqdata = {'p5511':'p5514','p5631':'p5632'} +if 'data22' in options.type and options.ptag in ptageqdata: options.ptag = ptageqdata[options.ptag] print("Overriding ptag to equivalent data ptag: -> %s"%(options.ptag)) print("Configured input data type: %s"%(options.type)) print("Configured input data DAOD flavour: %s"%('SUSY%d'%options.daod if options.daod>0 else options.flav)) -print("Configured input data sim type: %s"%('FullSim' if not options.AFII else 'AFII')) +print("Configured input data sim type: %s"%('FullSim' if not options.AF else 'AF')) # Set up (Py)ROOT. import ROOT @@ -65,13 +65,11 @@ cvmfsInputArea = [ '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/ARTInput/', ] inputFiles = {} -inputFiles['mc20a'] = 'DAOD_mc20aPHYS.%s.art.merge.root'%(options.ptag) -inputFiles['mc20d'] = 'DAOD_mc20dPHYS.%s.art.merge.root'%(options.ptag) -inputFiles['mc20e'] = 'DAOD_PHYS.mc20_13TeV.410470.FS_mc20e_%s.PHYS.pool.root'%(options.ptag) -inputFiles['mc21a'] = 'DAOD_PHYS.mc21_13p6TeV.601229.FS_mc21a_%s.PHYS.pool.root'%(options.ptag) -inputFiles['data18'] = 'DAOD_PHYS.data18_13TeV.358031.data18_%s.PHYS.pool.root'%(options.ptag) -inputFiles['data22'] = 'DAOD_PHYS.data22_13p6TeV.430542.data22_%s.PHYS.pool.root'%(options.ptag) -if options.daod == 0 and not '%s%s'%(options.type,'_AFII' if options.AFII else '') in inputFiles: sys.exit('No input file configured for type %s%s. Exiting.'%(options.type,'_AFII' if options.AFII else '')) +inputFiles['mc20e'] = 'mc20_13TeV.410470.FS_mc20e_%s.%s.pool.root'%(options.ptag,options.flav) +inputFiles['mc21a'] = 'mc21_13p6TeV.601229.FS_mc21a_%s.%s.pool.root'%(options.ptag,options.flav) +inputFiles['data18'] = 'data18_13TeV.358031.data18_%s.%s.pool.root'%(options.ptag,options.flav) +inputFiles['data22'] = 'data22_13p6TeV.430542.data22_%s.%s.pool.root'%(options.ptag,options.flav) +if options.daod == 0 and not '%s%s'%(options.type,'_AF' if options.AF else '') in inputFiles: sys.exit('No input file configured for type %s%s. Exiting.'%(options.type,'_AF' if options.AF else '')) inputDir = '' inputFile = '' @@ -89,11 +87,11 @@ elif options.inputGrid: else: if options.daod == 0 and not options.flav=='PHYS': inputDir = cvmfsInputArea[0] - ifile = options.type + ('_AFII' if options.AFII else '') + ifile = options.type + ('_AF' if options.AF else '') inputFile = inputFiles[ifile] if ifile in inputFiles else '' else: inputDir = cvmfsInputArea[1] - inputFile = 'DAOD_%s%s%s.%s.art.merge.root'%(options.type,'%s%d'%(options.flav,options.daod) if options.flav=='SUSY' else options.flav,'AFII' if options.AFII else '',options.ptag) + inputFile = 'DAOD_%s%s%s.%s.art.merge.root'%(options.type,'%s%d'%(options.flav,options.daod) if options.flav=='SUSY' else options.flav,'AF' if options.AF else '',options.ptag) if options.inputDir: inputDir = options.inputDir if options.inputFile: inputFile = options.inputFile @@ -112,36 +110,39 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, options.maxEvts ) # algorithm property settings here later on. from AnaAlgorithm.AnaAlgorithmConfig import AnaAlgorithmConfig config = AnaAlgorithmConfig( 'SUSYToolsAlg' ) +config.addPrivateTool("SUSYTools","ST::SUSYObjDef_xAOD") -config.STConfigFile = "SUSYTools/SUSYTools_Default.conf" -if (options.type == "data22" or "mc21" in options.type): config.STConfigFile = "SUSYTools/SUSYTools_Default_Run3.conf" - +config.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default.conf" +if (options.type == "data22" or "mc21" in options.type): config.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default_Run3.conf" config.DoSyst = options.dosyst -config.DataSource = 1 +config.SUSYTools.DataSource = 1 config.OutputLevel = outputlvl[options.log_level] -config.PRWLumiCalc = [] -config.UsePRWAutoconfig = True +config.SUSYTools.PRWLumiCalcFiles = [] +config.SUSYTools.AutoconfigurePRWTool = True if options.flav == "PHYSLITE": print("Running on PHYSLITE : ", inputFile) - config.isPHYSLITE = True - STconfig_lite = str(config.STConfigFile).replace(".conf","_LITE.conf") - config.STConfigFile = STconfig_lite + STconfig_lite = str(config.SUSYTools.ConfigFile).replace(".conf","_LITE.conf") + config.SUSYTools.ConfigFile = STconfig_lite + config.SUSYTools.IsPHYSLITE = True if options.type != 'data18' : - config.mcChannel = 410470 + mcChannel = 410470 -# set datasource if AtlasFastII -if options.AFII: - config.DataSource = 2 +# set datasource if AtlasFastII or 3 +if options.AF: + config.SUSYTools.DataSource = 2 # set mcCampaign if 'mc' in options.type: - config.mcCampaign = options.type + mcCampaign = options.type + config.SUSYTools.mcCampaign = options.type elif options.type == 'data18': - config.mcCampaign = 'mc20e' - config.DataSource = 0 + mcCampaign = 'mc20e' + config.SUSYTools.mcCampaign = options.type + config.SUSYTools.DataSource = 0 elif options.type == 'data22': - config.mcCampaign = 'mc21a' - config.DataSource = 0 + mcCampaign = 'mc21a' + config.SUSYTools.mcCampaign = options.type + config.SUSYTools.DataSource = 0 # set lumicalc info PRWLumiCalc = {} @@ -151,7 +152,7 @@ PRWLumiCalc['mc20d'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRun PRWLumiCalc['mc20e'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root'] PRWLumiCalc['mc21a'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/20220820/ilumicalc_histograms_None_427882-428855_OflLumi-Run3-001.root'] -config.PRWLumiCalc = PRWLumiCalc[config.mcCampaign] +config.SUSYTools.PRWLumiCalcFiles = PRWLumiCalc[mcCampaign] if options.grl: config.GRLFiles = options.grl.split(',') if options.maxEvtsManual: config.maxEvts = options.maxEvtsManual diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/applyST.py b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/applyST.py deleted file mode 100644 index a772fb1be44e68baed8afcb470d573d62587258e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/applyST.py +++ /dev/null @@ -1,605 +0,0 @@ -############################### -# jobOptions for ApplySUSYTools -############################### - -import AthenaPoolCnvSvc.ReadAthenaPool - -################ -# Job Parameters -################ - -# Event number -EVTMAX = 1000 - -# Output file name -#xAODFileName = "DAOD_AST.test.pool.root" -#xAODFileName = "DAOD_AST.stop1_jul20.pool.root" -xAODFileName = "DAOD_AST.topaod_jul20.pool.root" - -# Input dataset -# SZ - MIND that if you change this, you should also change accordingly the hard-coded "dataSource = 1" in line 73 -svcMgr.EventSelector.InputCollections= [os.environ['ASG_TEST_FILE_MC']] - - -from glob import glob -#inputDir = "/usatlas/groups/bnl_local2/paige/SUSY1/mc15_13TeV.387200.MadGraphPythia8EvtGen_A14NNPDF23LO_TT_directTT_800_100.merge.DAOD_SUSY1.e3969_s2608_r7772_r7676_p2666" -#inputDir = "/usatlas/groups/bnl_local2/paige/AOD/mc15_13TeV.387198.MadGraphPythia8EvtGen_A14NNPDF23LO_TT_directTT_800_1.merge.AOD.e3969_a766_a821_r7676" -#inputAOD = "%s/*.pool.root*" % inputDir -#svcMgr.EventSelector.InputCollections = glob(inputAOD) - -svcMgr.MessageSvc.defaultLimit = 9999999 -#svcMgr.MessageSvc.Format = "% F%18W%S%7W%R%T %0W%M" -svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" - -# Truth type: -# 1: MenuTruthThinning with PreserveAncestors (c.f. SUSY1) -# 2: TruthHard with reclustered parton shower (c.f. TRUTH2) -doTruth = 1 - - -################# -# Sample metadata -################# - -# See https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/AthAnalysisBase -from PyUtils import AthFile -af = AthFile.fopen(svcMgr.EventSelector.InputCollections[0]) -af.fileinfos #this is a dict of dicts -isMC = 'IS_SIMULATION' in af.fileinfos['evt_type'] -beam_energy = af.fileinfos['beam_energy'] -conditions_tag = af.fileinfos['conditions_tag'] -if isMC: - isFullSim = af.fileinfos['metadata']['/Simulation/Parameters']['SimulationFlavour']=='default' - -# isData = 0: data in ApplySUSYTools -# = 1: MC in ApplySUSYTools -# dataSource = 0: data in ST__SUSYObjDef_xAOD -# dataSource = 1: fullsim in ST__SUSYObjDef_xAOD -# dataSource = 2: AtlFastII in ST__SUSYObjDef_xAOD - -if isMC: - isData = 0 - if isFullSim: - dataSource = 1 - else: - dataSource = 2 -else: - isData = 1 - dataSource = 0 - -# SZ - UNFORTUNATELY METADATA IS BROKEN IN R21 :-( -# UUNCOMMENT BELOW TO HARD-CODE 'dataSource' TO FULLSIM MC -# SINCE ANYWAY WE'RE RUNNING OVER 'ASG_TEST_FILE_MC' -#dataSource = 1 - -############### -# Configure job -############### - -# List of containers to convert to AuxContainerBase with AuxDyn variables. -# Change list if you change ApplySUSYTools inputs. - -auxList = ["PrimaryVerticesAux.", "AntiKt4EMTopoJetsAux.", "ElectronsAux.", - "MuonsAux.", "BTagging_AntiKt4EMTopoAux.", "AntiKt4TruthJetsAux.", - "InDetTrackParticlesAux.", "GSFTrackParticlesAux.", - "MuonSpectrometerTrackParticlesAux.", "MET_TrackAux.", "TauJetsAux.", - "PhotonsAux.", "GSFConversionVerticesAux."] - -# Get the configuration manager -from AthenaCommon import CfgMgr - -# Get a handle to the main athsequencer, for adding things to later! -AST99Job = CfgMgr.AthSequencer("AthAlgSeq") - -# Add a tool for thinning derivations -AST99Job += CfgMgr.xAODMaker__AuxStoreWrapper("AST99AuxStoreWrapperAlg", - SGKeys = auxList, - OutputLevel = INFO) - -################################### -# Create Output Stream and Thinning -################################### - -from OutputStreamAthenaPool.MultipleStreamManager import MSMgr -xAODStreamName = "AST99Stream" -AST99Stream = MSMgr.NewPoolRootStream( xAODStreamName, xAODFileName ) - -from AthenaServices.Configurables import ThinningSvc -svcMgr += ThinningSvc("AST99ThinningSvc", - Streams = [xAODStreamName], - OutputLevel = INFO) - -thinningTools = [] -skimmingTools = [] - -######################################### -# Configure SUSYTools and object thinning -######################################### - -# Initial SUSYObjDef_xAOD -# PRWConfigFiles and PRWLumiCalcFiles from minimalExampleJobOptions_mc.py -AST99ObjDef = CfgMgr.ST__SUSYObjDef_xAOD("AST99ObjDef", - DataSource = dataSource, - ConfigFile = "SUSYTools/SUSYTools_Default.conf", - PRWConfigFiles = [ - "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root"], - PRWLumiCalcFiles = ["/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ilumicalc_histograms_None_276262-284154_IBLOFF.root"], - OutputLevel = WARNING) -ToolSvc += AST99ObjDef - -# For tau CP tools need to run TauTruthMatchingTool. Should be provided -# by most derivations but NOT in xAOD. -# Can avoid by using SkipTruthMatchCheck = True. - -### Not needed for 2.4? -AST99tauTruthTool = CfgMgr.TauAnalysisTools__TauTruthMatchingTool( - name = "AST99TauTruthMatchingTool", - WriteTruthTaus = True, - OutputLevel = INFO) -ToolSvc += AST99tauTruthTool - -# SZ - commenting BuildTruthTaus out, after having discussed this with David Kirchmeier: -# TauTruthMatchingTool inherits from it and can be used instead -# -#AST99tauBuildTruthTaus = CfgMgr.tauRecTools__BuildTruthTaus( -# name = "AST99TauBuildTruthTaus", -# WriteTruthTaus = True, -# OutputLevel = INFO) -#ToolSvc += AST99tauBuildTruthTaus - -# Not until https://its.cern.ch/jira/browse/ATLASG-794 is solved -#tauSmearingTool = CfgMgr.TauAnalysisTools__TauSmearingTool("TauSmearingTool", -# SkipTruthMatchCheck = False, -# OutputLevel = INFO) -#ToolSvc += tauSmearingTool -#AST99ObjDef.TauSmearingTool = tauSmearingTool - -# Set up trigger tools to avoid multiple instances -# Both SUSYObjDef and CutTool for skimming need TrigDecisionTool - -configTool = CfgMgr.TrigConf__xAODConfigTool() -ToolSvc += configTool - -trigDecTool = CfgMgr.Trig__TrigDecisionTool("TrigDecisionTool", - ConfigTool = configTool, - TrigDecisionKey = "xTrigDecision") -ToolSvc += trigDecTool - -AST99ObjDef.TrigConfigTool = configTool -AST99ObjDef.TrigDecisionTool = trigDecTool - - -# Initialize ApplySUSYTools -# SUSYTools uses a 20GeV cut for "baseline"; JetsPtCut is in addition. -# Triggers are just typical examples - -applyST = CfgMgr.ST__ApplySUSYTools( - MuonsName = "Muons", - MuonSpecTracksName = "MuonSpectrometerTrackParticles", - ElectronsName = "Electrons", - JetsName = "AntiKt4EMTopoJets", -# No fat jets unless they are set in the config file - FatJetsName = "NONE", #"AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - BTaggingName = "BTagging_AntiKt4EMTopo", - TruthJetsName = "AntiKt4TruthJets", - METsName = "MET_Reference_AntiKt4EMTopo", - JetsPtCut = 20000., - InDetTracksName = "InDetTrackParticles", - InDetPtCut = 1000., - GSFTracksName = "GSFTrackParticles", - GSFVerticesName = "GSFConversionVertices", - ElectronTriggers = ["HLT_e60_medium", "HLT_2e12_loose1_L12EM10VH"], - MuonTriggers = ["HLT_mu24_imedium", "HLT_2mu10"], - TauJetsName = "TauJets", - PhotonsName = "Photons", - PhotonTriggers = ["HLT_g120_loose", "HLT_2g20_tight"], - DoTST = True, - IsData = isData, - MaxCount = 10, - SUSYTools = ToolSvc.AST99ObjDef, - TauTruthMatchingTool = AST99tauTruthTool, - #BuildTruthTaus = AST99tauBuildTruthTaus, - ThinningSvc = "AST99ThinningSvc", - OutputLevel = Lvl.INFO) -AST99Job += applyST - - -# Jets and systematics -if isMC: - jetsysnames = ["","Nominal", "JET_JER_SINGLE_NP__1up", "JET_GroupedNP_1__1up", "JET_GroupedNP_1__1down", "JET_GroupedNP_2__1up", "JET_GroupedNP_2__1down", "JET_GroupedNP_3__1up", "JET_GroupedNP_3__1down"] - if dataSource == 2: - jetsysnames += ["JET_RelativeNonClosure_AFII__1up", "JET_RelativeNonClosure_AFII__1down"] -else: - jetsysnames = ["","Nominal"] - -# Electrons and systematics -if isMC: - elsysnames = ["", "Nominal", "EG_RESOLUTION_ALL__1down", "EG_RESOLUTION_ALL__1up", "EG_SCALE_ALL__1down", "EG_SCALE_ALL__1up", "EL_EFF_ID_TotalCorrUncertainty__1down", "EL_EFF_ID_TotalCorrUncertainty__1up", "EL_EFF_Reco_TotalCorrUncertainty__1down", "EL_EFF_Reco_TotalCorrUncertainty__1up", "EL_EFF_Trigger_TotalCorrUncertainty__1down", "EL_EFF_Trigger_TotalCorrUncertainty__1up"] -else: - elsysnames = ["", "Nominal"] - -# Muons and systematics -# What muon TrackParticles are needed? -if isMC: - musysnames = ["","Nominal","MUONS_ID__1down", "MUONS_ID__1up", "MUONS_MS__1down", "MUONS_MS__1up", "MUONS_SCALE__1down", "MUONS_SCALE__1up", "MUON_EFF_STAT__1down", "MUON_EFF_STAT__1up", "MUON_EFF_TrigStatUncertainty__1down", "MUON_EFF_TrigStatUncertainty__1up", "MUON_EFF_TrigSystUncertainty__1down", "MUON_EFF_TrigSystUncertainty__1up", "MUON_ISO_STAT__1down", "MUON_ISO_STAT__1up", "MUON_ISO_SYS__1down", "MUON_ISO_SYS__1up"] -else: - musysnames = ["","Nominal"] - -# MET - keep full containers -# Default MET corresponds to "" in jetsysnames -if applyST.DoTST : - metkey = (applyST.METsName + "Trk") -else: - metkey = (applyST.METsName + "Clus") - -CSTsysnames = ["MET_SoftCalo_Reso", "MET_SoftCalo_ScaleDown", "MET_SoftCalo_ScaleUp"] -TSTsysnames = ["MET_SoftTrk_ResoPara", "MET_SoftTrk_ResoPerp", "MET_SoftTrk_ScaleDown", "MET_SoftTrk_ScaleUp"] - -# TauJets -if isMC: - tausysnames = ["", "Nominal", "TAUS_TRUEHADTAU_EFF_ELEOLR_TOTAL__1down", "TAUS_TRUEHADTAU_EFF_ELEOLR_TOTAL__1up", "TAUS_TRUEHADTAU_EFF_JETID_TOTAL__1down", "TAUS_TRUEHADTAU_EFF_JETID_TOTAL__1up", "TAUS_TRUEHADTAU_EFF_RECO_TOTAL__1down", "TAUS_TRUEHADTAU_EFF_RECO_TOTAL__1up", "TAUS_TRUEHADTAU_SME_TES_TOTAL__1down", "TAUS_TRUEHADTAU_SME_TES_TOTAL__1up"] -else: - tausysnames = ["", "Nominal"] - -# Photons -if isMC: - phsysnames = ["", "Nominal", "EG_RESOLUTION_ALL__1down", "EG_RESOLUTION_ALL__1up", "EG_SCALE_ALL__1down", "EG_SCALE_ALL__1up", "PH_EFF_Uncertainty__1down", "PH_EFF_Uncertainty__1up"] -else: - phsysnames = ["", "Nominal"] - - -########################## -# Configure Truth Thinning -########################## - -if isMC and doTruth==1: - # Based on SUSY1.py. Thin TruthParticles keeping ancestors to preserve - # history. Added WritePi0Bosons to MenuTruthThinning. - from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning - AST99TruthThinning = DerivationFramework__MenuTruthThinning( - name = "AST99TruthThinning", - ThinningService = "AST99ThinningSvc", - WritePartons = False, - WriteHadrons = False, - WriteBHadrons = True, - WriteGeant = False, - GeantPhotonPtThresh = 20000., - WriteTauHad = True, - PartonPtThresh = -1.0, - WriteBSM = True, - WriteBosons = True, - WriteBSMProducts = True, - WriteBosonProducts = True, - WriteTopAndDecays = True, - WriteEverything = False, - WriteAllLeptons = False, - WriteLeptonsNotFromHadrons = False, - WriteStatus3 = False, - WriteFirstN = -1, - PreserveAncestors = True, - PreserveGeneratorDescendants = False, - SimBarcodeOffset = 200000) - ToolSvc += AST99TruthThinning - thinningTools.append(AST99TruthThinning) - - -if isMC and doTruth==2: - # Add back-translator from xAOD::TruthEvent to HepMC for xAOD input - # Needed to run hard truth on xAOD input files - # Use GEN_EVENT name for output - from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__xAODtoHepMCCnvAlg - AST99Job += DerivationFramework__xAODtoHepMCCnvAlg("xAOD2GEN_EVENT", - xAODTruthEventKey = "TruthEvents", - HepMCTruthEventKey = "GEN_EVENT", - MaxCount = 0, - OutputLevel = Lvl.INFO) - - # Build compact hard truth object - from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__CompactHardTruth - makeHard = DerivationFramework__CompactHardTruth(McEvent = "GEN_EVENT", - McEventOut = "GEN_HARD", - MaxCount = 0, - OutputLevel = Lvl.INFO) - AST99Job += makeHard - - # Convert GEN_HARD to TruthEvent with new names - # Need to set TruthLinks to avoid conflict with standard name?! - from xAODTruthCnv.xAODTruthCnvConf import xAODMaker__xAODTruthCnvAlg - AST99Job += xAODMaker__xAODTruthCnvAlg( - "GEN_HARD2xAOD", - AODContainerName = "GEN_HARD", - xAODTruthEventContainerName = "TruthHardEvents", - xAODTruthParticleContainerName = "TruthHardParticles", - xAODTruthVertexContainerName = "TruthHardVertices", - TruthLinks = "TruthHardLinks", - OutputLevel = Lvl.INFO) - - # Set up HardTruthThinning tool - from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HardTruthThinning - # Keep B,D,tau decays - cHadrons = [411,421,431, 4122,4132,4232,4332] - bHadrons = [511,521,531, 5122,5132,5232,5332] - tau = [15] - keepers = cHadrons + bHadrons + tau - # Keep particles in jets and around hard leptons - TruthThinningTool = DerivationFramework__HardTruthThinning( - name = "TruthThinningTool", - ThinningService = "AST99ThinningSvc", - EventInfo = "EventInfo", - TruthParticles = "TruthParticles", - TruthVertices = "TruthVertices", - HardParticles = "TruthHardParticles", - KeepIds = keepers, - JetName = "AntiKt4TruthJets", - JetPtCut = 20000, - JetEtaCut = 2.5, - JetConstPtCut = 1000, - IsolRadius = 0.2, - IsolPtCut = 1000, - MaxCount = 0, - OutputLevel = Lvl.INFO) - - # Declare to thinning service - ToolSvc += TruthThinningTool - thinningTools.append(TruthThinningTool) - - -############################ -# Configure Trigger Skimming -############################ - -# From https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/AnalysisCommon/CPAnalysisExamples/trunk/share/skimmingExampleJobOptions.py - -xeTrig = ["HLT_xe70", "HLT_j80_xe80"] -jetTrig = ["HLT_j360", "HLT_4j85"] -lepTrig = ["HLT_e24_lhtight_iloose", "HLT_mu24"] -allTrig = xeTrig + jetTrig + lepTrig - -cutExpression = '(' + ' || '.join(xeTrig) + ')' -AST99CutTool = CfgMgr.CutTool("AST99CutTool", - TrigDecisionTool = trigDecTool, - Cut = cutExpression, - OutputLevel = Lvl.INFO) - -ToolSvc += AST99CutTool -skimmingTools += [AST99CutTool] - - -#################### -# Configure Slimming -#################### - -# DerivationFramework uses SlimmingHelper, which automatically -# handles variables for CP tools. We can use AddItem directly. -# Start with xxxCPContent; remove all not needed for analysis. -# Variables xxxVarAux are CP tool dependent. -# Variables xxxVarAux0 are independent - base container only. -# Add SUSYTools decorations to xxxVarAux. - -# Jets -jetVarAux = ".pt.eta.phi.m" -jetVarAux += ".baseline.signal.passOR.bad.bjet.bjet_loose" -jetVarAux0 = ".JetEtaJESScaleMomentum_pt.JetEtaJESScaleMomentum_eta.JetEtaJESScaleMomentum_phi.JetEtaJESScaleMomentum_m.JetGSCScaleMomentum_pt.JetGSCScaleMomentum_eta.JetGSCScaleMomentum_phi.JetGSCScaleMomentum_m.JvtJvfcorr.JvtRpt.Jvt.NumTrkPt1000.NumTrkPt500.SumPtTrkPt500.TrackWidthPt1000.Width.ActiveArea4vec_eta.ActiveArea4vec_m.ActiveArea4vec_phi.ActiveArea4vec_pt.btagging.btaggingLink.GhostBHadronsFinal.GhostCHadronsFinal.GhostTausFinal.GhostTruth.OriginVertex.GhostTrack.HighestJVFVtx.ConeTruthLabelID.PartonTruthLabelID" - -# Electrons -elVarAux = ".pt.eta.phi.m.Loose.Medium.Tight" -elVarAux += ".baseline.signal.passOR.isol" -elVarAux0 = ".trackParticleLinks.truthParticleLink.author.ptcone20.ptcone30.ptcone40.topoetcone20.topoetcone30.topoetcone40.charge" -if len(applyST.ElectronTriggers) > 0: - elVarAux0 += ".match" + ".match".join(applyST.ElectronTriggers) - -# Muons -muVarAux = ".pt.eta.phi.InnerDetectorPt.MuonSpectrometerPt.momentumBalanceSignificance.CaloLRLikelihood.CaloMuonIDTag" -muVarAux += ".baseline.signal.passOR.isol.cosmic.passedHighPtCuts" -muVarAux0 = ".truthType.truthOrigin.author.muonType.inDetTrackParticleLink.muonSpectrometerTrackParticleLink.combinedTrackParticleLink.clusterLink.ptcone20.ptcone30.ptcone40.topoetcone20.topoetcone30.topoetcone40.truthParticleLink.charge.extrapolatedMuonSpectrometerTrackParticleLink" -if len(applyST.MuonTriggers) > 0: - muVarAux0 += ".match" + ".match".join(applyST.MuonTriggers) - -# InDet Tracks - minimal information -# vz NOT in InDetTrackParticlesCPContent?! -indetVarAux = ".phi.d0.z0.theta.qOverP.vz.definingParametersCovMatrix.numberOfPixelHits.numberOfSCTHits.vertexLink.numberOfInnermostPixelLayerHits.truthParticleLink" -indetVarAux += ".TrkIsoPt1000_ptcone20.TrkIsoPt1000_ptcone30.TrkIsoPt1000_ptcone40" -indetVarAux += ".TrkIsoPt500_ptcone20.TrkIsoPt500_ptcone30.TrkIsoPt500_ptcone40" - -#gsfTrkVarAux = ".phi.d0.z0.theta.qOverP.vz.definingParametersCovMatrix" -gsfTrkVarAux = ".phi.d0.z0.theta.qOverP.vz" - -gsfVtxVarAux = ".trackParticleLinks.x.y.z.px.py.pz.pt1.pt2..minRfirstHit" - -# MuonSpec Tracks - what is really needed? -muspVarAux = ".phi.d0.z0.theta.qOverP.vz.parameterX.parameterY.parameterZ.parameterPX.parameterPY.parameterPZ.numberOfPrecisionLayers.numberOfPhiLayers.numberOfTriggerEtaLayers" - -# BTagging - MV1 not in xAOD -btagVarAux = ".MV2c00_discriminant.MV2c10_discriminant.MV2c20_discriminant.MV2c100_discriminant.MV2m_pu.MV2m_pc.MV2m_pb" - -# TauJets - recommendations from Serban -tauVarAux = ".pt.eta.phi.m" -tauVarAux += ".baseline.signal" -tauVarAux0 = ".trackLinks.jetLink.vertexLink.charge.isTauFlags.BDTJetScore.BDTEleScore.Likelihood.SafeLikelihood" - -# Photons -phVarAux = ".pt.eta.phi.m" -phVarAux += ".baseline.signal" -phVarAux0 = ".vertexLinks.ptcone20.ptcone30.ptcone40.ptvarcone20.ptvarcone30.ptvarcone40.topoetcone20.topoetcone30.topoetcone40.truthParticleLink.truthOrigin.truthType.author.Loose.Medium.Tight" - -# Primary vertices - more than PrimaryVerticesCPContent but no track links -privtxVarAux = ".x.y.z.sumPt2.chiSquared.numberDoF.vertexType" - - -######################### -# Create Kernel Algorithm -######################### - -# Run truth thinning and any skimming -# Object thinning done by ApplySUSYTools -# See https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/AthAnalysisBase#Event_skimming_filtering - -from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -AST99Job += CfgMgr.DerivationFramework__DerivationKernel( - name = "AST99Kernel", - SkimmingTools = skimmingTools, - ThinningTools = thinningTools, - OutputLevel = Lvl.INFO ) - -AST99Stream.AddAcceptAlgs( "AST99Kernel" ) - -# Need this to write TriggerMenu and other MetaData -ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool("TriggerMenuMetaDataTool") -svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.TriggerMenuMetaDataTool ] - -# Should this use CutFlowHelpers?? -from EventBookkeeperTools.EventBookkeeperToolsConf import CutFlowSvc -svcMgr += CutFlowSvc() -theApp.CreateSvc += ['CutFlowSvc/CutFlowSvc'] - - -########################## -# Add Containers to Stream -########################## - -# Add (Thinned/Slimmed) Base Containers -# DAOD contains EventAuxInfo and JetAuxContainer -# Many Base Containers are AuxContainerBase in DAOD. - -AST99Stream.AddItem( "xAOD::EventInfo#EventInfo" ) -AST99Stream.AddItem( "xAOD::EventAuxInfo#EventInfoAux." ) - -AST99Stream.AddItem( "xAOD::VertexContainer#PrimaryVertices" ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#PrimaryVerticesAux%s" % (privtxVarAux) ) - -AST99Stream.AddItem( "xAOD::JetContainer#%s" % (applyST.JetsName) ) -#AST99Stream.AddItem( "xAOD::JetAuxContainer#%s" % (applyST.JetsName + "Aux" + jetVarAux + jetVarAux0) ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.JetsName + "Aux" + jetVarAux + jetVarAux0) ) - -AST99Stream.AddItem( "xAOD::ElectronContainer#%s" % (applyST.ElectronsName) ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.ElectronsName + "Aux" + elVarAux + elVarAux0 ) ) - -AST99Stream.AddItem( "xAOD::MuonContainer#%s" % (applyST.MuonsName) ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.MuonsName + "Aux" + muVarAux + muVarAux0) ) - -AST99Stream.AddItem( "xAOD::BTaggingContainer#%s" % (applyST.BTaggingName) ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.BTaggingName + "Aux" + btagVarAux) ) - -AST99Stream.AddItem( "xAOD::TauJetContainer#%s" % (applyST.TauJetsName) ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.TauJetsName + "Aux" + tauVarAux + tauVarAux0) ) - -AST99Stream.AddItem( "xAOD::PhotonContainer#%s" % (applyST.PhotonsName) ) -AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.PhotonsName + "Aux" + phVarAux + phVarAux0) ) - -if applyST.TruthJetsName != "": - AST99Stream.AddItem( "xAOD::JetContainer#%s" % (applyST.TruthJetsName) ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.TruthJetsName + "Aux" + jetVarAux + jetVarAux0) ) - -if applyST.InDetTracksName != "": - AST99Stream.AddItem( ["xAOD::TrackParticleContainer#%s" % (applyST.InDetTracksName)] ) - AST99Stream.AddItem( ["xAOD::AuxContainerBase#%s" % (applyST.InDetTracksName + "Aux" + indetVarAux)] ) - -if applyST.GSFTracksName != "": - AST99Stream.AddItem( "xAOD::TrackParticleContainer#%s" % (applyST.GSFTracksName) ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.GSFTracksName + "Aux" + gsfTrkVarAux) ) - -if applyST.GSFVerticesName != "": - AST99Stream.AddItem( "xAOD::VertexContainer#%s" % (applyST.GSFVerticesName) ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.GSFVerticesName + "Aux" + gsfVtxVarAux) ) - -if applyST.MuonSpecTracksName != "": - AST99Stream.AddItem( "xAOD::TrackParticleContainer#%s" % (applyST.MuonSpecTracksName) ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#%s" % (applyST.MuonSpecTracksName + "Aux" + muspVarAux) ) - -# Trigger -AST99Stream.AddItem( "xAOD::TrigDecision#xTrigDecision" ) -AST99Stream.AddItem( "xAOD::TrigDecisionAuxInfo#xTrigDecisionAux." ) -AST99Stream.AddItem( "xAOD::TrigConfKeys#TrigConfKeys" ) -AST99Stream.AddMetaDataItem( "xAOD::TriggerMenuContainer#*" ) -AST99Stream.AddMetaDataItem( "xAOD::TriggerMenuAuxContainer#*" ) - -# Other MetaData -AST99Stream.AddMetaDataItem( "xAOD::CutBookkeeperContainer#*" ) -AST99Stream.AddMetaDataItem( "xAOD::CutBookkeeperAuxContainer#*" ) - -# Add syst != "" variations with slimmed aux containers -# Slimmed base containers already added - -for syst in jetsysnames: - if syst != "": - AST99Stream.AddItem( 'xAOD::JetContainer#%s' % (applyST.JetsName+syst) ) - AST99Stream.AddItem( 'xAOD::ShallowAuxContainer#%sAux%s' % (applyST.JetsName+syst, jetVarAux) ) - -for syst in elsysnames: - if syst != "": - AST99Stream.AddItem( 'xAOD::ElectronContainer#%s' % (applyST.ElectronsName+syst) ) - AST99Stream.AddItem( 'xAOD::ShallowAuxContainer#%sAux%s' % (applyST.ElectronsName+syst, elVarAux) ) - -for syst in musysnames: - if syst != "": - AST99Stream.AddItem( 'xAOD::MuonContainer#%s' % (applyST.MuonsName+syst) ) - AST99Stream.AddItem( 'xAOD::ShallowAuxContainer#%sAux%s' % (applyST.MuonsName+syst, muVarAux) ) - -# Full MET containers including syst = "" -AST99Stream.AddItem( 'xAOD::MissingETContainer#%s' % (metkey) ) -AST99Stream.AddItem( 'xAOD::MissingETAuxContainer#%sAux.' % (metkey) ) - -for syst in jetsysnames: - AST99Stream.AddItem( 'xAOD::MissingETContainer#%s' % (metkey+syst) ) - AST99Stream.AddItem( 'xAOD::MissingETAuxContainer#%sAux.' % (metkey+syst) ) - -if isMC: - if applyST.DoTST : - for syst in TSTsysnames: - AST99Stream.AddItem( "xAOD::MissingETContainer#%s" % (metkey+syst) ) - AST99Stream.AddItem( "xAOD::MissingETAuxContainer#%sAux." % (metkey+syst) ) - else: - for syst in CSTsysnames: - AST99Stream.AddItem( "xAOD::MissingETContainer#%s" % (metkey+syst) ) - AST99Stream.AddItem( "xAOD::MissingETAuxContainer#%sAux." % (metkey+syst) ) - -# Track MET -AST99Stream.AddItem( 'xAOD::MissingETContainer#MET_Track' ) -AST99Stream.AddItem( 'xAOD::AuxContainerBase#MET_TrackAux.' ) - -for syst in tausysnames: - if syst != "": - AST99Stream.AddItem( 'xAOD::TauJetContainer#%s' % (applyST.TauJetsName+syst) ) - AST99Stream.AddItem( 'xAOD::ShallowAuxContainer#%sAux%s' % (applyST.TauJetsName+syst, tauVarAux) ) - -for syst in phsysnames: - if syst != "": - AST99Stream.AddItem( 'xAOD::PhotonContainer#%s' % (applyST.PhotonsName+syst) ) - AST99Stream.AddItem( 'xAOD::ShallowAuxContainer#%sAux%s' % (applyST.PhotonsName+syst, phVarAux) ) - -# Truth MET -if isMC: - AST99Stream.AddItem( 'xAOD::MissingETContainer#MET_Truth' ) - AST99Stream.AddItem( 'xAOD::AuxContainerBase#MET_TruthAux.' ) - -# Add thinned truth -if isMC: - AST99Stream.AddItem( "xAOD::TruthVertexContainer#TruthVertices" ) - AST99Stream.AddItem( "xAOD::TruthParticleContainer#TruthParticles" ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#TruthVerticesAux." ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#TruthParticlesAux." ) - -# Add hard truth containers if made -if doTruth==2: - AST99Stream.AddItem( "xAOD::TruthEventContainer#TruthHardEvents" ) - AST99Stream.AddItem( "xAOD::TruthEventAuxContainer#TruthHardEventsAux." ) - AST99Stream.AddItem( "xAOD::TruthParticleContainer#TruthHardParticles" ) - AST99Stream.AddItem( "xAOD::TruthParticleAuxContainer#TruthHardParticlesAux." ) - AST99Stream.AddItem( "xAOD::TruthVertexContainer#TruthHardVertices" ) - AST99Stream.AddItem( "xAOD::TruthVertexAuxContainer#TruthHardVerticesAux." ) - -# Add R=0.4 track jets - just kinematics -AST99Stream.AddItem( "xAOD::JetContainer#AntiKt4PV0TrackJets" ) -AST99Stream.AddItem( "xAOD::JetAuxContainer#AntiKt4PV0TrackJetsAux.pt.eta.phi.m" ) - -# Add TruthTaus -if isMC: - truthTauVar = ".pt.eta.phi.m.pdgId.barcode.status.IsHadronicTau.DecayModeVector" - truthTauVar += ".pt_vis.eta_vis.phi_vis.m_vis.numCharged" - AST99Stream.AddItem( "xAOD::TruthParticleContainer#TruthTaus" ) - AST99Stream.AddItem( "xAOD::AuxContainerBase#TruthTausAux.%s" % (truthTauVar) ) - -# Set event number -theApp.EvtMax=EVTMAX - diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/jobOptions.py b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..89ebd8aeda799eb64264b518be3400e515513485 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/jobOptions.py @@ -0,0 +1,103 @@ +""" +Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +""" + +# Author: Will Buttinger + +# run this with: +# athena SUSYTools/jobOptions.py [athArgs] - [susyArgs] +# do: athena SUSYTools/jobOptions.py - --help +# to see help messages +# to run on the grid do: +# pathena SUSYTools/jobOptions.py --inDS list,of,ds --useContElementBoundary --addNthFieldOfINDSToLFN=2 - [susyArgs] + +from AthenaCommon.AthArgumentParser import AthArgumentParser +susyArgsParser = AthArgumentParser() +susyArgsParser.add_argument("--testCampaign",action="store",default=None,choices=["mc20e","mc21a","data22","data18"],help="Specify to select a test campaign") +susyArgsParser.add_argument("--testFormat",action="store",default="PHYS",choices=["PHYS","PHYSLITE"],help="Specify to select a test format") +susyArgsParser.add_argument("--accessMode",action="store",choices=["POOLAccess","ClassAccess"],default="POOLAccess",help="xAOD read mode - Class is faster, POOL is more robust") +susyArgsParser.add_argument("--configFile",action="store",default=None,help="Name of the SUSYTools config file, leave blank for auto-config") +susyArgsParser.add_argument("--prwFiles",action="store",nargs="+",default=None,help="Name of prw files") +susyArgsParser.add_argument("--lumicalcFiles",action="store",nargs="+",default=None,help="Name of lumicalc files") +susyArgsParser.add_argument("--noSyst",action="store_true",help="include to disable systematics") +susyArgsParser.add_argument("--fileOutput",default=None,help="Name of output file") + +susyArgs = susyArgsParser.parse_args() + +if susyArgs.testCampaign: + pTag = 'p5631' if susyArgs.testCampaign!='data22' else 'p5632' + inputDir = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools' + inputFiles = {} + inputFiles['data18'] = f'data18_13TeV.00356250_{pTag}.{susyArgs.testFormat}.pool.root' + inputFiles['data22'] = f'data22_13p6TeV.00440543_{pTag}.{susyArgs.testFormat}.pool.root' + inputFiles['mc20e'] = f'mc20_13TeV.410470.FS_mc20e_{pTag}.{susyArgs.testFormat}.pool.root' + inputFiles['mc21a'] = f'mc21_13p6TeV.601229.FS_mc21a_{pTag}.{susyArgs.testFormat}.pool.root' + jps.AthenaCommonFlags.FilesInput = [f'{inputDir}/{inputFiles[susyArgs.testCampaign]}'] + if susyArgs.fileOutput is None: + susyArgs.fileOutput = f"hist-Ath_{susyArgs.testCampaign}_DAOD_{susyArgs.testFormat}.root" + +# setup xAOD file reading +jps.AthenaCommonFlags.AccessMode = susyArgs.accessMode +# setup ROOT file outputting +if susyArgs.fileOutput: jps.AthenaCommonFlags.HistOutputs = [f"ANALYSIS:{susyArgs.fileOutput}"] + +print("INFO: Processing:",jps.AthenaCommonFlags.FilesInput()) +print("INFO: Outputting:",jps.AthenaCommonFlags.HistOutputs()) + +# read input file metadata: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/AthAnalysis#How_to_access_file_metadata_at_t +from PyUtils import AthFile +af = AthFile.fopen(jps.AthenaCommonFlags.FilesInput()[0]) +isMC = 'IS_SIMULATION' in af.fileinfos['evt_type'] +isFastSim = isMC and ('ATLFASTII' in af.fileinfos['metadata']['/Simulation/Parameters']['SimulationFlavour'].upper()) #full sim or atlfast +print("INFO: Format: "," isMC: ",isMC," isFastSim: ",isFastSim) + +if isMC: + campaignMap = {284500:"mc20a",300000:"mc20d",310000:"mc20e",410000:"mc21a"} + MCCampaign = campaignMap[af.fileinfos["run_number"][0]] + +# configure SUSYTools algorithm and its tool +susyAlg = CfgMgr.SUSYToolsAlg(DoSyst = isMC and not susyArgs.noSyst) + +if susyArgs.configFile: + susyAlg.SUSYTools.ConfigFile = susyArgs.configFile +else: + # select config file based on whether we are run3 or run2 + if (isMC and MCCampaign in ["mc21a"]) or (not isMC and af.fileinfos["run_number"][0]>400000): + susyAlg.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default_Run3.conf" # run3 + else: + susyAlg.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default.conf" # run2 + if susyArgs.testFormat == "PHYSLITE": + STconfig_lite = str(susyAlg.SUSYTools.ConfigFile).replace(".conf","_LITE.conf") + susyAlg.SUSYTools.ConfigFile = STconfig_lite + susyAlg.SUSYTools.IsPHYSLITE = True + +print("INFO: Configuration file:",susyAlg.SUSYTools.ConfigFile) + +susyAlg.SUSYTools.DataSource = 0 if not isMC else (1 if not isFastSim else 2) # data/FS/atlfast + +print("INFO: Configuration SUSYTools.DataSource: ",susyAlg.SUSYTools.DataSource) + +if isMC: + if susyArgs.prwFiles: + susyAlg.SUSYTools.PRWConfigFiles = susyArgs.prwFiles + else: + susyAlg.SUSYTools.AutoconfigurePRWTool = True + # set lumicalc info based on the campaign, if running on MC + if susyArgs.lumicalcFiles: + susyAlg.SUSYTools.PRWLumiCalcFiles = susyArgs.lumicalcFiles + else: + PRWLumiCalc = {} + PRWLumiCalc['mc20a'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root', + '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20170619/PHYS_StandardGRL_All_Good_25ns_276262-284484_OflLumi-13TeV-008.root'] + PRWLumiCalc['mc20d'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.lumicalc.OflLumi-13TeV-010.root'] + PRWLumiCalc['mc20e'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root'] + PRWLumiCalc['mc21a'] = ['/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/20221219/ilumicalc_histograms_None_428648-440613_OflLumi-Run3-002.root'] + susyAlg.SUSYTools.PRWLumiCalcFiles = PRWLumiCalc[MCCampaign] + + +# schedule alg: +athAlgSeq += susyAlg + +include("AthAnalysisBaseComps/SuppressLogging.py") #Optional include to suppress as much athena output as possible. Keep at bottom of joboptions so that it doesn't suppress the logging of the things you have configured above +svcMgr+=CfgMgr.AthenaEventLoopMgr(IntervalInSeconds = 10,OutputLevel=INFO) # print progress in fixed period intervals +svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" #Creates more space for displaying tool names \ No newline at end of file diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_atlfast.py b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_atlfast.py deleted file mode 100644 index 773a11fd7922074981d585d4705aee32ee5e9ac9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_atlfast.py +++ /dev/null @@ -1,56 +0,0 @@ -#Author: Will Buttinger - -#This is the configuration file for an athena job using SUSYTools to calibrate physics objects -#You would use this joboption by copying it and substituting the TestAlg for your own algorithm -#and subtituting your own input files - -import AthenaPoolCnvSvc.ReadAthenaPool #read xAOD files - -theApp.EvtMax = 400 #set to -1 to run on all events - -inputFile = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.AFII_mc16e_p4237.PHYSVAL.pool.root' - -svcMgr.EventSelector.InputCollections = [ inputFile ] #specify input files here, takes a list -svcMgr.MessageSvc.OutputLevel = INFO - -ToolSvc += CfgMgr.ST__SUSYObjDef_xAOD("SUSYTools") - -ToolSvc.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default.conf" # Grab the default config file - -ToolSvc.SUSYTools.AutoconfigurePRWTool = True -ToolSvc.SUSYTools.PRWLumiCalcFiles = [ "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root" ] - -ToolSvc.SUSYTools.DataSource = 2 #configure to run on AFII sim - -algseq = CfgMgr.AthSequencer("AthAlgSeq") #The main alg sequence - -#this bit is used in the ATN nightly tests, for appending event rates to previous results -try: - from TrigValTools.Utils import getPreviousNightlyPath - myPath = getPreviousNightlyPath() -except ImportError: - myPath="." - -algseq += CfgMgr.SUSYToolsAlg("AtlFastAlg",RootStreamName="MYSTREAM",RateMonitoringPath=myPath,CheckTruthJets=True) #Substitute your alg here - -#You algorithm can use the SUSYTools through a ToolHandle: -# -#ToolHandle<ST::ISUSYObjDef_xAODTool> m_SUSYTools; -# -#If you declare the ToolHandle as a property (like in SUSYToolsAlg): -# -# declareProperty( "SUSYTools", m_SUSYTools ); -# -#You can then do something like the following: -algseq.AtlFastAlg.SUSYTools = ToolSvc.SUSYTools - -#That completes the minimum configuration. The rest is extra.... -algseq.AtlFastAlg.DoSyst = True -algseq.AtlFastAlg.OutputLevel = INFO - -svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" #Creates more space for displaying tool names -svcMgr += CfgMgr.AthenaEventLoopMgr(EventPrintoutInterval=100) #message every 100 events processed - -#this is for the output of histograms -svcMgr+=CfgMgr.THistSvc() -svcMgr.THistSvc.Output += ["MYSTREAM DATAFILE='monitoring.atlfast.root' OPT='RECREATE'"] diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_data.py b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_data.py deleted file mode 100644 index 72d9501a0393b45c720e6bb03d88b35340056335..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_data.py +++ /dev/null @@ -1,58 +0,0 @@ -#Author: Will Buttinger - -#This is the configuration file for an athena job using SUSYTools to calibrate physics objects -#You would use this joboption by copying it and substituting the TestAlg for your own algorithm -#and subtituting your own input files - -import AthenaPoolCnvSvc.ReadAthenaPool #read xAOD files - -theApp.EvtMax = 400 #set to -1 to run on all events - -inputFile = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.data18_13TeV.348403.data18_p4238.PHYSVAL.pool.root' - -svcMgr.EventSelector.InputCollections = [ inputFile ] #specify input files here, takes a list -svcMgr.MessageSvc.OutputLevel = INFO - -ToolSvc += CfgMgr.ST__SUSYObjDef_xAOD("SUSYTools") - -ToolSvc.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default.conf" # Grab the default config file - -ToolSvc.SUSYTools.AutoconfigurePRWTool = True -ToolSvc.SUSYTools.PRWLumiCalcFiles = [ "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root" ] - -ToolSvc.SUSYTools.DataSource = 0 #configure to run on data - -algseq = CfgMgr.AthSequencer("AthAlgSeq") #The main alg sequence - -#this bit is used in the ATN nightly tests, for appending event rates to previous results -try: - from TrigValTools.Utils import getPreviousNightlyPath - myPath = getPreviousNightlyPath() -except ImportError: - myPath="." - -algseq += CfgMgr.SUSYToolsAlg("DataAlg",RootStreamName="MYSTREAM",RateMonitoringPath=myPath,CheckTruthJets=False) #Substitute your alg here - -#You algorithm can use the SUSYTools through a ToolHandle: -# -#ToolHandle<ST::ISUSYObjDef_xAODTool> m_SUSYTools; -# -#If you declare the ToolHandle as a property (like in SUSYToolsAlg): -# -# declareProperty( "SUSYTools", m_SUSYTools ); -# -#You can then do something like the following: -algseq.DataAlg.SUSYTools = ToolSvc.SUSYTools - -algseq.DataAlg.DataSource = 0 #run on data - -#That completes the minimum configuration. The rest is extra.... -algseq.DataAlg.DoSyst = True -algseq.DataAlg.OutputLevel = INFO - -svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" #Creates more space for displaying tool names -svcMgr += CfgMgr.AthenaEventLoopMgr(EventPrintoutInterval=100) #message every 100 events processed - -#this is for the output of histograms -svcMgr+=CfgMgr.THistSvc() -svcMgr.THistSvc.Output += ["MYSTREAM DATAFILE='monitoring.data.root' OPT='RECREATE'"] diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_mc.py b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_mc.py deleted file mode 100644 index 975afb8bcc31f56553ce69c57164631f36f70d02..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/minimalExampleJobOptions_mc.py +++ /dev/null @@ -1,75 +0,0 @@ -#Author: Will Buttinger - -#This is the configuration file for an athena job using SUSYTools to calibrate physics objects -#You would use this joboption by copying it and substituting the TestAlg for your own algorithm -#and subtituting your own input files - -import AthenaPoolCnvSvc.ReadAthenaPool #read xAOD files - -theApp.EvtMax = 400 #set to -1 to run on all events - -### This JO uses MC16a by default, but if you specify MCCampaign (with -c "MCCampaign= ...) you can -### swap the MC campaign this is run for (used in ART tests) -try: - MCCampaign -except: - MCCampaign = 'MCe' - -if MCCampaign == 'MCa': - inputFile = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.FS_mc16a_p4237.PHYSVAL.pool.root' -elif MCCampaign == 'MCd': - inputFile = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.FS_mc16d_p4237.PHYSVAL.pool.root' -else: # MC16e by default - inputFile = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.FS_mc16e_p4237.PHYSVAL.pool.root' - -svcMgr.EventSelector.InputCollections = [ inputFile ] #specify input files here, takes a list -svcMgr.MessageSvc.OutputLevel = INFO - -ToolSvc += CfgMgr.ST__SUSYObjDef_xAOD("SUSYTools") - -ToolSvc.SUSYTools.ConfigFile = "SUSYTools/SUSYTools_Default.conf" # Grab the default config file - -ToolSvc.SUSYTools.AutoconfigurePRWTool = True -if MCCampaign == 'MCa': - ToolSvc.SUSYTools.PRWLumiCalcFiles = [ - "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root", - "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20170619/PHYS_StandardGRL_All_Good_25ns_276262-284484_OflLumi-13TeV-008.root" - ] -elif MCCampaign == 'MCd': - ToolSvc.SUSYTools.PRWLumiCalcFiles = [ "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.lumicalc.OflLumi-13TeV-010.root" ] -else: #default MCe - ToolSvc.SUSYTools.PRWLumiCalcFiles = [ "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root" ] - -algseq = CfgMgr.AthSequencer("AthAlgSeq") #The main alg sequence - -#this bit is used in the ATN nightly tests, for appending event rates to previous results -try: - from TrigValTools.Utils import getPreviousNightlyPath - myPath = getPreviousNightlyPath() -except ImportError: - myPath="." - -algseq += CfgMgr.SUSYToolsAlg("MCAlg",RootStreamName="MYSTREAM",RateMonitoringPath=myPath,CheckTruthJets=True) #Substitute your alg here - -#You algorithm can use the SUSYTools through a ToolHandle: -# -#ToolHandle<ST::ISUSYObjDef_xAODTool> m_SUSYTools; -# -#If you declare the ToolHandle as a property (like in SUSYToolsAlg): -# -# declareProperty( "SUSYTools", m_SUSYTools ); -# -#You can then do something like the following: -algseq.MCAlg.SUSYTools = ToolSvc.SUSYTools - -#That completes the minimum configuration. The rest is extra.... -algseq.MCAlg.DoSyst = True -algseq.MCAlg.OutputLevel = INFO - - -svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" #Creates more space for displaying tool names -svcMgr += CfgMgr.AthenaEventLoopMgr(EventPrintoutInterval=100) #message every 100 events processed - -#this is for the output of histograms -svcMgr+=CfgMgr.THistSvc() -svcMgr.THistSvc.Output += [ "MYSTREAM DATAFILE='monitoring.%s.root' OPT='RECREATE'" % MCCampaign ] diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data.ref new file mode 100644 index 0000000000000000000000000000000000000000..e84a4083d573393c33a9492003b5097b34ccbc68 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data.ref @@ -0,0 +1,97 @@ +ToolSvc.WTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.JVTEfficiencyTool WARNING Supplied SF file JetJvtEfficiency/Moriond2018/JvtSFFile_EMPFlowJets.root doesn't seem to contain SFs for NNJvt, falling back to dummy SFs ... + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** +ToolSvc.TauEffTool_Medium WARNING 2022-prerec tag are pre-recommendations and still under development. +=== CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT === + taggerName : DL1dv01 + Systematic strategy : SFGlobalEigen + + CDI file build number: Custom + +======= end of CalibrationDataInterfaceROOT instantiation ======== +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF (with comment: 'negative_tag_Zjet+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF (with comment: 'ttbarC+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF (with comment: 'ttbar_PDF+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF (with comment: 'ttbarC+addSys[newsys]+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF already cached! + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +ToolSvc.metSignificance_AntiKt4EMPFlow WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. +ToolSvc.grl WARNING Set to pass-through mode. +ToolSvc.TauEffTool_Medium WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (356250). Will only print this warning once. +ToolSvc.TauEffTool_Medium WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 + CalibrationDataInterfaceROOT object out-of-bounds summary: + No issues found diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data_Run3.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data_Run3.ref new file mode 100644 index 0000000000000000000000000000000000000000..655e2b85edaaa652b866c72ed17f8256799be577 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_data_Run3.ref @@ -0,0 +1,93 @@ +ToolSvc.WTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.JVTEfficiencyTool WARNING Supplied SF file JetJvtEfficiency/Moriond2018/JvtSFFile_EMPFlowJets.root doesn't seem to contain SFs for NNJvt, falling back to dummy SFs ... + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +SUSYToolsAlg.SUSYTools WARNING *** THE ELECTRON TRIGGER SF MIXED AND SF DILEP ARE CURRENTY NOT SUPPORTED IN RUN3 *** +SUSYToolsAlg.SUSYTools WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** +ToolSvc.TauEffTool_Medium WARNING 2022-prerec tag are pre-recommendations and still under development. +=== CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT === + taggerName : DL1dv01 + Systematic strategy : SFGlobalEigen + + CDI file build number: Custom + +======= end of CalibrationDataInterfaceROOT instantiation ======== +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF (with comment: 'negative_tag_Zjet+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF (with comment: 'ttbarC+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF (with comment: 'ttbar_PDF+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF (with comment: 'ttbarC+addSys[newsys]+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF already cached! + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +ToolSvc.metSignificance_AntiKt4EMPFlow WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. +ToolSvc.grl WARNING Set to pass-through mode. +ToolSvc.TauEffTool_Medium WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (440543). Will only print this warning once. +SUSYToolsAlg WARNING No PV found for this event! Skipping... +SUSYToolsAlg WARNING No PV found for this event! Skipping... +SUSYToolsAlg WARNING No PV found for this event! Skipping... +SUSYToolsAlg WARNING No PV found for this event! Skipping... +SUSYToolsAlg WARNING No PV found for this event! Skipping... +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +SUSYToolsAlg WARNING No PV found for this event! Skipping... +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 + CalibrationDataInterfaceROOT object out-of-bounds summary: + No issues found diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc.ref new file mode 100644 index 0000000000000000000000000000000000000000..a645ab8f1d178c665844d0d2d687a936c49c4346 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc.ref @@ -0,0 +1,128 @@ +PathResolver WARNING Locating dev file dev/PileupReweighting/share/DSID410xxx/pileup_mc16e_dsid410470_FS.root. Do not let this propagate to a release +ToolSvc.WTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.JVTEfficiencyTool WARNING Supplied SF file JetJvtEfficiency/Moriond2018/JvtSFFile_EMPFlowJets.root doesn't seem to contain SFs for NNJvt, falling back to dummy SFs ... + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYToolsAlg.SUSYTools WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** +SUSYToolsAlg.SUSYTools WARNING No Photon trigger SF available for FixedCutTight, using TightCaloOnly instead... Use at your own risk +ToolSvc.TauEffTool_Medium WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau125_medium...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160_medium...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau50L1TAU12_...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING 2022-prerec tag are pre-recommendations and still under development. +=== CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT === + taggerName : DL1dv01 + Systematic strategy : SFGlobalEigen + + CDI file build number: Custom + +======= end of CalibrationDataInterfaceROOT instantiation ======== +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF (with comment: 'negative_tag_Zjet+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF (with comment: 'ttbarC+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF (with comment: 'ttbar_PDF+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF (with comment: 'ttbarC+addSys[newsys]+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF already cached! + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +ToolSvc.metSignificance_AntiKt4EMPFlow WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. +ToolSvc.TauEffTool_Medium WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau125_medium...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160_medium...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau50L1TAU12_...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 + CalibrationDataInterfaceROOT object out-of-bounds summary: + DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF general: 0, extrapolated: 18 diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc_Run3.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc_Run3.ref new file mode 100644 index 0000000000000000000000000000000000000000..86f67aa6aa9c0448459d996f46311325261aa901 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsAlg_mc_Run3.ref @@ -0,0 +1,127 @@ +PathResolver WARNING Locating dev file dev/PileupReweighting/share/DSID601xxx/pileup_mc21a_dsid601229_FS.root. Do not let this propagate to a release +ToolSvc.WTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.WTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.ZTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau21WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau32WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Tau42WTAName', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'C2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'D2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'e3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L2Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'L3Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.TopTagger WARNING duplicated property name 'Ntrk500Name', see https://its.cern.ch/jira/browse/GAUDI-1023 +ToolSvc.JVTEfficiencyTool WARNING Supplied SF file JetJvtEfficiency/Moriond2018/JvtSFFile_EMPFlowJets.root doesn't seem to contain SFs for NNJvt, falling back to dummy SFs ... + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +SUSYToolsAlg.SUSYTools WARNING *** THE ELECTRON TRIGGER SF MIXED AND SF DILEP ARE CURRENTY NOT SUPPORTED IN RUN3 *** +SUSYToolsAlg.SUSYTools WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** +SUSYToolsAlg.SUSYTools WARNING No Photon trigger SF available for FixedCutTight, using TightCaloOnly instead... Use at your own risk +ToolSvc.TauEffTool_Medium WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau125_medium...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160_medium...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau50L1TAU12_...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING 2022-prerec tag are pre-recommendations and still under development. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING 2022-prerec tag are pre-recommendations and still under development. +=== CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT === + taggerName : DL1dv01 + Systematic strategy : SFGlobalEigen + + CDI file build number: Custom + +======= end of CalibrationDataInterfaceROOT instantiation ======== +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF (with comment: 'negative_tag_Zjet+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF (with comment: 'ttbarC+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF (with comment: 'ttbar_PDF+extrap[Run2MCcalib]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/B/default_SF already cached! +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is 410470_Eff +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/410470_Eff (with comment: 'efficiencies from sample PowhegPythia8' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterface: retrieved container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF (with comment: 'ttbarC+addSys[newsys]+extrap[Run2MCcalib_ttC]' and hadronisation setting 'Pythia8EvtGen') +CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/T/default_SF already cached! + 'NNParamFile':'NNJVT.Network.graph.Offline.Nonprompt_All_MaxWeight.json' + + + + Reading JVT likelihood histogram from: + + + 'NNCutFile':'NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json' + + + +ToolSvc.metSignificance_AntiKt4EMPFlow WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. +ToolSvc.TauEffTool_Medium WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +CP::TPileupReweighting::Initialize WARNING has 0.011277% unrepresented data. This was reassigned (UnrepresentedDataAction=3) +ToolSvc.TauTrigEffTool_Medium_HLT_tau125_medium...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160L1TAU10...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau160_medium...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau25_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35L1TAU12I...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau35_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau50L1TAU12_...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau60_medium1...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +ToolSvc.TauTrigEffTool_Medium_HLT_tau80L1TAU60_...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. +CP::TPileupReweighting::Initialize WARNING has 0.011455% unrepresented data. This was reassigned (UnrepresentedDataAction=3) +CP::TPileupReweighting::Initialize WARNING has 0.011046% unrepresented data. This was reassigned (UnrepresentedDataAction=3) +ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 + CalibrationDataInterfaceROOT object out-of-bounds summary: + DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/Light/default_SF general: 0, extrapolated: 27 + DL1dv01/AntiKt4EMPFlowJets/FixedCutBEff_85/C/default_SF general: 0, extrapolated: 9 diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data.ref index 3276929c6ded462421c2122aae66fc94c204a242..a64ebe45f4ead1a89dbcfd465330339b923d7d8c 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data.ref +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data.ref @@ -12,7 +12,12 @@ ToolSvc.JVTEfficiencyToolWARNING Supplied SF file JetJvtEfficiency/Moriond2018/J -SUSYObjDef_xAOD WARNING *** THE ELECTRON TRIGGER SF ARE CURRENTY NOT SUPPORTED *** +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations SUSYObjDef_xAOD WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** ToolSvc.TauEffTool_MediumWARNING 2022-prerec tag are pre-recommendations and still under development. === CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT === @@ -49,6 +54,7 @@ CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiK +ToolSvc.metSignificanc...WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. ToolSvc.TauEffTool_MediumWARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (356250). Will only print this warning once. ToolSvc.TauEffTool_MediumWARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 @@ -60,7 +66,6 @@ ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out- ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 Info in <SUSYToolsTester>: Time per event: (CPU / WALL) CalibrationDataInterfaceROOT object out-of-bounds summary: diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data_Run3.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data_Run3.ref index 2d01002af159b2179971359fddd182dcc624dbc2..4782ab3145827426eea2fefc9075f2abee11ea8e 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data_Run3.ref +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_data_Run3.ref @@ -12,7 +12,7 @@ ToolSvc.JVTEfficiencyToolWARNING Supplied SF file JetJvtEfficiency/Moriond2018/J -SUSYObjDef_xAOD WARNING *** THE ELECTRON TRIGGER SF ARE CURRENTY NOT SUPPORTED *** +SUSYObjDef_xAOD WARNING *** THE ELECTRON TRIGGER SF MIXED AND SF DILEP ARE CURRENTY NOT SUPPORTED IN RUN3 *** SUSYObjDef_xAOD WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** ToolSvc.TauEffTool_MediumWARNING 2022-prerec tag are pre-recommendations and still under development. === CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT === @@ -49,29 +49,27 @@ CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiK +ToolSvc.metSignificanc...WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. ToolSvc.TauEffTool_MediumWARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (440543). Will only print this warning once. +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 +Warning in <SUSYToolsTester>: No PV found for this event! Skipping... ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... -Warning in <SUSYToolsTester>: No PV found for this event! Skipping... Info in <SUSYToolsTester>: Time per event: (CPU / WALL) CalibrationDataInterfaceROOT object out-of-bounds summary: No issues found diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc.ref index c3706599762a1653167895a7461c092ea78cde90..d14f8d5368fa6a6547cd4b973ecdd1e13ec12ea8 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc.ref +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc.ref @@ -13,7 +13,12 @@ ToolSvc.JVTEfficiencyToolWARNING Supplied SF file JetJvtEfficiency/Moriond2018/J -SUSYObjDef_xAOD WARNING *** THE ELECTRON TRIGGER SF ARE CURRENTY NOT SUPPORTED *** +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations +SUSYObjDef_xAOD WARNING (AsgElectronEfficiencyCorrectionTool_trig_mixLep_*) Your selected electron Iso WP (Loose_VarRad) does not have trigger SFs defined. Falling back to FCLoose for SF calculations SUSYObjDef_xAOD WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** SUSYObjDef_xAOD WARNING No Photon trigger SF available for FixedCutTight, using TightCaloOnly instead... Use at your own risk ToolSvc.TauEffTool_MediumWARNING 2022-prerec tag are pre-recommendations and still under development. @@ -71,6 +76,7 @@ CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiK +ToolSvc.metSignificanc...WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. ToolSvc.TauEffTool_MediumWARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. ToolSvc.TauTrigEffTool...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. ToolSvc.TauTrigEffTool...WARNING TauEfficiency callibrations from 2022-prerec are not recommended for Run2 MC. Will only print this warning once. @@ -95,27 +101,9 @@ ToolSvc.TauTrigEffTool...WARNING TauEfficiency callibrations from 2022-prerec ar SUSYObjDef_xAOD WARNING TruthBSM is empty. Skipping FindSusyHP. SUSYObjDef_xAOD WARNING TruthBSM is empty. Skipping FindSusyHP. SUSYObjDef_xAOD WARNING TruthBSM is empty. Skipping FindSusyHP. -ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 SUSYObjDef_xAOD WARNING TruthBSM is empty. Skipping FindSusyHP. SUSYObjDef_xAOD WARNING TruthBSM is empty. Skipping FindSusyHP. ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 -ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 -ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 -ToolSvc.TopTagger WARNING One (or more) tagger input variable has an out-of-range value, setting score to -666 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation TTVA_STAT__1DN and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation TTVA_STAT__1UP and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation TTVA_SYS__1DN and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 -Info in <EfficiencyScaleFactor>: No TTVA sf/efficiency provided for standalone muons with 2.5<|eta|<2.7 for variation TTVA_SYS__1UP and muon with pt=53121.6172, eta=2.59 and phi=-2.93, returning 1.0 Info in <SUSYToolsTester>: Time per event: (CPU / WALL) CalibrationDataInterfaceROOT object out-of-bounds summary: No issues found diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc_Run3.ref b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc_Run3.ref index 79d40c04cb94e1a7d349aae217a0834eeb49683d..a25a78d6fecb5e2229d24375b3d97fc51522790c 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc_Run3.ref +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/share/ut_SUSYToolsTester_mc_Run3.ref @@ -13,7 +13,7 @@ ToolSvc.JVTEfficiencyToolWARNING Supplied SF file JetJvtEfficiency/Moriond2018/J -SUSYObjDef_xAOD WARNING *** THE ELECTRON TRIGGER SF ARE CURRENTY NOT SUPPORTED *** +SUSYObjDef_xAOD WARNING *** THE ELECTRON TRIGGER SF MIXED AND SF DILEP ARE CURRENTY NOT SUPPORTED IN RUN3 *** SUSYObjDef_xAOD WARNING *** THE ELECTRON CHARGE FLIP SF ARE CURRENTY NOT SUPPORTED *** SUSYObjDef_xAOD WARNING No Photon trigger SF available for FixedCutTight, using TightCaloOnly instead... Use at your own risk ToolSvc.TauEffTool_MediumWARNING 2022-prerec tag are pre-recommendations and still under development. @@ -71,8 +71,9 @@ CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container DL1dv01/AntiK +ToolSvc.metSignificanc...WARNING Setup the muon calibration tool with calib mode 1. Please consider to configure the tool via the 'MuonCalibTool' property. ToolSvc.TauEffTool_MediumWARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. -Warning in <CP::TPileupReweighting::Initialize>: has 0.012435% unrepresented data. This was reassigned (UnrepresentedDataAction=3) +Warning in <CP::TPileupReweighting::Initialize>: has 0.027644% unrepresented data. This was reassigned (UnrepresentedDataAction=3) ToolSvc.TauTrigEffTool...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. ToolSvc.TauTrigEffTool...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. ToolSvc.TauTrigEffTool...WARNING Could not determine MC campaign from run number! The mu dependent systematic of the trigger scale factors should not be trusted. Current (410000). Will only print this warning once. diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/ApplySUSYTools.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/ApplySUSYTools.cxx deleted file mode 100644 index 71c45c76cb33e7e7916fa0c3d3a89df456833b52..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/ApplySUSYTools.cxx +++ /dev/null @@ -1,1158 +0,0 @@ -//////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// Implementation for ApplySUSYTools -// Author: Frank Paige <paige@bnl.gov> -/////////////////////////////////////////////////////////////////// - -// Class header file -#include "ApplySUSYTools.h" - -// Tools and services used here -#include "AthenaKernel/IThinningSvc.h" - -// EDM includes: -#include "xAODEventInfo/EventInfo.h" -#include "xAODMuon/MuonContainer.h" -#include "xAODJet/JetContainer.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODMissingET/MissingETContainer.h" -#include "xAODMissingET/MissingETAuxContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/VertexContainer.h" -#include "xAODTau/TauJetContainer.h" -#include "xAODEgamma/PhotonContainer.h" -#include "xAODTracking/TrackParticleContainer.h" -#include "xAODBTagging/BTaggingContainer.h" - -// Various typedefs and enums used in the code -#include "xAODJet/JetAttributes.h" -#include "xAODJet/JetTypes.h" -#include "xAODPrimitives/IsolationType.h" - -// For tau truth matching -#include "TauAnalysisTools/ITauTruthMatchingTool.h" - -// Shallow copies for jet passing -#include "xAODCore/ShallowCopy.h" - -// Decorators -#include "AthContainers/AuxElement.h" - -// Cut book keeper objects -#include "xAODCutFlow/CutBookkeeperContainer.h" -#include "xAODCutFlow/CutBookkeeperAuxContainer.h" - -// Needed for systematics -#include "AsgMessaging/StatusCode.h" -#include "PATInterfaces/SystematicSet.h" - -// For finding calibration files -#include "PathResolver/PathResolver.h" - -// For environment setup -#include "TEnv.h" - -// For the setOriginalObjectLink function -#include "xAODBase/IParticleHelpers.h" - -// For tau truth matching -#include "TauAnalysisTools/ITauTruthMatchingTool.h" - -namespace ST { - -////////////// -// Constructor -////////////// - -ApplySUSYTools::ApplySUSYTools( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::AthAlgorithm( name, pSvcLocator ), - m_eleBaselinePt(0.), - m_elePt(0.), - m_eleEta(0.), - m_eled0sig(0.), - m_elez0(0.), - m_muBaselinePt(0.), - m_muPt(0.), - m_muEta(0.), - m_mud0sig(0.), - m_muz0(0.), - m_muCosmicz0(0.), - m_muCosmicd0(0.), - m_photonBaselinePt(0.), - m_photonEta(0.), - m_photonPt(0.), - m_tauPt(0.), - m_tauEta(0.), - m_jetPt(0.), - m_jetEta(0.), - m_jetJvt(0.), - m_badjetJvt(0.), - m_evtCount(0), - m_maxCount(0), - m_jetPtCut(20000.), - m_inDetPtCut(1000.), - m_doTST(true), - m_isData(0), - m_MuonsName("Muons"), - m_MuonSpecTPName("MuonSpectrometerTrackParticles"), - m_ElectronsName("Electrons"), - m_JetsName("AntiKt4EMTopoJets"), - m_FatJetsName("AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"), - m_BTagName("BTagging_AntiKt4EMTopo"), - m_TruthJetsName("AntiKt4TruthJets"), - m_METsName("MET_Reference_AntiKt4EMTopo"), - m_InDetTracksName("InDetTrackParticles"), - m_GSFTracksName("GSFTrackParticles"), - m_GSFVerticesName("GSFConversionVertices"), - m_TauJetsName("TauJets"), - m_PhotonsName("Photons"), - m_configFile("SUSYTools/SUSYTools_Default.conf"), - m_objTool("SUSYObjDef_xAOD/dummy"), - m_tauTruthTool(""), - m_thinningSvc("ThinningSvc/ThinningSvc", name) -{ - - // Property declaration - // Output name = input name + systematic name - - declareProperty("MuonsName", m_MuonsName); - declareProperty("MuonSpecTracksName", m_MuonSpecTPName); - declareProperty("ElectronsName", m_ElectronsName); - declareProperty("JetsName", m_JetsName); - declareProperty("FatJetsName", m_FatJetsName); - declareProperty("BTaggingName", m_BTagName); - declareProperty("TruthJetsName", m_TruthJetsName); - declareProperty("METsName", m_METsName); - declareProperty("JetsPtCut", m_jetPtCut); - declareProperty("InDetTracksName", m_InDetTracksName); - declareProperty("InDetPtCut", m_inDetPtCut); - declareProperty("GSFTracksName", m_GSFTracksName); - declareProperty("GSFVerticesName", m_GSFVerticesName); - declareProperty("ElectronTriggers", m_ElectronTrigs); - declareProperty("MuonTriggers", m_MuonTrigs); - declareProperty("DoTST", m_doTST); - declareProperty("TauJetsName", m_TauJetsName); - declareProperty("PhotonsName", m_PhotonsName); - declareProperty("PhotonTriggers", m_PhotonTrigs); - - declareProperty("IsData", m_isData); - declareProperty("MaxCount", m_maxCount); - declareProperty("ThinningSvc",m_thinningSvc); - //declareProperty("", ); - - // asg Tool Handles must be dealt with differently - m_tauTruthTool.declarePropertyFor( this, "TauTruthMatchingTool", "The TTMT" ); - m_objTool.declarePropertyFor( this, "SUSYTools", "The SUSYTools instance" ); -} - -///////////// -// Destructor -///////////// - -ApplySUSYTools::~ApplySUSYTools() -{} - - -//////////////////// -// Athena initialize -//////////////////// - -StatusCode ApplySUSYTools::initialize() -{ - ATH_MSG_INFO ("ApplySUSYTools::initialize(): start"); - - m_evtCount = -1; - - m_doFatJets=true; - - // Get pointer to ThinningSvc and cache it : - // m_thinningSvc is of type IThinningSvc - CHECK( m_thinningSvc.retrieve() ); - - // SUSYTools: Configure in Python - ATH_MSG_INFO("ApplySUSYTools::initialize(): retrieve m_objTool"); - CHECK( m_objTool.retrieve() ); - - // isData() in SUSYObjDef_xAOD.h but not ISUSYObjDef_xAOD.h. - // Failed to retrieve EventInfo?! - //const xAOD::EventInfo* eventInfo = 0; - //CHECK( evtStore()->retrieve( eventInfo, "EventInfo") ); - //m_isData = true; - //if( eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION) ) m_isData = false; - // Use jobOptions for now. :-( - - // Need truth matching for tau CP tools - if( !m_isData ){ - ATH_MSG_INFO("ApplySUSYTools::initialize(): retrieve m_tauTruthTool"); - m_tauTruthTool.setTypeAndName("TauAnalysisTools::TauTruthMatchingTool/TauTruthMatchingTool"); - ATH_CHECK( m_tauTruthTool.setProperty("WriteTruthTaus", true) ); - ATH_CHECK( m_tauTruthTool.retrieve() ); - } - - // Systematics - // First entry is default; use only it for data - m_systInfoList = m_objTool->getSystInfoList(); - ATH_MSG_INFO("Available systematics"); - for(const auto& si : m_systInfoList){ - std::string siname = si.systset.name(); - bool affKine = si.affectsKinematics; - bool affWt = si.affectsWeights; - unsigned int affTyp = si.affectsType; - ATH_MSG_INFO("Systematic name/kine/wt/type \"" <<siname <<"\" " <<affKine <<" " - <<affWt <<" " <<affTyp); - if( siname == "" ){ - m_systInfoJET.push_back(&si); - m_systInfoELE.push_back(&si); - m_systInfoMUON.push_back(&si); - m_systInfoTAU.push_back(&si); - m_systInfoPHO.push_back(&si); - if( m_isData ) break; - } - if( siname.substr(0,4) == "JET_" ) m_systInfoJET.push_back(&si); - if( siname.substr(0,4) == "JER_" ) m_systInfoJET.push_back(&si); - if( siname.substr(0,3) == "EG_" ) m_systInfoELE.push_back(&si); - if( siname.substr(0,3) == "EL_" ) m_systInfoELE.push_back(&si); - if( siname.substr(0,4) == "MUON" ) m_systInfoMUON.push_back(&si); - if( siname.substr(0,11) == "MET_SoftTrk" ) m_systInfoTST.push_back(&si); - if( siname.substr(0,11) == "MET_SoftCal" ) m_systInfoCST.push_back(&si); - if( siname.substr(0,5) == "TAUS_" ) m_systInfoTAU.push_back(&si); - if( siname.substr(0,3) == "EG_" ) m_systInfoPHO.push_back(&si); - if( siname.substr(0,3) == "PH_" ) m_systInfoPHO.push_back(&si); - } - - // Mask names - m_MuonCutMaskName = m_MuonsName + "CutMask"; - m_MuonSpecCutMaskName = m_MuonSpecTPName + "CutMask"; - m_ElectronCutMaskName = m_ElectronsName + "CutMask"; - m_JetCutMaskName = m_JetsName + "CutMask"; - m_TruthJetCutMaskName = m_TruthJetsName + "CutMask"; - m_InDetCutMaskName = m_InDetTracksName + "CutMask"; - m_GSFTrackCutMaskName = m_GSFTracksName + "CutMask"; - m_GSFVertexCutMaskName = m_GSFVerticesName + "CutMask"; - m_TauJetCutMaskName = m_TauJetsName + "CutMask"; - m_PhotonCutMaskName = m_PhotonsName + "CutMask"; - - ATH_MSG_INFO( "***** ***** ***** *****" ); - ATH_MSG_INFO( "Configuring from file " << m_configFile ); - - TEnv rEnv; - int success = -1; - m_configFile = (PathResolverFindCalibFile(m_configFile)).c_str(); - success = rEnv.ReadFile(m_configFile.c_str(), kEnvAll); - if(success != 0){ - ATH_MSG_ERROR( "Cannot open config file!"); - return StatusCode::FAILURE; - } - ATH_MSG_INFO( "Config file opened" ); - - // TauJet cuts set by tau_selection_*.conf config files - - m_eleBaselinePt = rEnv.GetValue("EleBaseline.Pt", 10000.); - m_elePt = rEnv.GetValue("Ele.Et", 25000.); - m_eleEta = rEnv.GetValue("Ele.Eta", 2.47); - m_eled0sig = rEnv.GetValue("Ele.d0sig", 5.); - m_elez0 = rEnv.GetValue("Ele.z0", 0.5); - ATH_MSG_DEBUG("Config Electrons " <<m_eleBaselinePt <<" " <<m_elePt <<" " - <<m_eleEta <<" " <<m_eled0sig <<" " <<m_elez0); - - m_muBaselinePt = rEnv.GetValue("MuonBaseline.Pt", 10000.); - m_muPt = rEnv.GetValue("Muon.Pt", 25000.); - m_muEta = rEnv.GetValue("Muon.Eta", 2.7); - m_mud0sig = rEnv.GetValue("Muon.d0sig", 3.); - m_muz0 = rEnv.GetValue("Muon.z0", 0.5); - m_muCosmicz0 = rEnv.GetValue("MuonCosmic.z0", 1.); - m_muCosmicd0 = rEnv.GetValue("MuonCosmic.d0", 0.2); - ATH_MSG_DEBUG("Config Muons " <<m_muBaselinePt <<" " <<m_muPt <<" " - <<m_muEta <<" " <<m_mud0sig <<" " <<m_muz0); - - m_photonBaselinePt = rEnv.GetValue("PhotonBaseline.Pt", 25000.); - m_photonPt = rEnv.GetValue("Photon.Pt", 130000.); - m_photonEta = rEnv.GetValue("Photon.Eta", 2.37); - ATH_MSG_DEBUG("Config Photons " <<m_photonBaselinePt <<" " <<m_photonPt <<" " - <<m_photonEta); - - m_tauPt = rEnv.GetValue("Tau.Pt", 20000.); - m_tauEta = rEnv.GetValue("Tau.Eta", 2.47); - ATH_MSG_DEBUG("Config TauJets " <<m_tauPt <<" " <<m_tauEta); - - m_jetPt = rEnv.GetValue("Jet.Pt", 20000.); - m_jetEta = rEnv.GetValue("Jet.Eta", 2.8); - m_jetJvt = rEnv.GetValue("Jet.Jvt", 0.64); - m_badjetJvt = rEnv.GetValue("BadJet.Jvt", 0.64); - ATH_MSG_DEBUG("Config Jets " <<m_jetPt <<" " <<m_jetEta <<" " - <<m_jetJvt <<" " <<m_badjetJvt); - - ATH_MSG_INFO("Config file done."); - - return StatusCode::SUCCESS; -} - - -////////////////// -// Athena finalize -////////////////// - -StatusCode ApplySUSYTools::finalize() -{ - ATH_MSG_INFO ("Finalizing " << name() << "..."); - - return StatusCode::SUCCESS; -} - - -///////////////// -// Athena execute -///////////////// - -StatusCode ApplySUSYTools::execute() -{ - - ++m_evtCount; - bool doPrint = false; - doPrint = m_evtCount < m_maxCount; - - if( m_evtCount%100 == 0 ){ - ATH_MSG_INFO ("Executing " <<name() <<" for event " <<m_evtCount); - } - if( doPrint ) ATH_MSG_INFO("Begin ApplySUSYTools for event " <<m_evtCount); - - // Reset systematics - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - // Up front, apply pileup reweighting -- no need to weight - CHECK( m_objTool->ApplyPRWTool() ); - - //////////////////////////// - // Retrieve original objects - //////////////////////////// - - // Retrieve input containers. SUSYTools GetXXX can do this, but we - // use FillXXX. Make ViewContainer for each systematic including - // "Nominal". - - const xAOD::MuonContainer* p_Muons = 0; - CHECK( evtStore()->retrieve(p_Muons, m_MuonsName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_Muons size = " <<p_Muons->size()); - - const xAOD::TrackParticleContainer* p_MuonSpecTP = 0; - CHECK( evtStore()->retrieve(p_MuonSpecTP, m_MuonSpecTPName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_MuonSpecTP size = " <<p_MuonSpecTP->size()); - - const xAOD::ElectronContainer* p_Electrons = 0; - CHECK( evtStore()->retrieve(p_Electrons, m_ElectronsName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_Electrons size = " <<p_Electrons->size()); - - const xAOD::JetContainer* p_Jets = 0; - CHECK( evtStore()->retrieve(p_Jets, m_JetsName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_Jets size = " <<p_Jets->size()); - - const xAOD::JetContainer* p_FatJets = 0; - if( evtStore()->contains<xAOD::JetContainer>(m_FatJetsName) ){ - if( !evtStore()->retrieve( p_FatJets, m_FatJetsName).isSuccess() ){ - ATH_MSG_ERROR("Failed to retrieve xAOD::JetContainer with name " - << m_FatJetsName); - return StatusCode::FAILURE; - } else{ - if( doPrint ) ATH_MSG_DEBUG("Got p_FatJets size = " - <<p_FatJets->size()); - } - } else { - if( doPrint ) ATH_MSG_DEBUG("FatJets xAOD::JetContainer with name " - << m_FatJetsName <<" not found"); - m_doFatJets=false; - } - - const xAOD::BTaggingContainer* p_bTag = 0; - CHECK( evtStore()->retrieve(p_bTag, m_BTagName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_bTag size = " <<p_bTag->size()); - // Need to set this to avoid crashes in decorator functions. - static SG::AuxElement::Decorator<char> dec_passOR("passOR"); - - const xAOD::VertexContainer* p_Vertices = 0; - CHECK( evtStore()->retrieve(p_Vertices, "PrimaryVertices") ); - const xAOD::Vertex* p_PrimVtx = m_objTool->GetPrimVtx(); - float z0PV = -666; - if( p_PrimVtx ) z0PV = p_PrimVtx->z(); - if( doPrint ) ATH_MSG_DEBUG("Got p_Vertices size,z0 = " - <<p_Vertices->size() <<" " <<z0PV); - - const xAOD::TauJetContainer* p_TauJets = 0; - CHECK( evtStore()->retrieve(p_TauJets, m_TauJetsName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_TauJets size = " <<p_TauJets->size()); - - const xAOD::PhotonContainer* p_Photons = 0; - CHECK( evtStore()->retrieve(p_Photons, m_PhotonsName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_Photons size = " <<p_Photons->size()); - - if( doPrint ) ATH_MSG_DEBUG("Retrieved all object containers for event " <<m_evtCount); - - // FIXME: Make empty TruthTaus if p_TauJets is empty and not data - // Tau code fails in this case! - if( !evtStore()->contains<xAOD::TruthParticleContainer>("TruthTaus") && - p_TauJets->size() == 0 && !m_isData ){ - ATH_MSG_DEBUG("FIXME: TruthTaus hack for empty TauJets."); - xAOD::TruthParticleContainer* noTT = new xAOD::TruthParticleContainer; - xAOD::TruthParticleAuxContainer* noTTAux = new xAOD::TruthParticleAuxContainer; - noTT->setStore( noTTAux ); - CHECK( evtStore()->record(noTT, "TruthTaus") ); - CHECK( evtStore()->record(noTTAux, "TruthTausAux.") ); - } - - - ///////////////////////////////////////////////////////// - // Make shallowCopy for each systematic including Nominal - // Order in each matches that in original container. - ///////////////////////////////////////////////////////// - - /////// - // Jets - /////// - - // Initialize mask to false; true if any variation passes "baseline" - // AND if pt > m_jetPtCut. - std::vector<bool>* jetCutMask = new std::vector<bool>(p_Jets->size(),false); - CHECK( evtStore()->record(jetCutMask, m_JetCutMaskName) ); - - for(auto si : m_systInfoJET){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("Applying jet systematic " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - - // This largely replicates GetJets - // setShallowIO writes output as shallow copy - std::pair<xAOD::JetContainer*, xAOD::ShallowAuxContainer*> cpPair = - xAOD::shallowCopyContainer(*p_Jets); - xAOD::JetContainer* cpJets = cpPair.first; - xAOD::ShallowAuxContainer* cpAux = cpPair.second; - cpAux->setShallowIO( true ); - if( !xAOD::setOriginalObjectLink(*p_Jets, *cpJets) ){ - ATH_MSG_ERROR("Failed setOriginalObjectLink"); - return StatusCode::FAILURE; - } - CHECK( evtStore()->record(cpJets, m_JetsName+sysname) ); - CHECK( evtStore()->record(cpAux, m_JetsName+sysname+"Aux.") ); - if( doPrint ) ATH_MSG_DEBUG("Recorded jet shallow copy + aux for " - <<m_JetsName+sysname); - - unsigned int pIndex = 0; - for(const auto& p : *cpJets){ - CHECK( m_objTool->FillJet(*p, true) ); - //dec_passOR(*p) = true; - bool isbad = m_objTool->IsBadJet(*p); - bool issig = m_objTool->IsSignalJet(*p, m_jetPt, m_jetEta); - bool isbjet = m_objTool->IsBJet(*p); - if( doPrint ) ATH_MSG_DEBUG("Systematic jet pt " <<sysname <<" " - <<p->pt() <<" " - <<static_cast<int>(p->auxdata<char>("baseline")) - <<" " <<isbad <<" " <<issig <<" " <<isbjet); - if( p->auxdata<char>("baseline") && p->pt() > m_jetPtCut ){ - (*jetCutMask)[pIndex] = true; - } - ++pIndex; - } - } - - // Jets thinning - CHECK( m_thinningSvc->filter(*p_Jets, *jetCutMask, - IThinningSvc::Operator::Or) ); - for(auto si : m_systInfoJET){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - const xAOD::JetContainer* jets = 0; - CHECK( evtStore()->retrieve(jets, m_JetsName+sysname) ); - CHECK( m_thinningSvc->filter(*jets, *jetCutMask, - IThinningSvc::Operator::Or) ); - } - - - /////// - // Fat Jets (nominal only!) - /////// - if(m_doFatJets){ - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - std::string sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("Applying jet systematic " <<sysname); - - // This largely replicates GetFatJets - // setShallowIO writes output as shallow copy - xAOD::JetContainer* fatjets_nominal(0); - xAOD::ShallowAuxContainer* fatjets_nominal_aux(0); - std::string fatjetcoll = m_FatJetsName.substr(0, m_FatJetsName.size()-4); - CHECK( m_objTool->GetFatJets(fatjets_nominal, fatjets_nominal_aux, true, fatjetcoll, true)); - - if( doPrint ){ - for (const auto& fatjet : *fatjets_nominal) { - ATH_MSG_DEBUG("--------------------------------------"); - ATH_MSG_DEBUG("Recorded fat jet pt = " << fatjet->pt()*0.001 << " ," - << " Wtag = " << static_cast<int>(fatjet->auxdata<int>("Wtag")) << " ," - << " Ztag = " << static_cast<int>(fatjet->auxdata<int>("Ztag"))); - } - } - }//endif doFatJets - - //////// - // Muons - //////// - - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - // Initialize mask to false; true if any variation passes "baseline". - // Pass m_muPtCut to FillMuon - // Also keep MuonSpectrometerTrackParticles - // InnerDetectorTrackParticles with all tracks below - - std::vector<bool>* muCutMask = new std::vector<bool>(p_Muons->size(),false); - CHECK( evtStore()->record(muCutMask, m_MuonCutMaskName) ); - std::vector<bool>* muSpecCutMask = 0; - if( p_MuonSpecTP ){ - muSpecCutMask = new std::vector<bool>(p_MuonSpecTP->size(),false); - CHECK( evtStore()->record(muSpecCutMask, m_MuonSpecCutMaskName) ); - } - - for(auto si : m_systInfoMUON){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("Applying muon systematic " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - - // This largely replicates GetMuons - // setShallowIO writes output as shallow copy - - std::pair<xAOD::MuonContainer*, xAOD::ShallowAuxContainer*> cpPair = - xAOD::shallowCopyContainer(*p_Muons); - xAOD::MuonContainer* cpMuons = cpPair.first; - xAOD::ShallowAuxContainer* cpAux = cpPair.second; - cpAux->setShallowIO( true ); - if( !xAOD::setOriginalObjectLink(*p_Muons, *cpMuons) ){ - ATH_MSG_ERROR("Failed setOriginalObjectLink"); - return StatusCode::FAILURE; - } - CHECK( evtStore()->record(cpMuons, m_MuonsName+sysname) ); - CHECK( evtStore()->record(cpAux, m_MuonsName+sysname+"Aux.") ); - - unsigned int pIndex = 0; - for(const auto& p : *cpMuons){ - CHECK( m_objTool->FillMuon(*p, m_muBaselinePt, m_muEta) ); - //dec_passOR(*p) = true; - bool issig = m_objTool->IsSignalMuon(*p, m_muPt, m_mud0sig, m_muz0); - bool iscosmic = m_objTool->IsCosmicMuon(*p, m_muCosmicz0, m_muCosmicd0); - bool ishi = false; - bool isbase = (bool)p->auxdata<char>("baseline"); - if( p->pt() > 4.e3 ) ishi = m_objTool->IsHighPtMuon(*p); - if( doPrint ) ATH_MSG_DEBUG("Systematic muon pt " <<sysname <<" " - <<p->pt() <<" " <<iscosmic <<" " - <<isbase <<" " <<issig <<" " <<ishi); - if( isbase ) (*muCutMask)[pIndex] = true; - ++pIndex; - - const xAOD::TrackParticle* trk = - p->trackParticle( xAOD::Muon::MuonSpectrometerTrackParticle ); - if( !trk ) continue; - size_t idx = trk->index(); - (*muSpecCutMask)[idx] = true; - } - } - - - // Muons thinning - //int muonsSize = p_Muons->size(); - CHECK( m_thinningSvc->filter(*p_Muons, *muCutMask, IThinningSvc::Operator::Or) ); - CHECK( m_thinningSvc->filter(*p_MuonSpecTP, *muSpecCutMask, IThinningSvc::Operator::Or) ); - for(auto si : m_systInfoMUON){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - const xAOD::MuonContainer* mus = 0; - CHECK( evtStore()->retrieve(mus, m_MuonsName+sysname) ); - CHECK( m_thinningSvc->filter(*mus, *muCutMask, IThinningSvc::Operator::Or) ); - } - - //////////// - // Electrons - //////////// - - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - // Initialize mask to false; true if any variation passes "baseline". - // Pass m_elPtCut to FillElectron - std::vector<bool>* elCutMask = new std::vector<bool>(p_Electrons->size(),false); - CHECK( evtStore()->record(elCutMask, m_ElectronCutMaskName) ); - - for(auto si : m_systInfoELE){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("Applying electron systematic " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - - // This largely replicates GetJets - // setShallowIO writes output as shallow copy - - std::pair<xAOD::ElectronContainer*, xAOD::ShallowAuxContainer*> cpPair = - xAOD::shallowCopyContainer(*p_Electrons); - xAOD::ElectronContainer* cpElectrons = cpPair.first; - xAOD::ShallowAuxContainer* cpAux = cpPair.second; - cpAux->setShallowIO( true ); - if( !xAOD::setOriginalObjectLink(*p_Electrons, *cpElectrons) ){ - ATH_MSG_ERROR("Failed setOriginalObjectLink"); - return StatusCode::FAILURE; - } - CHECK( evtStore()->record(cpElectrons, m_ElectronsName+sysname) ); - CHECK( evtStore()->record(cpAux, m_ElectronsName+sysname+"Aux.") ); - - unsigned int pIndex = 0; - for(const auto& p : *cpElectrons){ - CHECK( m_objTool->FillElectron(*p, m_eleBaselinePt, m_eleEta) ); - //dec_passOR(*p) = true; - bool issig = m_objTool->IsSignalElectron(*p, m_elePt, - m_eled0sig, m_elez0); - if( doPrint ) ATH_MSG_DEBUG("Systematic electron pt " <<sysname <<" " - <<p->pt() <<" " <<issig); - if( p->auxdata<char>("baseline") ) (*elCutMask)[pIndex] = true; - ++pIndex; - } - } - - // Electrons thinning - CHECK( m_thinningSvc->filter(*p_Electrons, *elCutMask, - IThinningSvc::Operator::Or) ); - - for(auto si : m_systInfoELE){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - const xAOD::ElectronContainer* els = 0; - CHECK( evtStore()->retrieve(els, m_ElectronsName+sysname) ); - CHECK( m_thinningSvc->filter(*els, *elCutMask, - IThinningSvc::Operator::Or) ); - } - - - /////////////////////////////// - // Rebuild MET with systematics - /////////////////////////////// - - // Use nominal Electrons and Muons recalled from StoreGate - // Ignore Photons and TauJets for MET - // Apply JET and soft term systematics for either TST or CST - - if( doPrint ) ATH_MSG_DEBUG("Start MET rebuild"); - - const xAOD::MuonContainer* p_MuonsN = 0; - CHECK( evtStore()->retrieve(p_MuonsN, m_MuonsName+"Nominal") ); - - const xAOD::ElectronContainer* p_ElectronsN = 0; - CHECK( evtStore()->retrieve(p_ElectronsN, m_ElectronsName+"Nominal") ); - - const xAOD::JetContainer* p_JetsN = 0; - CHECK( evtStore()->retrieve(p_JetsN, m_JetsName+"Nominal") ); - - if( doPrint ) ATH_MSG_DEBUG("Got Nominals for MET rebuild " <<p_MuonsN->size() <<" " - <<p_ElectronsN->size() <<" " <<p_JetsN->size()); - - std::string METsName = m_METsName + "Trk"; - if( !m_doTST ) METsName = m_METsName + "Clus"; - - // Jet systematics - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - for(auto si : m_systInfoJET){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("MET sysname " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - - const xAOD::JetContainer* p_JetsSys = 0; - if( doPrint ) ATH_MSG_DEBUG("Using jet name " <<m_JetsName+sysname); - CHECK( evtStore()->retrieve(p_JetsSys, m_JetsName+sysname) ); - if( doPrint ) ATH_MSG_DEBUG("Jet size " <<p_JetsSys->size()); - xAOD::MissingETContainer* met = new xAOD::MissingETContainer; - xAOD::MissingETAuxContainer* metaux = new xAOD::MissingETAuxContainer; - met->setStore( metaux); - CHECK( evtStore()->record(met, METsName+sysname) ); - CHECK( evtStore()->record(metaux, METsName+sysname+"Aux.") ); - if( doPrint ) ATH_MSG_DEBUG("Recorded " <<METsName+sysname <<" " - <<METsName+sysname+"Aux."); - // Only redo MET if primary vertex exists - if( p_PrimVtx ){ - CHECK( m_objTool->GetMET(*met, p_JetsSys, p_ElectronsN, p_MuonsN, - 0, 0, m_doTST, m_doTST).isSuccess() ); - if( doPrint ) ATH_MSG_DEBUG("MET et " - <<(*met)["Final"]->met() <<" " <<sysname); - } else { - ATH_MSG_DEBUG("No primary vertex, skipping GetMET"); - } - } - - // Soft term systematics - // No Nominal here - identical to Nominal for JET - - if( m_doTST ){ - if( doPrint ) ATH_MSG_DEBUG("Start MET TST systematics"); - for(auto si : m_systInfoTST){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("MET sysname " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - xAOD::MissingETContainer* met = new xAOD::MissingETContainer; - xAOD::MissingETAuxContainer* metaux = new xAOD::MissingETAuxContainer; - met->setStore( metaux); - CHECK( evtStore()->record(met, METsName+sysname) ); - CHECK( evtStore()->record(metaux, METsName+sysname+"Aux.") ); - if( doPrint ) ATH_MSG_DEBUG("Recorded " <<METsName+sysname <<" " - <<METsName+sysname+"Aux."); - if( p_PrimVtx ){ - CHECK( m_objTool->GetMET(*met, p_JetsN, p_ElectronsN, p_MuonsN, - 0, 0, m_doTST, m_doTST).isSuccess() ); - if( doPrint ) ATH_MSG_DEBUG("MET et " - <<(*met)["Final"]->met() <<" " <<sysname); - } - } - } else { - if( doPrint ) ATH_MSG_DEBUG("Start MET CST systematics"); - for(auto si : m_systInfoCST){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("MET sysname " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - xAOD::MissingETContainer* met = new xAOD::MissingETContainer; - xAOD::MissingETAuxContainer* metaux = new xAOD::MissingETAuxContainer; - met->setStore( metaux); - CHECK( evtStore()->record(met, METsName+sysname) ); - CHECK( evtStore()->record(metaux, METsName+sysname+"Aux.") ); - if( doPrint ) ATH_MSG_DEBUG("Recorded " <<METsName+sysname <<" " - <<METsName+sysname+"Aux."); - if( p_PrimVtx ){ - CHECK( m_objTool->GetMET(*met, p_JetsN, p_ElectronsN, p_MuonsN, - 0, 0, m_doTST, m_doTST).isSuccess() ); - if( doPrint ) ATH_MSG_DEBUG("MET et " - <<(*met)["Final"]->met() <<" " <<sysname); - } - } - } - - - ////////// - // TauJets - ////////// - - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - // Selection defined by SUSYTools TauID = Loose/Medium/Tight. - // Initialize mask to false; true if any variation passes "baseline" - - std::vector<bool>* tauCutMask = new std::vector<bool>(p_TauJets->size(),false); - CHECK( evtStore()->record(tauCutMask, m_TauJetCutMaskName) ); - - // Initialize tau truth -- needed for tau CP tools - // Must specify TauTruthMatchingTool.WriteTruthTaus = True. - - if( !m_isData && - !evtStore()->contains<xAOD::TruthParticleContainer>("TruthTaus") ){ - // If there are no taus, then we need to force the building of the container - if (0==p_TauJets->size()) CHECK( m_tauTruthTool->retrieveTruthTaus() ); - - for(const auto& tau : *p_TauJets){ - const xAOD::TruthParticle* trueTau = 0; - trueTau = m_tauTruthTool->getTruth(*tau); - if( doPrint ){ - if( trueTau ){ - ATH_MSG_DEBUG("getTruth tau " <<tau->pt() <<" " <<tau->eta() - <<" " <<tau->phi() - <<" trueTau " <<trueTau->pt() <<" " <<trueTau->eta() - <<" " <<trueTau->phi()); - } else { - ATH_MSG_DEBUG("getTruth tau " <<tau->pt() <<" " <<tau->eta() - <<" " <<tau->phi() << "trueTau not found"); - } - } - } - }//end TruthTaus - - - for(auto si : m_systInfoTAU){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("Applying tau systematic " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - - // This largely replicates GetTaus - // setShallowIO writes output as shallow copy - std::pair<xAOD::TauJetContainer*, xAOD::ShallowAuxContainer*> cpPair = - xAOD::shallowCopyContainer(*p_TauJets); - xAOD::TauJetContainer* cpTauJets = cpPair.first; - xAOD::ShallowAuxContainer* cpAux = cpPair.second; - cpAux->setShallowIO( true ); - if( !xAOD::setOriginalObjectLink(*p_TauJets, *cpTauJets) ){ - ATH_MSG_ERROR("Failed setOriginalObjectLink"); - return StatusCode::FAILURE; - } - CHECK( evtStore()->record(cpTauJets, m_TauJetsName+sysname) ); - CHECK( evtStore()->record(cpAux, m_TauJetsName+sysname+"Aux.") ); - if( doPrint ) ATH_MSG_DEBUG("Recorded tay shallow copy + aux for " - <<m_TauJetsName+sysname); - - unsigned int pIndex = 0; - for(const auto& p : *cpTauJets){ - /* - const xAOD::TruthParticle* trueTau = 0; - if( !m_isData ) trueTau = m_tauTruthTool->getTruth(*p); - if( doPrint ){ - if( trueTau ) ATH_MSG_DEBUG("Systematic truth tau " <<sysname <<" " - <<trueTau->pt()); - else ATH_MSG_DEBUG("Systematic truth tau NOT FOUND " <<sysname); - } - */ - float ptorig = (*p_TauJets)[pIndex]->pt(); - CHECK( m_objTool->FillTau(*p) ); - //bool issig = m_objTool->IsSignalTau(*p, m_tauPt, m_tauEta); - if( doPrint ) ATH_MSG_DEBUG("Systematic tau pt " <<sysname <<" " - <<p->pt() <<" " <<ptorig <<" " - <<static_cast<int>(p->auxdata<char>("baseline"))); - if( p->auxdata<char>("baseline") ){ - if( doPrint && sysname == "Nominal" ){ - ATH_MSG_DEBUG("Accepted Nominal tau pt " <<p->pt()); - } - (*tauCutMask)[pIndex] = true; - } - ++pIndex; - } - } - - // TauJets thinning - CHECK( m_thinningSvc->filter(*p_TauJets, *tauCutMask, - IThinningSvc::Operator::Or) ); - for(auto si : m_systInfoTAU){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - const xAOD::TauJetContainer* taujets = 0; - CHECK( evtStore()->retrieve(taujets, m_TauJetsName+sysname) ); - CHECK( m_thinningSvc->filter(*taujets, *tauCutMask, - IThinningSvc::Operator::Or) ); - } - - - ////////// - // Photons - ////////// - - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - - // Selection defined by SUSYTools PhotonID = Loose/Medium/Tight. - // Initialize mask to false; true if any variation passes "baseline" - std::vector<bool>* phoCutMask = new std::vector<bool>(p_Photons->size(),false); - CHECK( evtStore()->record(phoCutMask, m_PhotonCutMaskName) ); - - for(auto si : m_systInfoPHO){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - if( doPrint ) ATH_MSG_DEBUG("Applying photon systematic " <<sysname); - CHECK(m_objTool->applySystematicVariation(sys) == StatusCode::SUCCESS); - - // This largely replicates GetPhotons - // setShallowIO writes output as shallow copy - std::pair<xAOD::PhotonContainer*, xAOD::ShallowAuxContainer*> cpPair = - xAOD::shallowCopyContainer(*p_Photons); - xAOD::PhotonContainer* cpPhotons = cpPair.first; - xAOD::ShallowAuxContainer* cpAux = cpPair.second; - cpAux->setShallowIO( true ); - if( !xAOD::setOriginalObjectLink(*p_Photons, *cpPhotons) ){ - ATH_MSG_ERROR("Failed setOriginalObjectLink"); - return StatusCode::FAILURE; - } - CHECK( evtStore()->record(cpPhotons, m_PhotonsName+sysname) ); - CHECK( evtStore()->record(cpAux, m_PhotonsName+sysname+"Aux.") ); - if( doPrint ) ATH_MSG_DEBUG("Recorded photon shallow copy + aux for " - <<m_PhotonsName+sysname); - - unsigned int pIndex = 0; - for(const auto& p : *cpPhotons){ - float ptorig = (*p_Photons)[pIndex]->pt(); - CHECK( m_objTool->FillPhoton(*p, m_photonBaselinePt, m_photonEta) ); - bool issig = m_objTool->IsSignalPhoton(*p, m_photonPt); - if( doPrint ) ATH_MSG_DEBUG("Systematic photon pt " <<sysname <<" " - <<p->pt() <<" " <<ptorig <<" " - <<static_cast<int>(p->auxdata<char>("baseline")) <<" " - <<issig); - if( p->auxdata<char>("baseline") ){ - if( doPrint && sysname == "Nominal" ){ - ATH_MSG_DEBUG("Accepted Nominal photon pt " <<p->pt()); - } - (*phoCutMask)[pIndex] = true; - } - ++pIndex; - } - } - - // Photons thinning - CHECK( m_thinningSvc->filter(*p_Photons, *phoCutMask, - IThinningSvc::Operator::Or) ); - for(auto si : m_systInfoPHO){ - const CP::SystematicSet& sys = si->systset; - std::string sysname = sys.name(); - if( sysname == "" ) sysname = "Nominal"; - const xAOD::PhotonContainer* photons = 0; - CHECK( evtStore()->retrieve(photons, m_PhotonsName+sysname) ); - CHECK( m_thinningSvc->filter(*photons, *phoCutMask, - IThinningSvc::Operator::Or) ); - } - - - /////////////// - // InDet Tracks - /////////////// - - // Keep InDet tracks associated with selected objects. - - const xAOD::TrackParticleContainer* p_Tracks = 0; - CHECK( evtStore()->retrieve(p_Tracks, m_InDetTracksName) ); - - // Initialize mask - std::vector<bool>* trkCutMask = new std::vector<bool>(p_Tracks->size(),false); - CHECK( evtStore()->record(trkCutMask, m_InDetCutMaskName) ); - - // Jet ghost-associated tracks. Require pt > m_inDetPtCut and - // Npix>=1, NSCT>=6, d0<1.5, dz0*sin(theta)<1.5 - int nTrkJet = 0; - int nTrkTot = 0; - - for(unsigned int j=0; j<p_Jets->size(); ++j){ - if( !(*jetCutMask)[j] ) continue; - const xAOD::Jet* jet = (*p_Jets)[j]; - std::vector<const xAOD::IParticle*> ghosts = - jet->getAssociatedObjects<xAOD::IParticle>(xAOD::JetAttribute::GhostTrack); - for(const auto& gh : ghosts){ - const xAOD::TrackParticle* ptrk = dynamic_cast<const xAOD::TrackParticle*>(gh); - // ptrk==0 if track has been thinned - if( !ptrk ){ - if( doPrint ) ATH_MSG_DEBUG("Could not cast ghost to track!"); - continue; - } - if( ptrk->pt() < m_inDetPtCut ){ - if( doPrint ) ATH_MSG_VERBOSE("JETTRACK fail pt " <<ptrk->pt()); - continue; - } - size_t idx = ptrk->index(); - uint8_t pix = 0; - ptrk->summaryValue(pix, xAOD::numberOfPixelHits); - uint8_t sct = 0; - ptrk->summaryValue(sct, xAOD::numberOfSCTHits); - if( pix < 1 || sct < 6 ){ - if( doPrint ) ATH_MSG_VERBOSE("JETTRACK fail hits " <<pix <<" " <<sct); - continue; - } - float dz0 = ptrk->z0() + ptrk->vz() - z0PV; - dz0 = dz0/cosh(ptrk->eta()); - if( ptrk->d0() > 1.5 || dz0 > 1.5 ){ - if( doPrint ) ATH_MSG_VERBOSE("JETTRACK fail vtx " <<ptrk->d0() <<" " <<dz0); - continue; - } - (*trkCutMask)[idx] = true; - ++nTrkJet; - } - } - nTrkTot = nTrkJet; - - // Electron tracks - // trackParticle() gives GSFTrackParticles, not InDetTrackParticles - // Select latter with DeltaR - - const static float elMatchR = 0.05; - - for(unsigned int j=0; j<p_Electrons->size(); ++j){ - if( !(*elCutMask)[j] ) continue; - const xAOD::Electron* el = (*p_Electrons)[j]; - for(const auto& ptrk : (*p_Tracks)){ - if( !ptrk ) continue; - if( el->p4().DeltaR(ptrk->p4()) > elMatchR ) continue; - size_t idx = ptrk->index(); - (*trkCutMask)[idx] = true; - ++nTrkTot; - } - } - - // Muon tracks - just keep ID particle - // No additional cuts beyond Muon reconstruction - - for(unsigned int j=0; j<p_Muons->size(); ++j){ - if( !(*muCutMask)[j] ) continue; - const xAOD::Muon* mu = (*p_Muons)[j]; - const xAOD::TrackParticle* ptrk = - mu->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); - if( !ptrk ) continue; - size_t idx = ptrk->index(); - (*trkCutMask)[idx] = true; - ++nTrkTot; - } - - // TauJet tracks - // No additional cuts beyond TauJet reconstruction - // Serban: only need trackLinks() for physics, not wide/other tracks - - for(unsigned int j=0; j<p_TauJets->size(); ++j){ - if( !(*tauCutMask)[j] ) continue; - const auto& tpLinks = (*p_TauJets)[j]->tauTrackLinks(); - int nTrkTau = 0; - for(const auto& tpLink : tpLinks){ - if( !tpLink.isValid() ) continue; - size_t idx = (*tpLink)->index(); - (*trkCutMask)[idx] = true; - ++nTrkTot; - ++nTrkTau; - } - if( doPrint ) ATH_MSG_DEBUG("nTrkTau = " <<nTrkTau); - } - - // Call thinningSvc for tracks - if( doPrint ) ATH_MSG_DEBUG("InDet tracks passed " <<nTrkJet <<" " - <<nTrkTot <<" " <<p_Tracks->size()); - CHECK( m_thinningSvc->filter(*p_Tracks, *trkCutMask, - IThinningSvc::Operator::Or) ); - - - ////////////////////////// - // GSF Tracks and Vertices - ////////////////////////// - - // Keep GSF tracks associated with selected objects. - // Also need GSF vertices (Photons have vertices which have tracks) - - const xAOD::TrackParticleContainer* p_gsfTracks = 0; - CHECK( evtStore()->retrieve(p_gsfTracks, m_GSFTracksName) ); - std::vector<bool>* gsfTrackCutMask = new std::vector<bool>(p_gsfTracks->size(),false); - CHECK( evtStore()->record(gsfTrackCutMask, m_GSFTrackCutMaskName) ); - - const xAOD::VertexContainer* p_gsfVertices = 0; - CHECK( evtStore()->retrieve(p_gsfVertices, "GSFConversionVertices") ); - std::vector<bool>* gsfVertexCutMask = new std::vector<bool>(p_gsfVertices->size(),false); - CHECK( evtStore()->record(gsfVertexCutMask, m_GSFVertexCutMaskName) ); - - for(unsigned int j=0; j<p_Electrons->size(); ++j){ - if( !(*elCutMask)[j] ) continue; - const xAOD::Electron* el = (*p_Electrons)[j]; - size_t ntrk = el->nTrackParticles(); - for(unsigned int it=0; it<ntrk; ++it){ - const xAOD::TrackParticle* ptrk = el->trackParticle(it); - if( !ptrk ) continue; - if( ptrk->pt() < m_inDetPtCut ) continue; - int idx = ptrk->index(); - (*gsfTrackCutMask)[idx] = true; - } - } - - for(unsigned int j=0; j<p_Photons->size(); ++j){ - if( !(*elCutMask)[j] ) continue; - const xAOD::Photon* ph = (*p_Photons)[j]; - // GSF vertices - for(const auto& vxLink : ph->vertexLinks()){ - if( !vxLink.isValid() ) continue; - const xAOD::Vertex* vtx = (*vxLink); - (*gsfVertexCutMask)[vtx->index()] = true; - // GSF tracks from vertices - for(const auto& trkLink : vtx->trackParticleLinks()){ - if( !trkLink.isValid() ) continue; - const xAOD::TrackParticle* ptrk = (*trkLink); - (*gsfTrackCutMask)[ptrk->index()] = true; - } - } - } - - // Do thinning - CHECK( m_thinningSvc->filter(*p_gsfTracks, *gsfTrackCutMask, - IThinningSvc::Operator::Or) ); - CHECK( m_thinningSvc->filter(*p_gsfVertices, *gsfVertexCutMask, - IThinningSvc::Operator::Or) ); - - - ///////////// - // Truth Jets - ///////////// - - // SZ - TRUTH JETS MISSING IN R21 xAODs - commenting out for now - // Only for Monte Carlo - /*if( m_TruthJetsName != "" && m_isData==0 ){ - const xAOD::JetContainer* p_TruthJets = 0; - CHECK( evtStore()->retrieve(p_TruthJets, m_TruthJetsName) ); - if( doPrint ) ATH_MSG_DEBUG("Got p_TruthJets size = " <<p_TruthJets->size()); - - std::vector<bool>* truthJetCutMask = new std::vector<bool>(p_TruthJets->size(),false); - CHECK( evtStore()->record(truthJetCutMask, m_TruthJetCutMaskName) ); - - unsigned int pIndex = 0; - for(const auto& p : *p_TruthJets){ - if( p->pt() > m_jetPtCut ) (*truthJetCutMask)[pIndex] = true; - ++pIndex; - } - - CHECK( m_thinningSvc->filter(*p_TruthJets, *truthJetCutMask, - IThinningSvc::Operator::Or) ); - }//end m_TruthJetsName - */ - - ////////// - // Trigger - ////////// - - // DerivationFramework trigger thinning is complicated. Just support - // TrigDecisionTool and flag matched Electrons and Muons. - CHECK( m_objTool->resetSystematics() == StatusCode::SUCCESS ); - if( doPrint ) ATH_MSG_DEBUG("Start trigger"); - - for( const auto& key : m_ElectronTrigs ){ - if( doPrint ) ATH_MSG_DEBUG("e trigger " <<key); - SG::AuxElement::Decorator<char>dec_match("match"+key); - for(const auto& p : (*p_Electrons) ){ - dec_match(*p) = m_objTool->IsTrigMatched(p, key); - if( doPrint ) ATH_MSG_DEBUG("e match " <<p->pt() <<" " <<p->eta() <<" " - <<static_cast<int>(dec_match(*p))); - } - } - - for( const auto& key : m_MuonTrigs ){ - if( doPrint ) ATH_MSG_DEBUG("mu trigger " <<key); - SG::AuxElement::Decorator<char>dec_match("match"+key); - for(const auto& p : (*p_Muons) ){ - dec_match(*p) = m_objTool->IsTrigMatched(p, key); - if( doPrint ) ATH_MSG_DEBUG("mu match " <<p->pt() <<" " <<p->eta() <<" " - <<static_cast<int>(dec_match(*p))); - } - } - - for( const auto& key : m_PhotonTrigs ){ - if( doPrint ) ATH_MSG_DEBUG("e trigger " <<key); - SG::AuxElement::Decorator<char>dec_match("match"+key); - for(const auto& p : (*p_Photons) ){ - dec_match(*p) = m_objTool->IsTrigMatched(p, key); - if( doPrint ) ATH_MSG_DEBUG("g match " <<p->pt() <<" " <<p->eta() <<" " - <<static_cast<int>(dec_match(*p))); - } - } - - /////// - // Done - /////// - - // Cleanup handled by StoreGate - if( doPrint ) ATH_MSG_DEBUG("End ApplySUSYTools for event " <<m_evtCount); - return StatusCode::SUCCESS; - -} //end execute() - -} //end ST namespace - diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/ApplySUSYTools.h b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/ApplySUSYTools.h deleted file mode 100644 index db9462bcfed4b265903116ce0a8dce7ab708c570..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/ApplySUSYTools.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// ApplySUSYTools.h -// Header file for class ApplySUSYTools -// Author: Frank Paige <paige@bnl.gov> -// -// ApplySUSYTools is algorithm to apply SUSYTools in AthAnalysisBase, -// producing shallow copies with nominal calibration and systematic -// variations for jets, electrons, muons, and MET. -// -// Also produces vector<bool>, true if nominal or any systematic pass -// "baseline" selection, and uses it to thin objects. -// -/////////////////////////////////////////////////////////////////// - -#ifndef ST_APPLYSUSYTOOLS_H -#define ST_APPLYSUSYTOOLS_H 1 - -// Base class -#include "AthenaBaseComps/AthAlgorithm.h" - -// Handles on the tools -#include "AsgTools/AnaToolHandle.h" - -// Handle on the thinning service -#include "GaudiKernel/ServiceHandle.h" - -// SUSYTools interface -// Include needed for SystInfo -#include "SUSYTools/ISUSYObjDef_xAODTool.h" - -// STL includes -#include <vector> -#include <string> - -// For the thinning service -class IThinningSvc; - -// Need truth matching for TauJet CP tools -namespace TauAnalysisTools { - class ITauTruthMatchingTool; -} - -namespace ST { - -class ApplySUSYTools - : public ::AthAlgorithm -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// -public: - - // Copy constructor: - - /// Constructor with parameters: - ApplySUSYTools( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~ApplySUSYTools(); - - // Assignment operator: - //ApplySUSYTools &operator=(const ApplySUSYTools &alg); - - // Athena algorithm Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// -private: - - - bool m_doFatJets; - - - // Parameters read by SUSYTools from SUSYTools_Default.conf - // We repeat here those passed through GetElectrons, etc. - double m_eleBaselinePt; - double m_elePt; - double m_eleEta; - double m_eled0sig; - double m_elez0; - - double m_muBaselinePt; - double m_muPt; - double m_muEta; - double m_mud0sig; - double m_muz0; - double m_muCosmicz0; - double m_muCosmicd0; - - double m_photonBaselinePt; - double m_photonEta; - double m_photonPt; - - double m_tauPt; - double m_tauEta; - - double m_jetPt; - double m_jetEta; - double m_jetJvt; - double m_badjetJvt; - - // Counters - int m_evtCount; //! - int m_maxCount; - - // Cuts - float m_jetPtCut; // Hard coded >=20GeV in FillJet - float m_inDetPtCut; - - // Flags - bool m_doTST; - int m_isData; - - - - // StoreGate keys - std::string m_MuonsName; - std::string m_MuonSpecTPName; - std::string m_ElectronsName; - std::string m_JetsName; - std::string m_FatJetsName; - std::string m_BTagName; - std::string m_TruthJetsName; - std::string m_METsName; - std::string m_MuonCutMaskName; - std::string m_MuonSpecCutMaskName; - std::string m_ElectronCutMaskName; - std::string m_JetCutMaskName; - std::string m_TruthJetCutMaskName; - std::string m_InDetTracksName; - std::string m_InDetCutMaskName; - std::string m_GSFTracksName; - std::string m_GSFTrackCutMaskName; - std::string m_GSFVerticesName; - std::string m_GSFVertexCutMaskName; - std::string m_TauJetsName; - std::string m_TauJetCutMaskName; - std::string m_PhotonsName; - std::string m_PhotonCutMaskName; - - std::vector< std::string > m_ElectronTrigs; - std::vector< std::string > m_MuonTrigs; - std::vector< std::string > m_PhotonTrigs; - - std::string m_configFile; - - // SUSYTools object - asg::AnaToolHandle< ISUSYObjDef_xAODTool > m_objTool; - // Tau tools that we need direct handles on - asg::AnaToolHandle< TauAnalysisTools::ITauTruthMatchingTool > m_tauTruthTool; - - // SUSYTools systematics - std::vector< SystInfo > m_systInfoList; //! - std::vector< const SystInfo* > m_systInfoJET; //! - std::vector< const SystInfo* > m_systInfoELE; //! - std::vector< const SystInfo* > m_systInfoMUON; //! - std::vector< const SystInfo* > m_systInfoTST; //! - std::vector< const SystInfo* > m_systInfoCST; //! - std::vector< const SystInfo* > m_systInfoTAU; //! - std::vector< const SystInfo* > m_systInfoPHO; //! - - /// Pointer to IThinningSvc - ServiceHandle<IThinningSvc> m_thinningSvc; - -}; - - -} //end namespace ST - -#endif //ST_APPLYSUSYTOOLS_H - diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.cxx index deefd3b281ddfcb73afa67c719a9d692e2337ad5..fa0ccfedf9e2edcc610cf547cc5b66870f543fae 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // SUSYToolsAlg.cxx @@ -42,11 +42,11 @@ #endif // For output of histograms -#include "TH1F.h" -#include "TH2F.h" +#include "TH1.h" +#include "TH2.h" #include "TFile.h" #include "TEfficiency.h" -#include <AnaAlgorithm/IHistogramWorker.h> +//#include <AnaAlgorithm/IHistogramWorker.h> // For configuration #include "TString.h" @@ -73,27 +73,17 @@ int getSize(std::map<std::string,std::vector<std::string>> &collection, const st SUSYToolsAlg::SUSYToolsAlg(const std::string& name, ISvcLocator* pSvcLocator ) : EL::AnaAlgorithm (name, pSvcLocator) - , m_SUSYTools("") - , m_tauTruthMatchingTool("") + , m_SUSYTools("ST::SUSYObjDef_xAOD/SUSYTools",this) + , m_tauTruthMatchingTool("TauAnalysisTools::TauTruthMatchingTool/TauTruthMatchingTool") , m_Nevts(0) - , m_kernel("") + , m_kernel("StreamDAOD") , m_configFile("SUSYTools/SUSYTools_Default.conf") { - declareProperty( "DataSource", m_dataSource = 1 ); //default is fullsim = 1 declareProperty( "DoSyst", m_doSyst = false ); - - declareProperty( "STConfigFile", m_configFile ); - // - declareProperty( "PRWConfigs", m_PRWConfigs ); - declareProperty( "PRWLumiCalc", m_PRWLumiCalcFiles ); - declareProperty( "UsePRWAutoconfig", m_usePRWAutoconfig = false ); - declareProperty( "mcCampaign", m_mcCampaign = "" ); - declareProperty( "mcChannel", m_mcChannel = -99 ); declareProperty( "GRLFiles", m_GRLFiles ); declareProperty( "maxEvts", m_maxEvts = -999 ); declareProperty( "LumiBlockFilter", m_lbfilter = 90 ); - declareProperty( "isPHYSLITE", isPHYSLITE = false); // asg Tool Handles must be dealt with differently @@ -110,27 +100,14 @@ SUSYToolsAlg::~SUSYToolsAlg() { } StatusCode SUSYToolsAlg::initialize() { ATH_MSG_INFO("Initializing " << name() << "..."); - //--- ST config and retrieval - ATH_CHECK( m_SUSYTools.setProperty("DataSource",m_dataSource) ); - ATH_CHECK(m_SUSYTools.setProperty("PRWLumiCalcFiles", m_PRWLumiCalcFiles) ); - ATH_CHECK(m_SUSYTools.setProperty("OutputLevel", this->msg().level()) ); - ATH_CHECK(m_SUSYTools.setProperty("DebugMode", (static_cast<int>(this->msg().level())<3?true:false ))); - if (m_usePRWAutoconfig){ - ATH_CHECK(m_SUSYTools.setProperty("AutoconfigurePRWTool", true) ); - ATH_CHECK(m_SUSYTools.setProperty("mcCampaign", m_mcCampaign) ); - ATH_CHECK(m_SUSYTools.setProperty("mcChannel", m_mcChannel) ); - } else { - ATH_CHECK(m_SUSYTools.setProperty("PRWConfigFiles", m_PRWConfigs) ); - } - // - ATH_CHECK(m_SUSYTools.setProperty("ConfigFile", m_configFile) ); - m_SUSYTools.setTypeAndName("ST::SUSYObjDef_xAOD/SUSYTools"); - if (isPHYSLITE) { - ATH_CHECK(m_SUSYTools.setProperty("IsPHYSLITE", true) ); - } ATH_CHECK(m_SUSYTools.retrieve()); ATH_MSG_INFO("Retrieved tool: " << m_SUSYTools->name() ); + // read some of the property values (may have been autoconfigured at this point) + m_mcCampaign = *(m_SUSYTools->getProperty<std::string>("mcCampaign")); + m_isPHYSLITE = *(m_SUSYTools->getProperty<bool>("IsPHYSLITE")); + + // Need truth matching for tau CP tools if( !m_SUSYTools->isData() ){ m_tauTruthMatchingTool.setTypeAndName("TauAnalysisTools::TauTruthMatchingTool/TauTruthMatchingTool"); @@ -212,7 +189,7 @@ StatusCode SUSYToolsAlg::initialize() { m_triggers["ph"] = {}; m_triggers["ph"].push_back("HLT_g140_loose_L1EM22VHI"); - m_triggers["ph"].push_back("HLT_g300_etcut_L1EM22VHI"); + m_triggers["ph"].push_back("HLT_g300_L1EM22VHI"); // HLT_g300_etcut_L1EM22VHI not working in mc21 m_triggers["mu"] = {}; m_triggers["mu"].push_back("HLT_mu24_ivarmedium_L1MU14FCH"); @@ -346,7 +323,7 @@ StatusCode SUSYToolsAlg::execute() { // get EventInfo const xAOD::EventInfo* evtInfo(0); ATH_CHECK( evtStore()->retrieve(evtInfo, "EventInfo") ); - bool isData = ( m_dataSource == 0 ); + bool isData = m_SUSYTools->isData(); // manual max events within lumiblock selection (on top of Nevts) if (m_maxEvts>=-1 && (evtInfo->lumiBlock() != (unsigned int)m_lbfilter)) return StatusCode::SUCCESS; @@ -405,28 +382,28 @@ StatusCode SUSYToolsAlg::execute() { xAOD::ElectronContainer* electrons_nominal(0); xAOD::ShallowAuxContainer* electrons_nominal_aux(0); if (m_slices["ele"]) { - ATH_CHECK( m_SUSYTools->GetElectrons(electrons_nominal, electrons_nominal_aux,true, isPHYSLITE?"AnalysisElectrons":"Electrons") ); + ATH_CHECK( m_SUSYTools->GetElectrons(electrons_nominal, electrons_nominal_aux,true, m_isPHYSLITE?"AnalysisElectrons":"Electrons") ); ATH_MSG_DEBUG( "Number of electrons: " << electrons_nominal->size() ); } xAOD::PhotonContainer* photons_nominal(0); xAOD::ShallowAuxContainer* photons_nominal_aux(0); if (m_slices["pho"]) { - ATH_CHECK( m_SUSYTools->GetPhotons(photons_nominal, photons_nominal_aux, true, isPHYSLITE?"AnalysisPhotons":"Photons") ); + ATH_CHECK( m_SUSYTools->GetPhotons(photons_nominal, photons_nominal_aux, true, m_isPHYSLITE?"AnalysisPhotons":"Photons") ); ATH_MSG_DEBUG( "Number of photons: " << photons_nominal->size() ); } xAOD::MuonContainer* muons_nominal(0); xAOD::ShallowAuxContainer* muons_nominal_aux(0); if (m_slices["mu"]) { - ATH_CHECK( m_SUSYTools->GetMuons(muons_nominal, muons_nominal_aux, true, isPHYSLITE?"AnalysisMuons":"Muons") ); + ATH_CHECK( m_SUSYTools->GetMuons(muons_nominal, muons_nominal_aux, true, m_isPHYSLITE?"AnalysisMuons":"Muons") ); ATH_MSG_DEBUG( "Number of muons: " << muons_nominal->size() ); } xAOD::JetContainer* jets_nominal(0); xAOD::ShallowAuxContainer* jets_nominal_aux(0); if (m_slices["jet"]) { - ATH_CHECK( m_SUSYTools->GetJets(jets_nominal, jets_nominal_aux, true, isPHYSLITE?"AnalysisJets":"") ); + ATH_CHECK( m_SUSYTools->GetJets(jets_nominal, jets_nominal_aux, true, m_isPHYSLITE?"AnalysisJets":"") ); ATH_MSG_DEBUG( "Number of jets: " << jets_nominal->size() ); } @@ -499,13 +476,13 @@ StatusCode SUSYToolsAlg::execute() { xAOD::TauJetContainer* taus_nominal(0); xAOD::ShallowAuxContainer* taus_nominal_aux(0); if (m_slices["tau"]) { - if (!isData && !isPHYSLITE) { + if (!isData && !m_isPHYSLITE) { ATH_CHECK( evtStore()->retrieve(taus_gettruth,"TauJets") ); for(const auto& tau : *taus_gettruth) { m_tauTruthMatchingTool->getTruth(*tau); } } - ATH_CHECK( m_SUSYTools->GetTaus(taus_nominal, taus_nominal_aux, true, isPHYSLITE?"AnalysisTauJets":"TauJets") ); + ATH_CHECK( m_SUSYTools->GetTaus(taus_nominal, taus_nominal_aux, true, m_isPHYSLITE?"AnalysisTauJets":"TauJets") ); ATH_MSG_DEBUG( "Number of taus: " << taus_nominal->size() ); } @@ -590,9 +567,11 @@ StatusCode SUSYToolsAlg::execute() { bool passit = ((isRun3Trig||t.find("_L1")==std::string::npos) ? m_SUSYTools->IsTrigMatched(el, t) : false); passTM |= passit; if(passit) el_trigmatch_eff_nominal->SetBinContent(idx, el_trigmatch_eff_nominal->GetBinContent(idx)+1); + #ifdef XAOD_STANDALONE m_heffs["Trigger/el_pt_"+t]->Fill(passit,el->pt()/1000.); m_heffs["Trigger/el_eta_"+t]->Fill(passit,el->eta()); m_heffs["Trigger/el_phi_"+t]->Fill(passit,el->phi()); + #endif idx++; } if(passTM) el_n_flow_nominal->Fill(Cut::trigmatch); @@ -633,9 +612,11 @@ StatusCode SUSYToolsAlg::execute() { bool passit = ((isRun3Trig||t.find("_L1")==std::string::npos) ? m_SUSYTools->IsTrigMatched(ph, t) : false); passTM |= passit; if(passit) ph_trigmatch_eff_nominal->SetBinContent(idx, ph_trigmatch_eff_nominal->GetBinContent(idx)+1); + #ifdef XAOD_STANDALONE m_heffs["Trigger/ph_pt_"+t]->Fill(passit,ph->pt()/1000.); m_heffs["Trigger/ph_eta_"+t]->Fill(passit,ph->eta()); m_heffs["Trigger/ph_phi_"+t]->Fill(passit,ph->phi()); + #endif idx++; } if (passTM) ph_n_flow_nominal->Fill(Cut::trigmatch); @@ -676,9 +657,11 @@ StatusCode SUSYToolsAlg::execute() { bool passit = ((isRun3Trig||t.find("_L1")==std::string::npos) ? m_SUSYTools->IsTrigMatched(mu, t) : false); passTM |= passit; if(passit) mu_trigmatch_eff_nominal->SetBinContent(idx, mu_trigmatch_eff_nominal->GetBinContent(idx)+1); + #ifdef XAOD_STANDALONE m_heffs["Trigger/mu_pt_"+t]->Fill(passit,mu->pt()/1000.); m_heffs["Trigger/mu_eta_"+t]->Fill(passit,mu->eta()); m_heffs["Trigger/mu_phi_"+t]->Fill(passit,mu->phi()); + #endif idx++; } if(passTM) mu_n_flow_nominal->Fill(Cut::trigmatch); @@ -962,7 +945,7 @@ StatusCode SUSYToolsAlg::execute() { ATH_MSG_DEBUG("Get systematics-varied electrons"); xAOD::ElectronContainer* electrons_syst(0); xAOD::ShallowAuxContainer* electrons_syst_aux(0); - ATH_CHECK( m_SUSYTools->GetElectrons(electrons_syst, electrons_syst_aux, true , isPHYSLITE?"AnalysisElectrons":"Electrons") ); + ATH_CHECK( m_SUSYTools->GetElectrons(electrons_syst, electrons_syst_aux, true , m_isPHYSLITE?"AnalysisElectrons":"Electrons") ); electrons = electrons_syst; } @@ -970,7 +953,7 @@ StatusCode SUSYToolsAlg::execute() { ATH_MSG_DEBUG("Get systematics-varied photons"); xAOD::PhotonContainer* photons_syst(0); xAOD::ShallowAuxContainer* photons_syst_aux(0); - ATH_CHECK( m_SUSYTools->GetPhotons(photons_syst, photons_syst_aux, true, isPHYSLITE?"AnalysisPhotons":"Photons") ); + ATH_CHECK( m_SUSYTools->GetPhotons(photons_syst, photons_syst_aux, true, m_isPHYSLITE?"AnalysisPhotons":"Photons") ); photons = photons_syst; } @@ -978,7 +961,7 @@ StatusCode SUSYToolsAlg::execute() { ATH_MSG_DEBUG("Get systematics-varied muons"); xAOD::MuonContainer* muons_syst(0); xAOD::ShallowAuxContainer* muons_syst_aux(0); - ATH_CHECK( m_SUSYTools->GetMuons(muons_syst, muons_syst_aux, true, isPHYSLITE?"AnalysisMuons":"Muons") ); + ATH_CHECK( m_SUSYTools->GetMuons(muons_syst, muons_syst_aux, true, m_isPHYSLITE?"AnalysisMuons":"Muons") ); muons = muons_syst; } @@ -987,7 +970,7 @@ StatusCode SUSYToolsAlg::execute() { ATH_MSG_DEBUG("Get systematics-varied jets"); xAOD::JetContainer* jets_syst(0); xAOD::ShallowAuxContainer* jets_syst_aux(0); - ATH_CHECK( m_SUSYTools->GetJetsSyst(*jets_nominal, jets_syst, jets_syst_aux, true, isPHYSLITE?"AnalysisJets":"") ); + ATH_CHECK( m_SUSYTools->GetJetsSyst(*jets_nominal, jets_syst, jets_syst_aux, true, m_isPHYSLITE?"AnalysisJets":"") ); jets = jets_syst; } if (m_slices["fatjet"]) { @@ -1010,7 +993,7 @@ StatusCode SUSYToolsAlg::execute() { ATH_MSG_DEBUG("Get systematics-varied taus"); xAOD::TauJetContainer* taus_syst(0); xAOD::ShallowAuxContainer* taus_syst_aux(0); - ATH_CHECK( m_SUSYTools->GetTaus(taus_syst, taus_syst_aux,true, isPHYSLITE?"AnalysisTauJets":"TauJets") ); + ATH_CHECK( m_SUSYTools->GetTaus(taus_syst, taus_syst_aux,true, m_isPHYSLITE?"AnalysisTauJets":"TauJets") ); taus = taus_syst; } @@ -1169,7 +1152,7 @@ StatusCode SUSYToolsAlg::execute() { else{ btag_weight = m_SUSYTools->BtagSF(jets); size_t iwbin = find(syst_weights["BTag"].begin(), syst_weights["BTag"].end(), sys.name()) - syst_weights["BTag"].begin(); - if(iwbin < syst_weights["BTag"].size()) { weight_btags->SetBinContent(iwbin+1, weight_jets->GetBinContent(iwbin+1)+btag_weight); } + if(iwbin < syst_weights["BTag"].size()) { weight_btags->SetBinContent(iwbin+1, weight_btags->GetBinContent(iwbin+1)+btag_weight); } } if(isNominal){ //JVT @@ -1185,7 +1168,10 @@ StatusCode SUSYToolsAlg::execute() { if(iwbin < syst_weights["Jet"].size()) { weight_jets->SetBinContent(iwbin+1, weight_jets->GetBinContent(iwbin+1)+jet_weight); } } } - + else{ //data + weight_jets->SetBinContent(1, 1.); + weight_btags->SetBinContent(1, 1.); + } event_weight *= jet_weight; event_weight *= btag_weight; ATH_MSG_DEBUG("Combined b-tagging scale factor: " << btag_weight); @@ -1372,18 +1358,21 @@ StatusCode SUSYToolsAlg::bookHistograms(void) { } } - // Trigger histograms + #ifdef XAOD_STANDALONE + //// Trigger histograms for (std::string obj : {"el","mu","ph"}) { - for (const auto& trg : m_triggers[obj]) { - for (std::string var : {"pt","eta","phi"} ) { - std::string key = "Trigger/"+obj+"_"+var+"_"+trg; - std::string labels = ";"+labels_objects[obj]+" "+cfg_hist_labels[var][0]+";Efficiency "+trg; - m_heffs[key] = new TEfficiency(key.c_str(), labels.c_str(), cfg_hist_nbins[var], cfg_hist_minmax[var][0], cfg_hist_minmax[var][1]); - histogramWorker()->addOutput(m_heffs[key]); - ATH_MSG_INFO("Defined histogram: " << key.c_str() << ", " << m_heffs[key]); - } - } + for (auto trg : m_triggers[obj]) { + for (std::string var : {"pt","eta","phi"} ) { + std::string key = "Trigger/"+obj+"_"+var+"_"+trg; + std::string labels = ";"+labels_objects[obj]+" "+cfg_hist_labels[var][0]+";Efficiency "+trg; + ATH_CHECK(book(TEfficiency(key.c_str(), labels.c_str(), cfg_hist_nbins[var], cfg_hist_minmax[var][0], cfg_hist_minmax[var][1]))); + m_heffs[key] = histeff(key); + ATH_MSG_INFO("Defined histogram: " << key.c_str() << ", " << m_heffs[key]); + } + } } + #endif + ATH_CHECK( book(TH1D("Trigger/el_trigmatch_eff_nominal", "Electron Trigger Matching Efficiency (Nominal);Electron Trigger Matching Efficiency (Nominal);N", getSize(m_triggers,"el"), 0, getSize(m_triggers,"el")) ) ); ATH_CHECK( book(TH1D("Trigger/ph_trigmatch_eff_nominal", "Photon Trigger Matching Efficiency (Nominal);Photon Trigger Matching Efficiency (Nominal);N", getSize(m_triggers,"ph"), 0, getSize(m_triggers,"ph")) ) ); ATH_CHECK( book(TH1D("Trigger/mu_trigmatch_eff_nominal", "Muon Trigger Matching Efficiency (Nominal);Muon Trigger Matching Efficiency (Nominal);N", getSize(m_triggers,"mu"), 0, getSize(m_triggers,"mu")) ) ); @@ -1490,7 +1479,7 @@ void SUSYToolsAlg::stdHistsForObj(xAOD::IParticle *obj, const std::string& objty hist(dir+objtype+"_"+objlevel+"_truthType")->Fill( obj->auxdata<int>("truthType") ); hist(dir+objtype+"_"+objlevel+"_truthOrigin")->Fill( obj->auxdata<int>("truthOrigin") ); } else { - if(!isPHYSLITE){ + if(!m_isPHYSLITE){ bool istruthmatched = (bool)obj->auxdata<char>("IsTruthMatched"); int pid(0),ppid(0); if (istruthmatched && obj->isAvailable<ElementLink<xAOD::TruthParticleContainer>>("truthParticleLink")) { diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.h b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.h index d573d0f56644937a5dc8af0544996b2d16cccc2f..3126dbae45c930395c7d0dd7bccfbb9f6c8c9d3a 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.h +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/SUSYToolsAlg.h @@ -60,13 +60,8 @@ class SUSYToolsAlg : public EL::AnaAlgorithm { void stdHistsForObj(xAOD::IParticle *obj, const std::string& objtype, const std::string& objlevel, std::map<std::string,std::string> config = std::map<std::string,std::string>()); // configuration and main tools - int m_dataSource; - bool m_usePRWAutoconfig; - std::vector<std::string> m_PRWConfigs; - std::vector<std::string> m_PRWLumiCalcFiles; std::vector<std::string> m_GRLFiles; std::string m_mcCampaign; - int m_mcChannel; std::map<std::string,bool> m_slices; std::map<std::string,TH1*> m_hists; std::map<std::string,TEfficiency*> m_heffs; @@ -79,7 +74,7 @@ class SUSYToolsAlg : public EL::AnaAlgorithm { unsigned int m_Nevts; int m_maxEvts; int m_lbfilter; - bool isPHYSLITE; + bool m_isPHYSLITE; std::string m_kernel; std::string m_configFile; std::string m_FatJetCollection; diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/components/SUSYTools_entries.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/components/SUSYTools_entries.cxx index f5c9cdc1ebf2dbd12f8fa8ad2496176e0e404e99..8db03f3002251beb4266f7fa7b0da7a79d38914e 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/src/components/SUSYTools_entries.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/src/components/SUSYTools_entries.cxx @@ -1,15 +1,5 @@ -#include "GaudiKernel/DeclareFactoryEntries.h" - #include "SUSYTools/SUSYObjDef_xAOD.h" #include "../SUSYToolsAlg.h" -#include "../ApplySUSYTools.h" - -DECLARE_NAMESPACE_TOOL_FACTORY(ST, SUSYObjDef_xAOD) -DECLARE_ALGORITHM_FACTORY(SUSYToolsAlg) -DECLARE_NAMESPACE_ALGORITHM_FACTORY(ST, ApplySUSYTools) -DECLARE_FACTORY_ENTRIES(SUSYTools) { - DECLARE_NAMESPACE_TOOL(ST, SUSYObjDef_xAOD) - DECLARE_ALGORITHM(SUSYToolsAlg) - DECLARE_NAMESPACE_ALGORITHM(ST, ApplySUSYTools) -} +DECLARE_COMPONENT(SUSYToolsAlg) +DECLARE_COMPONENT(ST::SUSYObjDef_xAOD) diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AnaBase-grid.sh index bb4307a905a910dc4904a6dca3aec6a474e24937..0eb228ad0aba654b9b22fd1445cbd93e8f238aa8 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AnaBase-grid.sh @@ -9,15 +9,15 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t mc20e -m 2000 -p p5511 --inputFile DAOD_PHYS.mc20_13TeV.410470.FS_mc20e_p5511.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" -TestSUSYToolsAlg.py -f PHYS -t mc20e -m 2000 -p p5511 --inputFile DAOD_PHYS.mc20_13TeV.410470.FS_mc20e_p5511.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t mc20e -m 2000 -p p5631 --inputFile mc20_13TeV.410470.FS_mc20e_p5631.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" +TestSUSYToolsAlg.py -f PHYS -t mc20e -m 2000 -p p5631 --inputFile mc20_13TeV.410470.FS_mc20e_p5631.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-mc20e_DAOD_PHYS.root echo "Running DCube post-processing" -tName="MC20e" +tName="mc20e" dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc20e_DAOD_PHYS-rel22.root dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22.xml diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..fc71394fdec3edc37b2c02e3205bc05d57a7fe92 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_mc20e_DAOD_PHYS.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py - --testCampaign mc20e'" +athena SUSYTools/jobOptions.py --evtMax 2000 - --testCampaign mc20e +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="mc20e" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc20e_DAOD_PHYS-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYS.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AnaBase-grid.sh index 66cf3f7ccd41e308c41160dad5feeddafa8230d5..0a18bff3be541ac121bd7e8056ece944d7d19eca 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AnaBase-grid.sh @@ -9,15 +9,15 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t mc20e -m 2000 -p p5511 --inputFile DAOD_PHYSLITE.mc20_13TeV.410470.FS_mc20e_p5511.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" -TestSUSYToolsAlg.py -f PHYSLITE -t mc20e -m 2000 -p p5511 --inputFile DAOD_PHYSLITE.mc20_13TeV.410470.FS_mc20e_p5511.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t mc20e -m 2000 -p p5631 --inputFile mc20_13TeV.410470.FS_mc20e_p5631.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" +TestSUSYToolsAlg.py -f PHYSLITE -t mc20e -m 2000 -p p5631 --inputFile mc20_13TeV.410470.FS_mc20e_p5631.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-mc20e_DAOD_PHYSLITE.root echo "Running DCube post-processing" -tName="MC20e" +tName="mc20e" dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc20e_DAOD_PHYSLITE-rel22.root dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22.xml diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..ba0b0ec5c123b2e95b8bae3b96d913ce720da1bd --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC20e-LITE-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_mc20e_DAOD_PHYSLITE.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py - --testCampaign mc20e --testFormat PHYSLITE'" +athena SUSYTools/jobOptions.py --evtMax 2000 - --testCampaign mc20e --testFormat PHYSLITE +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="mc20e" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc20e_DAOD_PHYSLITE-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYSLITE.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AnaBase-grid.sh index 96017896df81e10d34d087713c9c2e376cb72c02..d21610212c05721ea6c4b35b15c1b3b2bf755e31 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AnaBase-grid.sh @@ -9,15 +9,15 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t mc21a -m 2000 -p p5511 --inputFile DAOD_PHYS.mc21_13p6TeV.601229.FS_mc21a_p5511.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" -TestSUSYToolsAlg.py -f PHYS -t mc21a -m 2000 -p p5511 --inputFile DAOD_PHYS.mc21_13p6TeV.601229.FS_mc21a_p5511.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t mc21a -m 2000 -p p5631 --inputFile mc21_13p6TeV.601229.FS_mc21a_p5631.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" +TestSUSYToolsAlg.py -f PHYS -t mc21a -m 2000 -p p5631 --inputFile mc21_13p6TeV.601229.FS_mc21a_p5631.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-mc21a_DAOD_PHYS.root echo "Running DCube post-processing" -tName="MC21a" +tName="mc21a" dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc21a_DAOD_PHYS-rel22.root dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22_Run3.xml diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b9eb32d2408507450bbbc17c225a97d32ea2cd5 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_mc21a_DAOD_PHYS.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py - --testCampaign mc21a'" +athena SUSYTools/jobOptions.py --evtMax 2000 - --testCampaign mc21a +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="mc21a" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc21a_DAOD_PHYS-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22_Run3.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYS.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AnaBase-grid.sh index 9609549e9c544903bf405ac1f0e48bf3fe063bf6..695cf26b97851c64548937908040361e1f154957 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AnaBase-grid.sh @@ -9,15 +9,15 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t mc21a -m 2000 -p p5440 --inputFile DAOD_PHYSLITE.mc21_13p6TeV.601229.FS_mc21a_p5511.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" -TestSUSYToolsAlg.py -f PHYSLITE -t mc21a -m 2000 -p p5511 --inputFile DAOD_PHYSLITE.mc21_13p6TeV.601229.FS_mc21a_p5511.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t mc21a -m 2000 -p p5631 --inputFile mc21_13p6TeV.601229.FS_mc21a_p5631.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst'" +TestSUSYToolsAlg.py -f PHYSLITE -t mc21a -m 2000 -p p5631 --inputFile mc21_13p6TeV.601229.FS_mc21a_p5631.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ --dosyst echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-mc21a_DAOD_PHYSLITE.root echo "Running DCube post-processing" -tName="MC21a" +tName="mc21a" dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc21a_DAOD_PHYSLITE-rel22.root dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22_Run3.xml diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..429e6fb0632271c2b08a7be2233fbcdcd474c53e --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_MC21a-LITE-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_mc21a_DAOD_PHYSLITE.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py - --testCampaign mc21a --testFormat PHYSLITE'" +athena SUSYTools/jobOptions.py --evtMax 2000 - --testCampaign mc21a --testFormat PHYSLITE +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="mc21a" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-mc21a_DAOD_PHYSLITE-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22_Run3.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYSLITE.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AnaBase-grid.sh index 8105c80861fb07a2bcf3c444237830f05db9c1f1..f9a3a527d1d75c98feaf7263a15dfbb62b92af3c 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AnaBase-grid.sh @@ -9,8 +9,8 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t data18 -p p5511 --inputFile DAOD_PHYS.data18_13TeV.00356250_p5511.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" -TestSUSYToolsAlg.py -f PHYS -t data18 -p p5511 --inputFile DAOD_PHYS.data18_13TeV.00356250_p5511.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t data18 -p p5631 -m 20000 --inputFile data18_13TeV.00356250_p5631.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" +TestSUSYToolsAlg.py -f PHYS -t data18 -p p5631 -m 20000 --inputFile data18_13TeV.00356250_p5631.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-data18_DAOD_PHYS.root diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..6cd35c8197a706685fa86523186a6be0551f7c8d --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_data18_DAOD_PHYS.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data18'" +athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data18 +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="data18" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-data18_DAOD_PHYS-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYS.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AnaBase-grid.sh index 98e87f80ef42adbf2e960ea01dec00eefa643cd2..55f2e143cd4edd598238f3aaf6dd7444df1b23d4 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AnaBase-grid.sh @@ -9,8 +9,8 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t data18 -p p5511 --inputFile DAOD_PHYSLITE.data18_13TeV.00356250_p5511.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" -TestSUSYToolsAlg.py -f PHYSLITE -t data18 -p p5511 --inputFile DAOD_PHYSLITE.data18_13TeV.00356250_p5511.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t data18 -p p5631 -m 20000 --inputFile data18_13TeV.00356250_p5631.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" +TestSUSYToolsAlg.py -f PHYSLITE -t data18 -p p5631 -m 20000 --inputFile data18_13TeV.00356250_p5631.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-data18_DAOD_PHYSLITE.root diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..20d7ac2bc28322e02201e0d02fa64b077fe87eff --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data18-LITE-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_data18_DAOD_PHYSLITE.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data18 --testFormat PHYSLITE'" +athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data18 --testFormat PHYSLITE +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="data18" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-data18_DAOD_PHYSLITE-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYSLITE.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AnaBase-grid.sh index b3c93682f751f7df637c6ff720d6b0bb6408a8ff..d3f050b728c0998ab2bcd06c0fbef89a97d2ebdd 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AnaBase-grid.sh @@ -9,8 +9,8 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t data22 -p p5514 --inputFile DAOD_PHYS.data22_13p6TeV.00440543_p5514.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" -TestSUSYToolsAlg.py -f PHYS -t data22 -p p5514 --inputFile DAOD_PHYS.data22_13p6TeV.00440543_p5514.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYS -t data22 -p p5632 -m 20000 --inputFile data22_13p6TeV.00440543_p5632.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" +TestSUSYToolsAlg.py -f PHYS -t data22 -p p5632 -m 20000 --inputFile data22_13p6TeV.00440543_p5632.PHYS.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-data22_DAOD_PHYS.root diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..8e69376f1b4dd6c7f8eaab802b3dfaf9b4357960 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_data22_DAOD_PHYS.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data22'" +athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data22 +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="data22" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-data22_DAOD_PHYS-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22_Run3.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYS.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AnaBase-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AnaBase-grid.sh index aae36e879fa959e0cf2d2df59c66949904269f50..0fa27702e2f3705388546d62164904253b898a80 100755 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AnaBase-grid.sh +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AnaBase-grid.sh @@ -9,8 +9,8 @@ # Create empty pool file art.py createpoolfile -echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t data22 -p p5514 --inputFile DAOD_PHYSLITE.data22_13p6TeV.00440543_p5514.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" -TestSUSYToolsAlg.py -f PHYSLITE -t data22 -p p5514 --inputFile DAOD_PHYSLITE.data22_13p6TeV.00440543_p5514.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ +echo "Running SUSYTools test: \'TestSUSYToolsAlg.py -f PHYSLITE -t data22 -p p5632 -m 20000 --inputFile data22_13p6TeV.00440543_p5632.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/'" +TestSUSYToolsAlg.py -f PHYSLITE -t data22 -p p5632 -m 20000 --inputFile data22_13p6TeV.00440543_p5632.PHYSLITE.pool.root --inputDir /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/ echo "art-result: $? TEST" mv submitDir/hist-*.root ./hist-data22_DAOD_PHYSLITE.root diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AthAna-grid.sh b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AthAna-grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..6d4432fc97869c09a18c90eb21a97e31b3511450 --- /dev/null +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/test/test_SUSYTools_ART_data22-LITE-AthAna-grid.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# art-description: SUSYTools ART test - share/minimalExampleJobOptions.py +# art-type: grid +# art-include: master/AthAnalysis +# art-output: hist-Ath_data22_DAOD_PHYSLITE.root +# art-output: dcube + +# Create empty pool file +art.py createpoolfile + +echo "Running SUSYTools test: 'share/athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data22 --testFormat PHYSLITE'" +athena SUSYTools/jobOptions.py --evtMax 20000 - --testCampaign data22 --testFormat PHYSLITE +echo "art-result: $? TEST" + +echo "Running DCube post-processing" + +tName="data22" +dcubeRef=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/References/hist-data22_DAOD_PHYSLITE-rel22.root +dcubeXml=/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/dev/SUSYTools/ART/xml/dcube_config_master_rel22_Run3.xml + +/cvmfs/atlas.cern.ch/repo/sw/art/dcube/bin/art-dcube ${tName} hist-Ath_${tName}_DAOD_PHYSLITE.root ${dcubeXml} ${dcubeRef} + +echo "art-result: $? DCUBE" + +echo "Done." diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYToolsTester.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYToolsTester.cxx index c640faf21b74f8bf6a09dd2a387988bc70b9ca5e..081b9ded928d2dc6274882bb2bdf2f7cfa99716e 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYToolsTester.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYToolsTester.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // System include(s): @@ -64,6 +64,7 @@ #include "AsgMessaging/MessageCheck.h" #include "PATInterfaces/CorrectionCode.h" #include "PathResolver/PathResolver.h" +#include "AsgTools/ToolStore.h" #include "AsgTools/ToolHandle.h" #include "AsgTools/StandaloneToolHandle.h" #include "AsgTools/IAsgTool.h" @@ -99,12 +100,12 @@ enum sel { passOR }; +namespace asg{ANA_MSG_HEADER(msgSTT) ANA_MSG_SOURCE(msgSTT,"SUSYToolsTester")} + //==================================================================================================== std::vector<std::string> getTokens(TString line, const TString& delim); std::map<std::string, std::string> getFileContainers(std::unique_ptr<TFile> &); -namespace asg{ANA_MSG_HEADER(msgSTT) ANA_MSG_SOURCE(msgSTT,"SUSYToolsTester")} - //==================================================================================================== int main( int argc, char* argv[] ) { @@ -112,8 +113,6 @@ int main( int argc, char* argv[] ) { ANA_CHECK_SET_TYPE (int); setMsgLevel(MSG::INFO); - //StatusCode::enableFailure(); - StatusCode::enableFailure(); CP::CorrectionCode::enableFailure(); // The application's name: @@ -121,9 +120,9 @@ int main( int argc, char* argv[] ) { // Check if we received a file name: if ( argc < 2 ) { - ATH_MSG_ERROR( "No file name received!" ); - ATH_MSG_ERROR( " Usage: " << APP_NAME << " [xAOD file name] [maxEvents] [isData=0/1 isAtlfast=0/1] [NoSyst=0/1] [Debug=0/1/2] [ConfigFile=<cfile.conf>] [PRWFile=<prwfile.root>] [autoconfigPRW=0/1]" ); - return StatusCode::FAILURE; + ANA_MSG_ERROR( "No file name received!" ); + ANA_MSG_ERROR( " Usage: " << APP_NAME << " [xAOD file name] [maxEvents] [isData=0/1 isAtlfast=0/1] [NoSyst=0/1] [Debug=0/1/2] [ConfigFile=<cfile.conf>] [PRWFile=<prwfile.root>] [autoconfigPRW=0/1]" ); + return 1; } @@ -259,8 +258,6 @@ int main( int argc, char* argv[] ) { ANA_CHECK( objTool.setProperty("DataSource", datasource) ) ; if(!config_file.empty()) ANA_CHECK( objTool.setProperty("ConfigFile", config_file) ); - ANA_CHECK( objTool.setBoolProperty("METDoTrkSyst", true) ); - ANA_CHECK( objTool.setBoolProperty("METDoCaloSyst", false) ); /////////////////////////////////////////////////////////////////////////////////////////// //// //// @@ -300,6 +297,7 @@ int main( int argc, char* argv[] ) { //// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + std::vector<std::string> prw_lumicalc; if (ilumicalc_file == "DUMMY") { ANA_CHECK( objTool.setProperty( "mcCampaign", "mc16e" ) ); @@ -327,7 +325,7 @@ int main( int argc, char* argv[] ) { if ( objTool.initialize() != StatusCode::SUCCESS) { ANA_MSG_ERROR( "Cannot initialize SUSYObjDef_xAOD, exiting." ); - return StatusCode::FAILURE; + return 1; } else { ANA_MSG_INFO( "SUSYObjDef_xAOD initialized..." ); } @@ -339,7 +337,7 @@ int main( int argc, char* argv[] ) { TEnv rEnv; if ( rEnv.ReadFile(config_file.c_str(), kEnvAll) != 0 ) { ANA_MSG_ERROR( "Cannot open config file, exiting."); - return StatusCode::FAILURE; + return 1; } ANA_MSG_INFO( "Config file opened" ); @@ -462,7 +460,7 @@ int main( int argc, char* argv[] ) { const xAOD::CutBookkeeperContainer* completeCBC = nullptr; if (!event.retrieveMetaInput(completeCBC, "CutBookkeepers").isSuccess()) { ANA_MSG_ERROR("Failed to retrieve CutBookkeepers from MetaData, exiting."); - return StatusCode::FAILURE; + return 1; } // Let's find the right CBK (latest with StreamAOD input before derivations) @@ -493,8 +491,8 @@ int main( int argc, char* argv[] ) { ANA_MSG_INFO( "CutBookkeepers Accepted " << nEventsProcessed << " SumWei " << sumOfWeights << " sumWei2 " << sumOfWeightsSquared); } else { ANA_MSG_INFO( "No relevent CutBookKeepers found" ); } - ATH_MSG_INFO("Found kernel: " << kernel); - ATH_MSG_INFO("Found stream: " << stream); + ANA_MSG_INFO("Found kernel: " << kernel); + ANA_MSG_INFO("Found stream: " << stream); // No special jets when running on PHYSLITE if (isPHYSLite) { @@ -543,18 +541,18 @@ int main( int argc, char* argv[] ) { int pdgid2 = 0; if( objTool.FindSusyHP(pdgid1, pdgid2) != StatusCode::SUCCESS ){ - ATH_MSG_WARNING( "SUSY Proc finding failed. Normal for non-SUSY samples." ); + ANA_MSG_WARNING( "SUSY Proc finding failed. Normal for non-SUSY samples." ); } if( pdgid1!=0 && pdgid2!=0){ //(just to avoid warnings) // --- Deprecated usage of procID - ATH_MSG_INFO( "--- SIGNAL ID1 : " << pdgid1 ); - ATH_MSG_INFO( " SIGNAL ID2 : " << pdgid2 ); - ATH_MSG_INFO( "--- XSECTION DETAILS" ); + ANA_MSG_INFO( "--- SIGNAL ID1 : " << pdgid1 ); + ANA_MSG_INFO( " SIGNAL ID2 : " << pdgid2 ); + ANA_MSG_INFO( "--- XSECTION DETAILS" ); } - ATH_MSG_INFO( " Xsec (high order) " << my_XsecDB->xsectTimesEff(ei->mcChannelNumber(),0) ); - ATH_MSG_INFO( " kfactor (high order) " << my_XsecDB->kfactor(ei->mcChannelNumber(),0) ); - ATH_MSG_INFO( " filter efficiency " << my_XsecDB->efficiency(ei->mcChannelNumber(),0) ); + ANA_MSG_INFO( " Xsec (high order) " << my_XsecDB->xsectTimesEff(ei->mcChannelNumber(),0) ); + ANA_MSG_INFO( " kfactor (high order) " << my_XsecDB->kfactor(ei->mcChannelNumber(),0) ); + ANA_MSG_INFO( " filter efficiency " << my_XsecDB->efficiency(ei->mcChannelNumber(),0) ); } } @@ -644,11 +642,11 @@ int main( int argc, char* argv[] ) { if (slices["tjet"] && hasTrkJets) { ANA_MSG_DEBUG( "Nominal track jet step" ); if( event.retrieve(TJC, TrkJetCollection).isSuccess() ){ - ATH_CHECK(objTool.GetTrackJets(trkjets_nominal, trkjets_nominal_aux)); + ANA_CHECK(objTool.GetTrackJets(trkjets_nominal, trkjets_nominal_aux)); ANA_MSG_DEBUG( trkjets_nominal->size() << " track jets"); } else { ANA_MSG_ERROR("TrackJet collection " << TrkJetCollection.c_str() << " not available in input file. Please check!"); - return StatusCode::FAILURE; + return 1; } } @@ -666,7 +664,7 @@ int main( int argc, char* argv[] ) { } } else { ANA_MSG_ERROR("LargeR jet collection " << FatJetCollection.c_str() << " not available in input file. Please check!"); - return StatusCode::FAILURE; + return 1; } } @@ -923,17 +921,17 @@ int main( int argc, char* argv[] ) { if (!isData){ const xAOD::TruthParticle* truthTau = T2MT->getTruth(*tau) ; if (tau->auxdata<char>("IsTruthMatched") || !truthTau){ - ATH_MSG_DEBUG("Tau was matched to a truth tau, which has " + ANA_MSG_DEBUG("Tau was matched to a truth tau, which has " << int(tau->auxdata<size_t>("TruthProng")) << " prongs and a charge of " << tau->auxdata<int>("TruthCharge")); - } else { ATH_MSG_DEBUG( "Tau was not matched to truth" ); } + } else { ANA_MSG_DEBUG( "Tau was not matched to truth" ); } } } } // Overlap Removal - ATH_MSG_DEBUG( "Overlap removal" ); + ANA_MSG_DEBUG( "Overlap removal" ); if (isNominal || (sysInfo.affectsKinematics && (syst_affectsElectrons || syst_affectsMuons || syst_affectsJets))) { if(stream.find("SUSY3")!=std::string::npos) { ANA_CHECK( objTool.OverlapRemoval(electrons, muons, jets, 0, taus) ); } else if(stream.find("SUSY10")!=std::string::npos) { ANA_CHECK( objTool.OverlapRemoval(electrons, muons, jets, 0, 0, fatjets_nominal) ); } @@ -943,7 +941,7 @@ int main( int argc, char* argv[] ) { // Jets - get goodjets if (slices["jet"]) { xAOD::JetInput::Type jetInputType = xAOD::JetInput::Uncategorized; - ATH_MSG_DEBUG("GoodJets?"); + ANA_MSG_DEBUG("GoodJets?"); for (const auto& jet : *jets) { if (jet->auxdata<char>("baseline") == 1 && jet->auxdata<char>("passOR") == 1 && @@ -1170,7 +1168,7 @@ int main( int argc, char* argv[] ) { else if(objTool.treatAsYear()==2016) muonSF = objTool.GetTotalMuonSF(*muons, true, true, muTrig2016.Data()); else if(objTool.treatAsYear()==2017) muonSF = objTool.GetTotalMuonSF(*muons, true, true, muTrig2017.Data()); else if(objTool.treatAsYear()==2018) muonSF = objTool.GetTotalMuonSF(*muons, true, true, muTrig2017.Data()); - else if(objTool.treatAsYear()==2022 && objTool.GetRandomRunNumber() < 435816) muonSF = objTool.GetTotalMuonSF(*muons, true, true, muTrig2022.Data()); //temporary solution to avoid warning from missing SF in the latest periods (from H) + else if(objTool.treatAsYear()==2022) muonSF = objTool.GetTotalMuonSF(*muons, true, true, muTrig2022.Data()); ANA_MSG_DEBUG("MUON AFTER SF = " << muonSF << " " << objTool.treatAsYear() << " " << objTool.GetRandomRunNumber() << " " << objTool.GetPileupWeight() ); } } diff --git a/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYTruthTester.cxx b/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYTruthTester.cxx index ff5f0e84f6edd12c0617d8e68034d876dd866215..b31f83300307a339b767269dadde81be5ecc1a92 100644 --- a/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYTruthTester.cxx +++ b/PhysicsAnalysis/SUSYPhys/SUSYTools/util/SUSYTruthTester.cxx @@ -44,8 +44,6 @@ int main( int argc, char* argv[] ) { using namespace asg::msgUserCode; ANA_CHECK_SET_TYPE (int); - //StatusCode::enableFailure(); - StatusCode::enableFailure(); CP::CorrectionCode::enableFailure(); // The application's name: @@ -141,7 +139,7 @@ int main( int argc, char* argv[] ) { if( objTool.FindSusyHP(pdgid1, pdgid2) != StatusCode::SUCCESS ){ Error(APP_NAME, "--- SOMETHING IS WRONG WITH THE SUSY PROC FINDING... ---"); - return StatusCode::FAILURE; + return 1; } if( pdgid1!=0 && pdgid2!=0){ //(just to avoid warnings) diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx index d422b02e5797c0c75fd383e1371f8c2f77f18a30..aa8701d23971f692ad788eef44a44be9401627f5 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx @@ -535,6 +535,11 @@ void CommonEfficiencyTool::ReadInputs(const TFile& fFile) m_fX = &truthTauPt; ATH_MSG_DEBUG("using truth pT for x-axis"); } + if (sTitle == "|eta|") + { + m_fX = &finalTauAbsEta; + ATH_MSG_DEBUG("using absolute tau eta for x-axis"); + } continue; } diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx index fa7afe1d00c01f74a3586e582ae659d55e10d171..274b25489c391f750bd15787272b9cb6191615d3 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauEfficiencyCorrectionsTool.cxx @@ -455,7 +455,7 @@ StatusCode TauEfficiencyCorrectionsTool::initializeTools_2022_prerec() // the path must be updated once RNN eVeto SFs are available if (m_sInputFilePathEleIDElectron.empty()) { if (m_sAFII) ATH_MSG_WARNING("No fast-sim recommendation for tau electron veto, using full sim"); - m_sInputFilePathEleIDElectron = sDirectory+ "EleRNN_TrueElectron_2022-mc20-prerec.root"; + m_sInputFilePathEleIDElectron = sDirectory+ "EleRNN_TrueElectron_2022-mc20-prerec-v2.root"; } if (m_sVarNameEleIDElectron.empty()) m_sVarNameEleIDElectron = "TauScaleFactorEleIDElectron"; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx index ca557612f1cfd8115d0169fd69061084d0536595..d152ba17b448bbdbf130e38ba6b5b79b35a6e5f9 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/util/TauAnalysisToolsExample.cxx @@ -86,6 +86,9 @@ int main( int argc, char* argv[] ) if (argc>3) sOutputFileName = TString(argv[3]); + //Do the trigger efficiency tools, requires correct ilumicalc + bool m_doTrigger = bool(argc>4); + Info( "TauAnalysisToolsExample", "Opening output file: %s", sOutputFileName.Data() ); std::unique_ptr< TFile > fOutputFile( TFile::Open( sOutputFileName, "RECREATE" ) ); CHECK( fOutputFile.get() ); @@ -115,14 +118,15 @@ int main( int argc, char* argv[] ) // defining needed Container const xAOD::EventInfo* xEventInfo = 0; const xAOD::TauJetContainer* xTauJetContainer = 0; - + CP::PileupReweightingTool* m_tPRWTool = new CP::PileupReweightingTool("PileupReweightingTool"); - std::vector<std::string> vLumiCalcFiles = {"/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/20221025/ilumicalc_histograms_None_428648-436169_OflLumi-Run3-001.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/20221025/ilumicalc_histograms_None_430536-436169_OflLumi-Run3-001.root"}; - CHECK(m_tPRWTool->setProperty("LumiCalcFiles", vLumiCalcFiles)); - // CHECK(m_tPRWTool->setProperty("DefaultChannel", "" )); - CHECK(m_tPRWTool->initialize()); + if (m_doTrigger){//dont initialize tool if not requested + std::vector<std::string> vLumiCalcFiles = {"/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20200803/ilumicalc_histograms_None_282026-282457_OflLumi-13TeV-009.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20190708/ilumicalc_histograms_None_297730-311481_OflLumi-13TeV-010.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/20221025/ilumicalc_histograms_None_428648-436169_OflLumi-Run3-001.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data22_13p6TeV/20221025/ilumicalc_histograms_None_430536-436169_OflLumi-Run3-001.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/20190609/ilumicalc_histograms_None_276262-284484_OflLumi-13TeV-010.root","/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/20190609/ilumicalc_histograms_None_325713-340453_OflLumi-13TeV-010.root"}; + CHECK(m_tPRWTool->setProperty("LumiCalcFiles", vLumiCalcFiles)); + // CHECK(m_tPRWTool->setProperty("DefaultChannel", "" )); + CHECK(m_tPRWTool->initialize()); + } ToolHandle<CP::IPileupReweightingTool> m_tPRWToolHandle = m_tPRWTool; - // =========================================================================== // TauSelectionTool // =========================================================================== @@ -146,7 +150,8 @@ int main( int argc, char* argv[] ) // =========================================================================== TauAnalysisTools::TauSmearingTool TauSmeTool( "TauSmearingTool" ); TauSmeTool.msg().setLevel( MSG::DEBUG ); - CHECK(TauSmeTool.setProperty("Campaign","mc20")); + CHECK(TauSmeTool.setProperty("RecommendationTag","2022-prerec")); + CHECK(TauSmeTool.setProperty("Campaign","mc21")); CHECK(TauSmeTool.initialize()); // restructure all recommended systematic variations for smearing tool @@ -163,6 +168,7 @@ int main( int argc, char* argv[] ) TauAnalysisTools::TauEfficiencyCorrectionsTool TauEffCorrTool( "TauEfficiencyCorrectionsTool" ); TauEffCorrTool.msg().setLevel( MSG::VERBOSE ); CHECK(TauEffCorrTool.setProperty("TauSelectionTool",TauSelToolHandle)); + CHECK(TauEffCorrTool.setProperty("RecommendationTag","2022-prerec")); CHECK(TauEffCorrTool.initialize()); // restructure all recommended systematic variations for efficiency tools @@ -177,25 +183,26 @@ int main( int argc, char* argv[] ) // =========================================================================== // TauEfficiencyCorrectionsTriggerTool // =========================================================================== - - TauAnalysisTools::TauEfficiencyCorrectionsTool TauEffTrigTool( "TauEfficiencyCorrectionsTriggerTool" ); - TauEffTrigTool.msg().setLevel( MSG::DEBUG ); - CHECK(TauEffTrigTool.setProperty("EfficiencyCorrectionTypes", std::vector<int>({SFTriggerHadTau}) )); - CHECK(TauEffTrigTool.setProperty("TriggerName", "HLT_tau25_medium1_tracktwo" )); - CHECK(TauEffTrigTool.setProperty("JetIDLevel", (int)JETIDRNNTIGHT )); - CHECK(TauEffTrigTool.setProperty("PileupReweightingTool", m_tPRWToolHandle )); - CHECK(TauEffTrigTool.setProperty("TriggerSFMeasurement", "combined")); - CHECK(TauEffTrigTool.initialize()); - - // restructure all recommended systematic variations for efficiency tools - std::vector<CP::SystematicSet> vEfficiencyCorrectionsTriggerSystematicSet; - vEfficiencyCorrectionsTriggerSystematicSet.push_back(CP::SystematicSet()); - for (auto SystematicsVariation : TauEffTrigTool.recommendedSystematics()) - { - vEfficiencyCorrectionsTriggerSystematicSet.push_back(CP::SystematicSet()); - vEfficiencyCorrectionsTriggerSystematicSet.back().insert(SystematicsVariation); - } - + TauAnalysisTools::TauEfficiencyCorrectionsTool TauEffTrigTool( "TauEfficiencyCorrectionsTriggerTool" ); + // restructure all recommended systematic variations for efficiency tools + std::vector<CP::SystematicSet> vEfficiencyCorrectionsTriggerSystematicSet; + if (m_doTrigger){ + + TauEffTrigTool.msg().setLevel( MSG::DEBUG ); + CHECK(TauEffTrigTool.setProperty("EfficiencyCorrectionTypes", std::vector<int>({SFTriggerHadTau}) )); + CHECK(TauEffTrigTool.setProperty("TriggerName", "HLT_tau25_medium1_tracktwo" )); + CHECK(TauEffTrigTool.setProperty("JetIDLevel", (int)JETIDRNNTIGHT )); + CHECK(TauEffTrigTool.setProperty("PileupReweightingTool", m_tPRWToolHandle )); + CHECK(TauEffTrigTool.setProperty("TriggerSFMeasurement", "combined")); + CHECK(TauEffTrigTool.initialize()); + + vEfficiencyCorrectionsTriggerSystematicSet.push_back(CP::SystematicSet()); + for (auto SystematicsVariation : TauEffTrigTool.recommendedSystematics()) + { + vEfficiencyCorrectionsTriggerSystematicSet.push_back(CP::SystematicSet()); + vEfficiencyCorrectionsTriggerSystematicSet.back().insert(SystematicsVariation); + } + } // =========================================================================== // TauTruthMatchingTool // =========================================================================== @@ -216,6 +223,11 @@ int main( int argc, char* argv[] ) for( Long64_t iEntry = 0; iEntry < iEntries; ++iEntry ) { + //Check TauJet Container Name + const char * m_tauJetContainerName = "TauJets"; + + + // Tell the object which entry to look at: xEvent.getEntry( iEntry ); @@ -229,15 +241,23 @@ int main( int argc, char* argv[] ) static_cast< int >( xEventInfo->runNumber() ), static_cast< int >( iEntry ) ); - RETRIEVE(xAOD::TauJetContainer, xTauJetContainer, "TauJets"); + if (xEvent.contains<xAOD::TauJetContainer>(m_tauJetContainerName)){ + RETRIEVE(xAOD::TauJetContainer, xTauJetContainer, m_tauJetContainerName); + }else{ + m_tauJetContainerName = "AnalysisTauJets"; + RETRIEVE(xAOD::TauJetContainer, xTauJetContainer, m_tauJetContainerName); + } std::pair< xAOD::TauJetContainer*, xAOD::ShallowAuxContainer* >xTauShallowContainer = xAOD::shallowCopyContainer(*xTauJetContainer); + if(iEntry==0){ + Info( "TauAnalysisToolsExample:: TauJetContainer = ",m_tauJetContainerName); + } // // copy truth particles to get truthparticle link for truth taus to work if (xEvent.contains<xAOD::TruthParticleContainer>("TruthParticles")) CHECK( xEvent.copy("TruthParticles") ); // copy taus - CHECK( xEvent.copy("TauJets") ); + CHECK( xEvent.copy(m_tauJetContainerName) ); // copy tracks CHECK( xEvent.copy("InDetTrackParticles") ); @@ -293,7 +313,7 @@ int main( int argc, char* argv[] ) CHECK( TauSmeTool.applyCorrection(*xTau) ); Info( "TauAnalysisToolsExample", "Smeared tau pt: %g ", - xTau->pt()); + xTau->pt()); for (auto sSystematicSet: vSmearingSystematicSet) { diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx index a7596f7bdbd8f301eb72404b493c770dff33687c..88674237849cbf9f0bc095615b833aebc0110b09 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx @@ -102,6 +102,9 @@ namespace top { m_weight_leptonSF_MU_SF_ID_TAGPT_DOWN(0.), m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_UP(0.), m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_DOWN(0.), + m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_UP(0.), + m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_DOWN(0.), + // Muon isolation SF systematics m_weight_leptonSF_MU_SF_Isol_STAT_UP(0.), m_weight_leptonSF_MU_SF_Isol_STAT_DOWN(0.), @@ -661,6 +664,10 @@ namespace top { "weight_leptonSF_MU_SF_ID_EXTRAPOLATION_UP"); systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_DOWN, "weight_leptonSF_MU_SF_ID_EXTRAPOLATION_DOWN"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_UP, + "weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_UP"); + systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_DOWN, + "weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_DOWN"); } else { systematicTree->makeOutputVariable(m_weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP, "weight_leptonSF_MU_SF_ID_SYST_LOWPT_UP"); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h index 8b47d3d256ae268e85a31d32d8c31c0e9acb7c1a..4ddd88bd362fd402404a4d27723534a4c996dbcb 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h @@ -324,6 +324,8 @@ namespace top { float m_weight_leptonSF_MU_SF_ID_TAGPT_DOWN; float m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_UP; float m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_DOWN; + float m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_UP; + float m_weight_leptonSF_MU_SF_ID_EXTRAPOLATION_LOWPT_DOWN; // Muon isolation SF systematics float m_weight_leptonSF_MU_SF_Isol_STAT_UP; float m_weight_leptonSF_MU_SF_Isol_STAT_DOWN; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config-mc21.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config-mc21.txt index 206867d486b95e68552ba441ee8bef6d968a79f3..575c2653f132d8720162fa0850bdac9148f3d56b 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config-mc21.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config-mc21.txt @@ -57,7 +57,7 @@ GlobalTriggersLoose 2022@e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22V ElectronCollectionName Electrons MuonCollectionName Muons JetCollectionName AntiKt4EMPFlowJets -LargeJetCollectionName None # can be e.g. AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets +LargeJetCollectionName None # can be e.g. AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets TauCollectionName None #can be e.g. TauJets PhotonCollectionName None #can be e.g. Photons TrackJetCollectionName None #can be e.g. AntiKtVR30Rmax4Rmin02TrackJets_BTagging201903 @@ -66,11 +66,11 @@ JetGhostTrackDecoName None # can be e.g. GhostTrack ### Electron configuration ElectronPt 25000 ElectronID TightLH -ElectronIDLoose LooseAndBLayerLH +ElectronIDLoose TightLH ElectronIsolationWPs HighPtCaloOnly TightTrackOnly_VarRad TightTrackOnly_FixedRad Tight_VarRad Loose_VarRad ElectronIsolation Tight_VarRad -ElectronIsolationLoose None -ElectronTriggerEfficiencyConfig SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 # NOTE: the value for this option is for Run2 environment and needs to be set to a different value for Run3 +ElectronIsolationLoose Tight_VarRad +ElectronTriggerEfficiencyConfig 2022_e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI ### Muon configuration MuonPt 25000 diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config.txt index a68702c5f6b5a93b5e69b1c1156f3c71d1cf7791..fe2b70030d4ab775a7670933ea5c9fc7239d7232 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/example-config.txt @@ -37,8 +37,8 @@ Systematics Nominal #Nominal->only nominal. All -> all systematics (will be much GRLDir GoodRunsLists GRLFile data18_13TeV/20190219/physics_25ns_Triggerno17e33prim.xml -PRWConfigFiles_FS dev/AnalysisTop/PileupReweighting/user.iconnell.Top.PRW.MC16e.FS.v2/prw.merged.root -PRWConfigFiles_AF dev/AnalysisTop/PileupReweighting/user.iconnell.Top.PRW.MC16e.AF.v2/prw.merged.root +PRWConfigFiles_FS PileupReweighting/mc20_common/mc20e.310000.physlite.prw.v1.root +PRWConfigFiles_AF PileupReweighting/mc20_common/mc20e.310000.physlite.prw.v1.root PRWActualMu_FS GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root PRWActualMu_AF GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root PRWLumiCalcFiles GoodRunsLists/data18_13TeV/20190318/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-010.root @@ -54,7 +54,7 @@ GlobalTriggersLoose 2015@e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose,m ElectronCollectionName Electrons MuonCollectionName Muons JetCollectionName AntiKt4EMPFlowJets -LargeJetCollectionName None # can be e.g. AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets +LargeJetCollectionName None # can be e.g. AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets TauCollectionName None #can be e.g. TauJets PhotonCollectionName None #can be e.g. Photons TrackJetCollectionName None #can be e.g. AntiKtVR30Rmax4Rmin02TrackJets_BTagging201903 diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts-mc21.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts-mc21.txt index ba83db0c133c3a22fb32dc724d632a2c2cc143a8..6f8ab3619c612141ae2f02c8e60c0cee9598cab0 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts-mc21.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts-mc21.txt @@ -20,7 +20,7 @@ TDPPath dev/AnalysisTop/TopDataPreparation/XSection-MC21-13p6TeV.data ElectronCollectionName Electrons MuonCollectionName Muons JetCollectionName AntiKt4EMPFlowJets -LargeJetCollectionName AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets +LargeJetCollectionName AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets TauCollectionName TauJets PhotonCollectionName Photons TrackJetCollectionName AntiKtVR30Rmax4Rmin02PV0TrackJets @@ -28,7 +28,7 @@ TrackJetCollectionName AntiKtVR30Rmax4Rmin02PV0TrackJets UseEgammaLeakageCorrection False ### Large-R configuration -LargeRJESJMSConfig CombMass +LargeRJESJMSConfig UFOSDMass LargeRJetPt 200000 LargeRJetEta 2 LargeJetSubstructure None diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt index a30a08603dd4aede8bef80fc18a25acb0cfcced0..77bfc6a92dede98a9349df81728aa7997fcf86a2 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/share/validation-cuts.txt @@ -21,7 +21,7 @@ TDPPath dev/AnalysisTop/TopDataPreparation/CI-XSection-MC16-13TeV.data ElectronCollectionName Electrons MuonCollectionName Muons JetCollectionName AntiKt4EMPFlowJets -LargeJetCollectionName AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets +LargeJetCollectionName AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets TauCollectionName TauJets PhotonCollectionName Photons TrackJetCollectionName AntiKtVR30Rmax4Rmin02PV0TrackJets @@ -29,7 +29,7 @@ TrackJetCollectionName AntiKtVR30Rmax4Rmin02PV0TrackJets UseEgammaLeakageCorrection False ### Large-R configuration -LargeRJESJMSConfig CombMass +LargeRJESJMSConfig UFOSDMass LargeRJetPt 200000 LargeRJetEta 2 LargeJetSubstructure None diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopBoostedTaggingCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopBoostedTaggingCPTools.cxx index 3fc011c7a89f66cd86662fff41d5746c35cd137f..623c856c35dae0bbd8f9580c6c06613357aa9101 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopBoostedTaggingCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopBoostedTaggingCPTools.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "TopCPTools/TopBoostedTaggingCPTools.h" @@ -87,13 +87,18 @@ namespace top { std::string jet_def = m_config->sgKeyLargeRJets(); jet_def.erase(jet_def.length() - 4); // jet collection name sans 'Jets' suffix + std::string mc_type = "MC20"; + + // If we are in Run 3, we should use MC21 instead... + if (m_config->isRun3()) mc_type = "MC21"; + const std::string name = "JetSFuncert_" + taggerName; try { const std::string& cfg = m_taggerSFsConfigs.at(taggerName); JetUncertaintiesTool* jet_SF_tmp = new JetUncertaintiesTool(name); top::check(jet_SF_tmp->setProperty("JetDefinition", jet_def), "Failed to set JetDefinition for " + name); - top::check(jet_SF_tmp->setProperty("MCType", "MC16"), "Failed to set MCType for " + name); + top::check(jet_SF_tmp->setProperty("MCType", mc_type), "Failed to set MCType for " + name); top::check(jet_SF_tmp->setProperty("ConfigFile", cfg), "Failed to set ConfigFile for " + name); top::check(jet_SF_tmp->setProperty("IsData", false), "Failed to set IsData for " + name); top::check(jet_SF_tmp->initialize(), "Failed to initialize " + name); @@ -110,84 +115,82 @@ namespace top { } void BoostedTaggingCPTools::initTaggersMaps() { - + // Calib areas - m_taggersCalibAreas["JSSWTopTaggerDNN"] = "JSSWTopTaggerDNN/Rel21/"; - m_taggersCalibAreas["SmoothedWZTagger"] = "SmoothedWZTaggers/Rel21/"; - + m_taggersCalibAreas["JSSWTopTaggerANN"] = "JSSWTopTaggerANN/Rel21/March2023/"; + m_taggersCalibAreas["JSSWTopTaggerDNN"] = "JSSWTopTaggerDNN/Rel21/February2022/"; + m_taggersCalibAreas["SmoothedWZTagger"] = "SmoothedWZTaggers/Rel21/February2022/"; + // Supported tagger types + // (ANN tagger is not yet ported to R22) m_taggersTypes = { - "JSSWTopTaggerDNN", "SmoothedWZTagger" + // "JSSWTopTaggerANN", + "JSSWTopTaggerDNN", + "SmoothedWZTagger", }; - + // Supported jet collections m_jetCollections = { - "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", - "AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets" + "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets", }; - - + + auto setConfig = [this](const std::string& tagger, const std::string& configName) { m_taggersConfigs[tagger] = configName; }; - - if (m_config->sgKeyLargeRJets() == "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets") { - + + if (m_config->sgKeyLargeRJets() == "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets") { + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BoostedJetTaggingRecommendationFullRun2#UFO_jets + // Top taggers - setConfig("DNNTaggerTopQuarkContained50","JSSDNNTagger_AntiKt10LCTopoTrimmed_TopQuarkContained_MC16_20201216_50Eff.dat"); - setConfig("DNNTaggerTopQuarkContained80","JSSDNNTagger_AntiKt10LCTopoTrimmed_TopQuarkContained_MC16_20201216_80Eff.dat"); - setConfig("DNNTaggerTopQuarkInclusive50","JSSDNNTagger_AntiKt10LCTopoTrimmed_TopQuarkInclusive_MC16_20201216_50Eff.dat"); - setConfig("DNNTaggerTopQuarkInclusive80","JSSDNNTagger_AntiKt10LCTopoTrimmed_TopQuarkInclusive_MC16_20201216_80Eff.dat"); - - // WZ taggers - setConfig("SmoothWContained50","SmoothedContainedWTagger_AntiKt10LCTopoTrimmed_FixedSignalEfficiency50_MC16_20201216.dat"); - setConfig("SmoothWContained80","SmoothedContainedWTagger_AntiKt10LCTopoTrimmed_FixedSignalEfficiency80_MC16_20201216.dat"); - setConfig("SmoothZContained50","SmoothedContainedZTagger_AntiKt10LCTopoTrimmed_FixedSignalEfficiency50_MC16_20201216.dat"); - setConfig("SmoothZContained80","SmoothedContainedZTagger_AntiKt10LCTopoTrimmed_FixedSignalEfficiency80_MC16_20201216.dat"); + setConfig("DNNTaggerTopQuarkContained50", "DNNTagger_AntiKt10UFOSD_TopContained50_Oct30.dat"); + setConfig("DNNTaggerTopQuarkContained80", "DNNTagger_AntiKt10UFOSD_TopContained80_Oct30.dat"); + setConfig("DNNTaggerTopQuarkInclusive50", "DNNTagger_AntiKt10UFOSD_TopInclusive50_Oct30.dat"); + setConfig("DNNTaggerTopQuarkInclusive80", "DNNTagger_AntiKt10UFOSD_TopInclusive80_Oct30.dat"); - } else if (m_config->sgKeyLargeRJets() == "AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets") { // WZ taggers - setConfig("SmoothWContained2VarMaxSig","SmoothedWTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_2Var_MC16d_20190809.dat"); - setConfig("SmoothZContained2VarMaxSig","SmoothedZTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_2Var_MC16d_20190809.dat"); - setConfig("SmoothW3VarMaxSig","SmoothedContainedWTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_3Var_MC16d_20190410.dat"); - setConfig("SmoothZ3VarMaxSig","SmoothedContainedZTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_3Var_MC16d_20190410.dat"); + // (ANN tagger is not yet ported to R22) + // setConfig("ANNTaggerWZContained50", "JSSANN50Tagger_AntiKt10UFOCSSKSoftDrop_Mar23pol3.dat"); + // setConfig("ANNTaggerWZContained60", "JSSANN60Tagger_AntiKt10UFOCSSKSoftDrop_Mar23pol3.dat"); + // setConfig("ANNTaggerWZContained70", "JSSANN70Tagger_AntiKt10UFOCSSKSoftDrop_Mar23pol3.dat"); + // setConfig("ANNTaggerWZContained80", "JSSANN80Tagger_AntiKt10UFOCSSKSoftDrop_Mar23pol3.dat"); + // setConfig("ANNTaggerWZContained90", "JSSANN90Tagger_AntiKt10UFOCSSKSoftDrop_Mar23pol3.dat"); + + setConfig("SmoothWContained50", "SmoothedContainedWTagger_AntiKt10UFOCSSKSoftDrop_FixedSignalEfficiency50_20220221.dat"); + setConfig("SmoothWContained80", "SmoothedContainedWTagger_AntiKt10UFOCSSKSoftDrop_FixedSignalEfficiency80_20220221.dat"); + setConfig("SmoothZContained50", "SmoothedContainedZTagger_AntiKt10UFOCSSKSoftDrop_FixedSignalEfficiency50_20220221.dat"); + setConfig("SmoothZContained80", "SmoothedContainedZTagger_AntiKt10UFOCSSKSoftDrop_FixedSignalEfficiency80_20220221.dat"); + + // (DNN tagger is not yet ported to R22) + // setConfig("DNNTaggerWContained50", "JSSDNN50Tagger_AntiKt10UFOCSSKSoftDrop_Jan22.dat"); + // setConfig("DNNTaggerWContained80", "JSSDNN80Tagger_AntiKt10UFOCSSKSoftDrop_Jan22.dat"); } - } - - - + void BoostedTaggingCPTools::initSFsMaps() { // Here we initialize SFs maps - + // This lambda function is universal for all taggers - auto setMaps = [this](const std::string& configPath, const std::string& tagger, const std::string& configName) { - m_taggerSFsConfigs[tagger] = configPath + "/" + configName; - m_taggerSFsNames[tagger] = tagger+"_SF"; - }; - - if (m_config->sgKeyLargeRJets() == "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets") { - // Tagging scale factors availabel for AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets - - const std::string configPath="rel21/Fall2020"; - //Top taggers - setMaps(configPath,"DNNTaggerTopQuarkContained50","R10_SF_LCTopo_TopTagContained_SigEff50.config"); - setMaps(configPath,"DNNTaggerTopQuarkContained80","R10_SF_LCTopo_TopTagContained_SigEff80.config"); - setMaps(configPath,"DNNTaggerTopQuarkInclusive50","R10_SF_LCTopo_TopTagInclusive_SigEff50.config"); - setMaps(configPath,"DNNTaggerTopQuarkInclusive80","R10_SF_LCTopo_TopTagInclusive_SigEff80.config"); - //WZ taggers - setMaps(configPath,"SmoothWContained50","R10_SF_LCTopo_WTag_SigEff50.config"); - setMaps(configPath,"SmoothWContained80","R10_SF_LCTopo_WTag_SigEff80.config"); - - } else if (m_config->sgKeyLargeRJets() == "AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets") { - // Tagging scale factors available for some of the taggers for TCC jets - - const std::string configPath="rel21/Summer2019/"; - //WZ taggers - setMaps(configPath,"SmoothWContained2VarMaxSig","R10_SF_TCC_2VarSmooth_WTag.config"); - setMaps(configPath,"SmoothZContained2VarMaxSig","R10_SF_TCC_2VarSmooth_ZTag.config"); + // (Commented out until SFs are available to suppress compilation warning) + // auto setMaps = [this](const std::string& configPath, const std::string& tagger, const std::string& configName) { + // m_taggerSFsConfigs[tagger] = configPath + "/" + configName; + // m_taggerSFsNames[tagger] = tagger + "_SF"; + // }; + + if (m_config->sgKeyLargeRJets() == "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets") { + ATH_MSG_WARNING("No Large-R jet tagging scale factors available yet!"); + + // Leaving old R21 LCTopo-configs here for now to have some idea on how to apply the settings later on + // const std::string configPath="rel21/Fall2020"; + // //Top taggers + // setMaps(configPath,"DNNTaggerTopQuarkContained50","R10_SF_LCTopo_TopTagContained_SigEff50.config"); + // setMaps(configPath,"DNNTaggerTopQuarkContained80","R10_SF_LCTopo_TopTagContained_SigEff80.config"); + // setMaps(configPath,"DNNTaggerTopQuarkInclusive50","R10_SF_LCTopo_TopTagInclusive_SigEff50.config"); + // setMaps(configPath,"DNNTaggerTopQuarkInclusive80","R10_SF_LCTopo_TopTagInclusive_SigEff80.config"); + // //WZ taggers + // setMaps(configPath,"SmoothWContained50","R10_SF_LCTopo_WTag_SigEff50.config"); + // setMaps(configPath,"SmoothWContained80","R10_SF_LCTopo_WTag_SigEff80.config"); } } - - + } // namespace top diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx index 9e73f7386e5cceda84f4eca038a5f001fa86aec3..09b13da63c517577110939b9a4f3f42cc67bec22 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopEgammaCPTools.cxx @@ -743,7 +743,7 @@ IAsgElectronEfficiencyCorrectionTool* tool = asg::ToolStore::get<IAsgElectronEfficiencyCorrectionTool>(name); } else { tool = new AsgElectronEfficiencyCorrectionTool(name); - if (!m_config->isRun3() && (trigger_key != "" && trigger_key != "None")) { + if (!m_config->isRun3()) { top::check(asg::setProperty(tool, "MapFilePath", "ElectronEfficiencyCorrection/2015_2018/rel21.2/Precision_Summer2020_v1/map4.txt"), "Failed to set MapFilePath to " + name); } else { if (map_path != "UseEgammaRecommended") { diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx index 6d369ba0ffa643a602e7bd01891d078ee237b757..23f30f19d45a86e4faab90b51501114c807b2e5e 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopJetMETCPTools.cxx @@ -39,7 +39,7 @@ namespace top { m_jetJVT_ConfigFile("JVTlikelihood_20140805.root"), - // Calibration strings for R21 only + // EMTopo (calibration configs for R21 only) m_jetAntiKt4_Data_ConfigFile("JES_MC16Recommendation_Consolidated_EMTopo_Apr2019_Rel21.config"), m_jetAntiKt4_Data_CalibSequence("JetArea_Residual_EtaJES_GSC_Insitu"), @@ -55,15 +55,19 @@ namespace top { m_jetAntiKt4_MCAFII_ConfigFile("JES_MC16Recommendation_AFII_EMTopo_Apr2019_Rel21.config"), m_jetAntiKt4_MCAFII_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear"), + // PFlow (some calibration configs are updated to R22) + // No R22 AF3 calibs yet m_jetAntiKt4_MCAFII_PFlow_ConfigFile("JES_MC16Recommendation_AFII_PFlow_Apr2019_Rel21.config"), m_jetAntiKt4_MCAFII_PFlow_CalibSequence("JetArea_Residual_EtaJES_GSC_Smear"), + // Phase-1 pre-recs for R22 Data & Fullsim m_jetAntiKt4_Data_PFlow_ConfigFile("PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config"), m_jetAntiKt4_Data_PFlow_CalibSequence("JetArea_Residual_EtaJES_GSC_Insitu"), m_jetAntiKt4_PFlow_MCFS_ConfigFile("PreRec_R22_PFlow_ResPU_EtaJES_GSC_February23_230215.config"), m_jetAntiKt4_PFlow_MCFS_CalibSequence("JetArea_Residual_EtaJES_GSC"), + // No JMS recommendations for R22 yet m_jetAntiKt4_Data_PFlow_JMS_ConfigFile("JES_JMS_MC16Recommendation_Consolidated_data_only_PFlow_July2019_Rel21.config"), m_jetAntiKt4_Data_PFlow_JMS_CalibSequence("JetArea_Residual_EtaJES_GSC_JMS_Insitu"), @@ -131,10 +135,14 @@ namespace top { } StatusCode JetMETCPTools::setupJetsCalibration() { - // Release 21 specific + // R21 specific // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetEtmissRecommendationsR21 // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ApplyJetCalibrationR21 + // For R22 (currently only fullsim & data without JMS) + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetEtmissRecommendationsR22 + // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ApplyJetCalibrationR22 + // Get jet calibration name and erase "Jets" from the end const std::string caloJets_type = m_config->sgKeyJets(); std::string jetCalibrationName; @@ -284,7 +292,8 @@ namespace top { // Summer2019 - JES/JER update // Summer2021 - JMS-options // Winter2023_PreRec - R22 Phase-1 JES/JER pre-recs - std::string conference = "Winter2023_PreRec"; + // Summer2023_PreRec - R22 Phase-1 JES/JER pre-recs improved after GSC and energy-per-layer bugfixes + std::string conference = "Summer2023_PreRec"; // By setting calib_area to "None" we pick up the default from the JES group std::string calib_area = "None"; @@ -293,10 +302,15 @@ namespace top { const bool JERisPseudoData = (m_config->jetJERSmearingModel() == "Full_PseudoData") || (m_config->jetJERSmearingModel() == "All_PseudoData"); std::string JERSmearModel = m_config->jetJERSmearingModel(); std::string JMSOption = m_config->jetJMSOption(); + bool jmsR21Override = false; // In case some JMS option is specified, we revert to R21 recommendations + // This flags helps in suppressing additional R22-specific warnings below + if (JMSOption != "None") { // Updated files using the JMS option are in Spring2021 - Switching and letting the user know - ATH_MSG_INFO("JMS not yet available for R22 pre-recs - Moving to Spring2021 R21 recommendations!"); + ATH_MSG_WARNING("JMS not yet available for R22 pre-recs - Moving to Spring2021 R21 recommendations!"); + jmsR21Override = true; conference = "Spring2021"; + if (JMSOption == "JMS_frozen") JMSOption = "_JMS_frozen"; else if (JMSOption == "JMS_scaled") JMSOption = "_JMS_scaled"; else { @@ -316,7 +330,9 @@ namespace top { } // Throw out a warning if we are using the FTAG-calib only NP-Model - if (m_config->jetUncertainties_NPModel() == "SR_Scenario1" && JERSmearModel == "Simple") { + if (m_config->jetUncertainties_NPModel() == "SR_Scenario1" + && JERSmearModel == "Simple" + && !jmsR21Override) { ATH_MSG_WARNING( "\n **********************************************************************************" "\n * NP-Model 'SR_Scenario1' is ONLY supposed to be used for FTAG calibration work! *" @@ -325,7 +341,8 @@ namespace top { ); } // Check if we have necessary configs already for R22 for users to have an easy time debugging - else if (!(m_config->jetUncertainties_NPModel() == "CategoryReduction" && JERSmearModel == "Full")) { + else if ((!(m_config->jetUncertainties_NPModel() == "CategoryReduction") || !(JERSmearModel == "Full")) + && !jmsR21Override) { ATH_MSG_WARNING( "Incorrect JES/JER config: In R22 phase-1, only NP-Model \"CategoryReduction\" with some type of \"Full\"" " JER-smearing is supported for analyses! Your choices might lead to a crash unless you have installed custom" @@ -437,56 +454,42 @@ namespace top { StatusCode JetMETCPTools::setupLargeRJetsCalibration() { std::string jetCalibrationNameLargeR = m_config->sgKeyLargeRJets(); - // erase "Jets" from the end - jetCalibrationNameLargeR.erase(jetCalibrationNameLargeR.length() - 4); + jetCalibrationNameLargeR.erase(jetCalibrationNameLargeR.length() - 4); // erase "Jets" from the end // Only a single calib config/sequence for MC and data // so just put it here for now. std::string calibConfigLargeR = ""; + std::string calibSequenceLargeR = "EtaJES_JMS"; // CalibSequence for MC (changed below for data) + const std::string calibAreaLargeR = "00-04-82"; const std::string calibChoice = m_config->largeRJESJMSConfig(); + if (asg::ToolStore::contains<IJetCalibrationTool>("JetCalibrationToolLargeR")) { m_jetCalibrationToolLargeR = asg::ToolStore::get<IJetCalibrationTool>("JetCalibrationToolLargeR"); } else { - if (m_config->isMC()) { - if (calibChoice == "CombMass") { - calibConfigLargeR = "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_17Oct2018.config"; - } else if (calibChoice == "TAMass") { - calibConfigLargeR = "JES_MC16recommendation_FatJet_Trimmed_JMS_TA_12Oct2018.config"; - } else if (calibChoice == "CaloMass") { - calibConfigLargeR = "JES_MC16recommendation_FatJet_Trimmed_JMS_calo_12Oct2018.config"; - } else if (calibChoice == "TCCMass") { - calibConfigLargeR = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config"; - } else if (calibChoice == "UFOSDMass") { - calibConfigLargeR = "JES_MC16recommendation_R10_UFO_CSSK_SoftDrop_JMS_01April2020.config"; - } else { - ATH_MSG_ERROR( - "Unknown largeRJESJMSConfig (Available options: TAMass, CaloMass, CombMass, TCCMass and UFOSDMass)) : " + calibChoice); - return StatusCode::FAILURE; + // First check that we have a valid calibChoice + // !!! Please also update the options in ConfigurationSettings.cxx 'LargeJetJESJMSConfig' if more are added !!! + if (calibChoice != "UFOSDMass") { + ATH_MSG_ERROR( + "Unknown largeRJESJMSConfig (Available options: UFOSDMass)) : " + calibChoice); + return StatusCode::FAILURE; + } + + if (m_config->isMC()) { // Currently the same for both data and MC (but not always from R21 experience...) + if (calibChoice == "UFOSDMass") { + calibConfigLargeR = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_10Mar2023.config"; } - } else { //Insitu calibration for Data - if ((calibChoice == "CombMass") || (calibChoice == "TAMass") || (calibChoice == "CaloMass")) { - calibConfigLargeR = "JES_MC16recommendation_FatJet_Trimmed_JMS_comb_March2021.config"; //Data has only one - // config file - } else if (calibChoice == "TCCMass") { - calibConfigLargeR = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config"; //There's no insitu - // calibration yet - } else if (calibChoice == "UFOSDMass") { - calibConfigLargeR = "JES_MC16recommendation_R10_UFO_CSSK_SoftDrop_JMS_01April2020.config"; //There's no insitu - // calibration yet - } else { - ATH_MSG_ERROR( - "Unknown largeRJESJMSConfig (Available options: TAMass, CaloMass, CombMass, TCCMass and UFOSDMass) : " + calibChoice); - return StatusCode::FAILURE; + } else { // In-situ calibration for Data + if (calibChoice == "UFOSDMass") { + calibConfigLargeR = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_10Mar2023.config"; + } + } + + if (!m_config->isMC()) { + if (calibChoice == "UFOSDMass") { + calibSequenceLargeR = "EtaJES_JMS_Insitu"; } } - std::string calibSequenceLargeR = "EtaJES_JMS"; - if ((!m_config->isMC()) && - (calibChoice != "TCCMass") && - (calibChoice != "UFOSDMass")) calibSequenceLargeR = "EtaJES_JMS_Insitu_InsituCombinedMass"; //For data, there's - // is insitu - // calibration for - // lc-topo jets - const std::string calibAreaLargeR = "00-04-82"; + JetCalibrationTool* jetCalibrationToolLargeR = new JetCalibrationTool("JetCalibrationToolLargeR"); top::check(asg::setProperty(jetCalibrationToolLargeR, "JetCollection", jetCalibrationNameLargeR), @@ -504,47 +507,45 @@ namespace top { m_jetCalibrationToolLargeR = jetCalibrationToolLargeR; } - // Moriond2017 uncertainty recommendations: - // names = "UJ_2016/Moriond2017/UJ2016_CaloMass_strong.config" // strong,medium,weak - // names = "UJ_2016/Moriond2017/UJ2016_CombinedMass_strong.config" // strong,medium,weak - std::string configDir(""); std::string largeRJESJERJMS_unc_config = m_config->largeRJetUncertainties_NPModel(); std::string largeRJMR_unc_config = m_config->largeRJetUncertainties_JMR_NPModel(); - std::string calibArea = "None"; // Take the default JetUncertainties CalibArea tag - std::string MC_type = "MC16"; - - configDir = m_config->largeRJetUncertaintiesConfigDir(); - - if(m_config->largeRJESJMSConfig() != "UFOSDMass"){ - - m_jetUncertaintiesToolLargeR - = setupJetUncertaintiesTool("JetUncertaintiesToolLargeR", - jetCalibrationNameLargeR, - MC_type, - m_config->isMC(), - configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config", - nullptr, - "", - calibArea); - - // setup the large-R pseudodata tool when required - if (m_config->isMC() && m_config->doLargeRPseudodataJER()) { - m_jetUncertaintiesToolLargeRPseudoData - = setupJetUncertaintiesTool("JetUncertaintiesToolLargeRPseudoData", - jetCalibrationNameLargeR, - MC_type, - false, // treat MC as data - configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config", - nullptr, - "", - calibArea); - } - - if (!m_config->isSystNominal(m_config->systematics())) - m_FFJetSmearingTool = setupFFJetSmearingTool(calibChoice,configDir + "/R10_" + largeRJMR_unc_config + ".config"); - - } + std::string calibArea = "None"; // Take the default JetUncertainties CalibArea tag + std::string MC_type = "MC20"; + + // If we are in Run 3, we should use MC21 instead... + if (m_config->isRun3()) MC_type = "MC21"; + + configDir = m_config->largeRJetUncertaintiesConfigDir(); + + // Comment out uncertainties tool setup until we have large-R uncertainty prescriptions + ATH_MSG_WARNING("No large-R jet uncertainty prescriptions are available yet!"); + + // m_jetUncertaintiesToolLargeR + // = setupJetUncertaintiesTool("JetUncertaintiesToolLargeR", + // jetCalibrationNameLargeR, + // MC_type, + // m_config->isMC(), + // configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config", + // nullptr, + // "", + // calibArea); + // + // // setup the large-R pseudodata tool when required + // if (m_config->isMC() && m_config->doLargeRPseudodataJER()) { + // m_jetUncertaintiesToolLargeRPseudoData + // = setupJetUncertaintiesTool("JetUncertaintiesToolLargeRPseudoData", + // jetCalibrationNameLargeR, + // MC_type, + // false, // treat MC as data + // configDir + "/R10_" + largeRJESJERJMS_unc_config + ".config", + // nullptr, + // "", + // calibArea); + // } + // + // if (!m_config->isSystNominal(m_config->systematics())) + // m_FFJetSmearingTool = setupFFJetSmearingTool(calibChoice,configDir + "/R10_" + largeRJMR_unc_config + ".config"); return StatusCode::SUCCESS; } @@ -686,7 +687,7 @@ namespace top { met::METSystematicsTool* metSyst = new met::METSystematicsTool("met::METSystematicsTool"); std::string METconfigDir = m_config->METUncertaintiesConfigDir(); - if (METconfigDir == "Latest") METconfigDir = "METUtilities/run2_13TeV/"; //Find calib files here: /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/METUtilities/ + if (METconfigDir == "Latest") METconfigDir = "METUtilities/R22_PreRecs"; //Find calib files here: /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/METUtilities/ top::check(metSyst->setProperty("ConfigPrefix", METconfigDir), "Failed to set METsyst calibration area"); //Set calib area explicitly - removes potential for crash when default area is changed in METSyst code // TST (Track soft terms) if (m_config->useParticleFlowJets()) { diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx index 6e51a34b8fc39c91ae90f9ab69ee6bf3efdaa9f0..4eb70f3177a3ef61123096912ba3fe86daf111de 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/Root/TopMuonCPTools.cxx @@ -297,7 +297,8 @@ namespace top { "Failed to set CustomInputFolder property for MuonEfficiencyScaleFactors tool"); } if (m_config->isRun3()) { - top::check(asg::setProperty(tool, "CalibrationRelease", "230123_Preliminary_r22run3"), + // the MuonEfficiencyScaleFactors tool is set up for Run 2 by default + top::check(asg::setProperty(tool, "CalibrationRelease", "230309_Preliminary_r22run3"), "Failed to set CalibrationRelease property for MuonEfficiencyScaleFactors tool"); } top::check(asg::setProperty(tool, "BreakDownSystematics", m_config->muonBreakDownSystematics()), @@ -327,6 +328,11 @@ namespace top { top::check(asg::setProperty(tool, "useRandomRunNumber", false), "Failed to set useRandomRunNumber for " + name + " tool"); } + if (!m_config->isRun3()) { + // the MuonCalib tool is set up for Run 3 by default + top::check(asg::setProperty(tool, "release", "Recs2022_08_16_Run3PreRecs"), + "Failed to set Run 2 release for " + name + " tool"); + } if (m_config->muonCalibMode() == "correctData_CB") top::check(asg::setProperty(tool, "calibMode", CP::MuonCalibTool::CalibMode::correctData_CB), "Failed to set calibrationMode for " + name + " tool"); else if (m_config->muonCalibMode() == "correctData_IDMS") diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx index e621d2d8a1bf87f9d007d29f65ba2ada4ebcaf47..63b8b506676bbeab3541e2c601bc458d67949ae4 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/Root/ConfigurationSettings.cxx @@ -291,8 +291,9 @@ namespace top { "Path to directory containing large-R jet uncertainties config", "rel21/Winter2021"); registerParameter("LargeRJESJMSConfig", - "Calibration for large-R JES/JMS. CombMass, CaloMass, TCCMass or UFOSDMass (default CombMass).", - "CombMass"); + "Calibration for large-R JES/JMS. Choices are 'UFOSDMass' (default 'UFOSDMass').", + "UFOSDMass", + {"UFOSDMass"}); registerParameter("BoostedJetTagging", "Boosted jet taggers to use in the analysis, separated by commas or white spaces." " By default, no tagger is used.", diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h index dd1256734e84c49355100778a0f85bcb976aca04..24bd5a1cd221d497b96867c63630c5acd65ee4d1 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/TopConfiguration/ConfigurationSettings.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef CONFIGURATIONSETTINGS_H_ @@ -86,7 +86,9 @@ namespace top { * @brief Add a variable to the configuration settings. * * @param name The key used to refer to this variable. - * @param message A human readable explanation + * @param message A human readable explanation. + * @param default_val Default value used for this setting. + * @param allowed_values Possible choices for this setting (optional, by default all values are allowed). */ void registerParameter(const std::string& name, const std::string& message, const std::string& default_val = "", const std::vector<std::string> allowed_values = {}); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx index bc9231f35ec0b7d4a0c4889a62d46df1339ead98..260efbd3b37e856904cbd0bf507bda725971dcd4 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ElectronScaleFactorCalculator.cxx @@ -337,8 +337,8 @@ namespace top { m_decor_recoSF = "EL_SF_Reco"; m_decor_idSF = "EL_SF_ID_" + m_config->electronID(); m_decor_idSF_loose = "EL_LOOSE_SF_ID_" + m_config->electronIDLoose(); - m_decor_isoSF = "EL_SF_Iso_" + m_config->electronIsolation(); - m_decor_isoSF_loose = "EL_LOOSE_SF_Iso_" + m_config->electronIsolationLoose(); + m_decor_isoSF = "EL_SF_Iso_" + m_config->electronIsolationSF(); + m_decor_isoSF_loose = "EL_LOOSE_SF_Iso_" + m_config->electronIsolationSFLoose(); m_decor_chargeidSF = "EL_SF_ChargeID_" + m_config->electronID() + "_" + m_config->electronIsolation(); m_decor_chargeidSF_loose = "EL_LOOSE_SF_ChargeID_" + m_config->electronIDLoose() + "_" + m_config->electronIsolationLoose(); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx index 2a3927d15c4ad1a5f4cdbd7b5e256e5dcdf4fbf5..f99a39cfa5cbcac7e7164807b378caded3f6e0ef 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/MuonScaleFactorCalculator.cxx @@ -51,7 +51,7 @@ namespace top { m_reco_syst_DOWN("MUON_EFF_RECO_SYS__1down"), m_reco_bkg_fraction_UP("MUON_EFF_RECO_BKGFRACTION__1up"), - m_reco_bkg_fraction_DOWN("UON_EFF_RECO_BKGFRACTION__1down"), + m_reco_bkg_fraction_DOWN("MUON_EFF_RECO_BKGFRACTION__1down"), m_reco_fit_model_lowpt_UP("MUON_EFF_RECO_FITMODEL_LOWPT__1up"), m_reco_fit_model_lowpt_DOWN("MUON_EFF_RECO_FITMODEL_LOWPT__1down"), m_reco_lumi_uncert_UP("MUON_EFF_RECO_LUMIUNCERT__1up"), @@ -86,6 +86,8 @@ namespace top { m_reco_tagpt_DOWN("MUON_EFF_RECO_TAGPT__1down"), m_reco_extrapolation_UP("MUON_EFF_RECO_EXTRAPOLATION__1up"), m_reco_extrapolation_DOWN("MUON_EFF_RECO_EXTRAPOLATION__1down"), + m_reco_extrapolation_lowpt_UP("MUON_EFF_RECO_EXTRAPOLATION_LOWPT__1up"), + m_reco_extrapolation_lowpt_DOWN("MUON_EFF_RECO_EXTRAPOLATION_LOWPT__1down"), m_reco_stat_lowpt_UP("MUON_EFF_RECO_STAT_LOWPT__1up"), m_reco_stat_lowpt_DOWN("MUON_EFF_RECO_STAT_LOWPT__1down"), @@ -187,6 +189,7 @@ namespace top { "MUON_EFF_TTVA_EXTRAPOLATION", "MUON_EFF_TrigStatUncertainty", "MUON_EFF_TrigSystUncertainty", + "MUON_EFF_RECO_EXTRAPOLATION_LOWPT", }; if (m_config->muonQuality() == "HighPt" || m_config->muonQualityLoose() == "HighPt") { implemented_systematics.insert("MUON_EFF_BADMUON_PTDEPENDENCY"); @@ -1041,6 +1044,11 @@ namespace top { const static SG::AuxElement::Decorator<float> id_sf_loose_decor_extrapolation_up(m_decor_idSF_loose + "_EXTRAPOLATION_UP"); const static SG::AuxElement::Decorator<float> id_sf_decor_extrapolation_down(m_decor_idSF + "_EXTRAPOLATION_DOWN"); const static SG::AuxElement::Decorator<float> id_sf_loose_decor_extrapolation_down(m_decor_idSF_loose + "_EXTRAPOLATION_DOWN"); + + const static SG::AuxElement::Decorator<float> id_sf_decor_extrapolation_lowpt_up(m_decor_idSF + "_EXTRAPOLATION_LOWPT_UP"); + const static SG::AuxElement::Decorator<float> id_sf_loose_decor_extrapolation_lowpt_up(m_decor_idSF_loose + "_EXTRAPOLATION_LOWPT_UP"); + const static SG::AuxElement::Decorator<float> id_sf_decor_extrapolation_lowpt_down(m_decor_idSF + "_EXTRAPOLATION_LOWPT_DOWN"); + const static SG::AuxElement::Decorator<float> id_sf_loose_decor_extrapolation_lowpt_down(m_decor_idSF_loose + "_EXTRAPOLATION_LOWPT_DOWN"); this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, m_reco_stat_UP, muon, @@ -1297,12 +1305,24 @@ namespace top { this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, m_reco_extrapolation_UP, muon, id_sf_loose_decor_extrapolation_up); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_extrapolation_lowpt_UP, muon, + id_sf_decor_extrapolation_lowpt_up); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_extrapolation_lowpt_UP, muon, + id_sf_loose_decor_extrapolation_lowpt_up); this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, m_reco_extrapolation_DOWN, muon, id_sf_decor_extrapolation_down); this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, m_reco_extrapolation_DOWN, muon, id_sf_loose_decor_extrapolation_down); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, + m_reco_extrapolation_lowpt_DOWN, muon, + id_sf_decor_extrapolation_lowpt_down); + this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsToolLoose, + m_reco_extrapolation_lowpt_DOWN, muon, + id_sf_loose_decor_extrapolation_down); } else { ///-- Syst UP --/// this->decorateIDSFandRecoEff(m_muonEfficiencyCorrectionsTool, diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx index 471fe56044458dacc4cc51ff6d06687a82b55fe0..9e49788c9a6999e3e4d871769cf05ea2ce143a7e 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/Root/ScaleFactorRetriever.cxx @@ -293,7 +293,7 @@ namespace top { if (sf.size() != sf_aux.size()) ATH_MSG_ERROR( "ScaleFactorRetriever::electronSFSystVariationVector error in size of vector of electron SFs"); double oldSF = 1.; - if (SFComp == top::topSFComp::RECO) oldSF = electronSF_Reco(*elPtr, top::topSFSyst::nominal, retrieveLoose); + if (SFComp == top::topSFComp::RECO) oldSF = electronSF_Reco(*elPtr, top::topSFSyst::nominal); if (SFComp == top::topSFComp::ID) oldSF = electronSF_ID(*elPtr, electronID, top::topSFSyst::nominal, retrieveLoose); if (SFComp == top::topSFComp::ISOLATION) oldSF = electronSF_Isol(*elPtr, electronIso, top::topSFSyst::nominal, retrieveLoose); @@ -334,7 +334,7 @@ namespace top { !elPtr->auxdataConst<char>("passPreORSelection")) continue; // in case one want the tight SFs in the loose // tree, need to only take the tight leptons - reco *= electronSF_Reco(*elPtr, SFSyst, retrieveLoose); + reco *= electronSF_Reco(*elPtr, SFSyst); id *= electronSF_ID(*elPtr, electronID, SFSyst, retrieveLoose); isol *= electronSF_Isol(*elPtr, electronIso, SFSyst, retrieveLoose); chargeid *= electronSF_ChargeID(*elPtr, electronID, electronIso, SFSyst, retrieveLoose); @@ -466,12 +466,13 @@ namespace top { } float ScaleFactorRetriever::electronSF_Reco(const xAOD::Electron& x, - const top::topSFSyst SFSyst, - bool useLooseDef) const { + const top::topSFSyst SFSyst + ) const { float sf(1.); std::string prefix="EL"; - if(useLooseDef) prefix+="_LOOSE"; + // the reco SF is the same for tight and loose electrons + // no special handling of the loose collection needed here if (x.isAvailable<float>(prefix+"_SF_Reco")) { sf = x.auxdataConst<float>(prefix+"_SF_Reco"); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h index 75f3a2d15253e4a9ae2024588337ee3ccff2dbf3..45e55c98e5959dc4ee687b0a793a29a99bb8bb8e 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/MuonScaleFactorCalculator.h @@ -228,6 +228,8 @@ namespace top { CP::SystematicSet m_reco_tagpt_DOWN; CP::SystematicSet m_reco_extrapolation_UP; CP::SystematicSet m_reco_extrapolation_DOWN; + CP::SystematicSet m_reco_extrapolation_lowpt_UP; + CP::SystematicSet m_reco_extrapolation_lowpt_DOWN; CP::SystematicSet m_reco_stat_lowpt_UP; CP::SystematicSet m_reco_stat_lowpt_DOWN; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h index d51d081ecbbf3c5c1f754b02e817337c6606d0d6..64681a4b31702fb361e1455356c534c9b1c1dc85 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/TopCorrections/ScaleFactorRetriever.h @@ -335,8 +335,8 @@ namespace top { void print(const top::Event& event); float electronSF_Reco(const xAOD::Electron& x, - const top::topSFSyst SFSyst, - bool useLooseDef) const; + const top::topSFSyst SFSyst + ) const; float electronSF_Trigger(const xAOD::Electron& x, const top::topSFSyst SFSyst, bool useLooseDef) const; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid_Tutorial.py b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid_Tutorial.py new file mode 100755 index 0000000000000000000000000000000000000000..bb624fbb5c6f91bc9e86a2ec90a84e191d99145c --- /dev/null +++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/scripts/01SubmitToGrid_Tutorial.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (C) 2023 CERN for the benefit of the ATLAS collaboration +import TopExamples.grid +import DerivationTags +import Data_rel21 +import MC16_TOPQ1 + +config = TopExamples.grid.Config() +config.code = 'top-xaod' +config.settingsFile = 'custom-saver-test.txt' +config.gridUsername = 'username' +config.suffix = '04-05-23' +config.excludedSites = '' +config.noSubmit = False # set to True if you just want to test the submission +config.CMake = True # need to set to True for CMake-based releases (release 22) +config.mergeType = 'Default' #'None', 'Default' or 'xAOD' +config.destSE = '' #This is the default (anywhere), or try e.g. 'UKI-SOUTHGRID-BHAM-HEP_LOCALGROUPDISK' + + +###Data - look in Data_rel21.py #TO BE UPDATED +###MC Simulation - look in MC16_TOPQ1.py #TO BE UPDATED +###Using a few test samples produced with release 22 +###Edit these lines if you don't want to run everything! +names = [ + 'TOPQ1_ttbar_PowPy8', +# 'Data16_TOPQ1', +] + +samples = TopExamples.grid.Samples(names) +TopExamples.grid.submit(config, samples) + diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx index e524b6c8b952e590cb2b5b857bb66580aef6703a..f6f858eb98f5bf216bbba18efdb67a9dc4bfcac0 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/Root/TruthTools.cxx @@ -110,10 +110,15 @@ namespace top { const xAOD::TruthParticle* getTruthMuonAssociatedToRecoMuon(const xAOD::Muon* muon) { if(!muon) return 0; - const xAOD::TrackParticle* track = muon->primaryTrackParticle(); - if(!track) return 0; - const xAOD::TruthParticle* truthmu= xAOD::TruthHelpers::getTruthParticle(*track); + const xAOD::TruthParticle* truthmu=xAOD::TruthHelpers::getTruthParticle(*muon); + if(!truthmu) + { + const xAOD::TrackParticle* track = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); + if(!track) track=muon->primaryTrackParticle(); + if(track) truthmu= xAOD::TruthHelpers::getTruthParticle(*track); + } + if(!truthmu) return 0; if(!truthmu->isMuon()) return 0; //note that the truth particle associated with a muon can be e.g. a pion/kaon in some cases (since pion/kaon decays are not done at generator level, but at simulation level), we ignore these cases diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTTZPartonHistory.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTTZPartonHistory.cxx index 169d1838e19c4d7409245a1d194129e3673dfbd4..8eb80e38c5527a7ab725d3694a5502afadc9dccb 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTTZPartonHistory.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/Root/CalcTTZPartonHistory.cxx @@ -170,7 +170,20 @@ namespace top { // Get the Truth Particles const xAOD::TruthParticleContainer* truthParticles(nullptr); - ATH_CHECK(evtStore()->retrieve(truthParticles, m_config->sgKeyMCParticle())); + if(m_config->getDerivationStream() == "PHYS") //in DAOD_PHYS we don't have the truth particles container + { + // To obtain both tops and the Z boson, we need the collections for both + std::vector<std::string> collections = {"TruthTop", "TruthBosonsWithDecayParticles", "HardScatterParticles"}; + ATH_CHECK(buildContainerFromMultipleCollections(collections,"AT_TTZPartonHistory_TruthParticles")); + ATH_CHECK(evtStore()->retrieve(truthParticles, "AT_TTZPartonHistory_TruthParticles")); + + //we need to be able to navigate from the Ws to their decayProducts, see CalcTopPartonHistory.h for details + ATH_CHECK(linkBosonCollections()); + } + else //otherwise we retrieve the container as usual + { + ATH_CHECK(evtStore()->retrieve(truthParticles, m_config->sgKeyMCParticle())); + } // Create the partonHistory xAOD object //cppcheck-suppress uninitvar diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx index 388e220a510ef70025e8a9e9843a45f23e19d9dc..79080424fecbd8a5f5eac06893d10a1178061959 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/JetObjectCollectionMaker.cxx @@ -100,16 +100,17 @@ namespace top { if (m_config->useLargeRJets()) { top::check(m_jetCalibrationToolLargeR.retrieve(), "Failed to retrieve JetCalibrationToolLargeR"); - if(m_config->largeRJESJMSConfig() != "UFOSDMass"){ - top::check(m_jetUncertaintiesToolLargeR.retrieve(), - "Failed to retrieve JetUncertaintiesToolLargeR"); - if (m_config->isMC() && m_config->doLargeRPseudodataJER()) - top::check(m_jetUncertaintiesToolLargeRPseudoData.retrieve(), - "Failed to retrieve JetUncertaintiesToolLargeRPseudoData"); - if (!m_config->isSystNominal(m_config->systematics())) - top::check(m_FFJetSmearingTool.retrieve(), - "Failed to retrieve FFJetSmearingTool"); - } + + // Retrieve large-R jet uncertainties tools + // (Commented out until large-R jet uncertainty prescriptions become available) + // top::check(m_jetUncertaintiesToolLargeR.retrieve(), + // "Failed to retrieve JetUncertaintiesToolLargeR"); + // if (m_config->isMC() && m_config->doLargeRPseudodataJER()) + // top::check(m_jetUncertaintiesToolLargeRPseudoData.retrieve(), + // "Failed to retrieve JetUncertaintiesToolLargeRPseudoData"); + // if (!m_config->isSystNominal(m_config->systematics())) + // top::check(m_FFJetSmearingTool.retrieve(), + // "Failed to retrieve FFJetSmearingTool"); } ///-- Small-R JER (Pseudo-)Data Smearing Config --/// @@ -226,14 +227,10 @@ namespace top { ///-- Large-R JES/JER/JMS/JMR systematics --/// CP::SystematicSet largeRsysts; if ((m_isMC || m_doFull_JER_largeR) && m_config->useLargeRJets()) { - if (m_config->largeRJESJMSConfig() == "CombMass") { // Only CombMass is supported for large-R JES/JER/JMS/JMR systematics at the moment - largeRsysts.insert(m_jetUncertaintiesToolLargeR->recommendedSystematics()); - if (!m_config->isSystNominal(m_config->systematics())) - largeRsysts.insert(m_FFJetSmearingTool->recommendedSystematics()); - } else { - ATH_MSG_WARNING( - "TA Mass & Calo Mass & TCCMass & UFO SD Mass are not supported for large-R jet uncertainties at the moment. Large-R jet systemtatics skipped!"); - } + ATH_MSG_WARNING("No Large-R jet systematic recommendations are available yet! Large-R jet systematics skipped!"); + // largeRsysts.insert(m_jetUncertaintiesToolLargeR->recommendedSystematics()); + // if (!m_config->isSystNominal(m_config->systematics())) + // largeRsysts.insert(m_FFJetSmearingTool->recommendedSystematics()); } @@ -244,7 +241,7 @@ namespace top { if (tmp_SF_uncert_tool.retrieve()) { m_tagSFUncorrelatedSystematics[name.first].clear(); - CP::SystematicSet correlatedSys,uncorrelatedSys; + CP::SystematicSet correlatedSys, uncorrelatedSys; const CP::SystematicSet& recommendedSys = tmp_SF_uncert_tool->recommendedSystematics(); for (const CP::SystematicVariation& sys : recommendedSys) { diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx index abf60254279c0366ed61bfeebeca8f5b2dea7341..35c52c74ec28bd6e53ae0177f421934e4c7623e6 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx @@ -284,13 +284,13 @@ namespace top { // https://svnweb.cern.ch/trac/atlasoff/browser/Reconstruction/MET/METUtilities/tags/METUtilities-00-01-43/util/example_METMaker_METSystematicsTool.cxx //get the soft cluster term, and applyCorrection - xAOD::MissingET* softClusMet = (*new_met_container)["SoftClusCore"]; + xAOD::MissingET* softClusMet = (*new_met_container)["SoftClus"]; if (softClusMet != nullptr) { //check we retrieved the clust term m_met_systematics->setRandomSeed(static_cast<int>(1e6*softClusMet->phi())); top::check(m_met_systematics->applyCorrection(*softClusMet, metHelper), "Failed to applyCorrection"); } - xAOD::MissingET* softTrkMet = (*new_met_container)["PVSoftTrkCore"]; + xAOD::MissingET* softTrkMet = (*new_met_container)["PVSoftTrk"]; if (softTrkMet != nullptr) { //check we retrieved the soft trk m_met_systematics->setRandomSeed(static_cast<int>(1e6*softTrkMet->phi())); top::check(m_met_systematics->applyCorrection(*softTrkMet, metHelper), "Failed to applyCorrection"); diff --git a/Projects/AnalysisBase/cmake/PreConfig.cmake.in b/Projects/AnalysisBase/cmake/PreConfig.cmake.in index 249c77a7e70752afe158c0b36faa303b3183eba4..b95fa4bda000128a27615bd6fdb18b4d923b6c4b 100644 --- a/Projects/AnalysisBase/cmake/PreConfig.cmake.in +++ b/Projects/AnalysisBase/cmake/PreConfig.cmake.in @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # # File setting up imported targets needed by the exported targets of # @CMAKE_PROJECT_NAME@. @@ -15,6 +15,10 @@ set( ATLAS_FLAKE8 @ATLAS_FLAKE8@ set( ATLAS_PYTHON_CHECKER @ATLAS_PYTHON_CHECKER@ CACHE STRING "Python checker command to run during Python module compilation" ) +# Child projects should not use the ATLAS CPack install scripts. +set( ATLAS_USE_CUSTOM_CPACK_INSTALL_SCRIPT FALSE + CACHE BOOL "Don't use the custom ATLAS CPack install scripts" ) + # Figure out whether to use QUIET in the find_package call(s). set( _quietFlag ) if( @CMAKE_PROJECT_NAME@_FIND_QUIETLY ) diff --git a/Projects/AnalysisBase/externals.txt b/Projects/AnalysisBase/externals.txt index 94813576396b4ac3eb5fd2c545764d8c8308469a..38d1868a2dd25dd9a817b148e5582732e7cc1fda 100644 --- a/Projects/AnalysisBase/externals.txt +++ b/Projects/AnalysisBase/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AnalysisBaseExternalsVersion = 2.0.151 +AnalysisBaseExternalsVersion = 2.0.156 diff --git a/Projects/AnalysisBase/version.txt b/Projects/AnalysisBase/version.txt index 40a0add428fc7b0deb5c46fc49528e02b0554827..dfec67ab06c535ae474d9c8ab5a58cb9fda660bf 100644 --- a/Projects/AnalysisBase/version.txt +++ b/Projects/AnalysisBase/version.txt @@ -1 +1 @@ -22.2.113 +24.2.11 diff --git a/Projects/AthAnalysis/CMakeLists.txt b/Projects/AthAnalysis/CMakeLists.txt index e07fc0f14c3be3d1fabd0c59e72d048ccdb237b7..497a46a51e076b490cc5ab6f1dce191bbde82c7b 100644 --- a/Projects/AthAnalysis/CMakeLists.txt +++ b/Projects/AthAnalysis/CMakeLists.txt @@ -33,6 +33,7 @@ find_package( VDT ) find_package( requests ) find_package( libffi ) find_package( gl2ps ) +find_package( autopep8 ) # Compile flag(s). add_definitions( -DXAOD_ANALYSIS ) diff --git a/Projects/AthAnalysis/build_externals.sh b/Projects/AthAnalysis/build_externals.sh index 0d32ae2d84d505b43cff794dac1075eae1711c72..0936e069f49ff7b9740b76601fcefa7e51791281 100755 --- a/Projects/AthAnalysis/build_externals.sh +++ b/Projects/AthAnalysis/build_externals.sh @@ -10,9 +10,9 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthAnalysisExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=102 - -DLCG_VERSION_POSTFIX="b_ATLAS_11" + -DLCG_VERSION_POSTFIX="b_ATLAS_21" -DATLAS_ONNXRUNTIME_USE_CUDA=FALSE - -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r11.000/Gaudi-v36r11.000.tar.gz;URL_MD5;75c37c23a1e210d8fcbf98d988bf7fcd") + -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r13.000/Gaudi-v36r13.000.tar.gz;URL_MD5;ca2ae582004acc869163a42cf10ab956") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/AthAnalysis/cmake/PreConfig.cmake.in b/Projects/AthAnalysis/cmake/PreConfig.cmake.in index 51d721ac294bf2068ed7665afd3708ddfe12a7ce..476487c93f6d91fc7def52fd5ff77e0f15f67302 100644 --- a/Projects/AthAnalysis/cmake/PreConfig.cmake.in +++ b/Projects/AthAnalysis/cmake/PreConfig.cmake.in @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # # Pre-config script to propagate variables to downstream projects # @@ -17,6 +17,10 @@ set( ATLAS_FLAKE8 @ATLAS_FLAKE8@ set( ATLAS_PYTHON_CHECKER @ATLAS_PYTHON_CHECKER@ CACHE STRING "Python checker command to run during Python module compilation" ) +# Child projects should not use the ATLAS CPack install scripts. +set( ATLAS_USE_CUSTOM_CPACK_INSTALL_SCRIPT FALSE + CACHE BOOL "Don't use the custom ATLAS CPack install scripts" ) + # Compilation flag(s). add_definitions( -DXAOD_ANALYSIS ) diff --git a/Projects/AthAnalysis/externals.txt b/Projects/AthAnalysis/externals.txt index 98df846ab745ba7bafff8c191381f33337ba33fe..9969a9ed2bd73eac402e777633b24bcef4c778e3 100644 --- a/Projects/AthAnalysis/externals.txt +++ b/Projects/AthAnalysis/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthAnalysisExternalsVersion = 2.0.151 +AthAnalysisExternalsVersion = 2.0.156 diff --git a/Projects/AthAnalysis/package_filters.txt b/Projects/AthAnalysis/package_filters.txt index b9b2966453c8baf56dcbb34712120e69176f3722..e96bcddd06a4cb49b4568fd8c0ce19fb56b13224 100644 --- a/Projects/AthAnalysis/package_filters.txt +++ b/Projects/AthAnalysis/package_filters.txt @@ -86,7 +86,7 @@ + PhysicsAnalysis/MCTruthClassifier + PhysicsAnalysis/MuonID/MuonIDAnalysis/.* + PhysicsAnalysis/MuonID/MuonSelectorTools -#+ PhysicsAnalysis/SUSYPhys/SUSYTools ++ PhysicsAnalysis/SUSYPhys/SUSYTools + PhysicsAnalysis/TauID/DiTauMassTools + PhysicsAnalysis/TauID/TauAnalysisTools + PhysicsAnalysis/TrackingID/.* diff --git a/Projects/AthAnalysis/version.txt b/Projects/AthAnalysis/version.txt index 40a0add428fc7b0deb5c46fc49528e02b0554827..dfec67ab06c535ae474d9c8ab5a58cb9fda660bf 100644 --- a/Projects/AthAnalysis/version.txt +++ b/Projects/AthAnalysis/version.txt @@ -1 +1 @@ -22.2.113 +24.2.11 diff --git a/Projects/AthDataQuality/CMakeLists.txt b/Projects/AthDataQuality/CMakeLists.txt index 53d03d8a60b81bf5862cd78c4ad81443488e1b76..454b6bfb5b81c7d690b3782adfa180d9dbc9ba70 100644 --- a/Projects/AthDataQuality/CMakeLists.txt +++ b/Projects/AthDataQuality/CMakeLists.txt @@ -18,7 +18,7 @@ set( TDAQ-COMMON_ATROOT find_package( AtlasCMake REQUIRED ) # Build the project against LCG: -set( LCG_VERSION_POSTFIX "b_ATLAS_11" +set( LCG_VERSION_POSTFIX "b_ATLAS_21" CACHE STRING "Version postfix for the LCG release to use" ) set( LCG_VERSION_NUMBER 102 CACHE STRING "Version number for the LCG release to use" ) @@ -38,6 +38,7 @@ find_package( TBB ) find_package( TIFF ) find_package( libffi ) find_package( gl2ps ) +find_package( autopep8 ) # Disable flake8. set( ATLAS_FLAKE8 true # <- this is the shell builtin `true` diff --git a/Projects/AthDataQuality/externals.txt b/Projects/AthDataQuality/externals.txt index ee9b72f53a81a54fefdbc81aaf9816ab615fa299..38547d71227ce66bdcee3dd438a88c1fe047cd17 100644 --- a/Projects/AthDataQuality/externals.txt +++ b/Projects/AthDataQuality/externals.txt @@ -5,4 +5,4 @@ # an "origin/" prefix before it. For tags however this is explicitly # forbidden. -AtlasExternalsVersion = 2.0.151 +AtlasExternalsVersion = 2.0.156 diff --git a/Projects/AthDataQuality/version.txt b/Projects/AthDataQuality/version.txt index 3e3319b9f0d24f39034266621e1dad1dbc3444df..934c1d66356d05097b8028f22de61a25c6a1ca1d 100644 --- a/Projects/AthDataQuality/version.txt +++ b/Projects/AthDataQuality/version.txt @@ -1 +1 @@ -23.0.34 +24.0.7 diff --git a/Projects/AthDerivation/CMakeLists.txt b/Projects/AthDerivation/CMakeLists.txt index e9450406cb6730db1d2d909c3ea9ac84338ddaf8..af6d6f3ed4a6134947b7a7b1dd5db5a1fd070a15 100644 --- a/Projects/AthDerivation/CMakeLists.txt +++ b/Projects/AthDerivation/CMakeLists.txt @@ -42,6 +42,7 @@ find_package( Frontier_Client ) find_package( VDT ) find_package( libffi ) find_package( gl2ps ) +find_package( autopep8 ) # Set up where to find the AthenaPoolUtilitiesTest CMake code. set( AthenaPoolUtilitiesTest_DIR diff --git a/Projects/AthDerivation/build_externals.sh b/Projects/AthDerivation/build_externals.sh index 0fe0ed3d332cd8c318556b8ce7882d591bf18198..e0033e13a9fd8dcbb3c3c078b45f00621d4d05ac 100755 --- a/Projects/AthDerivation/build_externals.sh +++ b/Projects/AthDerivation/build_externals.sh @@ -10,9 +10,9 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthDerivationExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=102 - -DLCG_VERSION_POSTFIX="b_ATLAS_11" - -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r11.000/Gaudi-v36r11.000.tar.gz;URL_MD5;75c37c23a1e210d8fcbf98d988bf7fcd" - -DATLAS_ACTS_SOURCE="URL;https://github.com/acts-project/acts/archive/refs/tags/v23.5.0.tar.gz;URL_MD5;URL_MD5;873112ed91c1a04737b91621cedb3921") + -DLCG_VERSION_POSTFIX="b_ATLAS_21" + -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r13.000/Gaudi-v36r13.000.tar.gz;URL_MD5;ca2ae582004acc869163a42cf10ab956" + -DATLAS_ACTS_SOURCE="URL;https://github.com/acts-project/acts/archive/refs/tags/v26.0.0.tar.gz;URL_MD5;6848960f4b75711144e163c4d1b04c8b") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/AthDerivation/externals.txt b/Projects/AthDerivation/externals.txt index d0419d59ff1436b2169870024f7c66cd000b409d..63f71031a0738d27ee5c5e8421162486d154630d 100644 --- a/Projects/AthDerivation/externals.txt +++ b/Projects/AthDerivation/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthDerivationExternalsVersion = 2.0.151 +AthDerivationExternalsVersion = 2.0.156 diff --git a/Projects/AthGeneration/CMakeLists.txt b/Projects/AthGeneration/CMakeLists.txt index af8450a0db944a13b95164aa09829eb4177c3ec5..81b8694f4ac51b8f3d8b47b16f55cf9572802c1c 100644 --- a/Projects/AthGeneration/CMakeLists.txt +++ b/Projects/AthGeneration/CMakeLists.txt @@ -35,6 +35,7 @@ find_package( AIDA ) find_package( VDT ) find_package( libffi ) find_package( gl2ps ) +find_package( autopep8 ) # Set the project into "GENERATIONBASE mode". set( GENERATIONBASE TRUE CACHE BOOL diff --git a/Projects/AthGeneration/build_externals.sh b/Projects/AthGeneration/build_externals.sh index 17c5db266c66c4bfd7292d80dbb35c687f85a052..33881c9d7638eb0a518889810d3bbc3c28f6a236 100755 --- a/Projects/AthGeneration/build_externals.sh +++ b/Projects/AthGeneration/build_externals.sh @@ -10,8 +10,8 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthGenerationExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=102 - -DLCG_VERSION_POSTFIX="b_ATLAS_11" - -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r11.000/Gaudi-v36r11.000.tar.gz;URL_MD5;75c37c23a1e210d8fcbf98d988bf7fcd") + -DLCG_VERSION_POSTFIX="b_ATLAS_21" + -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r13.000/Gaudi-v36r13.000.tar.gz;URL_MD5;ca2ae582004acc869163a42cf10ab956") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/AthGeneration/externals.txt b/Projects/AthGeneration/externals.txt index 076e601a8533df0c489e44db5cffd146e7a17477..1d235fdddeb4a941730e54257691d4753592672e 100644 --- a/Projects/AthGeneration/externals.txt +++ b/Projects/AthGeneration/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthGenerationExternalsVersion = 2.0.151 +AthGenerationExternalsVersion = 2.0.156 diff --git a/Projects/AthGeneration/version.txt b/Projects/AthGeneration/version.txt index 74e66dd6c68b57bcbdf60aa6f19dc65f287c21c5..6b4eeafd30031722c8ed203402adde1157faff12 100644 --- a/Projects/AthGeneration/version.txt +++ b/Projects/AthGeneration/version.txt @@ -1 +1 @@ -23.6.8 +23.6.14 diff --git a/Projects/AthSimulation/CMakeLists.txt b/Projects/AthSimulation/CMakeLists.txt index 9dcf3fd443653e710a084a7565385a9b14297bc2..137596957d845e4987b936860775a3ad75ae4fa6 100644 --- a/Projects/AthSimulation/CMakeLists.txt +++ b/Projects/AthSimulation/CMakeLists.txt @@ -32,6 +32,7 @@ find_package( VDT ) find_package( TIFF ) find_package( libffi ) find_package( gl2ps ) +find_package( autopep8 ) # Set the project into "SIMULATIONBASE mode". set( SIMULATIONBASE TRUE CACHE BOOL diff --git a/Projects/AthSimulation/build_externals.sh b/Projects/AthSimulation/build_externals.sh index fbbc8ea844e9de8670e131813f64d77c6356662b..dbe104443c7292fb362474024b2728146177f15e 100755 --- a/Projects/AthSimulation/build_externals.sh +++ b/Projects/AthSimulation/build_externals.sh @@ -10,8 +10,8 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthSimulationExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=102 - -DLCG_VERSION_POSTFIX="b_ATLAS_11" - -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r11.000/Gaudi-v36r11.000.tar.gz;URL_MD5;75c37c23a1e210d8fcbf98d988bf7fcd") + -DLCG_VERSION_POSTFIX="b_ATLAS_21" + -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r13.000/Gaudi-v36r13.000.tar.gz;URL_MD5;ca2ae582004acc869163a42cf10ab956") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/AthSimulation/externals.txt b/Projects/AthSimulation/externals.txt index 5b1e944790faffaaf05e15f0cb5113cc5f33b93b..77936b0b84248fe0dda4d77093888c061206c927 100644 --- a/Projects/AthSimulation/externals.txt +++ b/Projects/AthSimulation/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthSimulationExternalsVersion = 2.0.151 +AthSimulationExternalsVersion = 2.0.156 diff --git a/Projects/AthSimulation/version.txt b/Projects/AthSimulation/version.txt index 3e3319b9f0d24f39034266621e1dad1dbc3444df..934c1d66356d05097b8028f22de61a25c6a1ca1d 100644 --- a/Projects/AthSimulation/version.txt +++ b/Projects/AthSimulation/version.txt @@ -1 +1 @@ -23.0.34 +24.0.7 diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt index cd16b00980666a9aba968cedb43e9bd8e05806de..2f1501b5be102aa1b0665dbd9598bb297a05dd7f 100644 --- a/Projects/Athena/CMakeLists.txt +++ b/Projects/Athena/CMakeLists.txt @@ -96,9 +96,11 @@ find_package( Doxygen ) find_package( PNG ) find_package( VDT ) find_package( TIFF ) +find_package( auth_get_sso_cookie ) find_package( heaptrack ) find_package( libffi ) find_package( gl2ps ) +find_package( autopep8 ) # (Hopefully) Temporary global dependence on cuDNN, as described # in ATLASRECTS-6680. diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index 20963e1f586fdf637ee4b2ffd2044d2b1ee9a12a..88644bb2f887d1a0b845d8d6aa75d522e31a54b7 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -10,9 +10,9 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="AthenaExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=102 - -DLCG_VERSION_POSTFIX="b_ATLAS_11" - -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r11.000/Gaudi-v36r11.000.tar.gz;URL_MD5;75c37c23a1e210d8fcbf98d988bf7fcd" - -DATLAS_ACTS_SOURCE="URL;https://github.com/acts-project/acts/archive/refs/tags/v23.5.0.tar.gz;URL_MD5;873112ed91c1a04737b91621cedb3921") + -DLCG_VERSION_POSTFIX="b_ATLAS_21" + -DATLAS_GAUDI_SOURCE="URL;https://gitlab.cern.ch/atlas/Gaudi/-/archive/v36r13.000/Gaudi-v36r13.000.tar.gz;URL_MD5;ca2ae582004acc869163a42cf10ab956" + -DATLAS_ACTS_SOURCE="URL;https://github.com/acts-project/acts/archive/refs/tags/v26.0.0.tar.gz;URL_MD5;6848960f4b75711144e163c4d1b04c8b") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt index 5deb28b71637b4992b5929f47c18a85eb70d234e..05ea2c83600e28cfb5f7562efb103a80ad7e3432 100644 --- a/Projects/Athena/externals.txt +++ b/Projects/Athena/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthenaExternalsVersion = 2.0.151 +AthenaExternalsVersion = 2.0.156 diff --git a/Projects/Athena/version.txt b/Projects/Athena/version.txt index 3e3319b9f0d24f39034266621e1dad1dbc3444df..934c1d66356d05097b8028f22de61a25c6a1ca1d 100644 --- a/Projects/Athena/version.txt +++ b/Projects/Athena/version.txt @@ -1 +1 @@ -23.0.34 +24.0.7 diff --git a/Projects/DetCommon/externals.txt b/Projects/DetCommon/externals.txt index 3b82cb830d9aea2b22e0140ff5b1bfa7a0dfe795..b2a4166ac2b8afbf2022d31aaf8a6e1e98819325 100644 --- a/Projects/DetCommon/externals.txt +++ b/Projects/DetCommon/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AtlasExternalsVersion = 2.0.151 +AtlasExternalsVersion = 2.0.156 diff --git a/Projects/DetCommon/version.txt b/Projects/DetCommon/version.txt index 3e3319b9f0d24f39034266621e1dad1dbc3444df..934c1d66356d05097b8028f22de61a25c6a1ca1d 100644 --- a/Projects/DetCommon/version.txt +++ b/Projects/DetCommon/version.txt @@ -1 +1 @@ -23.0.34 +24.0.7 diff --git a/Projects/VP1Light/build_externals.sh b/Projects/VP1Light/build_externals.sh index f0f513456aa306a714e30112c8624d67f923cca9..bb7cf9253c69d6e83a416e5a9b551c2fe9360e0b 100755 --- a/Projects/VP1Light/build_externals.sh +++ b/Projects/VP1Light/build_externals.sh @@ -10,7 +10,7 @@ ATLAS_PROJECT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd) ATLAS_EXT_PROJECT_NAME="VP1LightExternals" ATLAS_BUILDTYPE="RelWithDebInfo" ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=102 - -DLCG_VERSION_POSTFIX="b_ATLAS_11") + -DLCG_VERSION_POSTFIX="b_ATLAS_21") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/VP1Light/externals.txt b/Projects/VP1Light/externals.txt index 9940619862ffe676db33cb1f7693c064224c58dc..0165e57b30b208496fa648d0cd50f2e8253ed7d1 100644 --- a/Projects/VP1Light/externals.txt +++ b/Projects/VP1Light/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -VP1LightExternalsVersion = 2.0.151 +VP1LightExternalsVersion = 2.0.156 diff --git a/Projects/VP1Light/version.txt b/Projects/VP1Light/version.txt index 3e3319b9f0d24f39034266621e1dad1dbc3444df..934c1d66356d05097b8028f22de61a25c6a1ca1d 100644 --- a/Projects/VP1Light/version.txt +++ b/Projects/VP1Light/version.txt @@ -1 +1 @@ -23.0.34 +24.0.7 diff --git a/Projects/WorkDir/package_filters_example.txt b/Projects/WorkDir/package_filters_example.txt index 6690210273855de3556a869b9120c70e66f37377..219c1967ce94bc5741ccf8cdef7a4bde37242f78 100644 --- a/Projects/WorkDir/package_filters_example.txt +++ b/Projects/WorkDir/package_filters_example.txt @@ -13,8 +13,8 @@ # # In your build/ directory you can now do e.g: # cmake -DATLAS_PACKAGE_FILTER_FILE=../package_filters.txt ../athena/Projects/WorkDir -# (where obviously you have put your package_filters.txt file in the same directory as build/) -# Complete instructions are found here: https://atlassoftwaredocs.web.cern.ch/gittutorial/branch-and-change/#setting-up-to-compile-and-test-code-for-the-tutorial +# (where obviously you have put your package_filters.txt file in the same directory as build/..) +# Complete instructions are found here: https://atlassoftwaredocs.web.cern.ch/gittutorial/git-develop/#setting-up-to-compile-and-test-code-for-the-tutorial # # Note that when you use git-atlas to make a sparse checkout, you will # only have the packages available that you want to compile anyway. diff --git a/Reconstruction/HeavyIonRec/HIGlobal/CMakeLists.txt b/Reconstruction/HeavyIonRec/HIGlobal/CMakeLists.txt index c052e4fb4ed61bb57178efb33267107679bfeff4..65c6a0963f1d75f1033cc28fe88ec671d6cdc8d8 100644 --- a/Reconstruction/HeavyIonRec/HIGlobal/CMakeLists.txt +++ b/Reconstruction/HeavyIonRec/HIGlobal/CMakeLists.txt @@ -19,7 +19,7 @@ atlas_add_component( HIGlobal atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_add_test( HIRec_HIGlobal_test +atlas_add_test( HIGlobal SCRIPT python -m HIGlobal.HIGlobalConfig - PROPERTIES TIMEOUT 900 + PROPERTIES TIMEOUT 1800 POST_EXEC_SCRIPT nopost.sh ) diff --git a/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt b/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt index 3e987e7544c0baaf34fce8c9cd1c4cdf395ade49..99927099b52222ec34b9cc0b15ad916b47a6c701 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt +++ b/Reconstruction/HeavyIonRec/HIJetRec/CMakeLists.txt @@ -23,7 +23,8 @@ atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_add_test( HIJet - SCRIPT python -m HIJetRec.HIJetRecConfigCA + SCRIPT python -m HIJetRec.HIJetRecConfigCA + PROPERTIES TIMEOUT 1800 POST_EXEC_SCRIPT nopost.sh) if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) # too slow for dbg build diff --git a/Reconstruction/Jet/BoostedJetTaggers/Root/SmoothedWZTagger.cxx b/Reconstruction/Jet/BoostedJetTaggers/Root/SmoothedWZTagger.cxx index 088847d38ab09ad86ada1033de698e42aa980e20..d239d601da9d618635e6e0545aae4177351468c4 100644 --- a/Reconstruction/Jet/BoostedJetTaggers/Root/SmoothedWZTagger.cxx +++ b/Reconstruction/Jet/BoostedJetTaggers/Root/SmoothedWZTagger.cxx @@ -167,6 +167,9 @@ StatusCode SmoothedWZTagger::initialize() { } #endif + m_decAcceptKey = m_containerName + "." + m_decorationName + "_" + m_decAcceptKey.key(); + ATH_CHECK( m_decAcceptKey.initialize() ); + return StatusCode::SUCCESS; } diff --git a/Reconstruction/Jet/JetAnalysisTools/JetTileCorrection/util/JetTileCorrectionTester.cxx b/Reconstruction/Jet/JetAnalysisTools/JetTileCorrection/util/JetTileCorrectionTester.cxx index 5898315d4eff6dcfb12cd202168e86a9999df370..b15ac92d9d4b7f5d255ae07bb596c023556dfaba 100644 --- a/Reconstruction/Jet/JetAnalysisTools/JetTileCorrection/util/JetTileCorrectionTester.cxx +++ b/Reconstruction/Jet/JetAnalysisTools/JetTileCorrection/util/JetTileCorrectionTester.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /// @file JetTileCorrectionTester.cxx @@ -121,7 +121,7 @@ int main( int argc, char* argv[] ) const xAOD::EventInfo* evtInfo = 0; CHECK( event.retrieve(evtInfo, "EventInfo") ); if ( entry%100==0 ){ - Info(APP_NAME, "===>>> Processing entry %lli, run %u, event %llu <<<===", + Info(APP_NAME, "===>>> Processing entry %lli, run %u, event %lu <<<===", entry, evtInfo->runNumber(), evtInfo->eventNumber()); } diff --git a/Reconstruction/Jet/JetJvtEfficiency/Root/JetJvtEfficiency.cxx b/Reconstruction/Jet/JetJvtEfficiency/Root/JetJvtEfficiency.cxx index 0935f4b7cea06f6d83791210105acd39b0891874..297e8186e4813ee97b201ccb7c65185b38e647dc 100644 --- a/Reconstruction/Jet/JetJvtEfficiency/Root/JetJvtEfficiency.cxx +++ b/Reconstruction/Jet/JetJvtEfficiency/Root/JetJvtEfficiency.cxx @@ -37,6 +37,7 @@ JetJvtEfficiency::JetJvtEfficiency( const std::string& name): asg::AsgTool( name m_isHSAcc(nullptr) { declareProperty( "TaggingAlg", m_tagger = CP::JvtTagger::NNJvt ); + declareProperty( "NNJvtTool", m_NNJvtTool_handle, "NN Jvt tool" ); declareProperty( "WorkingPoint", m_wp = "Default" ); declareProperty( "SFFile", m_file = "" ); declareProperty( "JetContainerName", m_jetContainerName = "AntiKt4EMPFlowJets" ); @@ -120,14 +121,16 @@ StatusCode JetJvtEfficiency::initialize(){ // setup the NNJvt tool for recalculating NNJvt scores if (m_NNJvtTool_handle.empty()) { + ATH_MSG_INFO( "NNJvtTool is empty! Initializing default tool "); asg::AsgToolConfig config_NNjvt ("JetPileupTag::JetVertexNNTagger/NNJvt"); - ATH_CHECK(config_NNjvt.setProperty("JetContainer", m_jetContainerName)); + ATH_CHECK(config_NNjvt.setProperty("JetContainer", m_jetContainerName+"_NNJvtCopy")); ATH_CHECK(config_NNjvt.setProperty("NNParamFile", m_NNJvtParamFile)); ATH_CHECK(config_NNjvt.setProperty("NNCutFile", m_NNJvtCutFile)); ATH_CHECK(config_NNjvt.setProperty("SuppressInputDependence", true)); // otherwise decorations can't be accessed properly ATH_CHECK(config_NNjvt.setProperty("SuppressOutputDependence", m_suppressOutputDependence)); ATH_CHECK(config_NNjvt.makePrivateTool(m_NNJvtTool_handle)); } + ATH_CHECK(m_NNJvtTool_handle.retrieve()); // NNJvt tool will decorate decision on jets that we can retrieve diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py index 6d2392583ab749fa272901d4a28b8cbd62a6be0e..7cfb0d511bb2a14a75d48d1acea963d039b968a5 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py @@ -55,22 +55,22 @@ commonHistoSpecs = [ # 2D histos, by concatenating 1D histo specifications : - "pt;m", - "pt;eta", - "phi;eta", + "m;pt", + "eta;pt", + "eta;phi", # TProfile2D : just use 3 variables. For now the sytem will automatically # interpret it as a TProfile2D (the 3rd variable being profiled) - "phi;eta;e", # --> Average Energy vs pt and eta - "phi;eta;pt", # --> Average pt vs phi and eta + "eta;phi;e", # --> Average Energy vs pt and eta + "eta;phi;pt", # --> Average pt vs phi and eta # Histograms build from a selection of filtered jets. # Use a SelectSpec dictionary to define the selection, and the histo to be drawn from it. SelectSpec( 'central', # the name of the selection '|eta|<0.5', # selection expression. The form 'min<var<max' is automatically interpreted. path='CentralJets', # force the path where the histos are saved in the final ROOT file - FillerTools = ["pt","m","eta","phi","EMFrac","Tile0Frac","LArQuality","nconstit","N90Constituents", + FillerTools = ["pt","m","eta","phi","EMFrac","Tile0Frac","LArQuality","nconstit","N90Constituents", "eta;phi", "JetConstitScaleMomentum_pt","JetEMScaleMomentum_pt","JetPileupScaleMomentum_pt","JetEtaJESScaleMomentum_pt", "JetConstitScaleMomentum_eta","JetEMScaleMomentum_eta","JetPileupScaleMomentum_eta","JetEtaJESScaleMomentum_eta", "JetConstitScaleMomentum_phi","JetEMScaleMomentum_phi","JetPileupScaleMomentum_phi","JetEtaJESScaleMomentum_phi", @@ -79,7 +79,7 @@ commonHistoSpecs = [ SelectSpec( 'tilegap3', # the name of the selection '1.0<|eta|<1.4', # selection expression. The form 'min<var<max' is automatically interpreted. path='TileGap3', # force the path where the histos are saved in the final ROOT file - FillerTools = ["pt","m","eta","phi","EMFrac","Tile0Frac","HECFrac","LArQuality","nconstit","N90Constituents", + FillerTools = ["pt","m","eta","phi","EMFrac","Tile0Frac","HECFrac","LArQuality","nconstit","N90Constituents", "eta;phi", ] ), # another selection : only leading jets @@ -105,22 +105,22 @@ commonHistoSpecs = [ ] ), # another selection : only very high pT jets - SelectSpec( 'highptrange2TeVto8TeV','2000<pt:GeV<8000',path='highptrange2TeVto8TeV',FillerTools = ["highpt","m","eta","phi","eta;phi",] ), - SelectSpec( 'highptrange1TeVto2TeV','1000<pt:GeV<2000',path='highptrange1TeVto2TeV',FillerTools = ["highpt","m","eta","phi","eta;phi",] ), - SelectSpec( 'highptrange500GeVto1TeV','500<pt:GeV<1000',path='highptrange500GeVto1TeV',FillerTools = ["highpt","m","eta","phi","eta;phi",] ), - SelectSpec( 'highptrange200GeVto500GeV','200<pt:GeV<500',path='highptrange200GeVto500GeV',FillerTools = ["highpt","m","eta","phi","eta;phi",] ), + SelectSpec( 'highptrange2TeVto8TeV','2000<pt:GeV<8000',path='highptrange2TeVto8TeV',FillerTools = ["pt","highpt","m","eta","phi","eta;phi","eta;phi;e","eta;phi;pt"] ), + SelectSpec( 'highptrange1TeVto2TeV','1000<pt:GeV<2000',path='highptrange1TeVto2TeV',FillerTools = ["pt","highpt","m","eta","phi","eta;phi","eta;phi;e","eta;phi;pt"] ), + SelectSpec( 'highptrange500GeVto1TeV','500<pt:GeV<1000',path='highptrange500GeVto1TeV',FillerTools = ["pt","highpt","m","eta","phi","eta;phi","eta;phi;e","eta;phi;pt"] ), + SelectSpec( 'highptrange200GeVto500GeV','200<pt:GeV<500',path='highptrange200GeVto500GeV',FillerTools = ["pt","highpt","m","eta","phi","eta;phi","eta;phi;e","eta;phi;pt"] ), # Selecting jets failing the LooseBad selection from the JetCleaningTool. SelectSpec( 'LooseBadFailedJets', 'LooseBad', InverseJetSel=True, FillerTools = ["pt","phi","eta","m","EMFrac","LArQuality","Tile0Frac","HECFrac","nconstit","N90Constituents", - "phi;eta","phi;eta;e","phi;eta;pt", + "eta;phi","eta;phi;e","eta;phi;pt", ]), # Selecting jets passing the LooseBad selection from the JetCleaningTool. SelectSpec( 'LooseBadJets', 'LooseBad', # this is not in the form 'min<x<max', so it will be assumed 'LooseBad' is an entry existing in JetStandardHistoSpecs.knownSelector FillerTools = [ "pt","eta","phi","m","EMFrac","LArQuality","Tile0Frac","HECFrac","nconstit","N90Constituents", - "phi;eta","phi;eta;e","phi;eta;pt", + "eta;phi","eta;phi;e","eta;phi;pt", ] ), ] # end commonHistoSpecs @@ -128,7 +128,8 @@ commonHistoSpecs = [ jvfHistosSpec = [ SelectSpec( 'highJVF', '0.3<JVF[0]', # JVF is a vector<float> for each jets. Here we cut on the 0th entry of this vector - FillerTools = ["pt","m","eta","phi", + FillerTools = ["pt","m","eta","phi","nconstit","N90Constituents", + "eta;phi","eta;phi;e","eta;phi;pt", ] ), ] @@ -234,8 +235,8 @@ def standardJetMonitoring(inputFlags): jetAlgConfs = [ # use the helper function defined above : #jetMonAlgConfig( "AntiKt4LCTopoJets", truthJetName="AntiKt4TruthJets"), #How can we make sure truth jets are available ?? - jetMonAlgConfig( "AntiKt4LCTopoJets", inputFlags), jetMonAlgConfig( "AntiKt4EMTopoJets", inputFlags), + jetMonAlgConfig( "AntiKt4LCTopoJets", inputFlags), jetMonAlgConfig( "AntiKt4EMPFlowJets", inputFlags), ] diff --git a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py index 8e0621c3e8e3eb05d89d4d51c6931a22896aa9c2..c6a7f258d56593ac3007e1133488ca8e758284de 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py @@ -118,8 +118,8 @@ _knownHistos = [ HistoSpec('Jvt', (70, -0.2, 1.2), title='Jet JVT;JVT;Entries', ), HistoSpec('JVFCorr', (120, -1.2, 1.2), title='Jet JVT; JVFCorr;Entries', ), HistoSpec('JvtRpt', (75, 0, 1.5), title='Jet JVT Rpt; JVTRpt;Entries', ), - HistoSpec('EM3Frac', (50,-0.1,1.0), title="EM3 fraction;EM3 fraction;Entries"), - HistoSpec('Tile0Frac', (50,-0.1,1.0), title="Tile0 fraction;Tile0 fraction;Entries"), + HistoSpec('EM3Frac', (50,-0.1,1.0), title='EM3 fraction;EM3 fraction;Entries'), + HistoSpec('Tile0Frac', (50,-0.1,1.0), title='Tile0 fraction;Tile0 fraction;Entries'), HistoSpec('GhostMuonSegmentCount', (60, 0, 60), title='Number of associated muon segments;Number;', xvar=VarSpec('GhostMuonSegmentCount','int')), @@ -209,8 +209,8 @@ _knownHistos = [ HistoSpec('Charge', (100, -2, 2), title='Charge;Charge;', ), - HistoSpec('DetectorEta', (100,-5,5), title="DetectorEta;Detector #eta;Entries" ), - HistoSpec('ActiveArea', (80,0,0.8), title="ActiveArea;Active Area;Entries" ), + HistoSpec('DetectorEta', (100,-5,5), title='DetectorEta;Detector #eta;Entries' ), + HistoSpec('ActiveArea', (80,0,0.8), title='ActiveArea;Active Area;Entries' ), HistoSpec('ActiveArea15', (80, 0, 1.5), title='Active Area;Active Area;Entries', xvar='ActiveArea'), HistoSpec('PullPhi', (100, -6.3, 6.3), title='PullPhi;PullPhi;', ), diff --git a/Reconstruction/Jet/JetUncertainties/JetUncertainties/FlavourUncertaintyComponent.h b/Reconstruction/Jet/JetUncertainties/JetUncertainties/FlavourUncertaintyComponent.h index 1e8fd940ce4705a56b35d8ef7320d4a651970329..11da124b8b28c7c3a2f72c2491c87c8a42bcbefc 100644 --- a/Reconstruction/Jet/JetUncertainties/JetUncertainties/FlavourUncertaintyComponent.h +++ b/Reconstruction/Jet/JetUncertainties/JetUncertainties/FlavourUncertaintyComponent.h @@ -20,6 +20,7 @@ class FlavourUncertaintyComponent : public UncertaintyComponent const TString defaultAnalysisRootFileName, const TString path, const TString calibArea, + const bool absEtaGluonFraction, const TString analysisHistPattern="" ); FlavourUncertaintyComponent(const FlavourUncertaintyComponent& toCopy); @@ -51,6 +52,7 @@ class FlavourUncertaintyComponent : public UncertaintyComponent const TString m_path; const TString m_calibArea; const bool m_absEta; + const bool m_absEtaGluonFraction; const TString m_secondUncName; std::string m_largeRJetTruthLabelName; diff --git a/Reconstruction/Jet/JetUncertainties/JetUncertainties/JetUncertaintiesTool.h b/Reconstruction/Jet/JetUncertainties/JetUncertainties/JetUncertaintiesTool.h index fcf21a63fb3eed5f9e4c7a22ad7afc269290832a..5708d5c7c8f699c89d42a3dac2f73991d6b6c24e 100644 --- a/Reconstruction/Jet/JetUncertainties/JetUncertainties/JetUncertaintiesTool.h +++ b/Reconstruction/Jet/JetUncertainties/JetUncertainties/JetUncertaintiesTool.h @@ -271,6 +271,9 @@ class ATLAS_NOT_THREAD_SAFE JetUncertaintiesTool : virtual public ICPJetUncertai SG::AuxElement::Accessor<float> m_accSigeffSF; SG::AuxElement::Accessor<float> m_accEfficiency; SG::AuxElement::Accessor<bool> m_accTagResult; + + // Properties for the flavour configuration + bool m_absEtaGluonFraction; }; diff --git a/Reconstruction/Jet/JetUncertainties/Root/FlavourUncertaintyComponent.cxx b/Reconstruction/Jet/JetUncertainties/Root/FlavourUncertaintyComponent.cxx index 5dfaf108876ea11ef268d0f40b1d0f4ce919d78d..1492b3b7d12db99553c41536419e71db848bb30d 100644 --- a/Reconstruction/Jet/JetUncertainties/Root/FlavourUncertaintyComponent.cxx +++ b/Reconstruction/Jet/JetUncertainties/Root/FlavourUncertaintyComponent.cxx @@ -26,6 +26,7 @@ FlavourUncertaintyComponent::FlavourUncertaintyComponent(const std::string& name , m_analysisHistPattern("") , m_defAnaFileName("") , m_absEta(false) + , m_absEtaGluonFraction(true) , m_secondUncName("") , m_largeRJetTruthLabelName("") , m_largeRJetTruthLabels() @@ -46,6 +47,7 @@ FlavourUncertaintyComponent::FlavourUncertaintyComponent( const ComponentHelpe const TString defaultAnalysisRootFileName, const TString path, const TString calibArea, + const bool absEtaGluonFraction, const TString analysisHistPattern ) : UncertaintyComponent(component,component.flavourType == FlavourComp::Composition ? 2 : 1) @@ -57,6 +59,7 @@ FlavourUncertaintyComponent::FlavourUncertaintyComponent( const ComponentHelpe , m_path(path) , m_calibArea(calibArea) , m_absEta(CompParametrization::isAbsEta(component.parametrization)) + , m_absEtaGluonFraction(absEtaGluonFraction) , m_secondUncName(component.uncNames.size()>1 ? component.uncNames.at(1) : "") , m_largeRJetTruthLabelName(component.LargeRJetTruthLabelName) , m_largeRJetTruthLabels(component.LargeRJetTruthLabels) @@ -85,6 +88,7 @@ FlavourUncertaintyComponent::FlavourUncertaintyComponent(const FlavourUncertaint , m_path(toCopy.m_path) , m_calibArea(toCopy.m_calibArea) , m_absEta(toCopy.m_absEta) + , m_absEtaGluonFraction(toCopy.m_absEtaGluonFraction) , m_secondUncName(toCopy.m_secondUncName) , m_largeRJetTruthLabelName(toCopy.m_largeRJetTruthLabelName) , m_largeRJetTruthLabels(toCopy.m_largeRJetTruthLabels) @@ -524,13 +528,13 @@ double FlavourUncertaintyComponent::getBJESUncertainty(const xAOD::Jet& jet, con double FlavourUncertaintyComponent::getGluonFraction(const double pT, const double eta, const int nJets) const { // nJets value checking is done in checkNjetsInput - return m_gluonFractionHists.at(nJets)->getValue(pT,fabs(eta)); + return m_gluonFractionHists.at(nJets)->getValue(pT,m_absEtaGluonFraction ? std::abs(eta) : eta); } double FlavourUncertaintyComponent::getGluonFractionError(const double pT, const double eta, const int nJets) const { // nJets value checking is done in checkNjetsInput - return m_gluonFractionErrorHists.at(nJets)->getValue(pT,fabs(eta)); + return m_gluonFractionErrorHists.at(nJets)->getValue(pT,m_absEtaGluonFraction ? std::abs(eta) : eta); } double FlavourUncertaintyComponent::getGluonResponseDifference(const double pT, const double eta) const diff --git a/Reconstruction/Jet/JetUncertainties/Root/JetUncertaintiesTool.cxx b/Reconstruction/Jet/JetUncertainties/Root/JetUncertaintiesTool.cxx index fc761d9443784b307d4dc4ab320d5625f69f14c8..fc6a6e9f207e49d2d22f634ee01a209a58ca201c 100644 --- a/Reconstruction/Jet/JetUncertainties/Root/JetUncertaintiesTool.cxx +++ b/Reconstruction/Jet/JetUncertainties/Root/JetUncertaintiesTool.cxx @@ -104,6 +104,7 @@ JetUncertaintiesTool::JetUncertaintiesTool(const std::string& name) , m_accSigeffSF("temp_sigeffSF") , m_accEfficiency("temp_efficiency") , m_accTagResult("temp_accept") + , m_absEtaGluonFraction(true) { declareProperty("JetDefinition",m_jetDef); declareProperty("MCType",m_mcType); @@ -114,6 +115,7 @@ JetUncertaintiesTool::JetUncertaintiesTool(const std::string& name) declareProperty("AnalysisHistPattern",m_analysisHistPattern); declareProperty("VariablesToShift",m_systFilters); declareProperty("IsData",m_isData); + declareProperty("AbsEtaGluonFraction",m_absEtaGluonFraction); ATH_MSG_DEBUG("Creating JetUncertaintiesTool named "<<m_name); @@ -165,6 +167,7 @@ JetUncertaintiesTool::JetUncertaintiesTool(const JetUncertaintiesTool& toCopy) , m_accSigeffSF(toCopy.m_accSigeffSF) , m_accEfficiency(toCopy.m_accEfficiency) , m_accTagResult(toCopy.m_accTagResult) + , m_absEtaGluonFraction(toCopy.m_absEtaGluonFraction) { ATH_MSG_DEBUG("Creating copy of JetUncertaintiesTool named "<<m_name); @@ -990,7 +993,7 @@ UncertaintyComponent* JetUncertaintiesTool::buildUncertaintyComponent(const Comp component.flavourType == FlavourComp::PerJetResponse_C){ return new PerJetFlavourUncertaintyComponent(component); }else - return new FlavourUncertaintyComponent(component,m_jetDef,m_analysisFile.c_str(),m_defAnaFile.c_str(),m_path.c_str(),m_calibArea.c_str(),m_analysisHistPattern.c_str()); + return new FlavourUncertaintyComponent(component,m_jetDef,m_analysisFile.c_str(),m_defAnaFile.c_str(),m_path.c_str(),m_calibArea.c_str(),m_absEtaGluonFraction,m_analysisHistPattern.c_str()); } else diff --git a/Reconstruction/MET/METInterface/METInterface/IMETSystematicsTool.h b/Reconstruction/MET/METInterface/METInterface/IMETSystematicsTool.h index e103f94eafbf5ac96c97f7b1dcc42219a11d1992..76064d87a06b6456ed4b53c892c95158bee90328 100644 --- a/Reconstruction/MET/METInterface/METInterface/IMETSystematicsTool.h +++ b/Reconstruction/MET/METInterface/METInterface/IMETSystematicsTool.h @@ -25,22 +25,22 @@ namespace met { namespace softCaloAffSyst { - const static CP::SystematicVariation MET_SoftCalo_ScaleUp ("MET_SoftCalo_ScaleUp" ); - const static CP::SystematicVariation MET_SoftCalo_ScaleDown("MET_SoftCalo_ScaleDown"); + const static CP::SystematicVariation MET_SoftCalo_ScaleUp ("MET_SoftCalo_Scale__1up" ); + const static CP::SystematicVariation MET_SoftCalo_ScaleDown("MET_SoftCalo_Scale__1down"); const static CP::SystematicVariation MET_SoftCalo_Reso ("MET_SoftCalo_Reso"); } namespace softTrkAffSyst { - const static CP::SystematicVariation MET_SoftTrk_ScaleUp ("MET_SoftTrk_ScaleUp" ); - const static CP::SystematicVariation MET_SoftTrk_ScaleDown("MET_SoftTrk_ScaleDown"); + const static CP::SystematicVariation MET_SoftTrk_ScaleUp ("MET_SoftTrk_Scale__1up" ); + const static CP::SystematicVariation MET_SoftTrk_ScaleDown("MET_SoftTrk_Scale__1down"); const static CP::SystematicVariation MET_SoftTrk_ResoPara ("MET_SoftTrk_ResoPara" ); const static CP::SystematicVariation MET_SoftTrk_ResoPerp ("MET_SoftTrk_ResoPerp" ); const static CP::SystematicVariation MET_SoftTrk_ResoCorr ("MET_SoftTrk_ResoCorr" ); } namespace jetTrkAffSyst { - const static CP::SystematicVariation MET_JetTrk_ScaleUp ("MET_JetTrk_ScaleUp" ); - const static CP::SystematicVariation MET_JetTrk_ScaleDown ("MET_JetTrk_ScaleDown"); + const static CP::SystematicVariation MET_JetTrk_ScaleUp ("MET_JetTrk_Scale__1up" ); + const static CP::SystematicVariation MET_JetTrk_ScaleDown ("MET_JetTrk_Scale__1down"); } enum SystType { diff --git a/Reconstruction/MET/METUtilities/METUtilities/METSystematicsTool.h b/Reconstruction/MET/METUtilities/METUtilities/METSystematicsTool.h index 377ac6558fe12f114b4bec793a29368af1f1fed1..20408f04a8384f878b442f9ff0a4d4155e0e7e9f 100644 --- a/Reconstruction/MET/METUtilities/METUtilities/METSystematicsTool.h +++ b/Reconstruction/MET/METUtilities/METUtilities/METSystematicsTool.h @@ -146,10 +146,10 @@ namespace met { TRandom3* getTLSRandomGen() const; //declared properties - Gaudi::Property<std::string> m_configPrefix{this, "ConfigPrefix", "METUtilities/data16_13TeV/rec_Dec16v1", ""}; - Gaudi::Property<std::string> m_configSoftTrkFile{this, "ConfigSoftTrkFile", "TrackSoftTerms.config", ""}; // TrackSoftTerms_afii.config for AFII + Gaudi::Property<std::string> m_configPrefix{this, "ConfigPrefix", "METUtilities/R22_PreRecs", ""}; + Gaudi::Property<std::string> m_configSoftTrkFile{this, "ConfigSoftTrkFile", "TrackSoftTerms-pflow.config", ""}; Gaudi::Property<std::string> m_configJetTrkFile{this, "ConfigJetTrkFile", "", ""}; - Gaudi::Property<std::string> m_configSoftCaloFile{this, "ConfigSoftCaloFile", "", ""}; // METRefFinal_Obsolete2012_V2.config + Gaudi::Property<std::string> m_configSoftCaloFile{this, "ConfigSoftCaloFile", "", ""}; Gaudi::Property<bool> m_useDevArea{this, "UseDevArea", false, ""}; std::unique_ptr<TH3D> m_shiftpara_pthard_njet_mu{}; diff --git a/Reconstruction/MET/METUtilities/Root/METSystematicsTool.cxx b/Reconstruction/MET/METUtilities/Root/METSystematicsTool.cxx index f21c1425a2132ba74308953ef2f7d496e719613e..077d7de56fadec1e10a576244f23afe1bc88de89 100644 --- a/Reconstruction/MET/METUtilities/Root/METSystematicsTool.cxx +++ b/Reconstruction/MET/METUtilities/Root/METSystematicsTool.cxx @@ -716,6 +716,13 @@ namespace met { ptHard.mpy *= 1./(double(m_units)) ; ptHard.sumet*= 1./(double(m_units)) ; + // protect from zero pthard. protects against an empty pthard for the soft term systematic + if(ptHard.sumet<1.0e-6){ + ptHard.sumet=1.0e-6; + ptHard.mpx=1.0e-6; + ptHard.mpy=0.0; + } + return ptHard; } diff --git a/Reconstruction/MET/METUtilities/test/gt_metSystematicsTool.cxx b/Reconstruction/MET/METUtilities/test/gt_metSystematicsTool.cxx index 4ff3a3f61414c5ce56a22e4ca28d07af247b70f2..2732cc6e89ca1ff182ce39294cc10b167e20d3fb 100644 --- a/Reconstruction/MET/METUtilities/test/gt_metSystematicsTool.cxx +++ b/Reconstruction/MET/METUtilities/test/gt_metSystematicsTool.cxx @@ -80,12 +80,14 @@ namespace met { } TEST_F( METSystTest, TestJetTrkHistosFilled ){ + ASSERT_TRUE(tool.setProperty("ConfigPrefix", "METUtilities/data16_13TeV/rec_Dec16v1")); + ASSERT_TRUE(tool.setProperty("ConfigSoftTrkFile","") ); ASSERT_TRUE(tool.setProperty("ConfigJetTrkFile" ,"JetTrackSyst.config")); ASSERT_TRUE(tool.initialize().isSuccess()); - ASSERT_TRUE(tool.m_shiftpara_pthard_njet_mu!=nullptr); - ASSERT_TRUE(tool.m_resopara_pthard_njet_mu !=nullptr); - ASSERT_TRUE(tool.m_resoperp_pthard_njet_mu !=nullptr); + ASSERT_TRUE(tool.m_shiftpara_pthard_njet_mu==nullptr); + ASSERT_TRUE(tool.m_resopara_pthard_njet_mu ==nullptr); + ASSERT_TRUE(tool.m_resoperp_pthard_njet_mu ==nullptr); ASSERT_TRUE(tool.m_jet_systRpt_pt_eta !=nullptr); } @@ -349,7 +351,7 @@ namespace met { // MissingET * correctedCopy = nullptr; // ASSERT_TRUE( asg::CheckHelper<CP::CorrectionCode>::isSuccess( tool.correctedCopy(*myObj, correctedCopy) ) ); - + // ASSERT_NE( correctedCopy, nullptr ); // ASSERT_TRUE( asg::CheckHelper<CP::CorrectionCode>::isSuccess( tool.applyCorrection(*myObj) ) ); // EXPECT_FLOAT_EQ( correctedCopy->mpx() , myObj->mpx() ); @@ -442,7 +444,7 @@ namespace met { // app = POOL::Init(); //important to do this first! // #endif // } - + // IAppMgrUI* app; // }; diff --git a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py index 40a8ea79b360993adab40c24fa0355216fb7a4d6..18606e02a434da49bc6f67a05826adc4ff576c30 100644 --- a/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py +++ b/Reconstruction/TrackCaloClusterRec/TrackCaloClusterRecTools/python/TrackCaloClusterConfig.py @@ -75,14 +75,13 @@ def setupTrackCaloAssoc(flags, caloClusterName="CaloCalTopoClusters",detectorEta def runTCCReconstruction(flags, caloClusterName="CaloCalTopoClusters", detectorEtaName = "default", trackParticleName="InDetTrackParticles", - assocPostfix="TCC", doCombined=False, doNeutral=True, doCharged=False, outputTCCName="TrackCaloClusters"): - - """Create a TrackCaloCluster collection from clusters and tracks (caloClusterName and trackParticleName). + assocPostfix="TCC", doCombined=False, doCharged=False, doNeutral=True, outputTCCName="TrackCaloClusters"): + """ + Create a TrackCaloCluster collection from clusters and tracks (caloClusterName and trackParticleName). Depending on options, the collection contains combined, neutral and/or charged TCC. - This functions schedules 2 TCC spécific algs : + This functions schedules 2 TCC specific algs : * a TrackCaloClusterInfoAlg to build the TrackCaloClusterInfo object * a TrackCaloClusterAlg to build the TCC - """ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -95,14 +94,6 @@ def runTCCReconstruction(flags, caloClusterName="CaloCalTopoClusters", detectorE setupTrackCaloAssoc(flags, caloClusterName, detectorEtaName, trackParticleName, assocPostfix, onlyPV0Tracks=False) ) - from TrackVertexAssociationTool.TTVAToolConfig import TTVAToolCfg - commonArgs=dict( - TrackVertexAssoTool = components.popToolsAndMerge(TTVAToolCfg(flags,"tvaTool",WorkingPoint="Nonprompt_All_MaxWeight")), - AssoClustersDecor=decorKey("AssoClusters"), - ) - - - ################################### # Schedule the TrackCaloClusterInfoAlg to create the weights for clusters/tracks and store them in a TrackCaloClusterInfo object. tccInfoAlg = CompFactory.TrackCaloClusterInfoAlg( @@ -121,7 +112,6 @@ def runTCCReconstruction(flags, caloClusterName="CaloCalTopoClusters", detectorE # and a list of tools to build the various TCC types. tccTools = [] - from TrackVertexAssociationTool.TTVAToolConfig import TTVAToolCfg commonArgs=dict( TrackVertexAssoTool = components.popToolsAndMerge(TTVAToolCfg(flags,"tvaTool",WorkingPoint="Nonprompt_All_MaxWeight")), @@ -134,49 +124,17 @@ def runTCCReconstruction(flags, caloClusterName="CaloCalTopoClusters", detectorE if doCharged: tccCharged = CompFactory.TCCChargedTool("TCCCharged", **commonArgs ) tccTools.append(tccCharged) - - if doNeutral: tccNeutral = CompFactory.TCCNeutralTool("TCCNeutral", **commonArgs ) tccTools.append(tccNeutral) - FEContainerName="" - if(doNeutral): - FEContainerName="JetETMissNeutralParticleFlowObjects" - neutraloutputTCCName=outputTCCName+"Neutral" - neutraltccAlg = CompFactory.TrackCaloClusterAlg(name = "TrackCaloClusterAlg_neutral", - OutputTCCName = neutraloutputTCCName, - TCCInfo = "TCCInfo", - TCCTools = tccTools, - #OutputLevel - AppendToTCCName = FEContainerName - - ) - components.addEventAlgo(neutraltccAlg) - - if(doCharged): - FEContainerName="JetETMissChargedParticleFlowObjects" - chargedoutputTCCName=outputTCCName+"Charged" - chargedtccAlg = CompFactory.TrackCaloClusterAlg(name = "TrackCaloClusterAlg_charged", - OutputTCCName = chargedoutputTCCName, - TCCInfo = "TCCInfo", - TCCTools = tccTools, - #OutputLevel = 2, - AppendToTCCName = FEContainerName, - - ) - components.addEventAlgo(chargedtccAlg) - - #exit(0) - if(doCombined or (doCharged and doNeutral)): - ufolog.error("TCC: Combined mode not setup - exiting gracefully") - exit(0) - if((not doCombined) and (not doCharged) and (not doNeutral)): - ufolog.error("runTCCReco: no mode set for input, this is an unexpected state") - exit(0) - - + tccAlg = CompFactory.TrackCaloClusterAlg(name = "TrackCaloClusterAlg", + OutputTCCName = outputTCCName, + TCCInfo = "TCCInfo", + TCCTools = tccTools, + ) + components.addEventAlgo(tccAlg) return components diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h b/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h index 2a638208403d1eff2ab591aa9e64c9a724ba7177..0f3d70cf463adbdaca5f118e8da3d533eb62fd98 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h +++ b/Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/VrtSecInclusive.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // VKalVrt.h @@ -174,6 +174,7 @@ namespace VKalVrtAthena { // Vertex reconstruction bool doPVcompatibilityCut; + bool doTightPVcompatibilityCut; bool removeFakeVrt; bool removeFakeVrtLate; bool doReassembleVertices; diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/python/VrtSecInclusiveConfig.py b/Reconstruction/VKalVrt/VrtSecInclusive/python/VrtSecInclusiveConfig.py index e2e151ca19aa0fc8d7c94b1fbf695e4a420f061e..97f537ca0e653967e93a9d35fb6d1a1a7c7cb780 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/python/VrtSecInclusiveConfig.py +++ b/Reconstruction/VKalVrt/VrtSecInclusive/python/VrtSecInclusiveConfig.py @@ -1,6 +1,6 @@ """Define method to configure VrtSecInclusive algorithm -Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration """ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -57,6 +57,7 @@ def VrtSecInclusiveCfg(flags, name="VrtSecInclusive", **kwargs): kwargs.setdefault("DoSAloneTRT" , False) kwargs.setdefault("ImpactWrtBL" , True) kwargs.setdefault("DoPVcompatibility" , True) + kwargs.setdefault("DoTightPVcompatibility" , False) kwargs.setdefault("RemoveFake2TrkVrt" , True) kwargs.setdefault("CheckHitPatternStrategy" , 'ExtrapolationAssist') # Either 'Classical', 'Extrapolation' or 'ExtrapolationAssist' kwargs.setdefault("doReassembleVertices" , True) diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx index 1c17c1aa12857853be97228dfaa5dae85bea6dac..b757635f1e45f7c9254ca2f5ffdbc54ea39fb113 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx +++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/Utilities.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // Header include @@ -710,6 +710,7 @@ namespace VKalVrtAthena { declareProperty("DoMapToLocal", m_jp.doMapToLocal = false ); declareProperty("DoTruth", m_jp.doTruth = false ); declareProperty("DoPVcompatibility", m_jp.doPVcompatibilityCut = true ); + declareProperty("DoTightPVcompatibility", m_jp.doTightPVcompatibilityCut = false ); declareProperty("RemoveFake2TrkVrt", m_jp.removeFakeVrt = true ); declareProperty("DoDelayedFakeReject", m_jp.removeFakeVrtLate = false ); declareProperty("CheckHitPatternStrategy", m_checkPatternStrategy = "Classical" ); // Either Classical or Extrapolation diff --git a/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx b/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx index 73fb50e659369b5928c613556e34a0b6418b6154..ff9618b81375771085aa8b540c60de401a14e129 100644 --- a/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx +++ b/Reconstruction/VKalVrt/VrtSecInclusive/src/VertexingAlgs.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // Header include @@ -81,11 +81,11 @@ namespace VKalVrtAthena { WrkVrt wrkvrt; wrkvrt.selectedTrackIndices.emplace_back( itrk_id ); wrkvrt.selectedTrackIndices.emplace_back( jtrk_id ); - - if( fabs( (*itrk)->d0() ) < m_jp.twoTrkVtxFormingD0Cut && fabs( (*jtrk)->d0() ) < m_jp.twoTrkVtxFormingD0Cut ) continue; // Attempt to think the combination is incompatible by default m_incomp.emplace_back( std::pair<int, int>(itrk_id, jtrk_id) ); + + if( std::abs( (*itrk)->d0() ) < m_jp.twoTrkVtxFormingD0Cut && std::abs( (*jtrk)->d0() ) < m_jp.twoTrkVtxFormingD0Cut ) continue; baseTracks.clear(); baseTracks.emplace_back( *itrk ); @@ -148,8 +148,8 @@ namespace VKalVrtAthena { const double vPosMomAngT = ( vDist.x()*wrkvrt.vertexMom.Px()+vDist.y()*wrkvrt.vertexMom.Py() ) / vDist.perp() / wrkvrt.vertexMom.Pt(); const double vPosMomAng3D = ( vDist.x()*wrkvrt.vertexMom.Px()+vDist.y()*wrkvrt.vertexMom.Py()+vDist.z()*wrkvrt.vertexMom.Pz() ) / (vDist.norm() * wrkvrt.vertexMom.Rho()); - double dphi1 = vDist.phi() - (*itrk)->phi(); while( dphi1 > TMath::Pi() ) { dphi1 -= TMath::TwoPi(); } while( dphi1 < -TMath::Pi() ) { dphi1 += TMath::TwoPi(); } - double dphi2 = vDist.phi() - (*itrk)->phi(); while( dphi2 > TMath::Pi() ) { dphi2 -= TMath::TwoPi(); } while( dphi2 < -TMath::Pi() ) { dphi2 += TMath::TwoPi(); } + double dphi1 = TVector2::Phi_mpi_pi(vDist.phi() - (*itrk)->phi()); + double dphi2 = TVector2::Phi_mpi_pi(vDist.phi() - (*jtrk)->phi()); const double dist_fromPV = vDist.norm(); if( m_jp.FillHist ) m_hists["2trkVtxDistFromPV"]->Fill( dist_fromPV ); @@ -269,6 +269,10 @@ namespace VKalVrtAthena { ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the vPos cut. (both tracks are opposite against the vertex pos)" ); continue; } + if (m_jp.doTightPVcompatibilityCut && (cos( dphi1 ) < -0.8 || cos( dphi2 ) < -0.8)){ + ATH_MSG_DEBUG(" > "<< __FUNCTION__ << ": failed to pass the tightened vPos cut. (at least one track is opposite against the vertex pos)" ); + continue; + } if( vPosMomAngT < -0.8 ) { ATH_MSG_DEBUG(" > " << __FUNCTION__ << ": failed to pass the vPos cut. (pos-mom directions are opposite)" ); continue; @@ -983,8 +987,8 @@ namespace VKalVrtAthena { const auto& distance = hypot( impactParameters.at(0), impactParameters.at(1) ); distances.emplace_back( distance ); - if( fabs( impactParameters.at(0) ) > m_jp.reassembleMaxImpactParameterD0 ) continue; - if( fabs( impactParameters.at(1) ) > m_jp.reassembleMaxImpactParameterZ0 ) continue; + if( std::abs( impactParameters.at(0) ) > m_jp.reassembleMaxImpactParameterD0 ) continue; + if( std::abs( impactParameters.at(1) ) > m_jp.reassembleMaxImpactParameterZ0 ) continue; mergiableVertex[index] = ritr; mergiableVerticesSet.emplace( ritr ); @@ -1139,8 +1143,8 @@ namespace VKalVrtAthena { if( !getSVImpactParameters( trk, vertexPos, impactParameters, impactParErrors) ) continue; - if( fabs( impactParameters.at(0) ) / sqrt( impactParErrors.at(0) ) > m_jp.associateMaxD0Signif ) continue; - if( fabs( impactParameters.at(1) ) / sqrt( impactParErrors.at(1) ) > m_jp.associateMaxZ0Signif ) continue; + if( std::abs( impactParameters.at(0) ) / sqrt( impactParErrors.at(0) ) > m_jp.associateMaxD0Signif ) continue; + if( std::abs( impactParameters.at(1) ) / sqrt( impactParErrors.at(1) ) > m_jp.associateMaxZ0Signif ) continue; ATH_MSG_DEBUG( " > " << __FUNCTION__ << ": trk " << trk << ": d0 to vtx = " << impactParameters.at(k_d0) @@ -1709,7 +1713,7 @@ namespace VKalVrtAthena { double qOverP_wrtSV = sv_perigee->parameters() [Trk::qOverP]; double theta_wrtSV = sv_perigee->parameters() [Trk::theta]; - double p_wrtSV = 1.0 / fabs( qOverP_wrtSV ); + double p_wrtSV = 1.0 / std::abs( qOverP_wrtSV ); double pt_wrtSV = p_wrtSV * sin( theta_wrtSV ); double eta_wrtSV = -log( tan( theta_wrtSV/2. ) ); double phi_wrtSV = sv_perigee->parameters() [Trk::phi]; diff --git a/Reconstruction/egamma/egammaAlgs/python/egammaForwardBuilderConfig.py b/Reconstruction/egamma/egammaAlgs/python/egammaForwardBuilderConfig.py index deddc52b5449d9b17a59852f5e89683a7dfbead5..f85f2863ae8153d73e2100ca4773901d01492987 100644 --- a/Reconstruction/egamma/egammaAlgs/python/egammaForwardBuilderConfig.py +++ b/Reconstruction/egamma/egammaAlgs/python/egammaForwardBuilderConfig.py @@ -1,6 +1,7 @@ # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration from ElectronPhotonSelectorTools.EgammaPIDdefs import egammaPID +from egammaTools.EMTrackMatchBuilderConfig import EMTrackMatchBuilderCfg from ElectronPhotonSelectorTools.AsgForwardElectronIsEMSelectorsConfig import ( AsgForwardElectronIsEMSelectorCfg) from AthenaCommon.Logging import logging @@ -15,6 +16,11 @@ def egammaForwardBuilderCfg(flags, name='egammaForwardElectron', **kwargs): mlog.info('Starting configuration') acc = ComponentAccumulator() + if "TrackMatchBuilderTool" not in kwargs: + emtrkmatch = EMTrackMatchBuilderCfg(flags) + kwargs["TrackMatchBuilderTool"] = acc.popToolsAndMerge(emtrkmatch) + if flags.Detector.GeometryITk: + kwargs["doTrackMatching"] = True if "forwardelectronIsEMselectors" not in kwargs: LooseFwdElectronSelector = AsgForwardElectronIsEMSelectorCfg( flags, diff --git a/Reconstruction/egamma/egammaAlgs/python/egammaTopoClusterCopierConfig.py b/Reconstruction/egamma/egammaAlgs/python/egammaTopoClusterCopierConfig.py index e7faa40dfda6b0c2b0ffde27a96cc0a9ce757553..5df0149db20d8c0e639e87e17ffeedb34b9270ef 100644 --- a/Reconstruction/egamma/egammaAlgs/python/egammaTopoClusterCopierConfig.py +++ b/Reconstruction/egamma/egammaAlgs/python/egammaTopoClusterCopierConfig.py @@ -24,6 +24,10 @@ def egammaTopoClusterCopierCfg(flags, name='', **kwargs): kwargs.setdefault( "ECut", 700 if not flags.Egamma.doLowMu else 300) + if flags.Detector.GeometryITk: + kwargs.setdefault( + "EtaCut", + 4.0) if name=='': name = kwargs["OutputTopoCollection"]+'Copier' diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx index 1eb37ad2d14a7142905660249c4637afd059f09e..a8859eecea9e80cd82fbf425f6a294baf6f21dd6 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.cxx @@ -57,6 +57,9 @@ StatusCode egammaForwardBuilder::initialize() "fwd-electron selector names"); return StatusCode::FAILURE; } + + // retrieve track match builder + ATH_CHECK(RetrieveEMTrackMatchBuilder()); ATH_MSG_DEBUG("Initialization completed successfully"); @@ -97,6 +100,8 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const return StatusCode::FAILURE; } + EgammaRecContainer egammaRecsFwd; + // loop over input cluster container and create fwd electrons xAOD::CaloClusterContainer::const_iterator clus_begin = inputClusters->begin(); @@ -108,40 +113,54 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const size_t origClusterIndex = 0; for (; clus_begin!=clus_end; ++clus_begin,++origClusterIndex) { - //Preselectcion cuts + //Preselection cuts if((*clus_begin)->et() < m_ETcut|| std::abs((*clus_begin)->eta())<m_etacut){ continue; } - //Create a new electron - xAOD::Electron* el = new xAOD::Electron(); - xaodFrwd->push_back(el); - el->setAuthor( xAOD::EgammaParameters::AuthorFwdElectron ); - - //Deep copy of topo cluster as might want to own modify it - xAOD::CaloCluster *newCluster = new xAOD::CaloCluster(**clus_begin); + auto newCluster = new xAOD::CaloCluster(**clus_begin); outClusterContainer->push_back(newCluster); - //set links back to the original caloCalTopoCluster we copied from + // Create links back to the original clusters std::vector<ElementLink<xAOD::CaloClusterContainer>> constituentLinks; constituentLinks.emplace_back(*inputClusters, origClusterIndex, ctx); caloClusterLinks(*newCluster) = constituentLinks; - - //Now attach the copied cluster to the electron - int index = outClusterContainer->size() - 1; - ElementLink<xAOD::CaloClusterContainer> newclusterElementLink( + + int index = outClusterContainer->size() - 1; + const ElementLink<xAOD::CaloClusterContainer> clusterLink( *outClusterContainer, index, ctx); - std::vector< ElementLink< xAOD::CaloClusterContainer > > linksToClusters; - linksToClusters.push_back(newclusterElementLink); - el->setCaloClusterLinks(linksToClusters); + const std::vector<ElementLink<xAOD::CaloClusterContainer>> + clusterLinkVector{ clusterLink }; - // do Four Momentum - ATH_CHECK(m_fourMomBuilder->execute(ctx, el)); + auto egRec = std::make_unique<egammaRec>(); + egRec->setCaloClusters(clusterLinkVector); + egammaRecsFwd.push_back(std::move(egRec)); + } + + // Add track-cluster matching information if requested + if (m_doTrackMatching) { + ATH_CHECK(m_trackMatchBuilder->executeRec(ctx, &egammaRecsFwd)); + } - // do object quality - ATH_CHECK(ExecObjectQualityTool(ctx, el)); + for (const egammaRec* egRec : egammaRecsFwd) { + + if (!egRec) { + return StatusCode::FAILURE; + } + xAOD::Electron* el = new xAOD::Electron(); + xaodFrwd->push_back(el); + el->setAuthor(xAOD::EgammaParameters::AuthorFwdElectron); + + std::vector<ElementLink<xAOD::CaloClusterContainer>> clusterLinks; + for (size_t i = 0; i < egRec->getNumberOfClusters(); ++i) { + clusterLinks.push_back(egRec->caloClusterElementLink(i)); + } + el->setCaloClusterLinks(clusterLinks); + + ATH_CHECK(m_fourMomBuilder->execute(ctx, el)); + ATH_CHECK(ExecObjectQualityTool(ctx, el)); // Apply the Forward Electron selectors size_t size = m_forwardElectronIsEMSelectors.size(); @@ -156,6 +175,59 @@ StatusCode egammaForwardBuilder::execute(const EventContext& ctx) const "isEM" + m_forwardElectronIsEMSelectorResultNames[i]); } + if (egRec->getNumberOfTrackParticles() == 0 and m_doTrackMatching) { + continue; + } + std::vector<ElementLink<xAOD::TrackParticleContainer>> trackLinks; + for (size_t i = 0; i < egRec->getNumberOfTrackParticles(); ++i) { + trackLinks.push_back(egRec->trackParticleElementLink(i)); + } + el->setTrackParticleLinks(trackLinks); + + const xAOD::TrackParticle* trackParticle = el->trackParticle(); + if (trackParticle) { + el->setCharge(trackParticle->charge()); + } + if (m_doTrackMatching) { + // Set DeltaEta, DeltaPhi , DeltaPhiRescaled + std::array<double, 4> deltaEta = egRec->deltaEta(); + std::array<double, 4> deltaPhi = egRec->deltaPhi(); + std::array<double, 4> deltaPhiRescaled = egRec->deltaPhiRescaled(); + + el->setTrackCaloMatchValue(static_cast<float>(deltaEta[0]), + xAOD::EgammaParameters::deltaEta0); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhi[0]), + xAOD::EgammaParameters::deltaPhi0); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[0]), + xAOD::EgammaParameters::deltaPhiRescaled0); + + el->setTrackCaloMatchValue(static_cast<float>(deltaEta[1]), + xAOD::EgammaParameters::deltaEta1); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhi[1]), + xAOD::EgammaParameters::deltaPhi1); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[1]), + xAOD::EgammaParameters::deltaPhiRescaled1); + + static const SG::AuxElement::Accessor<float> pear("deltaEta1PearDistortion"); + + el->setTrackCaloMatchValue(static_cast<float>(deltaEta[2]), + xAOD::EgammaParameters::deltaEta2); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhi[2]), + xAOD::EgammaParameters::deltaPhi2); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[2]), + xAOD::EgammaParameters::deltaPhiRescaled2); + + el->setTrackCaloMatchValue(static_cast<float>(deltaEta[3]), + xAOD::EgammaParameters::deltaEta3); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhi[3]), + xAOD::EgammaParameters::deltaPhi3); + el->setTrackCaloMatchValue(static_cast<float>(deltaPhiRescaled[3]), + xAOD::EgammaParameters::deltaPhiRescaled3); + + float deltaPhiLast = static_cast<float>(egRec->deltaPhiLast()); + el->setTrackCaloMatchValue( + deltaPhiLast, xAOD::EgammaParameters::deltaPhiFromLastMeasurement); + } } // Now finalize the cluster: based on code in CaloClusterStoreHelper::finalizeClusters @@ -180,3 +252,25 @@ egammaForwardBuilder::ExecObjectQualityTool( // execute the tool return m_objectQualityTool->execute(ctx,*eg); } + +StatusCode +egammaForwardBuilder::RetrieveEMTrackMatchBuilder() +{ + if (!m_doTrackMatching) { + m_trackMatchBuilder.disable(); + return StatusCode::SUCCESS; + } + + if (m_trackMatchBuilder.empty()) { + ATH_MSG_ERROR( + "EMTrackMatchBuilder is empty, but track matching is enabled"); + return StatusCode::FAILURE; + } + + if (m_trackMatchBuilder.retrieve().isFailure()) { + ATH_MSG_ERROR("Unable to retrieve " << m_trackMatchBuilder); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h index c537026dc2443b348e8a2c715acf4e53fdad1820..745c347e32f0b5c48dca8d4334547c1cba8afa6e 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaForwardBuilder.h @@ -45,6 +45,7 @@ #include "egammaInterfaces/IegammaBaseTool.h" #include "egammaInterfaces/IEMFourMomBuilder.h" #include "EgammaAnalysisInterfaces/IAsgForwardElectronIsEMSelector.h" +#include "egammaInterfaces/IEMTrackMatchBuilder.h" #include "GaudiKernel/SystemOfUnits.h" @@ -68,6 +69,7 @@ class egammaForwardBuilder : public AthReentrantAlgorithm virtual StatusCode execute(const EventContext& ctx) const override final; private: + StatusCode RetrieveEMTrackMatchBuilder(); StatusCode ExecObjectQualityTool(const EventContext& ctx, xAOD::Egamma* eg) const; @@ -85,6 +87,14 @@ class egammaForwardBuilder : public AthReentrantAlgorithm "EMFourMomBuilder", "Handle of 4-mom Builder" }; + /** @brief Tool to perform track-cluster matching*/ + ToolHandle<IEMTrackMatchBuilder> m_trackMatchBuilder{ + this, + "TrackMatchBuilderTool", + "EMTrackMatchBuilder", + "Tool that matches tracks to egammaRecs (Fwd)" + }; + /** @brief input topo cluster type */ SG::ReadHandleKey<xAOD::CaloClusterContainer> m_topoClusterKey{ this, @@ -123,6 +133,12 @@ class egammaForwardBuilder : public AthReentrantAlgorithm /** @brief eta cut */ Gaudi::Property<double> m_etacut{ this, "EtaCut", 2.5, "eta cut" }; + /** @brief private member flag to do the track matching */ + Gaudi::Property<bool> m_doTrackMatching{ this, + "doTrackMatching", + false, + "Boolean to do track matching" }; + protected: /** Handle to the selectors */ ToolHandleArray<IAsgForwardElectronIsEMSelector> m_forwardElectronIsEMSelectors {this, diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx index 4c95fb74eb1e678bf64d0653996db34781a2ccd3..b4a4b30f2bcf165dc6c8939c4b86ffa521dabdd7 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx @@ -211,7 +211,7 @@ egammaSelectedTrackCopy::selectTrack(const EventContext& ctx, z_perigee); // Get Cluster parameters - const double clusterEta = cluster->etaBE(2); + const double clusterEta = xAOD::EgammaHelpers::isFCAL(cluster) ? cluster->eta() : cluster->etaBE(2); const bool isEndCap = !xAOD::EgammaHelpers::isBarrel(cluster); // use trkEta only if sufficient hits in the Si const double Et = trkTRT ? cluster->et() : cluster->e() / cosh(trkEta); diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaTopoClusterCopier.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaTopoClusterCopier.cxx index 36bc49ba3f8e418317f00f9531f48a07182108da..691328db7a884839bce279bacea8780e2065a0e5 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaTopoClusterCopier.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaTopoClusterCopier.cxx @@ -8,6 +8,7 @@ #include "xAODCore/ShallowCopy.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" +#include "xAODEgamma/EgammaxAODHelpers.h" #include <cmath> @@ -122,7 +123,7 @@ StatusCode egammaTopoClusterCopier::execute(const EventContext& ctx) const { clus->energyBE(2) + clus->energyBE(3) + eg_tilegap) / clusterE; acc_emfraction(*clus) = emfrac; - if (emfrac > m_EMFracCut && (clusterE * emfrac) > m_ECut) { + if ((emfrac > m_EMFracCut && (clusterE * emfrac) > m_ECut) || xAOD::EgammaHelpers::isFCAL(clus)) { ++buff_PassSelection; ATH_MSG_DEBUG("-->Selected Cluster at eta,phi,et,EMFraction " << clus->eta() << " , "<< clus->phi() << " , " << clus->et()<<" , "<< emfrac); diff --git a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx index d29a31f06c606bfae9db69f9577c579a872a7ede..a99edc5cca9ac1a4a086542aea416c9eef54078c 100644 --- a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx +++ b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx @@ -3,6 +3,7 @@ */ #include "egammaCaloClusterSelector.h" #include "xAODCaloEvent/CaloCluster.h" +#include "xAODEgamma/EgammaxAODHelpers.h" #include "CaloUtils/CaloCellList.h" #include "CaloDetDescr/CaloDetDescrManager.h" #include <CLHEP/Units/SystemOfUnits.h> @@ -55,6 +56,17 @@ bool egammaCaloClusterSelector::passSelection( return false; } + // Accept all clusters in the FCAL + if (xAOD::EgammaHelpers::isFCAL(cluster)){ + return true; + } + + // Sanity check to catch extreme eta values + const double eta2 = std::abs(cluster->etaBE(2)); + if (eta2 > 10) { + return false; + } + // Check energy deposit if requested if (!m_egammaCheckEnergyDepositTool.empty() && !m_egammaCheckEnergyDepositTool->checkFractioninSamplingCluster(cluster)) { @@ -66,11 +78,6 @@ bool egammaCaloClusterSelector::passSelection( if (!cluster->hasSampling(CaloSampling::EMB2) && !cluster->hasSampling(CaloSampling::EME2)){ return false; } - const double eta2 = std::abs(cluster->etaBE(2)); - constexpr double ETA2_CUT = 10; - if (eta2 > ETA2_CUT) { - return false; - } // minimum energy reconstructed in 2nd sampling constexpr double EM2ENERGY_CUT = 50 * MeV; if (cluster->energyBE(2) < EM2ENERGY_CUT){ diff --git a/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx b/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx index e25366d09434753323441d91d5002c2dbb5d1a2c..4589cf3b4282c89e70e8e3cb7b0e9526efb4c894 100644 --- a/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx +++ b/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx @@ -497,7 +497,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2012")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo)); } @@ -505,7 +504,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo)); } @@ -513,7 +511,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DUp(*histo)); } @@ -521,7 +518,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DDown(*histo)); } @@ -529,7 +525,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE1(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorUp(*histo)); } @@ -537,7 +532,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE1(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorDown(*histo)); } @@ -545,7 +539,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2011")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo)); } @@ -553,7 +546,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo)); } @@ -561,7 +553,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DUp(*histo)); } @@ -569,7 +560,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DDown(*histo)); } @@ -577,7 +567,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE1(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorUp(*histo)); } @@ -585,7 +574,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE1(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorDown(*histo)); } @@ -593,7 +581,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo)); } @@ -601,7 +588,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DUp(*histo)); } @@ -609,7 +595,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DDown(*histo)); } @@ -617,7 +602,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE1(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorUp(*histo)); } @@ -625,7 +609,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE1(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorDown(*histo)); } @@ -633,7 +616,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v6/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2_mu_run2_rel21_v1")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -641,7 +623,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v5/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2mu_2016_rel21_v1")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -649,7 +630,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v3/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2mu_2016_v1")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -657,7 +637,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2012")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -665,7 +644,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -673,7 +651,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DDown(*histo)); } @@ -681,7 +658,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DUp(*histo)); } @@ -689,7 +665,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DErrorDown(*histo)); } @@ -697,7 +672,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DErrorUp(*histo)); } @@ -705,7 +679,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2011")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -713,7 +686,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -721,7 +693,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DDown(*histo)); } @@ -729,7 +700,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DUp(*histo)); } @@ -737,7 +707,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DErrorDown(*histo)); } @@ -745,7 +714,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DErrorUp(*histo)); } @@ -753,7 +721,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1D(*histo)); } @@ -761,7 +728,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DDown(*histo)); } @@ -769,7 +735,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DUp(*histo)); } @@ -777,7 +742,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DErrorDown(*histo)); } @@ -785,7 +749,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010")); - assert(histo); add_scale(new ScaleE2(InputModifier::ONEBASED), new GetAmountHisto1DErrorUp(*histo)); } @@ -793,7 +756,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v5/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2016_rel21")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo_ps_tot_error)); } @@ -801,7 +763,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v4/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2016")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo_ps_tot_error)); } @@ -809,7 +770,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo_ps_tot_error)); } @@ -817,7 +777,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DUp(*histo_ps_tot_error)); } @@ -825,7 +784,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DDown(*histo_ps_tot_error)); } @@ -833,7 +791,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorUp(*histo_ps_tot_error)); } @@ -841,7 +798,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorDown(*histo_ps_tot_error)); } @@ -849,7 +805,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo_ps_tot_error)); } @@ -857,7 +812,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DUp(*histo_ps_tot_error)); } @@ -865,7 +819,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DDown(*histo_ps_tot_error)); } @@ -873,7 +826,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorUp(*histo_ps_tot_error)); } @@ -881,7 +833,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorDown(*histo_ps_tot_error)); } @@ -890,7 +841,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1D(*histo_ps_tot_error)); } @@ -898,7 +848,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DUp(*histo_ps_tot_error)); } @@ -906,7 +855,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ONEBASED_ALPHA), new GetAmountHisto1DDown(*histo_ps_tot_error)); } @@ -914,7 +862,6 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorUp(*histo_ps_tot_error)); } @@ -922,13 +869,11 @@ void egammaLayerRecalibTool::add_scale(const std::string& tuneIn) const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root"); TFile f(file.c_str()); TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010")); - assert(histo_ps_tot_error); add_scale(new ScaleE0(InputModifier::ZEROBASED_ALPHA), new GetAmountHisto1DErrorDown(*histo_ps_tot_error)); } else { - std::cerr << tune << " is not a valid tune" << std::endl; - assert(false); + throw std::runtime_error(tune+" is not a valid tune"); } } diff --git a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx index 6f741405e473f98492e4ccc17d664fd864744f97..fab3f62f14ad7c5141cec7a846128c923cbe5bf5 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx @@ -115,6 +115,10 @@ EMExtrapolationTools::getClusterLayerSurfaces( CaloSampling::EME2, CaloSampling::EME3 }; + constexpr std::array<CaloSampling::CaloSample, 4> endcapLayersAboveEta2p5 = { + CaloSampling::EME2, + CaloSampling::EME3 + }; constexpr std::array<CaloSampling::CaloSample, 1> forwardLayers = { CaloSampling::FCAL0, }; @@ -143,11 +147,20 @@ EMExtrapolationTools::getClusterLayerSurfaces( } } } else if (isEMEC) { - for (const CaloSampling::CaloSample lay : endcapLayers) { - if (cluster.hasSampling(lay)) { - clusterLayers.emplace_back(lay); + if(std::abs(cluster.eta()) < 2.5){ + for (const CaloSampling::CaloSample lay : endcapLayers) { + if (cluster.hasSampling(lay)) { + clusterLayers.emplace_back(lay); + } + } + } + else { + for (const CaloSampling::CaloSample lay : endcapLayersAboveEta2p5) { + if (cluster.hasSampling(lay)) { + clusterLayers.emplace_back(lay); + } + } } - } } else { for (const CaloSampling::CaloSample lay : forwardLayers) { if (cluster.hasSampling(lay)) { @@ -272,7 +285,7 @@ EMExtrapolationTools::getMatchAtCalo( i = 0; } else if (sample == CaloSampling::EME1 || sample == CaloSampling::EMB1) { i = 1; - } else if (sample == CaloSampling::EME2 || sample == CaloSampling::EMB2) { + } else if (sample == CaloSampling::EME2 || sample == CaloSampling::EMB2 || sample == CaloSampling::FCAL0) { i = 2; } else if (sample == CaloSampling::EME3 || sample == CaloSampling::EMB3) { i = 3; diff --git a/Simulation/Digitization/python/PileUpMTConfig.py b/Simulation/Digitization/python/PileUpMTConfig.py index 9a7aed3d38900f959b26a602f2c2a3fb74eb9906..8594c591d2908836e17411169ac9deb72d778f89 100644 --- a/Simulation/Digitization/python/PileUpMTConfig.py +++ b/Simulation/Digitization/python/PileUpMTConfig.py @@ -6,6 +6,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import ProductionStep from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg +from SGComps.AddressRemappingConfig import InputRenameCfg from Digitization.RunDependentConfig import ( maxNevtsPerXing, LumiProfileSvcCfg, @@ -33,6 +34,16 @@ class PUBkgKind(Enum): BEAMHALO = 5 +def HSInputRenameCfg(): + acc = ComponentAccumulator() + acc.merge(InputRenameCfg("xAOD::EventInfo", "EventInfo", "HSEventInfo")) + acc.merge(InputRenameCfg("xAOD::EventAuxInfo", "EventInfoAux.", "HSEventInfoAux.")) + acc.merge(InputRenameCfg("EventInfo", "EventInfo", "HSEventInfo")) + acc.merge(InputRenameCfg("McEventCollection", "TruthEvent", "HSTruthEvent")) + acc.merge(InputRenameCfg("TrackRecordCollection", "MuonEntryLayer", "HSMuonEntryLayer")) + return acc + + def BatchedMinbiasSvcCfg(flags, name="LowPtMinbiasSvc", kind=PUBkgKind.LOWPT, **kwargs): flags.dump() acc = ComponentAccumulator() @@ -46,7 +57,7 @@ def BatchedMinbiasSvcCfg(flags, name="LowPtMinbiasSvc", kind=PUBkgKind.LOWPT, ** if kind == PUBkgKind.LOWPT: acc.merge(LowPtMinBiasEventSelectorCfg(flags)) - kwargs.setdefault("OnDemandMB", True) + kwargs.setdefault("OnDemandMB", False) kwargs.setdefault("MBBatchSize", 10000) # kwargs.setdefault("MBBatchSize", 1.3 * flags.Digitization.PU.NumberOfLowPtMinBias * n_bc) kwargs.setdefault("NSimultaneousBatches", 1) @@ -68,7 +79,7 @@ def BatchedMinbiasSvcCfg(flags, name="LowPtMinbiasSvc", kind=PUBkgKind.LOWPT, ** kwargs.setdefault("OnDemandMB", False) # load enough events that the probability of running out for any given event is no more than 1e-5 kwargs.setdefault( - "MBBatchSize", 8 * max(flags.Digitization.PU.NumberOfHighPtMinBias, 1) * n_bc + "MBBatchSize", 2 * max(flags.Digitization.PU.NumberOfHighPtMinBias, 1) * n_bc ) kwargs.setdefault("NSimultaneousBatches", flags.Concurrency.NumConcurrentEvents) kwargs.setdefault("SkippedHSEvents", skip) @@ -170,6 +181,7 @@ def PileUpMTAlgCfg(flags, **kwargs): "double event selection is not supported " "by PileUpMTAlg" % (not flags.Input.SecondaryFiles) ) + acc.merge(HSInputRenameCfg()) acc.merge(PoolReadCfg(flags)) # add minbias service(s) if flags.Digitization.PU.LowPtMinBiasInputCols: diff --git a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigLegacy.py b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigLegacy.py index 1425cc4971d6bc0db40a158b8430d2bc60891210..22f3f16616e2eff72e846aec6ad436dc4fb8ea68 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigLegacy.py +++ b/Simulation/G4Atlas/G4AtlasAlg/python/G4AtlasAlgConfigLegacy.py @@ -38,6 +38,8 @@ def getG4AtlasAlg(name='G4AtlasAlg', **kwargs): kwargs.setdefault('TruthRecordService', simFlags.TruthStrategy.TruthServiceName()) kwargs.setdefault('GeoIDSvc', 'ISF_GeoIDSvc') + from AthenaCommon.CfgGetter import getService + kwargs.setdefault("UserActionSvc", getService("G4UA::UserActionSvc")) from ISF_Config.ISF_jobProperties import ISF_Flags if ISF_Flags.Simulator.isQuasiStable(): @@ -60,3 +62,4 @@ def getG4AtlasAlg(name='G4AtlasAlg', **kwargs): # Needed to ensure that DeadMaterialCalibrationHitsMerger is scheduled correctly. kwargs.setdefault("ExtraOutputs", [( 'CaloCalibrationHitContainer' , 'StoreGateSvc+LArCalibrationHitActive_DEAD' ), ( 'CaloCalibrationHitContainer' , 'StoreGateSvc+LArCalibrationHitDeadMaterial_DEAD' ), ( 'CaloCalibrationHitContainer' , 'StoreGateSvc+LArCalibrationHitInactive_DEAD' )]) return CfgMgr.G4AtlasAlg(name, **kwargs) + diff --git a/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.cxx b/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.cxx index 46f02a15696b2cfb8f3f1a6b912ac65e5b5b2d76..12087833537fd9114b1ca3527ca9ed44609fe7f1 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.cxx +++ b/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.cxx @@ -68,6 +68,8 @@ StatusCode G4AtlasAlg::initialize ATLAS_NOT_THREAD_SAFE () // Create the scoring manager if requested if (m_recordFlux) G4ScoringManager::GetScoringManager(); + ATH_CHECK( m_userActionSvc.retrieve() ); + // One-time initialization try { std::call_once(initializeOnceFlag, &G4AtlasAlg::initializeOnce, this); @@ -78,7 +80,7 @@ StatusCode G4AtlasAlg::initialize ATLAS_NOT_THREAD_SAFE () } ATH_CHECK( m_rndmGenSvc.retrieve() ); - ATH_CHECK( m_userActionSvc.retrieve() ); + ATH_CHECK(m_actionTools.retrieve()); ATH_CHECK(m_senDetTool.retrieve()); ATH_CHECK(m_fastSimTool.retrieve()); @@ -115,6 +117,11 @@ void G4AtlasAlg::initializeOnce() if(m_physListSvc.retrieve().isFailure()) { throw std::runtime_error("Could not initialize ATLAS PhysicsListSvc!"); } + for (const auto& action_tool : m_actionTools) { + if (m_userActionSvc->addActionTool(action_tool).isFailure()) { + throw std::runtime_error("Failed to add action tool "+action_tool.name()); + } + } // Create the (master) run manager if(m_useMT) { @@ -132,7 +139,7 @@ void G4AtlasAlg::initializeOnce() workerInit->SetFastSimMasterTool( m_fastSimTool.typeAndName() ); runMgr->SetUserInitialization( workerInit.release() ); std::unique_ptr<G4AtlasActionInitialization> actionInitialization = - std::make_unique<G4AtlasActionInitialization>(&*m_userActionSvc); + std::make_unique<G4AtlasActionInitialization>(m_userActionSvc.get()); runMgr->SetUserInitialization(actionInitialization.release()); #else throw std::runtime_error("Trying to use multi-threading in non-MT build!"); @@ -149,7 +156,7 @@ void G4AtlasAlg::initializeOnce() runMgr->SetFastSimMasterTool(m_fastSimTool.typeAndName() ); runMgr->SetPhysListSvc(m_physListSvc.typeAndName() ); std::unique_ptr<G4AtlasActionInitialization> actionInitialization = - std::make_unique<G4AtlasActionInitialization>(&*m_userActionSvc); + std::make_unique<G4AtlasActionInitialization>(m_userActionSvc.get()); runMgr->SetUserInitialization(actionInitialization.release()); } diff --git a/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.h b/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.h index 91b94205fd22f16aa251a8ed76fd21895b445156..9eb0df2ee02e429ac288fbce1178f54f6db3c96d 100644 --- a/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.h +++ b/Simulation/G4Atlas/G4AtlasAlg/src/G4AtlasAlg.h @@ -22,6 +22,7 @@ #include "StoreGate/WriteHandleKey.h" #include "AthenaKernel/IAthRNGSvc.h" #include "G4AtlasInterfaces/IUserActionSvc.h" +#include "G4AtlasInterfaces/IUserActionTool.h" #include "G4AtlasInterfaces/IDetectorGeometrySvc.h" #include "G4AtlasInterfaces/ISensitiveDetectorMasterTool.h" #include "G4AtlasInterfaces/IFastSimulationMasterTool.h" @@ -148,6 +149,7 @@ private: /// Fast Simulation Master Tool PublicToolHandle<IFastSimulationMasterTool> m_fastSimTool{this, "FastSimMasterTool", "FastSimulationMasterTool", ""}; /// @} + PublicToolHandleArray<G4UA::IUserActionTool> m_actionTools{this, "UserActionTools", {}, "User action tools to be added to the G4 Action service."}; }; diff --git a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py index fada738186c826e571f9a798f8d539e9db02cf41..e80c101e9b7dfaf5b55dec287b4a888c6641c10f 100755 --- a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py +++ b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py @@ -238,7 +238,10 @@ class TestAtlasG4Cosmics(unittest.TestCase): def test___G4AtlasAlg_ListOfSetProperties(self): - expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EventInfo', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListSvc', 'QuasiStablePatcher', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'UserLimitsSvc', 'Verbosities'] + expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EventInfo', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', + 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', + 'PhysicsListSvc', 'QuasiStablePatcher', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', + 'UserLimitsSvc', 'Verbosities', 'UserActionTools'] g4atlasalg = self._job_config_dict['G4AtlasAlg'] actual_list = g4atlasalg.keys() expected_property_value_sorted = sorted(expected_list) diff --git a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py index 14e463a19b7f6d8333a042b4bb5fcc6bbb4745db..9db1d31c29e8d5a1298b751b30b174a062c4a48f 100755 --- a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py +++ b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py @@ -154,7 +154,10 @@ class TestAtlasG4(unittest.TestCase): def test___G4AtlasAlg_ListOfSetProperties(self): - expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EventInfo', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListSvc', 'QuasiStablePatcher', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'UserLimitsSvc', 'Verbosities'] + expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EventInfo', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', + 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', + 'PhysicsListSvc', 'QuasiStablePatcher', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', + 'UserLimitsSvc', 'Verbosities', 'UserActionTools'] g4atlasalg = self._job_config_dict['G4AtlasAlg'] actual_list = g4atlasalg.keys() expected_property_value_sorted = sorted(expected_list) diff --git a/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py b/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py index f134e55136612bcf73860950dcbdf52927b0e16a..6baebbf02c82949ac7b789560c114917c403a402 100755 --- a/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py +++ b/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py @@ -174,7 +174,10 @@ class TestTestBeam(unittest.TestCase): def test___G4AtlasAlg_ListOfSetProperties(self): - expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EventInfo', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListSvc', 'QuasiStablePatcher', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'UserLimitsSvc', 'Verbosities'] + expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EventInfo', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', + 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', + 'PhysicsListSvc', 'QuasiStablePatcher', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', + 'UserLimitsSvc', 'Verbosities', 'UserActionTools'] g4atlasalg = self._job_config_dict['G4AtlasAlg'] actual_list = g4atlasalg.keys() expected_property_value_sorted = sorted(expected_list) diff --git a/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/IUserActionSvc.h b/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/IUserActionSvc.h index 21231b373569b804a9bc83204c638fd8be64be6a..a587aa256fb17599173b8a62bbe5edf26fed9e23 100644 --- a/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/IUserActionSvc.h +++ b/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/IUserActionSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ @@ -8,10 +8,12 @@ // Framework includes #include "GaudiKernel/IService.h" +#include "GaudiKernel/ToolHandle.h" + #include <vector> #include "G4UserSteppingAction.hh" - +#include "G4AtlasInterfaces/IUserActionTool.h" namespace G4UA { @@ -31,6 +33,14 @@ namespace G4UA // For ISF, get UserActions that could have stored secondary particles virtual StatusCode getSecondaryActions( std::vector< G4UserSteppingAction* >& actions ) = 0; + /// @brief In very rare cases, the IUserActionSvc needs to call tools of which it cannot be owner during its initialization + /// as these tools declare event data dependencies which is a big no go for a service. Let instead the algorithm own the tool + /// and pipe it to the service during initialization + /// @param service_tool + /// @return + virtual StatusCode addActionTool(const ToolHandle<IUserActionTool>& service_tool) = 0; + + /// Creates the InterfaceID and interfaceID() method DeclareInterfaceID(G4UA::IUserActionSvc, 1, 0); diff --git a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx index 6197b655621f7475e1e20140136aa1c401ec685f..da2c996521d420b8f2dbfad87b3bd5196844d6b0 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx @@ -43,6 +43,20 @@ namespace G4UA return StatusCode::SUCCESS; } + StatusCode UserActionSvc::addActionTool(const ToolHandle<IUserActionTool>& service_tool){ + + if (!service_tool.isPublic()){ + ATH_MSG_FATAL("Only public tools are allowed"); + return StatusCode::FAILURE; + } + if (service_tool.empty()) { + ATH_MSG_FATAL("NO point in adding empty tool handles here."); + return StatusCode::FAILURE; + } + ATH_MSG_INFO(" Add new tool "<<service_tool.name()); + m_userActionTools.push_back(service_tool); + return StatusCode::SUCCESS; + } //--------------------------------------------------------------------------- // Initialize the user actions for the current thread. diff --git a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h index 4477e0b8d9c4e517c1a3d73dc5561b77d9231f21..4b6dbb9f47e77f6fa71ddd97530bdbcffbf0c21a 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h @@ -48,6 +48,7 @@ namespace G4UA StatusCode getSecondaryActions( std::vector< G4UserSteppingAction* >& actions ) override final; + StatusCode addActionTool(const ToolHandle<IUserActionTool>& service_tool) override final; private: /// @name Handles to ATLAS action tools diff --git a/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.cxx b/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.cxx index 5b0ef3fc3f0755c1da89a99fd968ae262b5e51d5..dd6f341e2a8ae02c92601ff11c641cc420eea60c 100644 --- a/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.cxx +++ b/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.cxx @@ -139,12 +139,16 @@ namespace G4UA m_tree->Branch("collected_X0", &m_collected_X0); //Vector m_tree->Branch("collected_L0", &m_collected_L0); //Vector - + m_tree->Branch("collected_inhitr", &m_collected_hitr); //Vector m_tree->Branch("collected_inhitz", &m_collected_hitz); //Vector + m_tree->Branch("collected_inhitx", &m_collected_hitx); //Vector + m_tree->Branch("collected_inhity", &m_collected_hity); //Vector m_tree->Branch("collected_outhitr", &m_collected_outhitr); //Vector m_tree->Branch("collected_outhitz", &m_collected_outhitz); //Vector + m_tree->Branch("collected_outhitx", &m_collected_outhitx); //Vector + m_tree->Branch("collected_outhity", &m_collected_outhity); //Vector m_tree->Branch("collected_material", &m_collected_material); //Vector m_tree->Branch("collected_density", &m_collected_density); //Vector @@ -394,9 +398,13 @@ namespace G4UA m_collected_L0.clear(); m_collected_hitr.clear(); + m_collected_hitx.clear(); + m_collected_hity.clear(); m_collected_hitz.clear(); m_collected_outhitr.clear(); + m_collected_outhitx.clear(); + m_collected_outhity.clear(); m_collected_outhitz.clear(); m_collected_material.clear(); @@ -447,9 +455,13 @@ namespace G4UA m_collected_hitr.push_back(hitPoint.perp()); m_collected_hitz.push_back(hitPoint.z()); + m_collected_hitx.push_back(hitPoint.x()); + m_collected_hity.push_back(hitPoint.y()); m_collected_outhitr.push_back(endPoint.perp()); m_collected_outhitz.push_back(endPoint.z()); + m_collected_outhitx.push_back(endPoint.x()); + m_collected_outhity.push_back(endPoint.y()); std::string groupmaterial = getMaterialClassification(matName); diff --git a/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.h b/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.h index 8203513cd39ac7e65915eb952647420204f4bac2..d449e3df1073634fab93ea3b3447af7ecf889ecd 100644 --- a/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.h +++ b/Simulation/G4Utilities/G4UserActions/src/LengthIntegrator.h @@ -13,7 +13,7 @@ #include "G4UserEventAction.hh" #include "G4UserSteppingAction.hh" - +//#include "AthenaBaseComps/AthMessaging.h" #include <string> #include <map> @@ -39,7 +39,7 @@ namespace G4UA /// finalization of the LengthIntegratorTool. /// class LengthIntegrator final : public G4UserEventAction, - public G4UserSteppingAction + public G4UserSteppingAction { public: @@ -80,9 +80,13 @@ namespace G4UA std::vector<double> m_collected_L0; std::vector<float> m_collected_hitr; + std::vector<float> m_collected_hitx; + std::vector<float> m_collected_hity; std::vector<float> m_collected_hitz; std::vector<float> m_collected_outhitr; + std::vector<float> m_collected_outhitx; + std::vector<float> m_collected_outhity; std::vector<float> m_collected_outhitz; std::vector<float> m_collected_density; diff --git a/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt b/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt index 4c684675cdc2861fdfdee408676299a8045bc44a..1585adac4bef732d0305e0aa4253f74ca6d5338c 100644 --- a/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ISF_ActsTools ) @@ -21,3 +21,4 @@ atlas_add_component( ISF_ActsTools # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + diff --git a/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfig.py b/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfig.py index 300d7a7bc5196b3da3cfc9339dcd9e365a1806fd..3380fbedc7f0a09b19fd0a9b6e77b90fa6d0e403 100644 --- a/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfig.py +++ b/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfig.py @@ -1,14 +1,16 @@ -"""ComponentAccumulator tool configuration for ISF_ActsTools +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration """ + ComponentAccumulator tool configuration for ISF_ActsTools +""" + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory def ActsFatrasSimToolCfg(flags, name="ISF_ActsFatrasSimTool", **kwargs): """Return ISF_FatrasSimHitCreatorID configured with ComponentAccumulator""" acc = ComponentAccumulator() - from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometryToolCfg + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg kwargs.setdefault('TrackingGeometryTool', acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags))) kwargs.setdefault("MaxSteps", 2000) diff --git a/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigDb.py b/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigDb.py index ea64ee8d726a4e6b21c05dd68977cda94a9db034..a3486f6be1d2a4214a18e2ee036278434b561346 100644 --- a/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigDb.py +++ b/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigDb.py @@ -1,5 +1,4 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration - +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaCommon.CfgGetter import addTool diff --git a/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigLegacy.py b/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigLegacy.py index 76c8b861dc538e8900fbcf8336a4d7ed17094045..813d788339d66a22fbb73f60f90b6b643ee69a7d 100644 --- a/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigLegacy.py +++ b/Simulation/ISF/ISF_Acts/ISF_ActsTools/python/ISF_ActsToolsConfigLegacy.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx index 3d5efd2a35643607f894b79889524f2efa48c7a0..870a132782a61e06e6ff5bea7dc9e9aa98e10f83 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGAN.cxx @@ -289,10 +289,10 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState &simulstate, simulstate.set_E(0); int vox = 0; - for (auto element : binsInLayers) { + for (const auto& element : binsInLayers) { int layer = element.first; - TH2D *h = &element.second; + const TH2D *h = &element.second; int xBinNum = h->GetNbinsX(); // If only one bin in r means layer is empty, no value should be added if (xBinNum == 1) { @@ -336,12 +336,12 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState &simulstate, } vox = 0; - for (auto element : binsInLayers) { + for (const auto& element : binsInLayers) { int layer = element.first; simulstate.setAuxInfo<int>("GANlayer"_FCShash, layer); TFCSLateralShapeParametrizationHitBase::Hit hit; - TH2D *h = &element.second; + const TH2D *h = &element.second; int xBinNum = h->GetNbinsX(); // If only one bin in r means layer is empty, no value should be added if (xBinNum == 1) { @@ -429,7 +429,7 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState &simulstate, continue; } - TAxis *x = (TAxis *)h->GetXaxis(); + const TAxis *x = h->GetXaxis(); nHitsR = x->GetBinUpEdge(ix) - x->GetBinLowEdge(ix); if (yBinNum == 1) { // nbins in alpha depend on circumference lenght @@ -438,7 +438,7 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState &simulstate, } else { // d = 2*r*sin (a/2r) this distance at the upper r must be 1mm for // layer 1 or 5, 5mm otherwise. - TAxis *y = (TAxis *)h->GetYaxis(); + const TAxis *y = h->GetYaxis(); double angle = y->GetBinUpEdge(iy) - y->GetBinLowEdge(iy); double r = x->GetBinUpEdge(ix); double d = 2 * r * sin(angle / 2 * r); @@ -449,7 +449,7 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState &simulstate, nHitsR = std::min(10, std::max(1, nHitsR)); for (int ir = 0; ir < nHitsR; ++ir) { - TAxis *x = (TAxis *)h->GetXaxis(); + const TAxis *x = h->GetXaxis(); double r = x->GetBinLowEdge(ix) + x->GetBinWidth(ix) / (nHitsR + 1) * ir; @@ -459,7 +459,7 @@ bool TFCSEnergyAndHitGAN::fillEnergy(TFCSSimulationState &simulstate, alpha = CLHEP::RandFlat::shoot(simulstate.randomEngine(), -M_PI, M_PI); } else { - TAxis *y = (TAxis *)h->GetYaxis(); + const TAxis *y = h->GetYaxis(); alpha = y->GetBinLowEdge(iy) + y->GetBinWidth(iy) / (nHitsAlpha + 1) * ialpha; } diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt index ff316e56e014350ed8e30ac7a7d3d9f0fccc124e..5dd5c959c04f34319b8c7dfb0dd1a04c71a77613 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/CMakeLists.txt @@ -38,4 +38,4 @@ atlas_add_test( ISF_FastCaloSimServices_Config_test SCRIPT test/FastCaloSimServicesTest.py -n 3 PRIVATE_WORKING_DIRECTORY POST_EXEC_SCRIPT nopost.sh - PROPERTIES TIMEOUT 2000) + PROPERTIES TIMEOUT 4000) diff --git a/Tools/CampaignsARTTests/config/dcube_config_all_domains_reduced.xml b/Tools/CampaignsARTTests/config/dcube_config_all_domains_reduced.xml index 0162e3946b23803c478a6c659b4ef90527544921..057adfc15c3cde060a209e77929bf5868df30d25 100644 --- a/Tools/CampaignsARTTests/config/dcube_config_all_domains_reduced.xml +++ b/Tools/CampaignsARTTests/config/dcube_config_all_domains_reduced.xml @@ -467,109 +467,6 @@ <hist1D name="Photon_Phot_n" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Photon_Phot_n_weighted" plotopts="" tests="KS" type="TH1F"/> </TDirectory> - <TDirectory name="PhotTopo"> - <TDirectory name="All"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_PhotTopo_All_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_All_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_All_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_PhotTopo_All_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <TDirectory name="Iso"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_PhotTopo_Iso_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_Iso_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_Iso_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_PhotTopo_Iso_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <TDirectory name="IsoLoose"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_PhotTopo_IsoLoose_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_IsoLoose_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_IsoLoose_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_PhotTopo_IsoLoose_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <TDirectory name="IsoTight"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_PhotTopo_IsoTight_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_IsoTight_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_IsoTight_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_PhotTopo_IsoTight_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <hist1D name="Photon_PhotTopo_n" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotTopo_n_weighted" plotopts="" tests="KS" type="TH1F"/> - </TDirectory> - <TDirectory name="PhotAmb"> - <TDirectory name="All"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_PhotAmb_All_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotAmb_All_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotAmb_All_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_PhotAmb_All_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <hist1D name="Photon_PhotAmb_n" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_PhotAmb_n_weighted" plotopts="" tests="KS" type="TH1F"/> - </TDirectory> - <TDirectory name="Conv"> - <TDirectory name="All"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_Conv_All_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_All_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_All_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Conv_All_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <TDirectory name="Iso"> - <TDirectory name="KinPlots"> - <hist1D name="Photon_Conv_Iso_KinPlots_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_Iso_KinPlots_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_Iso_KinPlots_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Conv_Iso_KinPlots_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - <hist1D name="Photon_Conv_n" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_n_weighted" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_nVtx" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_convR" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Conv_convRvsEta" plotopts="" tests="KS" type="TH2F"/> - <hist2D name="Photon_Conv_convRvsType" plotopts="" tests="KS" type="TH2F"/> - <hist1D name="Photon_Conv_convType" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_convDeltaEta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Conv_ConvDeltaPhi" plotopts="" tests="KS" type="TH1F"/> - </TDirectory> - <TDirectory name="TruthAll"> - <TDirectory name="All"> - <hist1D name="Photon_TruthAll_All_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_All_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_All_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_TruthAll_All_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Iso"> - <TDirectory name="all"> - <hist1D name="Photon_TruthAll_Iso_all_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_Iso_all_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_Iso_all_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_TruthAll_Iso_all_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Conv"> - <hist1D name="Photon_TruthAll_Iso_Conv_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_Iso_Conv_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_Iso_Conv_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_TruthAll_Iso_Conv_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Unc"> - <hist1D name="Photon_TruthAll_Iso_Unc_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_Iso_Unc_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_TruthAll_Iso_Unc_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_TruthAll_Iso_Unc_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - </TDirectory> - </TDirectory> <TDirectory name="Truth"> <TDirectory name="Reco"> <TDirectory name="all"> @@ -578,18 +475,6 @@ <hist1D name="Photon_Truth_Reco_all_phi" plotopts="" tests="KS" type="TH1F"/> <hist2D name="Photon_Truth_Reco_all_etvseta" plotopts="" tests="KS" type="TH2F"/> </TDirectory> - <TDirectory name="Conv"> - <hist1D name="Photon_Truth_Reco_Conv_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Reco_Conv_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Reco_Conv_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_Reco_Conv_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Unc"> - <hist1D name="Photon_Truth_Reco_Unc_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Reco_Unc_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Reco_Unc_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_Reco_Unc_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> </TDirectory> <TDirectory name="RecoLoose"> <TDirectory name="all"> @@ -598,18 +483,6 @@ <hist1D name="Photon_Truth_RecoLoose_all_phi" plotopts="" tests="KS" type="TH1F"/> <hist2D name="Photon_Truth_RecoLoose_all_etvseta" plotopts="" tests="KS" type="TH2F"/> </TDirectory> - <TDirectory name="Conv"> - <hist1D name="Photon_Truth_RecoLoose_Conv_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoLoose_Conv_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoLoose_Conv_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_RecoLoose_Conv_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Unc"> - <hist1D name="Photon_Truth_RecoLoose_Unc_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoLoose_Unc_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoLoose_Unc_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_RecoLoose_Unc_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> </TDirectory> <TDirectory name="RecoTight"> <TDirectory name="all"> @@ -618,18 +491,6 @@ <hist1D name="Photon_Truth_RecoTight_all_phi" plotopts="" tests="KS" type="TH1F"/> <hist2D name="Photon_Truth_RecoTight_all_etvseta" plotopts="" tests="KS" type="TH2F"/> </TDirectory> - <TDirectory name="Conv"> - <hist1D name="Photon_Truth_RecoTight_Conv_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoTight_Conv_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoTight_Conv_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_RecoTight_Conv_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Unc"> - <hist1D name="Photon_Truth_RecoTight_Unc_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoTight_Unc_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_RecoTight_Unc_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_RecoTight_Unc_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> </TDirectory> <TDirectory name="Iso"> <TDirectory name="all"> @@ -638,18 +499,6 @@ <hist1D name="Photon_Truth_Iso_all_phi" plotopts="" tests="KS" type="TH1F"/> <hist2D name="Photon_Truth_Iso_all_etvseta" plotopts="" tests="KS" type="TH2F"/> </TDirectory> - <TDirectory name="Conv"> - <hist1D name="Photon_Truth_Iso_Conv_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Iso_Conv_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Iso_Conv_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_Iso_Conv_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> - <TDirectory name="Unc"> - <hist1D name="Photon_Truth_Iso_Unc_et" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Iso_Unc_eta" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Photon_Truth_Iso_Unc_phi" plotopts="" tests="KS" type="TH1F"/> - <hist2D name="Photon_Truth_Iso_Unc_etvseta" plotopts="" tests="KS" type="TH2F"/> - </TDirectory> </TDirectory> </TDirectory> <hist1D name="Photon_author" plotopts="" tests="KS" type="TH1F"/> @@ -1169,7 +1018,6 @@ <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsBOS" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsBOL" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsBEE" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEIS" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEIL" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEMS" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEML" plotopts="" tests="KS" type="TH1F"/> @@ -1177,8 +1025,6 @@ <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEOL" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEES" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsEEL" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsCSS" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Muons_All_matched_AllMuons_truthHits_precMatchedHitsCSL" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_phiMatchedHitsSummed" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_phiMatchedHitsBM1" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_truthHits_phiMatchedHitsBM2" plotopts="" tests="KS" type="TH1F"/> @@ -1201,7 +1047,6 @@ </TDirectory> <TDirectory name="Eloss"> <hist1D name="Muons_All_matched_AllMuons_Eloss_msInnerMatchChi2" plotopts="" tests="KS" type="TH1F"/> - <hist1D name="Muons_All_matched_AllMuons_Eloss_msOuterMatchChi2" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_Eloss_ELoss" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_Eloss_ELossDiffTruth" plotopts="" tests="KS" type="TH1F"/> <hist1D name="Muons_All_matched_AllMuons_Eloss_ELossDiffTruthEta0_1p35" plotopts="" tests="KS" type="TH1F"/> @@ -1446,6 +1291,7 @@ </TDirectory> </TDirectory> <TDirectory name="BTag"> + <!-- <TDirectory name="ROC_EMTopo"> <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_tagger_IP3D_b_matched_weight" type="TGraphErrors" plotopts="logy" tests="KS"/> <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_tagger_IP3D_b_matched_weight_ctag" type="TGraphErrors" plotopts="logy" tests="KS"/> @@ -1455,9 +1301,8 @@ <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_tagger_DL1dv00_b_matched_weight_ctag" type="TGraphErrors" plotopts="logy" tests="KS"/> <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_tagger_GN1_b_matched_weight" type="TGraphErrors" plotopts="logy" tests="KS"/> <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_tagger_GN1_b_matched_weight_ctag" type="TGraphErrors" plotopts="logy" tests="KS"/> - <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_old_taggers_IP2D_b_matched_weight" type="TGraphErrors" plotopts="logy" tests="KS"/> - <graph name="rejVsEff_BTag_AntiKt4EMTopoJets_old_taggers_IP2D_b_matched_weight_ctag" type="TGraphErrors" plotopts="logy" tests="KS"/> </TDirectory> + --> <TDirectory name="AntiKt4EMTopoJets"> <TDirectory name="other_histograms"> <TDirectory name="histos"> diff --git a/Tools/CampaignsARTTests/share/test_digi_reco_inTimeTruth_mu1.sh b/Tools/CampaignsARTTests/share/test_digi_reco_inTimeTruth_mu1.sh index 8f66411ddcfc5aaab20799174edaead7bd3acf69..187ffde14497f6751f1692ec523fe43ef4046cdc 100755 --- a/Tools/CampaignsARTTests/share/test_digi_reco_inTimeTruth_mu1.sh +++ b/Tools/CampaignsARTTests/share/test_digi_reco_inTimeTruth_mu1.sh @@ -116,7 +116,7 @@ else python $ftag_merge_DQA/$ftag_merge_script --pattern "*BTAG_PHYSVAL*" --output NTUP_BTAG_MERGE_PHYSVAL.root -d BTag fi -root -l -b -q $ftag_merge_DQA/$ftag_roc_script\(\"ttbar\",\"EMTopo\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"ROC_NTUP_BTAG_MERGE_PHYSVAL.root\",\{\"IP2D\",\"IP3D\",\"SV1\",\"DL1dv00\",\"GN1\"\}\) +root -l -b -q $ftag_merge_DQA/$ftag_roc_script\(\"ttbar\",\"EMTopo\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"ROC_NTUP_BTAG_MERGE_PHYSVAL.root\",\{\"IP3D\",\"SV1\",\"DL1dv00\",\"GN1\"\}\) hadd NTUP_MERGE_PHYSVAL.root NTUP_PHYSVAL.root NTUP_BTAG_MERGE_PHYSVAL.root ROC_NTUP_BTAG_MERGE_PHYSVAL.root checkstep "Merging and post processing" diff --git a/Tools/CampaignsARTTests/share/test_full_chain_mu0.sh b/Tools/CampaignsARTTests/share/test_full_chain_mu0.sh index 4b924e61b7ff49dcabde83b48f388bda0454d536..c4c3213fd9820bea3d5bfb8d615ddcbff07bde10 100755 --- a/Tools/CampaignsARTTests/share/test_full_chain_mu0.sh +++ b/Tools/CampaignsARTTests/share/test_full_chain_mu0.sh @@ -8,7 +8,7 @@ echo "Input Parameters" number_of_events=$1 #Option for sim/digi/reco -default_geometry="ATLAS-P2-RUN4-01-01-00" +default_geometry="ATLAS-P2-RUN4-03-00-00" default_condition="OFLCOND-MC15c-SDR-14-05" #Post-processing for ID/ITk and FTag @@ -67,6 +67,9 @@ run "RAWtoALL" Reco_tf.py \ --outputAODFile "AOD.pool.root" \ --maxEvents ${number_of_events} +#a missing Acts material map can be overriden by a statement like +#--preExec "all:ConfigFlags.Acts.TrackingGeometry.MaterialSource='material-maps-ATLAS-P2-RUN4-01-01-00-ITk-HGTD.json'" \ + checkstep "RAWtoALL" run "AODtoDAOD_PHYSVAL" Derivation_tf.py \ @@ -118,7 +121,7 @@ else python $ftag_merge_DQA/$ftag_merge_script --pattern "*BTAG_PHYSVAL*" --output NTUP_BTAG_MERGE_PHYSVAL.root -d BTag fi -root -l -b -q $ftag_merge_DQA/$ftag_roc_script\(\"ttbar\",\"EMTopo\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"ROC_NTUP_BTAG_MERGE_PHYSVAL.root\",\{\"IP2D\",\"IP3D\",\"SV1\",\"DL1dv00\",\"GN1\"\}\) +root -l -b -q $ftag_merge_DQA/$ftag_roc_script\(\"ttbar\",\"EMTopo\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"NTUP_BTAG_MERGE_PHYSVAL.root\",\"ROC_NTUP_BTAG_MERGE_PHYSVAL.root\",\{\"IP3D\",\"SV1\",\"DL1dv00\",\"GN1\"\}\) hadd NTUP_MERGE_PHYSVAL.root NTUP_PHYSVAL.root NTUP_BTAG_MERGE_PHYSVAL.root ROC_NTUP_BTAG_MERGE_PHYSVAL.root checkstep "Merging and post processing" diff --git a/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_davs.sh b/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_davs.sh index a011a1fbdf29f1335724b3ae2392000a1ec8dbba..bc85f1298dfc8b2e2894d857221a0e0f873b2bda 100755 --- a/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_davs.sh +++ b/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_davs.sh @@ -3,11 +3,10 @@ # art-description: DirectIOART Athena Reco_tf.py inputFile:RDO protocol=DAVS # art-type: grid # art-output: *.pool.root -# art-include: master/Athena # art-athena-mt: 8 set -e -Reco_tf.py --AMI q221 --conditionsTag "default:OFLCOND-MC16-SDR-RUN2-09" "RDOtoRDOTrigger:OFLCOND-MC16-SDR-RUN2-08-02" --athenaopts='--threads=1' --inputRDOFile davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1 --outputRDO_TRIGFile art.pool.root --preExec 'from AthenaConfiguration.AllConfigFlags import ConfigFlags; ConfigFlags.Trigger.AODEDMSet="AODFULL"' +unset ATHENA_PROC_NUMBER; unset ATHENA_CORE_NUMBER; Reco_tf.py --AMI q443 --steering "doRDO_TRIG" "doTRIGtoALL" --inputRDOFile davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1 --outputRDO_TRIGFile art.pool.root --maxEvents 25 echo "art-result: $? DirectIOART_Athena_RecoTF_inputRDO_protocol_DAVS" diff --git a/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_https.sh b/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_https.sh index 6e20f50185362536a17bae16d0b946f72e1e0c77..4f184b84acb3ae512e5569798cbac413cae049db 100755 --- a/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_https.sh +++ b/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_https.sh @@ -3,11 +3,10 @@ # art-description: DirectIOART Athena Reco_tf.py inputFile:RDO protocol=HTTPS # art-type: grid # art-output: *.pool.root -# art-include: master/Athena # art-athena-mt: 8 set -e -Reco_tf.py --AMI q221 --conditionsTag "default:OFLCOND-MC16-SDR-RUN2-09" "RDOtoRDOTrigger:OFLCOND-MC16-SDR-RUN2-08-02" --athenaopts='--threads=1' --inputRDOFile https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1 --outputRDO_TRIGFile art.pool.root --preExec 'from AthenaConfiguration.AllConfigFlags import ConfigFlags; ConfigFlags.Trigger.AODEDMSet="AODFULL"' +unset ATHENA_PROC_NUMBER; unset ATHENA_CORE_NUMBER; Reco_tf.py --AMI q443 --steering "doRDO_TRIG" "doTRIGtoALL" --inputRDOFile https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1 --outputRDO_TRIGFile art.pool.root --maxEvents 25 echo "art-result: $? DirectIOART_Athena_RecoTF_inputRDO_protocol_HTTPS" diff --git a/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_root.sh b/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_root.sh index 5efe26ef9953546a1d0ba8518b6227f34e170559..3a7b01667bce1b65f7a84c2bad679a521eb85200 100755 --- a/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_root.sh +++ b/Tools/DirectIOART/test/test_directioart_athena_recotf_with_rdo_root.sh @@ -3,11 +3,10 @@ # art-description: DirectIOART Athena Reco_tf.py inputFile:RDO protocol=ROOT # art-type: grid # art-output: *.pool.root -# art-include: master/Athena # art-athena-mt: 8 set -e -Reco_tf.py --AMI q221 --conditionsTag "default:OFLCOND-MC16-SDR-RUN2-09" "RDOtoRDOTrigger:OFLCOND-MC16-SDR-RUN2-08-02" --athenaopts='--threads=1' --inputRDOFile root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1 --outputRDO_TRIGFile art.pool.root --preExec 'from AthenaConfiguration.AllConfigFlags import ConfigFlags; ConfigFlags.Trigger.AODEDMSet="AODFULL"' +unset ATHENA_PROC_NUMBER; unset ATHENA_CORE_NUMBER; Reco_tf.py --AMI=q443 --steering "doRDO_TRIG" "doTRIGtoALL" --inputRDOFile root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1 --outputRDO_TRIGFile art.pool.root --maxEvents 25 echo "art-result: $? DirectIOART_Athena_RecoTF_inputRDO_protocol_ROOT" diff --git a/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_davs.sh b/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_davs.sh new file mode 100755 index 0000000000000000000000000000000000000000..983d00ce26af1756f083e59bbdc13ba71e1f3cf2 --- /dev/null +++ b/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_davs.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# art-description: DirectIOART AthenaMT Sim_tf.py inputFile:EVNT protocol=DAVS +# art-type: grid +# art-output: *.pool.root +# art-include: master/Athena +# art-athena-mt: 2 + +set -e + +Sim_tf.py \ + --multithreaded="True" \ + --inputEVNTFile=davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc21_13p6TeV/d3/3f/EVNT.29070483._000001.pool.root.1 \ + --maxEvents=8 \ + --postInclude "default:PyJobTransforms/UseFrontier.py" \ + --preInclude "EVNTtoHITS:Campaigns/MC21SimulationMultiBeamSpot.py,SimulationJobOptions/preInclude.ExtraParticles.py,SimulationJobOptions/preInclude.G4ExtraProcesses.py" \ + --randomSeed=4056 \ + --DBRelease="all:300.0.4" \ + --conditionsTag "default:OFLCOND-MC21-SDR-RUN3-05" \ + --geometryVersion="default:ATLAS-R3S-2021-03-00-00_VALIDATION" \ + --runNumber=801165 \ + --AMITag=s3873 \ + --jobNumber=4056 \ + --firstEvent=4055001 \ + --outputHITSFile=hits.pool.root \ + --simulator=FullG4MT_QS + +echo "art-result: $? DirectIOART_AthenaMT_SimTF_inputEVNT_protocol_DAVS" diff --git a/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_https.sh b/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_https.sh new file mode 100755 index 0000000000000000000000000000000000000000..98f3adcb070191d0fdabf84eff35a4243d943f76 --- /dev/null +++ b/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_https.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# art-description: DirectIOART AthenaMT Sim_tf.py inputFile:EVNT protocol=HTTPS +# art-type: grid +# art-output: *.pool.root +# art-include: master/Athena +# art-athena-mt: 2 + +set -e + +Sim_tf.py \ + --multithreaded="True" \ + --inputEVNTFile=https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc21_13p6TeV/d3/3f/EVNT.29070483._000001.pool.root.1 \ + --maxEvents=8 \ + --postInclude "default:PyJobTransforms/UseFrontier.py" \ + --preInclude "EVNTtoHITS:Campaigns/MC21SimulationMultiBeamSpot.py,SimulationJobOptions/preInclude.ExtraParticles.py,SimulationJobOptions/preInclude.G4ExtraProcesses.py" \ + --randomSeed=4056 \ + --DBRelease="all:300.0.4" \ + --conditionsTag "default:OFLCOND-MC21-SDR-RUN3-05" \ + --geometryVersion="default:ATLAS-R3S-2021-03-00-00_VALIDATION" \ + --runNumber=801165 \ + --AMITag=s3873 \ + --jobNumber=4056 \ + --firstEvent=4055001 \ + --outputHITSFile=hits.pool.root \ + --simulator=FullG4MT_QS + +echo "art-result: $? DirectIOART_AthenaMT_SimTF_inputEVNT_protocol_HTTPS" diff --git a/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_root.sh b/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_root.sh new file mode 100755 index 0000000000000000000000000000000000000000..b3671ca961fced3d496e77f909e1e034ff72bf71 --- /dev/null +++ b/Tools/DirectIOART/test/test_directioart_athenamt_simtf_with_evnt_root.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# art-description: DirectIOART AthenaMT Sim_tf.py inputFile:EVNT protocol=ROOT +# art-type: grid +# art-output: *.pool.root +# art-include: master/Athena +# art-athena-mt: 2 + +set -e + +Sim_tf.py \ + --multithreaded="True" \ + --inputEVNTFile=root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc21_13p6TeV/d3/3f/EVNT.29070483._000001.pool.root.1 \ + --maxEvents=8 \ + --postInclude "default:PyJobTransforms/UseFrontier.py" \ + --preInclude "EVNTtoHITS:Campaigns/MC21SimulationMultiBeamSpot.py,SimulationJobOptions/preInclude.ExtraParticles.py,SimulationJobOptions/preInclude.G4ExtraProcesses.py" \ + --randomSeed=4056 \ + --DBRelease="all:300.0.4" \ + --conditionsTag "default:OFLCOND-MC21-SDR-RUN3-05" \ + --geometryVersion="default:ATLAS-R3S-2021-03-00-00_VALIDATION" \ + --runNumber=801165 \ + --AMITag=s3873 \ + --jobNumber=4056 \ + --firstEvent=4055001 \ + --outputHITSFile=hits.pool.root \ + --simulator=FullG4MT_QS + +echo "art-result: $? DirectIOART_AthenaMT_SimTF_inputEVNT_protocol_ROOT" diff --git a/Tools/PROCTools/data/q447_AOD_digest.ref b/Tools/PROCTools/data/q447_AOD_digest.ref index 5cebf762de6f063c659d391d9e444b553b1c9743..415ef684f06aa65c0628999faddd10d63717fed5 100644 --- a/Tools/PROCTools/data/q447_AOD_digest.ref +++ b/Tools/PROCTools/data/q447_AOD_digest.ref @@ -1,6 +1,6 @@ run event nTopo nIdTracks nTauTracks nTaus nMuons nElec nTrueElec nFakeElec nPhot nTruePhot nFakePhot 242000 3120001 230 8 3 1 1 0 0 0 0 0 0 242000 3120002 183 6 0 0 1 0 0 0 0 0 0 - 242000 3120003 377 35 3 2 2 1 0 1 2 0 2 + 242000 3120003 377 36 3 2 2 1 0 1 2 0 2 242000 3120004 174 11 0 0 0 0 0 0 0 0 0 242000 3120005 400 37 6 1 3 2 0 2 3 1 2 diff --git a/Tools/TrfTestsART/test/test_trf_RUN4_r2a_ca_mt_mu200_overlay.sh b/Tools/TrfTestsART/test/test_trf_RUN4_r2a_ca_mt_mu200_overlay.sh index 4b5f1762e5472c3bc359736882cad223a15dcdcc..551963d0746ec56a05a24a21f77e4c40a76d8814 100755 --- a/Tools/TrfTestsART/test/test_trf_RUN4_r2a_ca_mt_mu200_overlay.sh +++ b/Tools/TrfTestsART/test/test_trf_RUN4_r2a_ca_mt_mu200_overlay.sh @@ -10,7 +10,7 @@ if [ -z ${ATLAS_REFERENCE_DATA+x} ]; then fi HSHitsFile="${ATLAS_REFERENCE_DATA}/PhaseIIUpgrade/HITS/ATLAS-P2-RUN4-01-01-00/mc21_14TeV.601229.PhPy8EG_A14_ttbar_hdamp258p75_SingleLep.simul.HITS.e8481_s4038/HITS.32253544._000100.pool.root.1" -RDOFile="${ATLAS_REFERENCE_DATA}/PhaseIIUpgrade/RDO_BKG/ATLAS-P2-RUN4-01-00-00/RUN4_presampling.mu200.50events.RDO.pool.root" +RDOFile="${ATLAS_REFERENCE_DATA}/PhaseIIUpgrade/RDO_BKG/ATLAS-P2-RUN4-01-01-00/RUN4_presampling.mu200.50events.RDO.pool.root" Reco_tf.py \ --CA \ diff --git a/Tools/TrfTestsARTPlots/test/test_trf_mc20_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_mc20_phys_physlite_ca.sh index fedf98c92f28b33e5054c4f791bc7cd8e2e05684..eb2624c247b73d8fb6bd94883f5ed06b85578efb 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_mc20_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_mc20_phys_physlite_ca.sh @@ -5,6 +5,7 @@ # art-include: master/Athena # art-athena-mt: 8 # art-output: dcube* +# art-output: hist_physlite_latest.root # art-html: dcube_physlite export ATHENA_CORE_NUMBER=8 @@ -50,8 +51,8 @@ echo "art-result: ${rc4} xAODHistSize" # dcube references echo "============ dcube references" -dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc20/v0/hist_physlite_2308.root" -dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc20/v0/dcube_config_hist_physlite_2308.xml" +dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc20/v5/hist_physlite_2403.root" +dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc20/v4/dcube_config_hist_physlite_2402.xml" echo ${dcubeRef} echo ${dcubeXML} diff --git a/Tools/TrfTestsARTPlots/test/test_trf_mc21_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_mc21_phys_physlite_ca.sh index 18468aa8f9c6b58031e36a34236df9cab0d0417c..79bc6f74696a979f6617ed1bef007f8e6555bd73 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_mc21_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_mc21_phys_physlite_ca.sh @@ -5,6 +5,7 @@ # art-include: master/Athena # art-athena-mt: 8 # art-output: dcube* +# art-output: hist_physlite_latest.root # art-html: dcube_physlite export ATHENA_CORE_NUMBER=8 @@ -49,8 +50,8 @@ echo "art-result: ${rc4} xAODHistSize" # dcube references echo "============ dcube references" -dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc21/v0/hist_physlite_2308.root" -dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc21/v0/dcube_config_hist_physlite_2308.xml" +dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc21/v5/hist_physlite_2403.root" +dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/mc21/v4/dcube_config_hist_physlite_2402.xml" echo ${dcubeRef} echo ${dcubeXML} diff --git a/Tools/TrfTestsARTPlots/test/test_trf_q442_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_q442_phys_physlite_ca.sh index dbf96687b60d4689dcec2be625bc094055786cc4..18dc13b7149e7629a0140c535873275b5fb53366 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_q442_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_q442_phys_physlite_ca.sh @@ -5,6 +5,7 @@ # art-include: master/Athena # art-athena-mt: 8 # art-output: dcube* +# art-output: hist_physlite_latest.root # art-html: dcube_physlite export ATHENA_CORE_NUMBER=8 @@ -59,8 +60,8 @@ echo "art-result: ${rc4} xAODHistSize" # dcube references echo "============ dcube references" -dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q442/v3/hist_physlite_2311.root" -dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q442/v3/dcube_config_hist_physlite_2311.xml" +dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q442/v5/hist_physlite_2403.root" +dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q442/v4/dcube_config_hist_physlite_2402.xml" echo ${dcubeRef} echo ${dcubeXML} diff --git a/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh index 8b044e0f74fd5b860dcc71a19c68b593dcc32972..1c66fb5d53fba38d06eb4c6f85a46abc98e015fb 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh @@ -5,6 +5,7 @@ # art-include: master/Athena # art-athena-mt: 8 # art-output: dcube* +# art-output: hist_physlite_latest.root # art-html: dcube_physlite export ATHENA_CORE_NUMBER=8 @@ -62,8 +63,8 @@ echo "art-result: ${rc4} xAODHistSize" # dcube references echo "============ dcube references" -dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q443_ca/v3/hist_physlite_2314.root" -dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q443_ca/v3/dcube_config_hist_physlite_2314.xml" +dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q443_ca/v5/hist_physlite_2403.root" +dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q443_ca/v4/dcube_config_hist_physlite_2402.xml" echo ${dcubeRef} echo ${dcubeXML} diff --git a/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh index 5eef295ba486c72dc4dd22c45829de432d126c25..351d4f036ccbbe9f54d02febe0317c63ca448be6 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh @@ -5,6 +5,7 @@ # art-include: master/Athena # art-athena-mt: 8 # art-output: dcube* +# art-output: hist_physlite_latest.root # art-html: dcube_physlite export ATHENA_CORE_NUMBER=8 @@ -63,8 +64,8 @@ echo "art-result: ${rc4} xAODHistSize" # dcube references echo "============ dcube references" -dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q445_ca/v3/hist_physlite_2314.root" -dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q445_ca/v3/dcube_config_hist_physlite_2314.xml" +dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q445_ca/v5/hist_physlite_2403.root" +dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q445_ca/v4/dcube_config_hist_physlite_2402.xml" echo ${dcubeRef} echo ${dcubeXML} diff --git a/Tools/TrfTestsARTPlots/test/test_trf_q449_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_q449_phys_physlite_ca.sh index f32a9b88f646fa0017aeb652f1c319ff2994d02f..37de1ebbd76e804c22198646ebf17a5339324976 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_q449_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_q449_phys_physlite_ca.sh @@ -6,6 +6,7 @@ # art-athena-mt: 8 # art-output: dcube* # art-output: ecube* +# art-output: hist_physlite_latest.root # art-html: ecube export ATHENA_CORE_NUMBER=8 @@ -60,8 +61,8 @@ echo "art-result: ${rc4} xAODHistSize" # dcube references echo "============ dcube references" -dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q449_ca/v3/hist_physlite_2311.root" -dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q449_ca/v3/dcube_config_hist_physlite_2311.xml" +dcubeRef="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q449_ca/v5/hist_physlite_2403.root" +dcubeXML="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrfTestsART/dcube/q449_ca/v4/dcube_config_hist_physlite_2402.xml" echo ${dcubeRef} echo ${dcubeXML} diff --git a/Tools/WorkflowTestRunner/python/References.py b/Tools/WorkflowTestRunner/python/References.py index f7b857f62797f89ee4766e7653f579331491fda6..496143a3bbe5833d254e1a5738de3581c68ac94a 100644 --- a/Tools/WorkflowTestRunner/python/References.py +++ b/Tools/WorkflowTestRunner/python/References.py @@ -6,7 +6,7 @@ # The top-level directory for the files is /eos/atlas/atlascerngroupdisk/data-art/grid-input/WorkflowReferences/ # Then the subfolders follow the format branch/test/version, i.e. for s3760 in master the reference files are under -# /eos/atlas/atlascerngroupdisk/data-art/grid-input/WorkflowReferences/master/s3760/v1 for v1 version +# /eos/atlas/atlascerngroupdisk/data-art/grid-input/WorkflowReferences/main/s3760/v1 for v1 version # Format is "test" : "version" references_map = { @@ -22,8 +22,8 @@ references_map = { "d1726": "v1", "d1759": "v1", # Reco - "q442": "v2", - "q443": "v1", - "q445": "v1", - "q449": "v1", + "q442": "v4", + "q443": "v3", + "q445": "v3", + "q449": "v3", } diff --git a/Tools/WorkflowTestRunner/python/Test.py b/Tools/WorkflowTestRunner/python/Test.py index 315df45cd476486e97ccb228263dc5a54573766e..5e6a3e7787f6915ce96f737e6f2648cf263e943e 100644 --- a/Tools/WorkflowTestRunner/python/Test.py +++ b/Tools/WorkflowTestRunner/python/Test.py @@ -25,7 +25,7 @@ class TestSetup: self.checks_only = False self.release_reference = "" self.release_validation = "" - self.release_ID = "23.0" # The following is not flexible enough, can probably be hardcoded: environ["AtlasVersion"][0:4] + self.release_ID = "main" # The following is not flexible enough, can probably be hardcoded: environ["AtlasVersion"][0:4] self.parallel_execution = False self.disable_output_checks = False self.custom_threads = None diff --git a/Tracking/Acts/ActsConfig/CMakeLists.txt b/Tracking/Acts/ActsConfig/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3682ca4fe20f5b8bcce10e51d7eb49c4830e41c9 --- /dev/null +++ b/Tracking/Acts/ActsConfig/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( ActsConfig ) + +# Install files from the package: +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + +atlas_add_test( TrackingComponents + SCRIPT test/TrackingComponents.py ) diff --git a/Tracking/Acts/ActsInterop/python/ActsCIFlags.py b/Tracking/Acts/ActsConfig/python/ActsCIFlags.py similarity index 67% rename from Tracking/Acts/ActsInterop/python/ActsCIFlags.py rename to Tracking/Acts/ActsConfig/python/ActsCIFlags.py index 9a3cd44b8b79bbbeda1799aac3c04d364a172acd..e66746b9066fc47258e68dad78d476ed7df816cf 100644 --- a/Tracking/Acts/ActsInterop/python/ActsCIFlags.py +++ b/Tracking/Acts/ActsConfig/python/ActsCIFlags.py @@ -18,10 +18,16 @@ def actsValidateClustersFlags(flags): flags.Reco.EnableHGTDExtension = False flags.Tracking.recoChain = [TrackingComponent.ValidateActsClusters] -def actsValidateSpacePointsFlags(flags): - """flags for Reco_tf with CA used in CI tests: use for validating space point formation with Acts""" +def actsTrkValidateSpacePointsFlags(flags): + """flags for Reco_tf with CA used in CI tests: use for validating Athena-based space point formation""" flags.Reco.EnableHGTDExtension = False flags.Tracking.recoChain = [TrackingComponent.ValidateActsSpacePoints] + +def actsCoreValidateSpacePointsFlags(flags): + """flags for Reco_tf with CA used in CI tests: use for validating ACTS-based space point formation""" + from ActsConfig.ActsConfigFlags import SpacePointStrategy + flags.Acts.SpacePointStrategy = SpacePointStrategy.ActsCore + actsTrkValidateSpacePointsFlags(flags) def actsValidateSeedsFlags(flags): """flags for Reco_tf with CA used in CI tests: use SiSpacePointSeedMaker tool during reconstruction""" @@ -31,19 +37,29 @@ def actsValidateSeedsFlags(flags): def actsValidateOrthogonalSeedsFlags(flags): """flags for Reco_tf with CA used in CI tests: use SiSpacePointSeedMaker tool during reconstruction (orthogonal seeding)""" - from ActsInterop.ActsConfigFlags import SeedingStrategy + from ActsConfig.ActsConfigFlags import SeedingStrategy flags.Acts.SeedingStrategy = SeedingStrategy.Orthogonal actsValidateSeedsFlags(flags) def actsValidateTracksFlags(flags): """flags for Reco_tf with CA used in CI tests: use ActsTrkFinding during reconstruction""" flags.Reco.EnableHGTDExtension = False - flags.Tracking.MainPass.doAmbiguityProcessorTrackFit = False + flags.Tracking.ITkMainPass.doAmbiguityProcessorTrackFit = False flags.Tracking.recoChain = [TrackingComponent.ValidateActsTracks] +def actsValidateGSFFlags(flags): + """flags for Reco_tf with CA used in CI tests: use GaussianSumFitter""" + flags.Reco.EnableHGTDExtension = False + from ActsConfig.ActsConfigFlags import TrackFitterType + flags.Acts.trackFitterType = TrackFitterType.GaussianSumFitter + def actsArtFlags(flags): """flags for Reco_tf with CA used in ART test: add Acts workflow to reco sequence""" flags.Reco.EnableHGTDExtension = False - flags.Acts.doMonitoring = True flags.Tracking.recoChain = [TrackingComponent.AthenaChain, TrackingComponent.ActsChain] + +def actsBenchmarkSpotFlags(flags): + """flags for Reco_tf with CA used for becnkmarking with SPOT""" + flags.Reco.EnableHGTDExtension = False + flags.Tracking.recoChain = [TrackingComponent.BenchmarkSpot] diff --git a/Tracking/Acts/ActsInterop/python/ActsConfigFlags.py b/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py similarity index 50% rename from Tracking/Acts/ActsInterop/python/ActsConfigFlags.py rename to Tracking/Acts/ActsConfig/python/ActsConfigFlags.py index ed74e2b3f4b816ed90d8d924f82bba84de16ed30..716774d62ad20c3ba170208ea1b9712c46536cc5 100644 --- a/Tracking/Acts/ActsInterop/python/ActsConfigFlags.py +++ b/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py @@ -6,11 +6,22 @@ from AthenaConfiguration.Enums import FlagEnum class SeedingStrategy(FlagEnum): Default = "Default" Orthogonal = "Orthogonal" - + +# This is temporary during the integration of ACTS. +class SpacePointStrategy(FlagEnum): + ActsCore = "ActsCore" # ACTS-based SP formation + ActsTrk = "ActsTrk" #SP formation without ACTS + +class TrackFitterType(FlagEnum): + KalmanFitter = 'KalmanFitter' # default ACTS fitter to choose + GaussianSumFitter = 'GaussianSumFitter' # new experimental implementation + def createActsConfigFlags(): actscf = AthConfigFlags() - # General Flags - TO BE ADDED + # General Flags + actscf.addFlag('Acts.EDM.PersistifyClusters', False) + actscf.addFlag('Acts.EDM.PersistifySpacePoints', False) # Geometry Flags @@ -18,13 +29,16 @@ def createActsConfigFlags(): # a path to a local JSON file # 'Default' : material map source is evaluated from the geometry tag # 'None' : no material map is provided - actscf.addFlag('Acts.TrackingGeometry.MaterialSource', 'None') + actscf.addFlag('Acts.TrackingGeometry.MaterialSource', 'Default') actscf.addFlag('Acts.TrackingGeometry.MaterialCalibrationFolder', 'ACTS/MaterialMaps/ITk') # Monitoring actscf.addFlag('Acts.doMonitoring', False) actscf.addFlag('Acts.doAnalysis', False) + # SpacePoint + actscf.addFlag("Acts.SpacePointStrategy", SpacePointStrategy.ActsTrk, enum=SpacePointStrategy) # Define SpacePoint Strategy + # Seeding actscf.addFlag("Acts.SeedingStrategy", SeedingStrategy.Default, enum=SeedingStrategy) # Define Seeding Strategy @@ -32,4 +46,8 @@ def createActsConfigFlags(): actscf.addFlag('Acts.doRotCorrection', True) actscf.addFlag('Acts.doPrintTrackStates', False) + # Track fitting + actscf.addFlag('Acts.writeTrackCollection', False) # save to file (ESD, AOD) the Resolved and Refitted track collections + actscf.addFlag('Acts.trackFitterType', TrackFitterType.KalmanFitter, enum=TrackFitterType) # Define Tracking algorithm for refitting + return actscf diff --git a/Tracking/Acts/ActsConfig/python/ActsPostIncludes.py b/Tracking/Acts/ActsConfig/python/ActsPostIncludes.py new file mode 100644 index 0000000000000000000000000000000000000000..d1295c8754685362c5f407349398baf21073c820 --- /dev/null +++ b/Tracking/Acts/ActsConfig/python/ActsPostIncludes.py @@ -0,0 +1,51 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + +def PersistifyActsEDMCfg(flags) -> ComponentAccumulator: + acc = ComponentAccumulator() + + toAOD = [] + + from ActsConfig.TrackingComponentConfigurer import ( + TrackingComponentConfigurer) + configuration_settings = TrackingComponentConfigurer(flags) + + if flags.Acts.EDM.PersistifyClusters and configuration_settings.producesActsClusters(): + pixel_cluster_shortlist = ['-pixelClusterLink'] + strip_cluster_shortlist = ['-sctClusterLink'] + + pixel_cluster_variables = '.'.join(pixel_cluster_shortlist) + strip_cluster_variables = '.'.join(strip_cluster_shortlist) + + toAOD += ['xAOD::PixelClusterContainer#ITkPixelClusters', + 'xAOD::PixelClusterAuxContainer#ITkPixelClustersAux.' + pixel_cluster_variables, + 'xAOD::StripClusterContainer#ITkStripClusters', + 'xAOD::StripClusterAuxContainer#ITkStripClustersAux.' + strip_cluster_variables] + + if flags.Acts.EDM.PersistifySpacePoints and configuration_settings.producesActsSpacePoints(): + pixel_spacepoint_shortlist = [] + strip_spacepoint_shortlist = ['topHalfStripLength', + 'bottomHalfStripLength', + 'topStripDirection', + 'bottomStripDirection', + 'stripCenterDistance', + 'topStripCenter'] + + pixel_spacepoint_variables = '.'.join(pixel_spacepoint_shortlist) + strip_spacepoint_variables = '.'.join(strip_spacepoint_shortlist) + + toAOD += ['xAOD::SpacePointContainer#ITkPixelSpacePoints', + 'xAOD::SpacePointAuxContainer#ITkPixelSpacePointsAux.' + pixel_spacepoint_variables, + 'xAOD::SpacePointContainer#ITkStripSpacePoints', + 'xAOD::SpacePointAuxContainer#ITkStripSpacePointsAux.' + strip_spacepoint_variables, + 'xAOD::SpacePointContainer#ITkStripOverlapSpacePoints', + 'xAOD::SpacePointAuxContainer#ITkStripOverlapSpacePointsAux.' + strip_spacepoint_variables] + + # If there is nothing to persistify, returns an empty CA + if len(toAOD) == 0: + return acc + + from OutputStreamAthenaPool.OutputStreamConfig import addToAOD + acc.merge(addToAOD(flags, toAOD)) + return acc diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/python/ActsTrkAnalysisConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkAnalysisConfig.py similarity index 65% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/python/ActsTrkAnalysisConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkAnalysisConfig.py index dab6dafd5f2dccc80a8375c96c78ba4becbf386c..6df421824d801b8bc36d8f85d2f088af9c553a95 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/python/ActsTrkAnalysisConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkAnalysisConfig.py @@ -19,9 +19,9 @@ def ActsTrkPixelClusterAnalysisAlgCfg(flags, name="ActsTrkPixelClusterAnalysisAl monitoringGroup.defineHistogram('eta;h_etaCluster', title="h_etaCluster; cluster #eta", type="TH1F", path="PixelClusters", xbins=100, xmin=-5, xmax=5) - monitoringGroup.defineTree('barrelEndcap,layerDisk,phiModule,etaModule,isInnermost,isNextToInnermost,eta,globalX,globalY,globalZ,perp,localX,localY,localCovXX,localCovYY,sizeX,sizeY;PixelClusters', + monitoringGroup.defineTree('barrelEndcap,layerDisk,phiModule,etaModule,isInnermost,isNextToInnermost,eta,globalX,globalY,globalZ,perp,localX,localY,localCovXX,localCovYY,sizeX,sizeY,widthY;PixelClusters', path='ntuples', - treedef='barrelEndcap/vector<int>:layerDisk/vector<int>:phiModule/vector<int>:etaModule/vector<int>:isInnermost/vector<int>:isNextToInnermost/vector<int>:eta/vector<double>:globalX/vector<float>:globalY/vector<float>:globalZ/vector<float>:perp/vector<float>:localX/vector<float>:localY/vector<float>:localCovXX/vector<float>:localCovYY/vector<float>:sizeX/vector<int>:sizeY/vector<int>') + treedef='barrelEndcap/vector<int>:layerDisk/vector<int>:phiModule/vector<int>:etaModule/vector<int>:isInnermost/vector<int>:isNextToInnermost/vector<int>:eta/vector<double>:globalX/vector<float>:globalY/vector<float>:globalZ/vector<float>:perp/vector<float>:localX/vector<float>:localY/vector<float>:localCovXX/vector<float>:localCovYY/vector<float>:sizeX/vector<int>:sizeY/vector<int>:widthY/vector<float>') result.merge(helper.result()) return result @@ -43,9 +43,9 @@ def ActsTrkStripClusterAnalysisAlgCfg(flags, name="ActsTrkStripClusterAnalysisAl monitoringGroup.defineHistogram('eta;h_etaCluster', title="h_etaCluster; cluster #eta", type="TH1F", path="StripClusters", xbins=100, xmin=-5, xmax=5) - monitoringGroup.defineTree('barrelEndcap,layerDisk,phiModule,etaModule,sideModule,eta,globalX,globalY,globalZ,perp,localX,localCovXX,sizeX,hitsInThirdTimeBin;StripClusters', + monitoringGroup.defineTree('barrelEndcap,layerDisk,phiModule,etaModule,sideModule,eta,globalX,globalY,globalZ,perp,localX,localCovXX,sizeX;StripClusters', path='ntuples', - treedef='barrelEndcap/vector<int>:layerDisk/vector<int>:phiModule/vector<int>:etaModule/vector<int>:sideModule/vector<int>:eta/vector<double>:globalX/vector<float>:globalY/vector<float>:globalZ/vector<float>:perp/vector<float>:localX/vector<float>:localCovXX/vector<float>:sizeX/vector<int>:hitsInThirdTimeBin/vector<int>') + treedef='barrelEndcap/vector<int>:layerDisk/vector<int>:phiModule/vector<int>:etaModule/vector<int>:sideModule/vector<int>:eta/vector<double>:globalX/vector<float>:globalY/vector<float>:globalZ/vector<float>:perp/vector<float>:localX/vector<float>:localCovXX/vector<float>:sizeX/vector<int>') result.merge(helper.result()) return result @@ -153,30 +153,28 @@ def ActsTrkBaseSeedAnalysisAlgCfg(flags, kwargs.setdefault('InputSeedCollection', 'ITkPixelSeeds') - from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometryToolCfg + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg geoTool = acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) acc.addPublicTool(geoTool) # ATLAS Converter Tool - from ActsTrkEventCnv.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg + from ActsConfig.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg converterTool = acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) # Track Param Estimation Tool - from ActsTrkTrackParamsEstimationTool.ActsTrkTrackParamsEstimationToolConfig import TrackParamsEstimationToolCfg + from ActsConfig.ActsTrkTrackParamsEstimationConfig import TrackParamsEstimationToolCfg trackEstimationTool = acc.popToolsAndMerge(TrackParamsEstimationToolCfg(flags)) kwargs.setdefault('TrackingGeometryTool', acc.getPublicTool(geoTool.name)) # PublicToolHandle kwargs.setdefault('ATLASConverterTool', converterTool) kwargs.setdefault('TrackParamsEstimationTool', trackEstimationTool) - + monitoringAlgorithm = helper.addAlgorithm(CompFactory.ActsTrk.SeedAnalysisAlg, name, **kwargs) monitoringGroup = helper.addGroup(monitoringAlgorithm, 'ActsTrkSeedAnalysisAlg', 'ActsTrkAnalysis') monitoringGroup.defineHistogram('Nseed', title='Number of Seeds;N;Entries', type='TH1I', path=f'{histoPath}', xbins=100, xmin=0, xmax=0) - - monitoringGroup.defineHistogram('z1,r1;zr1', title='Bottom SP - Z coordinate vs R;z [mm];r [mm]', type='TH2F', path=f'{histoPath}', xbins=1500, xmin=-3000, xmax=3000, ybins=400, ymin=perp_min, ymax=perp_max) @@ -187,6 +185,64 @@ def ActsTrkBaseSeedAnalysisAlgCfg(flags, xbins=1500, xmin=-3000, xmax=3000, ybins=400, ymin=perp_min, ymax=perp_max) + monitoringGroup.defineHistogram('x1;x1', title='Bottom SP - x coordinate;x [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-perp_max, xmax=perp_max) + monitoringGroup.defineHistogram('y1;y1', title='Bottom SP - y coordinate;y [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-perp_max, xmax=perp_max) + monitoringGroup.defineHistogram('z1;z1', title='Bottom SP - z coordinate;z [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-3000, xmax=3000) + monitoringGroup.defineHistogram('r1;r1', title='Bottom SP - radius coordinate;r [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=perp_min, xmax=perp_max) + + monitoringGroup.defineHistogram('x2;x2', title='Middle SP - x coordinate;x [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-perp_max, xmax=perp_max) + monitoringGroup.defineHistogram('y2;y2', title='Middle SP - y coordinate;y [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-perp_max, xmax=perp_max) + monitoringGroup.defineHistogram('z2;z2', title='Middle SP - z coordinate;z [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-3000, xmax=3000) + monitoringGroup.defineHistogram('r2;r2', title='Middle SP - radius coordinate;r [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=perp_min, xmax=perp_max) + + monitoringGroup.defineHistogram('x3;x3', title='Top SP - x coordinate;x [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-perp_max, xmax=perp_max) + monitoringGroup.defineHistogram('y3;y3', title='Top SP - y coordinate;y [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-perp_max, xmax=perp_max) + monitoringGroup.defineHistogram('z3;z3', title='Top SP - z coordinate;z [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=-3000, xmax=3000) + monitoringGroup.defineHistogram('r3;r3', title='Top SP - radius coordinate;r [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=perp_min, xmax=perp_max) + + if ntupleName == 'PixelSeeds': + monitoringGroup.defineHistogram('pt;pT', title='Pt;Pt;Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=0, xmax=100) + monitoringGroup.defineHistogram('d0;d0', title='d0;d0 [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=2) + monitoringGroup.defineHistogram('eta;Eta', title='Pseudo-Rapidity;Pseudo-Rapidity;Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=4.5) + monitoringGroup.defineHistogram('theta;Theta', title='Theta;Theta;Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=1.6) + monitoringGroup.defineHistogram('penalty;Penalty', title='Penalty;Penalty;Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=200) + monitoringGroup.defineHistogram('dzdr_b;dzdr_b', title='dzdr_b;;;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=-30, xmax=30) + monitoringGroup.defineHistogram('dzdr_t;dzdr_t', title='dzdr_t;;;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=-30, xmax=30) + elif ntupleName == 'StripSeeds': + monitoringGroup.defineHistogram('pt;pT', title='Pt;Pt;Entries;', type='TH1F', path=f'{histoPath}', + xbins=100, xmin=0, xmax=2300) + monitoringGroup.defineHistogram('d0;d0', title='d0;d0 [mm];Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=120) + monitoringGroup.defineHistogram('eta;Eta', title='Pseudo-Rapidity;Pseudo-Rapidity;Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=4.5) + monitoringGroup.defineHistogram('theta;Theta', title='Theta;Theta;Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=1.6) + monitoringGroup.defineHistogram('penalty;Penalty', title='Penalty;Penalty;Entries;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=0, xmax=20000) + monitoringGroup.defineHistogram('dzdr_b;dzdr_b', title='dzdr_b;;;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=-6.5, xmax=6.5) + monitoringGroup.defineHistogram('dzdr_t;dzdr_t', title='dzdr_t;;;', type='TH1F', path=f'{histoPath}', + xbins=50, xmin=-6.5, xmax=6.5) + if flags.Tracking.doTruth: monitoringGroup.defineHistogram('passed,estimated_eta;EfficiencyEta', title='Efficiency vs eta;eta;Efficiency', type='TEfficiency', path=f'{histoPath}', xbins=50, xmin=-5, xmax=5) @@ -251,6 +307,54 @@ def ActsTrkBaseEstimatedTrackParamsAnalysisAlgCfg(flags, return helper.result() +def ActsTrkSeedingAlgorithmAnalysisAlgCfg(flags, name="ActsTrkSeedingAlgorithmAnalysis", **kwargs): + result = ComponentAccumulator() + + MonitoringGroupNames = [] + + if "SeedingTools" not in kwargs: + from InDetConfig.SiSpacePointsSeedToolConfig import ITkSiSpacePointsSeedMakerCfg + ITkSiSpacePointsSeedMaker = result.popToolsAndMerge(ITkSiSpacePointsSeedMakerCfg(flags)) + ITkSiSpacePointsSeedMaker.maxSize = 1e8 + MonitoringGroupNames.append("ITkSiSpacePointSeedMaker") + + from ActsConfig.ActsTrkSeedingConfig import ActsTrkSiSpacePointsSeedMakerCfg + ActsITkSiSpacePointsSeedMaker = result.popToolsAndMerge(ActsTrkSiSpacePointsSeedMakerCfg(flags)) + ActsITkSiSpacePointsSeedMaker.doSpacePointConversion = False + ActsITkSiSpacePointsSeedMaker.doSeedConversion = False + MonitoringGroupNames.append("ActsITkSiSpacePointSeedMaker") + + from ActsConfig.ActsTrkSeedingConfig import ActsTrkITkPixelOrthogonalSeedingToolCfg + orthogonal_seeding_tool = result.popToolsAndMerge(ActsTrkITkPixelOrthogonalSeedingToolCfg(flags)) + ActsITkSiSpacePointsSeedMakerOrthogonal = \ + result.popToolsAndMerge(ActsTrkSiSpacePointsSeedMakerCfg(flags, + name="ActsTrkSiSpacePointsSeedMakerOrthogonal", + SeedToolPixel=orthogonal_seeding_tool)) + ActsITkSiSpacePointsSeedMakerOrthogonal.doSpacePointConversion = False + ActsITkSiSpacePointsSeedMakerOrthogonal.doSeedConversion = False + MonitoringGroupNames.append("ActsOrthogonalITkSiSpacePointSeedMaker") + + from GaudiKernel.GaudiHandles import PrivateToolHandleArray + kwargs.setdefault("SeedingTools", + PrivateToolHandleArray([ITkSiSpacePointsSeedMaker, + ActsITkSiSpacePointsSeedMaker, + ActsITkSiSpacePointsSeedMakerOrthogonal])) + + kwargs.setdefault("MonitorNames", MonitoringGroupNames) + + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(flags, 'SeedingAlgorithmAnalysisAlgCfg') + monitoringAlgorithm = helper.addAlgorithm(CompFactory.ActsTrk.SeedingAlgorithmAnalysisAlg, name, **kwargs) + + for groupName in MonitoringGroupNames: + monitoringGroup = helper.addGroup(monitoringAlgorithm, groupName, '/'+groupName+'/') + monitoringGroup.defineTree('eventNumber,stripSeedInitialisationTime,stripSeedProductionTime,pixelSeedInitialisationTime,pixelSeedProductionTime,numberPixelSpacePoints,numberStripSpacePoints,numberPixelSeeds,numberStripSeeds;seedInformation', + path='ntuples', + treedef='eventNumber/I:stripSeedInitialisationTime/F:stripSeedProductionTime/F:pixelSeedInitialisationTime/F:pixelSeedProductionTime/F:numberPixelSpacePoints/I:numberStripSpacePoints/I:numberPixelSeeds/I:numberStripSeeds/I') + + result.merge(helper.result()) + return result + def ActsTrkPixelEstimatedTrackParamsAnalysisAlgCfg(flags, name = 'ActsTrkPixelEstimatedTrackParamsAnalysisAlg', **kwargs): kwargs.setdefault('InputTrackParamsCollection', 'ITkPixelEstimatedTrackParams') @@ -261,7 +365,12 @@ def ActsTrkStripEstimatedTrackParamsAnalysisAlgCfg(flags, name = 'ActsTrkStripEs kwargs.setdefault('InputTrackParamsCollection', 'ITkStripEstimatedTrackParams') return ActsTrkBaseEstimatedTrackParamsAnalysisAlgCfg(flags, name, histoPath = 'StripEstimatedTrackParams', ntupleName = 'StripEstimatedTrackParams', **kwargs) - +def PhysValActsCfg(flags, + name: str = 'PhysValActs') -> ComponentAccumulator: + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ActsTrk.PhysValTool(name=name)) + return acc + def ActsTrkClusterAnalysisCfg(flags): acc = ComponentAccumulator() if flags.Detector.EnableITkPixel: diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/python/ActsTrkClusterizationConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkClusterizationConfig.py similarity index 51% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/python/ActsTrkClusterizationConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkClusterizationConfig.py index 77f59e900eb8e046fbe1258de278df2b8d400eba..a7271b6595cc04046cc1e0b2632d80413cf59c37 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/python/ActsTrkClusterizationConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkClusterizationConfig.py @@ -1,9 +1,35 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -from ActsTrkClusterizationTools.ActsTrkClusterizationToolsConfig import ActsTrkITkPixelClusteringToolCfg, ActsTrkITkStripClusteringToolCfg from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from SCT_ConditionsTools.ITkStripConditionsToolsConfig import ITkStripConditionsSummaryToolCfg +from InDetConfig.SiClusterizationToolConfig import ITkClusterMakerToolCfg, ITkPixelRDOToolCfg +from SiLorentzAngleTool.ITkStripLorentzAngleConfig import ITkStripLorentzAngleToolCfg + +def ActsTrkITkPixelClusteringToolCfg(flags, name="ActsITkPixelClusteringTool", **kwargs): + acc = ComponentAccumulator() + kwargs.setdefault("PixelRDOTool", acc.popToolsAndMerge(ITkPixelRDOToolCfg(flags))) + kwargs.setdefault("ClusterMakerTool", acc.popToolsAndMerge(ITkClusterMakerToolCfg(flags))) + kwargs.setdefault("AddCorners", True) + kwargs.setdefault("ErrorStrategy", 1) + kwargs.setdefault("PixelChargeCalibCondData", "ITkPixelChargeCalibCondData") + kwargs.setdefault("PixelOfflineCalibData", "") + acc.setPrivateTools(CompFactory.ActsTrk.PixelClusteringTool(name, **kwargs)) + return acc + + +def ActsTrkITkStripClusteringToolCfg(flags, name="ActsITkStripClusteringTool", **kwargs): + acc = ComponentAccumulator() + kwargs.setdefault("StripConditionsTool", acc.popToolsAndMerge(ITkStripConditionsSummaryToolCfg(flags))) + kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge(ITkStripLorentzAngleToolCfg(flags))) + + if flags.ITk.selectStripIntimeHits: + from AthenaConfiguration.Enums import BeamType + coll_25ns = flags.Beam.BunchSpacing<=25 and flags.Beam.Type is BeamType.Collisions + kwargs.setdefault("timeBins", "01X" if coll_25ns else "X1X") + + acc.setPrivateTools(CompFactory.ActsTrk.StripClusteringTool(name, **kwargs)) + return acc def ActsTrkITkPixelClusterizationAlgCfg(flags, name='ActsTrkITkPixelClusterizationAlg', **kwargs): acc = ComponentAccumulator() @@ -12,14 +38,13 @@ def ActsTrkITkPixelClusterizationAlgCfg(flags, name='ActsTrkITkPixelClusterizati kwargs.setdefault("PixelClusteringTool", acc.popToolsAndMerge(ActsTrkITkPixelClusteringToolCfg(flags))) if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkITkPixelClusterizationMonitoringToolCfg + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkITkPixelClusterizationMonitoringToolCfg kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkITkPixelClusterizationMonitoringToolCfg(flags))) acc.addEventAlgo(CompFactory.ActsTrk.PixelClusterizationAlg(name, **kwargs)) return acc - -def ActsTrkITkStripClusterizationAlgCfg(flags, name='ActsTrkItkStripClusterizationAlg', **kwargs): +def ActsTrkITkStripClusterizationAlgCfg(flags, name='ActsTrkITkStripClusterizationAlg', **kwargs): acc = ComponentAccumulator() kwargs.setdefault("StripRDOContainerKey", "ITkStripRDOs") kwargs.setdefault("StripClustersKey", "ITkStripClusters") @@ -29,7 +54,7 @@ def ActsTrkITkStripClusterizationAlgCfg(flags, name='ActsTrkItkStripClusterizati kwargs.setdefault("checkBadModules", True) if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkITkStripClusterizationMonitoringToolCfg + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkITkStripClusterizationMonitoringToolCfg kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkITkStripClusterizationMonitoringToolCfg(flags))) acc.addEventAlgo(CompFactory.ActsTrk.StripClusterizationAlg(name, **kwargs)) @@ -43,7 +68,7 @@ def ActsTrkClusterizationCfg(flags): acc.merge(ActsTrkITkStripClusterizationAlgCfg(flags)) if flags.Acts.doAnalysis: - from ActsTrkAnalysis.ActsTrkAnalysisConfig import ActsTrkClusterAnalysisCfg + from ActsConfig.ActsTrkAnalysisConfig import ActsTrkClusterAnalysisCfg acc.merge(ActsTrkClusterAnalysisCfg(flags)) return acc diff --git a/Tracking/Acts/ActsTrkEventCnv/python/ActsTrkEventCnvConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkEventCnvConfig.py similarity index 55% rename from Tracking/Acts/ActsTrkEventCnv/python/ActsTrkEventCnvConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkEventCnvConfig.py index 6cba6c07ea68a49ca545014d3428de41227115c0..7f06e8a525b508b7664ce6979a695fe7483d04aa 100644 --- a/Tracking/Acts/ActsTrkEventCnv/python/ActsTrkEventCnvConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkEventCnvConfig.py @@ -1,25 +1,27 @@ # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory + def ActsToTrkConverterToolCfg(flags, name="ActsToTrkConverterTool", **kwargs): - from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometryToolCfg + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg result = ComponentAccumulator() - kwargs.setdefault("TrackingGeometryTool", result.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags))) # PrivateToolHandle - result.setPrivateTools(CompFactory.ActsTrk.ActsToTrkConverterTool(name, **kwargs) ) + kwargs.setdefault("TrackingGeometryTool", result.popToolsAndMerge( + ActsTrackingGeometryToolCfg(flags))) # PrivateToolHandle + result.setPrivateTools( + CompFactory.ActsTrk.ActsToTrkConverterTool(name, **kwargs)) return result + def TrkToActsConvertorAlgCfg(flags, name="", **kwargs): result = ComponentAccumulator() - kwargs.setdefault("ConvertorTool", result.popToolsAndMerge(ActsToTrkConverterToolCfg(flags))) # PrivateToolHandle + kwargs.setdefault("ConvertorTool", result.popToolsAndMerge( + ActsToTrkConverterToolCfg(flags))) # PrivateToolHandle result.addEventAlgo( - CompFactory.ActsTrk.TrkToActsConvertorAlg(name, **kwargs) ) + CompFactory.ActsTrk.TrkToActsConvertorAlg(name, **kwargs)) return result -if __name__ == "__main__": -# To run this, do e.g. - # python -m ActsTrkEventCnv.ActsTrkEventCnvConfig --threads=1 - +def RunConversion(): from AthenaConfiguration.AllConfigFlags import initConfigFlags from TrkConfig.TrackCollectionReadConfig import TrackCollectionReadCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg @@ -29,9 +31,9 @@ if __name__ == "__main__": flags.Input.Files = [ '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/ESD/ATLAS-P2-RUN4-01-01-00/ESD.ttbar_mu0.pool.root'] flags.IOVDb.GlobalTag = "OFLCOND-MC15c-SDR-14-05" - flags.Scheduler.ShowDataDeps=True - flags.Scheduler.ShowDataFlow=True - flags.Scheduler.CheckDependencies=True + flags.Scheduler.ShowDataDeps = True + flags.Scheduler.ShowDataFlow = True + flags.Scheduler.CheckDependencies = True flags.lock() flags.dump() @@ -39,8 +41,8 @@ if __name__ == "__main__": from AthenaConfiguration.MainServicesConfig import MainServicesCfg cfg = MainServicesCfg(flags) else: - cfg=ComponentAccumulator() - + cfg = ComponentAccumulator() + # Set up to read ESD and tracks track_collections = ['CombinedITkTracks'] cfg.merge(PoolReadCfg(flags)) @@ -51,15 +53,38 @@ if __name__ == "__main__": from TrkEventCnvTools.TrkEventCnvToolsConfigCA import TrkEventCnvSuperToolCfg cfg.merge(TrkEventCnvSuperToolCfg(flags)) - # Muon geometry not yet in ActsTrackingGeometrySvcCfg from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg cfg.merge(MuonGeoModelCfg(flags)) # Now setup the convertor - acc = TrkToActsConvertorAlgCfg(flags, OutputLevel=1, TrackCollectionKeys=track_collections) + acc = TrkToActsConvertorAlgCfg( + flags, OutputLevel=1, TrackCollectionKeys=track_collections) cfg.merge(acc) + # Let's dump the input tracks, and also the output ACTS tracks + from DumpEventDataToJSON.DumpEventDataToJSONConfig import DumpEventDataToJSONAlgCfg + acc = DumpEventDataToJSONAlgCfg( + flags, doExtrap=False, OutputLevel=1, + TrackCollectionKeys=track_collections, + CscPrepRawDataKey="", + MMPrepRawDataKey="", + sTgcPrepRawDataKey="", + MdtPrepRawDataKey="", + RpcPrepRawDataKey="", + TgcPrepRawDataKey="", + PixelPrepRawDataKey="", + SctPrepRawDataKey="", + TrtPrepRawDataKey="", + CaloCellContainerKey=[""], + CaloClusterContainerKeys=[""], + MuonContainerKeys=[""], + JetContainerKeys=[""], + TrackParticleContainerKeys=[""], + OutputLocation="dump.json", + ) + print(acc.getEventAlgo('DumpEventDataToJsonAlg')) + cfg.merge(acc) cfg.printConfig(withDetails=True, summariseProps=True) if not args.config_only: @@ -67,3 +92,9 @@ if __name__ == "__main__": if not sc.isSuccess(): import sys sys.exit("Execution failed") + + +if __name__ == "__main__": + # To run this, do e.g. + # python -m ActsTrkEventCnv.ActsTrkEventCnvConfig --threads=1 + RunConversion() diff --git a/Tracking/Acts/ActsConfig/python/ActsTrkFindingConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkFindingConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..7fa96cd7e77803430ac3d0e1ac0c386e9aa07a66 --- /dev/null +++ b/Tracking/Acts/ActsConfig/python/ActsTrkFindingConfig.py @@ -0,0 +1,112 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +# Tools +def ActsTrkFindingToolCfg( + flags, name: str = "ActsTrackFindingTool", **kwargs +) -> ComponentAccumulator: + acc = ComponentAccumulator() + + kwargs.setdefault("maxPropagationStep", 10000) + kwargs.setdefault("etaBins", []) + kwargs.setdefault("chi2CutOff", [15.0]) + kwargs.setdefault("numMeasurementsCutOff", [10]) + + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg, ActsTrackingGeometryToolCfg + kwargs.setdefault( + "TrackingGeometryTool", + acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)), + ) # PrivateToolHandle + kwargs.setdefault( + "ExtrapolationTool", + acc.popToolsAndMerge(ActsExtrapolationToolCfg(flags, MaxSteps=10000)), + ) # PrivateToolHandle + from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg + kwargs.setdefault( + "SummaryTool", acc.popToolsAndMerge(InDetTrackSummaryToolCfg(flags)) + ) # PrivateToolHandle + from ActsConfig.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg + kwargs.setdefault( + "ATLASConverterTool", + acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)), + ) + + if flags.Detector.GeometryITk: + from InDetConfig.InDetBoundaryCheckToolConfig import ITkBoundaryCheckToolCfg + + BoundaryCheckToolCfg = ITkBoundaryCheckToolCfg + else: + from InDetConfig.InDetBoundaryCheckToolConfig import InDetBoundaryCheckToolCfg + + BoundaryCheckToolCfg = InDetBoundaryCheckToolCfg + + kwargs.setdefault( + "BoundaryCheckTool", + acc.popToolsAndMerge(BoundaryCheckToolCfg(flags)), + ) + + if flags.Acts.doRotCorrection: + if flags.Detector.GeometryITk: + from TrkConfig.TrkRIO_OnTrackCreatorConfig import ITkRotCreatorCfg + + RotCreatorCfg = ITkRotCreatorCfg + else: + from TrkConfig.TrkRIO_OnTrackCreatorConfig import InDetRotCreatorCfg + + RotCreatorCfg = InDetRotCreatorCfg + + kwargs.setdefault( + "RotCreatorTool", + acc.popToolsAndMerge(RotCreatorCfg(flags, name="ActsRotCreatorTool")), + ) + + if flags.Acts.doPrintTrackStates: + kwargs.setdefault( + "TrackStatePrinter", + acc.popToolsAndMerge(ActsTrackStatePrinterCfg(flags)), + ) + + acc.setPrivateTools(CompFactory.ActsTrk.TrackFindingTool(name, **kwargs)) + return acc + +def ActsTrackStatePrinterCfg( + flags, name: str = "TrackStatePrinter", **kwargs +) -> ComponentAccumulator: + acc = ComponentAccumulator() + + kwargs.setdefault( + "InputSpacePoints", + [ + "ITkPixelSpacePoints", + "ITkStripSpacePoints", + "ITkStripOverlapSpacePoints", + ], + ) + kwargs.setdefault("spacePointType", [0, 1, 1]) + + acc.setPrivateTools(CompFactory.ActsTrk.TrackStatePrinter(name, **kwargs)) + return acc + +# ACTS only algorithm +def ActsTrkFindingCfg(flags, name: str = "ActsTrkFindingAlg", **kwargs): + acc = ComponentAccumulator() + + # tools + if "TrackFindingTool" not in kwargs: + kwargs["TrackFindingTool"] = acc.popToolsAndMerge(ActsTrkFindingToolCfg(flags)) + + kwargs.setdefault("PixelClusterContainerKey", "ITkPixelClusters") + kwargs.setdefault("StripClusterContainerKey", "ITkStripClusters") + kwargs.setdefault("PixelDetectorElements", "ITkPixelDetectorElementCollection") + kwargs.setdefault("StripDetectorElements", "ITkStripDetectorElementCollection") + kwargs.setdefault("InputEstimatedTrackParameters", "ITkPixelEstimatedTrackParams") + kwargs.setdefault("TracksLocation", "SiSPSeededActsTracks") + + if flags.Acts.doMonitoring: + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkFindingMonitoringCfg + kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkFindingMonitoringCfg(flags))) + + acc.addEventAlgo(CompFactory.ActsTrk.TrackFindingAlg(name, **kwargs)) + return acc diff --git a/Tracking/Acts/ActsConfig/python/ActsTrkFittingConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkFittingConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..5d8488b1af731f4be0cf178325185dcf12960b34 --- /dev/null +++ b/Tracking/Acts/ActsConfig/python/ActsTrkFittingConfig.py @@ -0,0 +1,124 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from ActsConfig.ActsConfigFlags import TrackFitterType +from ActsInterop import UnitConstants + +def ActsFitterCfg(flags, name: str = "ActsKalmanFitter", **kwargs): + result = ComponentAccumulator() + + # Make sure this is set correctly! + # /eos/project-a/acts/public/MaterialMaps/ATLAS/material-maps-Pixel-SCT.json + + if "TrackingGeometryTool" not in kwargs: + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg + kwargs["TrackingGeometryTool"] = result.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) # PrivateToolHandle + + if "ExtrapolationTool" not in kwargs: + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg + kwargs["ExtrapolationTool"] = result.popToolsAndMerge( + ActsExtrapolationToolCfg(flags, MaxSteps=10000) + ) # PrivateToolHandle + + if flags.Acts.trackFitterType is TrackFitterType.KalmanFitter: + kwargs.setdefault("ReverseFilteringPt", 1.0 * UnitConstants.GeV) + kwargs.setdefault("OverstepLimit", 300 * UnitConstants.um) + + from ActsConfig.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg + actsConverter = result.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) + kwargs["ATLASConverterTool"] = actsConverter + + if "SummaryTool" not in kwargs: + from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg + summary = result.getPrimaryAndMerge( + InDetTrackSummaryToolCfg(flags, + # doHolesInDet=False + ) + ) + kwargs["SummaryTool"] = summary + + if flags.Detector.GeometryITk: + from InDetConfig.InDetBoundaryCheckToolConfig import ITkBoundaryCheckToolCfg + + kwargs.setdefault( + "BoundaryCheckTool", result.popToolsAndMerge(ITkBoundaryCheckToolCfg(flags)) + ) + else: + from InDetConfig.InDetBoundaryCheckToolConfig import InDetBoundaryCheckToolCfg + + kwargs.setdefault( + "BoundaryCheckTool", + result.popToolsAndMerge(InDetBoundaryCheckToolCfg(flags)), + ) + + if flags.Acts.trackFitterType is TrackFitterType.KalmanFitter: # This flag is by default set to KalmanFitter + result.setPrivateTools(CompFactory.ActsTrk.ActsKalmanFitter(name, **kwargs)) + elif flags.Acts.trackFitterType is TrackFitterType.GaussianSumFitter: + name = name.replace("KalmanFitter", "GaussianSumFitter") + result.setPrivateTools(CompFactory.ActsTrk.ActsGaussianSumFitter(name, **kwargs)) + + return result + + + +def ActsReFitterAlgCfg(flags, name="ActsReFitterAlg", **kwargs): + result = ComponentAccumulator() + + actsFitter = result.popToolsAndMerge(ActsFitterCfg(flags)) + + kwargs.setdefault("ActsFitter", actsFitter) + kwargs.setdefault("TrackName", "ResolvedTracks") + + result.addEventAlgo( + CompFactory.ActsReFitterAlg( + name=name, + **kwargs, + ) + ) + + if flags.Acts.writeTrackCollection: + result.merge(writeAdditionalTracks(flags)) + + return result + + + +def writeAdditionalTracks(flags, trackName='ResolvedTracks', newTrackName='ReFitted_Tracks'): + result = ComponentAccumulator() + + from xAODTrackingCnv.xAODTrackingCnvConfig import ITkTrackParticleCnvAlgCfg + + if flags.Tracking.doTruth: + from InDetConfig.ITkTrackTruthConfig import ITkTrackTruthCfg + result.merge(ITkTrackTruthCfg(flags, + Tracks = trackName, + DetailedTruth = f"{trackName}DetailedTruth", + TracksTruth = f"{trackName}TruthCollection")) + result.merge(ITkTrackTruthCfg(flags, + Tracks = newTrackName, + DetailedTruth = f"{newTrackName}DetailedTruth", + TracksTruth = f"{newTrackName}TruthCollection")) + + result.merge(ITkTrackParticleCnvAlgCfg(flags, + name = f"{trackName}TrackParticleCnvAlg", + TrackContainerName = trackName, + xAODTrackParticlesFromTracksContainerName = f"{trackName}TrackParticles", + TrackTruthContainerName = f"{trackName}TruthCollection")) + result.merge(ITkTrackParticleCnvAlgCfg(flags, + name = f"{newTrackName}TrackParticleCnvAlg", + TrackContainerName = newTrackName, + xAODTrackParticlesFromTracksContainerName = f"{newTrackName}TrackParticles", + TrackTruthContainerName = f"{newTrackName}TruthCollection")) + + from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD + itemList = [f"xAOD::TrackParticleContainer#{trackName}TrackParticles", + f"xAOD::TrackParticleAuxContainer#{trackName}TrackParticlesAux.", + f"xAOD::TrackParticleContainer#{newTrackName}TrackParticles", + f"xAOD::TrackParticleAuxContainer#{newTrackName}TrackParticlesAux."] + + result.merge(addToESD(flags, itemList)) + result.merge(addToAOD(flags, itemList)) + + return result + diff --git a/Tracking/Acts/ActsGeantFollowing/python/ActsGeantFollowingConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkGeantFollowingConfig.py similarity index 100% rename from Tracking/Acts/ActsGeantFollowing/python/ActsGeantFollowingConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkGeantFollowingConfig.py diff --git a/Tracking/Acts/ActsGeometry/python/ActsGeometryConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkGeometryConfig.py similarity index 80% rename from Tracking/Acts/ActsGeometry/python/ActsGeometryConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkGeometryConfig.py index 50443e9249145930e6b460d24db79b1325845b29..05eeadcb14f07e9deadea9ba7bf4251975c11c03 100644 --- a/Tracking/Acts/ActsGeometry/python/ActsGeometryConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkGeometryConfig.py @@ -6,6 +6,10 @@ from AthenaConfiguration.ComponentFactory import CompFactory def ActsTrackingGeometrySvcCfg(flags, name = "ActsTrackingGeometrySvc", **kwargs) : result = ComponentAccumulator() + from ROOT.ActsTrk import DetectorType + kwargs.setdefault("NotAlignDetectors", [DetectorType.Trt, + DetectorType.Hgtd]) + subDetectors = [] if flags.Detector.GeometryBpipe: from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg @@ -66,15 +70,19 @@ def ActsTrackingGeometrySvcCfg(flags, name = "ActsTrackingGeometrySvc", **kwargs **kwargs) if flags.Detector.GeometryITk: if flags.Acts.TrackingGeometry.MaterialSource == "Default": + extension = "ITk" + if flags.Detector.GeometryHGTD: + extension += "-HGTD" actsTrackingGeometrySvc.UseMaterialMap = True actsTrackingGeometrySvc.MaterialMapCalibFolder = flags.Acts.TrackingGeometry.MaterialCalibrationFolder - actsTrackingGeometrySvc.MaterialMapInputFile = "material-maps-" + flags.GeoModel.AtlasVersion +".json" + actsTrackingGeometrySvc.MaterialMapInputFile = \ + "material-maps-" + flags.GeoModel.AtlasVersion + "-" + extension + ".json" elif flags.Acts.TrackingGeometry.MaterialSource.find(".json") != -1: actsTrackingGeometrySvc.UseMaterialMap = True actsTrackingGeometrySvc.MaterialMapCalibFolder = flags.Acts.TrackingGeometry.MaterialCalibrationFolder actsTrackingGeometrySvc.MaterialMapInputFile = flags.Acts.TrackingGeometry.MaterialSource - result.addService(actsTrackingGeometrySvc) + result.addService(actsTrackingGeometrySvc, primary = True) return result @@ -93,31 +101,45 @@ def ActsTrackingGeometryToolCfg(flags, name = "ActsTrackingGeometryTool" ) : result.setPrivateTools(CompFactory.ActsTrackingGeometryTool(name)) return result - -def NominalAlignmentCondAlgCfg(flags, name = "NominalAlignmentCondAlg", **kwargs) : +def ActsDetAlignCondAlgCfg(flags, name="ActsDetAlignmentCondAlg", **kwargs): result = ComponentAccumulator() - result.merge(ActsTrackingGeometrySvcCfg(flags)) - result.addCondAlgo(CompFactory.NominalAlignmentCondAlg(name, **kwargs)) + kwargs.setdefault("TrackingGeometrySvc", result.getPrimaryAndMerge(ActsTrackingGeometrySvcCfg(flags))) + the_alg = CompFactory.ActsDetAlignCondAlg(name, **kwargs) + result.addCondAlgo(the_alg, primary = True) return result - - def ActsAlignmentCondAlgCfg(flags, name = "ActsAlignmentCondAlg", **kwargs) : result = ComponentAccumulator() - + from ROOT.ActsTrk import DetectorType if flags.Detector.GeometryITk: from PixelConditionsAlgorithms.ITkPixelConditionsConfig import ITkPixelAlignCondAlgCfg result.merge(ITkPixelAlignCondAlgCfg(flags)) + result.merge(ActsDetAlignCondAlgCfg(flags, name="ActsDetAlignmentCondAlgITkPixel", + InputTransforms="ITkPixelAlignmentStore", + ActsTransforms="ActsITkPixelAlignmentStore", + DetectorType=DetectorType.Pixel)) from SCT_ConditionsAlgorithms.ITkStripConditionsAlgorithmsConfig import ITkStripAlignCondAlgCfg result.merge(ITkStripAlignCondAlgCfg(flags)) - kwargs.setdefault("PixelAlignStoreReadKey", "ITkPixelAlignmentStore") - kwargs.setdefault("SCTAlignStoreReadKey", "ITkStripAlignmentStore") + result.merge(ActsDetAlignCondAlgCfg(flags, name="ActsDetAlignmentCondAlgITkSct", + InputTransforms="ITkStripAlignmentStore", + ActsTransforms="ActsITkStripAlignmentStore", + DetectorType=DetectorType.Sct)) + + kwargs.setdefault("AlignmentStores", ["ActsITkPixelAlignmentStore", "ActsITkStripAlignmentStore"]) else: from PixelConditionsAlgorithms.PixelConditionsConfig import PixelAlignCondAlgCfg result.merge(PixelAlignCondAlgCfg(flags)) + result.merge(ActsDetAlignCondAlgCfg(flags, name="ActsDetAlignmentCondAlgPixel", + InputTransforms="PixelAlignmentStore", + ActsTransforms="ActsPixelAlignmentStore", + DetectorType=DetectorType.Pixel)) + from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig import SCT_AlignCondAlgCfg result.merge(SCT_AlignCondAlgCfg(flags)) - kwargs.setdefault("PixelAlignStoreReadKey", "PixelAlignmentStore") - kwargs.setdefault("SCTAlignStoreReadKey", "SCTAlignmentStore") + result.merge(ActsDetAlignCondAlgCfg(flags, name="ActsDetAlignmentCondAlgSct", + InputTransforms="SCTAlignmentStore", + ActsTransforms="ActsSCTAlignmentStore", + DetectorType=DetectorType.Sct)) + kwargs.setdefault("AlignmentStores", ["ActsPixelAlignmentStore", "ActsSCTAlignmentStore"]) result.addCondAlgo(CompFactory.ActsAlignmentCondAlg(name, **kwargs)) return result diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/python/ActsTrkMonitoringConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkMonitoringConfig.py similarity index 93% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/python/ActsTrkMonitoringConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkMonitoringConfig.py index 4a01851cd50d0501790d903b01ab5ce8a77df898..8e9f6599f34f68090ab581d6f2f3233d5cbbf811 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/python/ActsTrkMonitoringConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkMonitoringConfig.py @@ -9,7 +9,7 @@ def ActsTrkMonitoringHistSvcCfg(flags) -> ComponentAccumulator: return acc def ActsTrkITkPixelClusterizationMonitoringToolCfg(flags, - name: str = "ActsTrkItkPixelClusterizationMonitoringTool", + name: str = "ActsTrkITkPixelClusterizationMonitoringTool", **kwargs) -> ComponentAccumulator: acc = ComponentAccumulator() @@ -24,7 +24,7 @@ def ActsTrkITkPixelClusterizationMonitoringToolCfg(flags, return acc def ActsTrkITkStripClusterizationMonitoringToolCfg(flags, - name: str = "ActsTrkItkStripClusterizationMonitoringTool", + name: str = "ActsTrkITkStripClusterizationMonitoringTool", **kwargs) -> ComponentAccumulator: acc = ComponentAccumulator() @@ -84,11 +84,11 @@ def ActsTrkITkPixelSeedingMonitoringCfg(flags, monTool = GenericMonitoringTool(flags, name) monTool.defineHistogram('TIME_execute', path='EXPERT', type='TH1F', title='Time for execute', - xbins=100, xmin=0, xmax=50000) + xbins=50, xmin=0, xmax=10000) monTool.defineHistogram('TIME_seedCreation', path='EXPERT', type='TH1F', title='Time for seed creation', - xbins=100, xmin=0, xmax=50000) + xbins=50, xmin=0, xmax=10000) monTool.defineHistogram('TIME_parameterEstimation', path='EXPERT', type='TH1F', title='Time for parameter estimation', - xbins=100, xmin=0, xmax=50000) + xbins=50, xmin=0, xmax=10000) acc.setPrivateTools(monTool) acc.merge(ActsTrkMonitoringHistSvcCfg(flags)) @@ -103,11 +103,11 @@ def ActsTrkITkStripSeedingMonitoringCfg(flags, monTool = GenericMonitoringTool(flags, name) monTool.defineHistogram('TIME_execute', path='EXPERT', type='TH1F', title='Time for execute', - xbins=100, xmin=0, xmax=50000) + xbins=50, xmin=0, xmax=10000) monTool.defineHistogram('TIME_seedCreation', path='EXPERT', type='TH1F', title='Time for seed creation', - xbins=100, xmin=0, xmax=50000) + xbins=50, xmin=0, xmax=10000) monTool.defineHistogram('TIME_parameterEstimation', path='EXPERT', type='TH1F', title='Time for parameter estimation', - xbins=100, xmin=0, xmax=50000) + xbins=50, xmin=0, xmax=10000) acc.setPrivateTools(monTool) acc.merge(ActsTrkMonitoringHistSvcCfg(flags)) diff --git a/Tracking/Acts/ActsConfig/python/ActsTrkPriVxFinderConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkPriVxFinderConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..d5697b53429208c37a6e5f110a59b5a6d364e06e --- /dev/null +++ b/Tracking/Acts/ActsConfig/python/ActsTrkPriVxFinderConfig.py @@ -0,0 +1,95 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Configuration of InDetPriVxFinderTool package +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +def ActsGaussAdaptiveMultiFindingCfg(flags, + name="ActsAdaptiveMultiPriVtxFinderTool", + **kwargs): + acc = ComponentAccumulator() + + if "TrackSelector" not in kwargs: + from InDetConfig.InDetTrackSelectionToolConfig import ( + VtxInDetTrackSelectionCfg) + kwargs.setdefault("TrackSelector", acc.popToolsAndMerge( + VtxInDetTrackSelectionCfg(flags))) + + if "TrackingGeometryTool" not in kwargs: + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg + kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge( + ActsTrackingGeometryToolCfg(flags))) # PrivateToolHandle + + if "ExtrapolationTool" not in kwargs: + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg + kwargs.setdefault("ExtrapolationTool", acc.popToolsAndMerge( + ActsExtrapolationToolCfg(flags))) # PrivateToolHandle + + kwargs.setdefault("useBeamConstraint", + flags.Tracking.PriVertex.useBeamConstraint) + kwargs.setdefault("tracksMaxZinterval", + flags.Tracking.PriVertex.maxZinterval) + kwargs.setdefault("do3dSplitting", + not flags.Tracking.PriVertex.useBeamConstraint) + + acc.setPrivateTools( + CompFactory.ActsTrk.AdaptiveMultiPriVtxFinderTool(name, **kwargs)) + return acc + +def TrigActsGaussAdaptiveMultiFindingCfg( + flags, + name="ActsAdaptiveMultiPriVtxFinderTool", + signature="", + **kwargs): + acc = ComponentAccumulator() + + if "TrackSelector" not in kwargs: + from InDetConfig.InDetTrackSelectionToolConfig import ( + TrigVtxInDetTrackSelectionCfg) + kwargs.setdefault("TrackSelector", acc.popToolsAndMerge( + TrigVtxInDetTrackSelectionCfg(flags, signature=signature))) + + from TrigInDetConfig.ConfigSettings import getInDetTrigConfig + config = getInDetTrigConfig(signature) + + kwargs.setdefault("useBeamConstraint", True) + kwargs.setdefault("useSeedConstraint", False) + kwargs.setdefault("tracksMaxZinterval", config.TracksMaxZinterval) + kwargs.setdefault("do3dSplitting", False) + kwargs.setdefault("addSingleTrackVertices", config.addSingleTrackVertices) + + acc.setPrivateTools(acc.popToolsAndMerge( + ActsGaussAdaptiveMultiFindingCfg(flags, name+signature, **kwargs))) + return acc + +def ActsIterativeFindingCfg(flags, + name="ActsIterativePriVtxFinderTool", + **kwargs): + acc = ComponentAccumulator() + + if "TrackSelector" not in kwargs: + from InDetConfig.InDetTrackSelectionToolConfig import ( + VtxInDetTrackSelectionCfg) + kwargs.setdefault("TrackSelector", acc.popToolsAndMerge( + VtxInDetTrackSelectionCfg(flags))) + + if "TrackingGeometryTool" not in kwargs: + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg + kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge( + ActsTrackingGeometryToolCfg(flags))) # PrivateToolHandle + + if "ExtrapolationTool" not in kwargs: + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg + kwargs.setdefault("ExtrapolationTool", acc.popToolsAndMerge( + ActsExtrapolationToolCfg(flags))) # PrivateToolHandle + + kwargs.setdefault("useBeamConstraint", + flags.Tracking.PriVertex.useBeamConstraint) + kwargs.setdefault("significanceCutSeeding", 12) + kwargs.setdefault("maximumChi2cutForSeeding", 49) + kwargs.setdefault("maxVertices", flags.Tracking.PriVertex.maxVertices) + kwargs.setdefault("doMaxTracksCut", flags.Tracking.PriVertex.doMaxTracksCut) + kwargs.setdefault("maxTracks", flags.Tracking.PriVertex.maxTracks) + + acc.setPrivateTools( + CompFactory.ActsTrk.IterativePriVtxFinderTool(name, **kwargs)) + return acc diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/python/ActsTrkSeedingToolConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkSeedingConfig.py similarity index 57% rename from Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/python/ActsTrkSeedingToolConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkSeedingConfig.py index c5d1c248e99afd0b00c6e0915ec339785cc88bab..75d8a031c0bc732e695a24a82f1a31fbaa43eed4 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/python/ActsTrkSeedingToolConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkSeedingConfig.py @@ -1,14 +1,21 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory +from ActsConfig.ActsTrkTrackParamsEstimationConfig import TrackParamsEstimationToolCfg +from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometryToolCfg +from ActsConfig.ActsConfigFlags import SeedingStrategy +from ActsConfig.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg from ActsInterop import UnitConstants -from ActsInterop.ActsConfigFlags import SeedingStrategy +# ACTS tools def ActsTrkITkPixelSeedingToolCfg(flags, **kwargs) -> ComponentAccumulator: acc = ComponentAccumulator() - ## For ITkPixel, use default values for ActsTrk::SeedingTool + ## For ITkPixel + kwargs.setdefault("numSeedIncrement" , float("inf")) + kwargs.setdefault("deltaZMax" , float("inf")) + kwargs.setdefault("maxPtScattering", float("inf")) acc.setPrivateTools(CompFactory.ActsTrk.SeedingTool(name = "ActsSeedingTool_ITkPixel", **kwargs)) return acc @@ -34,6 +41,7 @@ def ActsTrkITkStripSeedingToolCfg(flags, kwargs.setdefault("deltaRMiddleMinSPRange" , 30 * UnitConstants.mm) kwargs.setdefault("deltaRMiddleMaxSPRange" , 150 * UnitConstants.mm) kwargs.setdefault("useDetailedDoubleMeasurementInfo" , True) + kwargs.setdefault("maxPtScattering", float("inf")) # For SeedFilterConfig kwargs.setdefault("useDeltaRorTopRadius" , False) kwargs.setdefault("seedConfirmationInFilter" , False) @@ -41,8 +49,8 @@ def ActsTrkITkStripSeedingToolCfg(flags, kwargs.setdefault("compatSeedLimit" , 4) kwargs.setdefault("numSeedIncrement" , 1.) kwargs.setdefault("seedWeightIncrement" , 10100.) - kwargs.setdefault("maxSeedsPerSpMConf" , 10e6) - kwargs.setdefault("maxQualitySeedsPerSpMConf" , 10e6) + kwargs.setdefault("maxSeedsPerSpMConf" , 100) + kwargs.setdefault("maxQualitySeedsPerSpMConf" , 100) # For seeding algorithm kwargs.setdefault("zBinNeighborsBottom" , [(0,1),(0,1),(0,1),(0,2),(0,1),(0,0),(-1,0),(-2,0),(-1,0),(-1,0),(-1,0)]) @@ -52,21 +60,20 @@ def ActsTrkITkStripSeedingToolCfg(flags, def ActsTrkITkPixelOrthogonalSeedingToolCfg(flags, **kwargs) -> ComponentAccumulator: acc = ComponentAccumulator() - ## For ITkPixel, use default values for ActsTrk::OrthogonalSeedingTool + ## For ITkPixel, use default values for ActsTrk::OrthogonalSeedingTool acc.setPrivateTools(CompFactory.ActsTrk.OrthogonalSeedingTool(name = "OrthogonalSeedingTool_ITkPixel", **kwargs)) return acc def ActsTrkITkStripOrthogonalSeedingToolCfg(flags, **kwargs) -> ComponentAccumulator: acc = ComponentAccumulator() - ## For ITkStrip, change properties that have to be modified w.r.t. the default values + ## For ITkStrip, change properties that have to be modified w.r.t. the default values kwargs.setdefault("impactMax" , 20. * UnitConstants.mm) kwargs.setdefault('rMax', 1200. * UnitConstants.mm) kwargs.setdefault("deltaRMinTopSP" , 20. * UnitConstants.mm) kwargs.setdefault("deltaRMaxTopSP" , 300. * UnitConstants.mm) kwargs.setdefault("deltaRMinBottomSP" , 20. * UnitConstants.mm) kwargs.setdefault("deltaRMaxBottomSP" , 300. * UnitConstants.mm) - kwargs.setdefault("maxSeedsPerSpMConf" , 10e6) kwargs.setdefault("deltaZMax" , 900. * UnitConstants.mm) kwargs.setdefault("interactionPointCut" , False) kwargs.setdefault("skipPreviousTopSP", False) @@ -75,8 +82,8 @@ def ActsTrkITkStripOrthogonalSeedingToolCfg(flags, kwargs.setdefault("seedWeightIncrement" , 10100.) kwargs.setdefault("numSeedIncrement" , 1.) kwargs.setdefault("seedConfirmationInFilter" , False) - kwargs.setdefault("maxSeedsPerSpMConf" , 10e6) - kwargs.setdefault("maxQualitySeedsPerSpMConf" , 10e6) + kwargs.setdefault("maxSeedsPerSpMConf" , 100) + kwargs.setdefault("maxQualitySeedsPerSpMConf" , 100) kwargs.setdefault("useDeltaRorTopRadius" , False) kwargs.setdefault("rMinMiddle", 33. * UnitConstants.mm) kwargs.setdefault("rMaxMiddle", 1200. * UnitConstants.mm) @@ -94,8 +101,8 @@ def ActsTrkSiSpacePointsSeedMakerCfg(flags, kwargs['name'] = name # Main properties - from ActsInterop.TrackingComponentConfigurer import TrackingComponentConfigurer - configuration_settings = TrackingComponentConfigurer(flags) + from ActsConfig.TrackingComponentConfigurer import TrackingComponentConfigurer + configuration_settings = TrackingComponentConfigurer(flags) kwargs.setdefault('SpacePointsPixelName', 'ITkPixelSpacePoints') kwargs.setdefault('SpacePointsStripName', 'ITkStripSpacePoints') @@ -148,3 +155,102 @@ def ActsTrkSiSpacePointsSeedMakerCfg(flags, acc.setPrivateTools(CompFactory.ActsTrk.SiSpacePointsSeedMaker(**kwargs)) return acc + + +# ACTS algorithm using Athena objects upstream +def ActsTrkITkPixelSeedingCfg(flags, + name: str = 'ActsTrkPixelSeedingAlg', + **kwargs): + acc = ComponentAccumulator() + + # Need To add additional tool(s) + # Tracking Geometry Tool + geoTool = acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) + acc.addPublicTool(geoTool) + + # ATLAS Converter Tool + converterTool = acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) + + # Track Param Estimation Tool + trackEstimationTool = acc.popToolsAndMerge(TrackParamsEstimationToolCfg(flags)) + + seedTool = None + if "SeedTool" not in kwargs: + if flags.Acts.SeedingStrategy is SeedingStrategy.Orthogonal: + seedTool = acc.popToolsAndMerge(ActsTrkITkPixelOrthogonalSeedingToolCfg(flags)) + else: + seedTool = acc.popToolsAndMerge(ActsTrkITkPixelSeedingToolCfg(flags)) + + kwargs.setdefault('InputSpacePoints', ['ITkPixelSpacePoints']) + kwargs.setdefault('OutputSeeds', 'ITkPixelSeeds') + kwargs.setdefault('SeedTool', seedTool) + kwargs.setdefault('TrackingGeometryTool', acc.getPublicTool(geoTool.name)) # PublicToolHandle + kwargs.setdefault('ATLASConverterTool', converterTool) + kwargs.setdefault('TrackParamsEstimationTool', trackEstimationTool) + kwargs.setdefault('OutputEstimatedTrackParameters', 'ITkPixelEstimatedTrackParams') + kwargs.setdefault('UsePixel', True) + kwargs.setdefault('DetectorElements', 'ITkPixelDetectorElementCollection') + + if flags.Acts.doMonitoring: + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkITkPixelSeedingMonitoringCfg + kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkITkPixelSeedingMonitoringCfg(flags))) + + acc.addEventAlgo(CompFactory.ActsTrk.SeedingAlg(name, **kwargs)) + return acc + + +def ActsTrkITkStripSeedingCfg(flags, + name: str = 'ActsTrkStripSeedingAlg', + **kwargs): + acc = ComponentAccumulator() + + # Need To add additional tool(s) + # Tracking Geometry Tool + geoTool = acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) + acc.addPublicTool(geoTool) + + # ATLAS Converter Tool + converterTool = acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) + + # Track Param Estimation Tool + trackEstimationTool = acc.popToolsAndMerge(TrackParamsEstimationToolCfg(flags)) + + seedTool = None + if "SeedTool" not in kwargs: + if flags.Acts.SeedingStrategy is SeedingStrategy.Orthogonal: + seedTool = acc.popToolsAndMerge(ActsTrkITkStripOrthogonalSeedingToolCfg(flags)) + else: + seedTool = acc.popToolsAndMerge(ActsTrkITkStripSeedingToolCfg(flags)) + + kwargs.setdefault('InputSpacePoints', ['ITkStripSpacePoints', 'ITkStripOverlapSpacePoints']) + kwargs.setdefault('OutputSeeds', 'ITkStripSeeds') + kwargs.setdefault('SeedTool', seedTool) + kwargs.setdefault('TrackingGeometryTool', acc.getPublicTool(geoTool.name)) # PublicToolHandle + kwargs.setdefault('ATLASConverterTool', converterTool) + kwargs.setdefault('TrackParamsEstimationTool', trackEstimationTool) + kwargs.setdefault('OutputEstimatedTrackParameters', 'ITkStripEstimatedTrackParams') + kwargs.setdefault('UsePixel', False) + kwargs.setdefault('DetectorElements', 'ITkStripDetectorElementCollection') + + if flags.Acts.doMonitoring: + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkITkStripSeedingMonitoringCfg + kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkITkStripSeedingMonitoringCfg(flags))) + + acc.addEventAlgo(CompFactory.ActsTrk.SeedingAlg(name, **kwargs)) + return acc + + +def ActsTrkSeedingCfg(flags): + acc = ComponentAccumulator() + if flags.Detector.EnableITkPixel: + acc.merge(ActsTrkITkPixelSeedingCfg(flags)) + if flags.Detector.EnableITkStrip: + acc.merge(ActsTrkITkStripSeedingCfg(flags)) + + if flags.Acts.doAnalysis: + from ActsConfig.ActsTrkAnalysisConfig import ActsTrkSeedAnalysisCfg, ActsTrkEstimatedTrackParamsAnalysisCfg + acc.merge(ActsTrkSeedAnalysisCfg(flags)) + acc.merge(ActsTrkEstimatedTrackParamsAnalysisCfg(flags)) + + return acc + diff --git a/Tracking/TrkConfig/python/ActsTrkSpacePointFormationConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkSpacePointFormationConfig.py similarity index 74% rename from Tracking/TrkConfig/python/ActsTrkSpacePointFormationConfig.py rename to Tracking/Acts/ActsConfig/python/ActsTrkSpacePointFormationConfig.py index 4d04d94a6a4b298fff5b50f0bc9d266e7f4de59f..f735ea1e84ee344eb473cf8195681578964067b8 100644 --- a/Tracking/TrkConfig/python/ActsTrkSpacePointFormationConfig.py +++ b/Tracking/Acts/ActsConfig/python/ActsTrkSpacePointFormationConfig.py @@ -1,6 +1,7 @@ # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory +from ActsConfig.ActsConfigFlags import SpacePointStrategy def ActsTrkPixelSpacePointToolCfg(flags, name = "ActsTrkPixelSpacePointTool", **kwargs): acc = ComponentAccumulator() @@ -14,7 +15,19 @@ def ActsTrkStripSpacePointToolCfg(flags, name = "ActsTrkStripSpacePointTool", ** kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge(ITkStripLorentzAngleToolCfg(flags)) ) kwargs.setdefault("AllClusters", False) - acc.setPrivateTools(CompFactory.ActsTrk.StripSpacePointFormationTool(name, **kwargs)) + acc.setPrivateTools(CompFactory.ActsTrk.ActsTrkStripSpacePointFormationTool(name, **kwargs)) + return acc + +def ActsCoreStripSpacePointToolCfg(flags, name = "ActsCoreStripSpacePointTool", **kwargs): + acc = ComponentAccumulator() + + from SiLorentzAngleTool.ITkStripLorentzAngleConfig import ITkStripLorentzAngleToolCfg + kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge(ITkStripLorentzAngleToolCfg(flags)) ) + kwargs.setdefault("AllClusters", False) + from ActsConfig.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg + kwargs.setdefault("ConverterTool", acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags))) + + acc.setPrivateTools(CompFactory.ActsTrk.ActsCoreStripSpacePointFormationTool(name, **kwargs)) return acc def ActsTrkPixelSpacePointFormationCfg(flags, @@ -33,7 +46,7 @@ def ActsTrkPixelSpacePointFormationCfg(flags, kwargs.setdefault("PixelSpacePoints", "ITkPixelSpacePoints") if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkPixelSpacePointFormationMonitoringToolCfg + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkPixelSpacePointFormationMonitoringToolCfg kwargs.setdefault("MonTool", acc.popToolsAndMerge(ActsTrkPixelSpacePointFormationMonitoringToolCfg(flags))) acc.addEventAlgo(CompFactory.ActsTrk.PixelSpacePointFormationAlg(name, **kwargs)) @@ -46,7 +59,11 @@ def ActsTrkStripSpacePointFormationCfg(flags, from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripReadoutGeometryCfg acc = ITkStripReadoutGeometryCfg(flags) - ActsTrkStripSpacePointTool = acc.popToolsAndMerge(ActsTrkStripSpacePointToolCfg(flags)) + if flags.Acts.SpacePointStrategy is SpacePointStrategy.ActsCore: + ActsTrkStripSpacePointTool = acc.popToolsAndMerge(ActsCoreStripSpacePointToolCfg(flags)) + else: + ActsTrkStripSpacePointTool = acc.popToolsAndMerge(ActsTrkStripSpacePointToolCfg(flags)) + kwargs.setdefault("SpacePointFormationTool", ActsTrkStripSpacePointTool) kwargs.setdefault("StripClusters", "ITkStripClusters") @@ -58,7 +75,7 @@ def ActsTrkStripSpacePointFormationCfg(flags, kwargs.setdefault("ProcessOverlapForStrip", True) if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkStripSpacePointFormationMonitoringToolCfg + from ActsConfig.ActsTrkMonitoringConfig import ActsTrkStripSpacePointFormationMonitoringToolCfg kwargs.setdefault("MonTool", acc.popToolsAndMerge(ActsTrkStripSpacePointFormationMonitoringToolCfg(flags))) acc.addEventAlgo(CompFactory.ActsTrk.StripSpacePointFormationAlg(name, **kwargs)) @@ -85,7 +102,7 @@ def ActsTrkSpacePointFormationCfg(flags): acc.merge(ActsTrkStripSpacePointFormationCfg(flags)) if flags.Acts.doAnalysis: - from ActsTrkAnalysis.ActsTrkAnalysisConfig import ActsTrkSpacePointAnalysisCfg + from ActsConfig.ActsTrkAnalysisConfig import ActsTrkSpacePointAnalysisCfg acc.merge(ActsTrkSpacePointAnalysisCfg(flags)) return acc diff --git a/Tracking/Acts/ActsConfig/python/ActsTrkTrackParamsEstimationConfig.py b/Tracking/Acts/ActsConfig/python/ActsTrkTrackParamsEstimationConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..1634575e09172c9d9791b9c2e49ae1e1101b0458 --- /dev/null +++ b/Tracking/Acts/ActsConfig/python/ActsTrkTrackParamsEstimationConfig.py @@ -0,0 +1,25 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory +from ActsInterop import UnitConstants + +def TrackParamsEstimationToolCfg(ConfigFlags, + name: str = "TrackParamsEstimationTool", + **kwargs) -> ComponentAccumulator: + assert isinstance(name, str) + + acc = ComponentAccumulator() + + kwargs.setdefault('bFieldMin', 0.1 * UnitConstants.T) + kwargs.setdefault('sigmaLoc0', 25 * UnitConstants.um) + kwargs.setdefault('sigmaLoc1', 100 * UnitConstants.um) + kwargs.setdefault('sigmaPhi', 0.02 * UnitConstants.degree) + kwargs.setdefault('sigmaTheta', 0.02 * UnitConstants.degree) + kwargs.setdefault('sigmaQOverP', 0.1 / UnitConstants.GeV) + kwargs.setdefault('sigmaT0', 1400 * UnitConstants.s) + # eBoundLoc0, eBoundLoc1, eBoundPhi, eBoundTheta, eBoundQOverP, eBoundTime + kwargs.setdefault('initialVarInflation', [1., 1., 1., 1., 1., 1.]) + + acc.setPrivateTools(CompFactory.ActsTrk.TrackParamsEstimationTool(name=name, **kwargs)) + return acc diff --git a/Tracking/Acts/ActsInterop/python/TrackingComponentConfigurer.py b/Tracking/Acts/ActsConfig/python/TrackingComponentConfigurer.py similarity index 90% rename from Tracking/Acts/ActsInterop/python/TrackingComponentConfigurer.py rename to Tracking/Acts/ActsConfig/python/TrackingComponentConfigurer.py index 67ba9a107a25efd3837a3fbe8df03964e05369c5..af07d2fc2212a9282aa69f1c049a9c596413e89d 100644 --- a/Tracking/Acts/ActsInterop/python/TrackingComponentConfigurer.py +++ b/Tracking/Acts/ActsConfig/python/TrackingComponentConfigurer.py @@ -9,7 +9,8 @@ class TrackingComponentConfigurer: TrackingComponent.ValidateActsClusters : "ValidateActsClusters", TrackingComponent.ValidateActsSpacePoints : "ValidateActsSpacePoints", TrackingComponent.ValidateActsSeeds : "ValidateActsSeeds", - TrackingComponent.ValidateActsTracks : "ValidateActsTracks" + TrackingComponent.ValidateActsTracks : "ValidateActsTracks", + TrackingComponent.BenchmarkSpot : "BenchmarkSpot" } def __init__(self, @@ -120,7 +121,13 @@ class TrackingComponentConfigurer: @property def doActsToAthenaSeed(self) -> bool: return self.ActsToAthenaSeedConverter + + def producesActsClusters(self) -> bool: + return self.ActsCluster or self.AthenaToActsClusterConverter + def producesActsSpacePoints(self) -> bool: + return self.ActsSpacePoint or self.AthenaToActsSpacePointConverter + def AthenaChain(self): self.AthenaCluster = True self.AthenaSpacePoint = True @@ -168,3 +175,13 @@ class TrackingComponentConfigurer: self.ActsSeed = True self.ActsTrack = True + def BenchmarkSpot(self): + # Very not-standard configuration + self.AthenaCluster = True + self.ActsCluster = True + self.AthenaToActsClusterConverter = True + self.ActsSpacePoint = True + self.ActsSeed = True + self.ActsToAthenaSeedConverter = True + self.AthenaTrack = True + diff --git a/Tracking/Acts/ActsInterop/share/TrackingComponents.ref b/Tracking/Acts/ActsConfig/share/TrackingComponents.ref similarity index 100% rename from Tracking/Acts/ActsInterop/share/TrackingComponents.ref rename to Tracking/Acts/ActsConfig/share/TrackingComponents.ref diff --git a/Tracking/Acts/ActsInterop/test/TrackingComponents.py b/Tracking/Acts/ActsConfig/test/TrackingComponents.py similarity index 92% rename from Tracking/Acts/ActsInterop/test/TrackingComponents.py rename to Tracking/Acts/ActsConfig/test/TrackingComponents.py index 842f21c78296929a75abdaca67a0ce8c1b8825e3..64469c1d229edb57588ae0cc2b1407b89f1ddc40 100755 --- a/Tracking/Acts/ActsInterop/test/TrackingComponents.py +++ b/Tracking/Acts/ActsConfig/test/TrackingComponents.py @@ -3,7 +3,7 @@ if __name__ == "__main__": from TrkConfig.TrkConfigFlags import TrackingComponent - from ActsInterop.TrackingComponentConfigurer import TrackingComponentConfigurer + from ActsConfig.TrackingComponentConfigurer import TrackingComponentConfigurer request_collection = { "Production Mode" : [TrackingComponent.AthenaChain, TrackingComponent.ActsChain], diff --git a/Tracking/Acts/ActsDataPreparation/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsDataPreparation/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..6a69a25c63c582216d037456e0c758b5321ebc6a --- /dev/null +++ b/Tracking/Acts/ActsDataPreparation/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/Acts/ActsDataPreparation diff --git a/Tracking/Acts/ActsDataPreparation/CMakeLists.txt b/Tracking/Acts/ActsDataPreparation/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..07ee615d699981684111976d6e5ab0cc1da38305 --- /dev/null +++ b/Tracking/Acts/ActsDataPreparation/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir(ActsDataPreparation) + +# External dependencies: +find_package(Acts COMPONENTS Core) +find_package(Eigen) + +atlas_add_component( ActsDataPreparation + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS + ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES + ${EIGEN_LIBRARIES} + ActsCore + ActsTrkToolInterfacesLib + AthenaBaseComps + AthenaMonitoringKernelLib + GaudiKernel + InDetConditionsSummaryService + InDetIdentifier + InDetReadoutGeometry + InDetRawData + SiClusterizationToolLib + xAODInDetMeasurement + ActsTrkEventLib + ActsTrkEventCnvLib + BeamSpotConditionsData + MagFieldConditions + SCT_ReadoutGeometry + PixelReadoutGeometryLib + SiSpacePointFormationLib + InDetCondTools + ReadoutGeometryBase + ) diff --git a/Tracking/Acts/ActsDataPreparation/src/ActsCoreStripSpacePointFormationTool.cxx b/Tracking/Acts/ActsDataPreparation/src/ActsCoreStripSpacePointFormationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a1e0f70c66aacd6a3eea39cd69e65cb4cd091989 --- /dev/null +++ b/Tracking/Acts/ActsDataPreparation/src/ActsCoreStripSpacePointFormationTool.cxx @@ -0,0 +1,667 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "ActsCoreStripSpacePointFormationTool.h" +#include "Acts/Utilities/SpacePointUtility.hpp" +#include "InDetIdentifier/SCT_ID.h" +#include "ReadoutGeometryBase/SiCellId.h" +#include "InDetCondTools/ISiLorentzAngleTool.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" +#include "xAODInDetMeasurement/StripClusterAuxContainer.h" +#include "xAODInDetMeasurement/ContainerAccessor.h" +#include "Acts/SpacePointFormation/SpacePointBuilderConfig.hpp" +#include "ActsGeometry/ATLASSourceLink.h" +namespace ActsTrk +{ + + ActsCoreStripSpacePointFormationTool::ActsCoreStripSpacePointFormationTool(const std::string &type, + const std::string &name, + const IInterface *parent) + : base_class(type, name, parent) + {} + + StatusCode ActsCoreStripSpacePointFormationTool::initialize(){ + + ATH_CHECK(detStore()->retrieve(m_stripId, "SCT_ID")); + ATH_CHECK(m_lorentzAngleTool.retrieve()); + ATH_CHECK(m_trackingGeometryTool.retrieve()); + ATH_CHECK(m_ATLASConverterTool.retrieve()); + + return StatusCode::SUCCESS; + } + + StatusCode ActsCoreStripSpacePointFormationTool::produceSpacePoints(const EventContext &ctx, + const xAOD::StripClusterContainer &clusterContainer, + const InDet::SiElementPropertiesTable &properties, + const InDetDD::SiDetectorElementCollection &elements, + const Amg::Vector3D &beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints, + bool processOverlaps) const + { + /// Production of ActsTrk::SpacePoint from strip clusters + /// Strip space points involves a more complex logic since + /// they are made combining clusters from pairs of + /// overlapping detectors. + + /// For each trigger element, first evaluate and collect the quantities you need to build the space points. + /// The detector element array has capacity 6: + /// [0] is the trigger element + /// [1] is the opposite element + /// [2]-[3] are the elements tested for eta overlaps + /// [4]-[5] are the elements tested for phi overlaps + /// For each element you save the corresponding cluster collections and the + /// space point compatibility range as described below. + /// + /// For the opposite element and the ones tested for eta overlaps, you have to check + /// if clusters are compatible with the local position of the trigger cluster + /// requiring that the distance between the two clusters in phi is withing a specified range. + /// - For the clusters on the opposite element: [-m_overlapLimitOpposite, m_overlapLimitOpposite] + /// + /// - For the eta overlapping clusters : you use m_overlapLimitEtaMin and m_overlapLimitEtaMax + /// in different combination depending if you are checking a stereo module or not + /// + /// For each element, the extremes of these ranges are saved in the overlapExtents array + /// which is used later on + /// - overlapExtents[0], overlapExtents[1] are filled for the opposite element + /// - overlapExtents[2], overlapExtents[3], overlapExtents[4], overlapExtents[5] are filled for the eta overlapping elements + /// + /// For the elements tested for phi overlaps, you have to check + /// if clusters are compatible with the local position of the trigger cluster. + /// This needs that the trigger cluster is at the edge of the trigger module: + /// e.g. -hwidth < locX_trigger < -hwidth+m_overlapLimitPhi (or hwidth-m_overlapLimitPhi < locX_trigger < hwidth) + /// and that the other cluster is on the compatible edge of its module: + /// e.g. hwidth-m_overlapLimitPhi < locX_other < hwidth (or -hwidth < locX_other < -hwidth+m_overlapLimitPhi) + /// + /// For each element, the extremes of these ranges are saved in the overlapExtents array + /// which is used later on + /// - overlapExtents[6], overlapExtents[7], overlapExtents[10], overlapExtents[11] + /// overlapExtents[8], overlapExtents[9], overlapExtents[12], overlapExtents[13] are filled for the phi overlapping elements + + /// Access to the cluster from a given detector element is possible + /// via the ContainerAccessor. + + + + std::vector<ATLASUncalibSourceLink::ElementsType> elementsCollection; + elementsCollection.reserve(clusterContainer.size()); + + auto spBuilderConfig = std::make_shared<Acts::SpacePointBuilderConfig>(); + + const std::shared_ptr<const Acts::TrackingGeometry> trkGeometry = m_trackingGeometryTool->trackingGeometry(); + spBuilderConfig->trackingGeometry = trkGeometry; + + auto spConstructor = [this, &clusterContainer, &elements](const Acts::Vector3 &pos, + const Acts::Vector2 &cov, + const boost::container::static_vector<Acts::SourceLink, 2> &slinks) + -> StripSP{ + std::vector<std::size_t> measIndices; + std::array<StripInformationHelper, 2> stripInfos; + size_t idx = 0; + for (const auto& slink : slinks){ + const auto& atlasSourceLink = slink.get<ATLASUncalibSourceLink>(); + const auto& hit = atlasSourceLink.atlasHit(); + + // Check if the cluster is in the cluster container + const auto it = std::find(clusterContainer.begin(), clusterContainer.end(), dynamic_cast<const xAOD::StripCluster*>(&hit)); + if (it != clusterContainer.end()){ + const auto cluster_index = it - clusterContainer.begin(); + const auto &id = hit.identifierHash(); + const auto &element = elements.getDetectorElement(id); + size_t stripIndex = 0; + auto ends = this->getStripEnds(atlasSourceLink, element, stripIndex); + const auto ¤tLocalPos = atlasSourceLink.values(); + auto vertex = Amg::Vector3D(0,0,0); + StripInformationHelper stripInfo(id,ends.first, ends.second, vertex, currentLocalPos(0, 0), cluster_index, stripIndex); + measIndices.push_back(cluster_index); + stripInfos[idx++] = std::move(stripInfo); + } + } + const auto& [firstInfo, secondInfo] = stripInfos; + const auto topHalfStripLength = 0.5*firstInfo.stripDirection().norm(); + Eigen::Matrix<double, 3, 1> topStripDirection = -firstInfo.stripDirection()/(2.*topHalfStripLength); + Eigen::Matrix<double, 3, 1> topStripCenter = 0.5*firstInfo.trajDirection(); + + const auto bottomHalfStripLength = 0.5*secondInfo.stripDirection().norm(); + Eigen::Matrix<double, 3, 1> bottomStripDirection = -secondInfo.stripDirection()/(2.*bottomHalfStripLength); + Eigen::Matrix<double, 3, 1> stripCenterDistance = firstInfo.stripCenter() - secondInfo.stripCenter(); + + StripSP sp; + sp.idHashes = {firstInfo.idHash(), secondInfo.idHash()}; + sp.globPos = pos.cast<float>(); + sp.cov_r = cov(0,0); + sp.cov_z = cov(1,0); + sp.measurementIndexes = measIndices; + sp.topHalfStripLength = topHalfStripLength; + sp.bottomHalfStripLength = bottomHalfStripLength; + sp.topStripDirection = topStripDirection.cast<float>(); + sp.bottomStripDirection = bottomStripDirection.cast<float>(); + sp.stripCenterDistance = stripCenterDistance.cast<float>(); + sp.topStripCenter = topStripCenter.cast<float>(); + + return sp; + }; + + auto spBuilder = std::make_shared<Acts::SpacePointBuilder<StripSP>>(*spBuilderConfig, spConstructor); + + ContainerAccessor<xAOD::StripCluster, IdentifierHash, 1> + stripAccessor( + clusterContainer, + [](const xAOD::StripCluster &cl) + { return cl.identifierHash(); }, + elements.size()); + + const auto &allIdHashes = stripAccessor.allIdentifiers(); + for (auto &idHash : allIdHashes) + { + const InDetDD::SiDetectorElement *thisElement = elements.getDetectorElement(idHash); + if (thisElement->isStereo()) + continue; + + // Retrieve the neighbours of the detector element + const std::vector<IdentifierHash>& others = *properties.neighbours(idHash); + + if ( others.empty()) continue; + + // This flag is use to trigger if the search should be performed. + // In case there are no clusters on the neighbours of the selected + // detector element, the flag stays false. + bool search = false; + size_t neighbour = 0; + while (not search and neighbour < others.size()){ + search = stripAccessor.isIdentifierPresent( others.at(neighbour) ); + neighbour++; + } + if (not search) continue; + + // prepare clusters, indices and modules for space point formation + std::array<std::vector<std::pair<const xAOD::StripCluster *, size_t>>, static_cast<size_t>(nNeighbours)> neighbourClusters{}; + std::array<std::vector<std::pair<ATLASUncalibSourceLink, size_t>>, static_cast<size_t>(nNeighbours)> neighbourSourceLinks{}; + std::array<const InDetDD::SiDetectorElement *, static_cast<size_t>(nNeighbours)> neighbourElements{}; + + auto groupStart = clusterContainer.begin(); + // Get the detector element and range for the idHash + neighbourElements[0] = thisElement; + for (auto &this_range : stripAccessor.rangesForIdentifierDirect(idHash)){ + for (auto start = this_range.first; start != this_range.second; ++start){ + size_t position = std::distance(groupStart, start); + neighbourClusters[0].push_back(std::make_pair(*start, position)); + auto slink = m_ATLASConverterTool->uncalibratedTrkMeasurementToSourceLink(elements, **start, elementsCollection); + neighbourSourceLinks[0].emplace_back(std::make_pair(slink, position)); + } + } + + Identifier thisId = thisElement->identify(); + + // define overlap extends before building space points + std::array<double, 14> overlapExtents{}; + // Default case: you test the opposite element and the overlapping in phi (total 3 elements) + int Nmax = 4; + + // In the barrel, test the eta overlaps as well (total 5 elements) + if (m_stripId->is_barrel(thisId)) + Nmax = 6; + + // You can remove all the overlaps if requested. + // Here you test only the opposite element + if (not processOverlaps) + Nmax = 2; + + float hwidth(properties.halfWidth(idHash)); + int n = 0; + + // The order of the elements in others is such that you first get the opposite element, + // the overlapping in phi and then the overlapping in eta + // For this reason you need to re-order the indices, since the SiSpacePointMakerTool will process + // first the eta overlaps and then the phi ones + const std::array<size_t, nNeighbours> neigbourIndices{ThisOne, Opposite, EtaMinus, EtaPlus, PhiMinus, PhiPlus}; + + for (const auto &otherHash : others){ + if (++n == Nmax) break; + + if (not stripAccessor.isIdentifierPresent(otherHash)) + continue; + + const InDetDD::SiDetectorElement *otherElement = elements.getDetectorElement(otherHash); + + neighbourElements[neigbourIndices[n]] = otherElement; + for (auto &this_range : stripAccessor.rangesForIdentifierDirect(otherHash)){ + for (auto start = this_range.first; start != this_range.second; ++start){ + size_t position = std::distance(groupStart, start); + neighbourClusters[neigbourIndices[n]].push_back(std::make_pair(*start, position)); + auto slink = m_ATLASConverterTool->uncalibratedTrkMeasurementToSourceLink(elements, **start, elementsCollection); + neighbourSourceLinks[neigbourIndices[n]].emplace_back(std::make_pair(slink, position)); + } + } + + switch (n){ + case Opposite: + { + overlapExtents[0] = -m_overlapLimitOpposite; + overlapExtents[1] = m_overlapLimitOpposite; + break; + } + case PhiMinus: + { + overlapExtents[6] = -hwidth; + overlapExtents[7] = -hwidth + m_overlapLimitPhi; + overlapExtents[8] = hwidth - m_overlapLimitPhi; + overlapExtents[9] = hwidth; + break; + } + case PhiPlus: + { + overlapExtents[10] = hwidth - m_overlapLimitPhi; + overlapExtents[11] = hwidth; + overlapExtents[12] = -hwidth; + overlapExtents[13] = -hwidth + m_overlapLimitPhi; + break; + } + case EtaMinus: + { + if ((m_stripId->layer_disk(thisId) & 1) == 0){ + overlapExtents[2] = m_overlapLimitEtaMin; + overlapExtents[3] = m_overlapLimitEtaMax; + } else{ + overlapExtents[2] = -m_overlapLimitEtaMax; + overlapExtents[3] = -m_overlapLimitEtaMin; + } + break; + } + default: + { + if ((m_stripId->layer_disk(thisId) & 1) == 0){ + overlapExtents[4] = -m_overlapLimitEtaMax; + overlapExtents[5] = -m_overlapLimitEtaMin; + } else { + overlapExtents[4] = m_overlapLimitEtaMin; + overlapExtents[5] = m_overlapLimitEtaMax; + } + break; + } + } + } + + ATH_CHECK( fillSpacePoints(ctx, spBuilder, neighbourElements, neighbourSourceLinks, overlapExtents, beamSpotVertex, + spacePoints, overlapSpacePoints) ); + } + return StatusCode::SUCCESS; + } + + StatusCode ActsCoreStripSpacePointFormationTool::fillSpacePoints(const EventContext &ctx, + std::shared_ptr<Acts::SpacePointBuilder<StripSP>> spBuilder, + std::array<const InDetDD::SiDetectorElement *,nNeighbours> elements, + std::array<std::vector<std::pair<ATLASUncalibSourceLink, size_t>>,nNeighbours> sourceLinks, + std::array<double, 14> overlapExtents, + const Amg::Vector3D &beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints ) const + { + // This function is called once all the needed quantities are collected. + // It is used to build space points checking the compatibility of clusters on pairs of detector elements. + // Detector elements and cluster collections are elements and clusters, respectively. + // [0] is the trigger element + // [1] is the opposite element + // [2]-[3] are the elements tested for eta overlaps + // [4]-[5] are the elements tested for phi overlaps + // + // To build space points: + // - For the opposite element and the ones tested for eta overlaps, you have to check + // if clusters are compatible with the local position of the trigger cluster + // requiring that the distance between the two clusters in phi is withing a specified range. + // - overlapExtents[0], overlapExtents[1] are filled for the opposite element + // - overlapExtents[2], overlapExtents[3], overlapExtents[4], overlapExtents[5] are filled for the eta overlapping elements + // - For the elements tested for phi overlaps, you have to check + // if clusters are compatible with the local position of the trigger cluster. + // This needs that the trigger cluster is at the edge of the trigger module + // and that the other cluster is on the compatible edge of its module + // - overlapExtents[6], overlapExtents[7], overlapExtents[10], overlapExtents[11] + // overlapExtents[8], overlapExtents[9], overlapExtents[12], overlapExtents[13] are filled for the phi overlapping elements + + + + Acts::Vector3 vertex(beamSpotVertex.x(), beamSpotVertex.y(), beamSpotVertex.z()); + constexpr int otherSideIndex{1}; + constexpr int maxEtaIndex{3}; + std::array<int,nNeighbours - 1> elementIndex{}; + int nElements = 0; + + // For the nNeighbours sides, fill elementIndex with the indices of the existing elements. + // Same the number of elements in nElements to loop on the later on + for (int n = 1; n != nNeighbours; ++n) { + if (elements[n]){ + elementIndex[nElements++] = n; + } + } + // return if all detector elements are nullptr + if(!nElements) return StatusCode::SUCCESS; + + const InDetDD::SiDetectorElement *triggerElement = elements[0]; + bool isEndcap = triggerElement->isEndcap(); + std::vector<StripInformationHelper> stripInfos; + stripInfos.reserve(sourceLinks[0].size()); + + std::vector<ATLASUncalibSourceLink> triggerSlinks; + triggerSlinks.reserve(sourceLinks[0].size()); + + // loop on all clusters on the trigger detector element and save the related information + for (auto &sourceLink_index : sourceLinks[0]){ + triggerSlinks.emplace_back(sourceLink_index.first); + } + + double limit = 1. + m_stripLengthTolerance; + double slimit = 0.; + + if (not m_allClusters){ + // Start processing the opposite side and the eta overlapping elements + int n = 0; + for (; n < nElements; ++n){ + int currentIndex = elementIndex[n]; + if (currentIndex > maxEtaIndex) + break; + + // get the detector element and the IdentifierHash + const InDetDD::SiDetectorElement *currentElement = elements[currentIndex]; + + // retrieve the range + double min = overlapExtents[currentIndex * 2 - 2]; + double max = overlapExtents[currentIndex * 2 - 1]; + + size_t minStrip, maxStrip = 0; + + if (m_stripGapParameter != 0.){ + updateRange(*triggerElement, *currentElement, slimit, min, max); + correctPolarRange(triggerElement, min, max, minStrip, maxStrip); + } + + StripInformationHelper currentStripInfo; + for (auto &sourceLink_index : sourceLinks[currentIndex]){ + const auto ¤tLocalPos = sourceLink_index.first.values(); + + const auto currentSlink = sourceLink_index.first; + for (auto triggerSlink : triggerSlinks){ + const auto &triggerLocalPos = triggerSlink.values(); + double diff = currentLocalPos(0, 0) - triggerLocalPos(0, 0); + if (diff < min || diff > max) + continue; + if (currentIndex == otherSideIndex){ + ATH_CHECK( makeSpacePoint(ctx, spacePoints, spBuilder, triggerSlink, currentSlink, triggerElement, + currentElement, limit, slimit, vertex)); + + } else { + ATH_CHECK(makeSpacePoint(ctx, overlapSpacePoints, spBuilder, triggerSlink, currentSlink, triggerElement, + currentElement, limit, slimit, vertex)); + } + } + } + } + // process the phi overlapping elements + // if possible n starts from 4 + for (; n < nElements; ++n){ + int currentIndex = elementIndex[n]; + const InDetDD::SiDetectorElement *currentElement = elements[currentIndex]; + double min = overlapExtents[4 * currentIndex - 10]; + double max = overlapExtents[4 * currentIndex - 9]; + + size_t minStrip, maxStrip = 0; + + if (m_stripGapParameter != 0.){ + updateRange(*triggerElement, *currentElement, slimit, min, max); + correctPolarRange(triggerElement, min, max, minStrip, maxStrip); + } + + std::vector<ATLASUncalibSourceLink> triggerPhiSlinks; + triggerSlinks.reserve(triggerSlinks.size()); + for (auto triggerSlink : triggerSlinks){ + auto centralValue = triggerSlink.values()(0, 0); + auto minValue = min; + auto maxValue = max; + if (isEndcap){ + size_t stripIndex = 0; + getStripEnds(triggerSlink, triggerElement, stripIndex); + centralValue = stripIndex; + minValue = minStrip; + maxValue = maxStrip; + } + if (minValue <= centralValue and centralValue <= maxValue){ + triggerPhiSlinks.emplace_back(triggerSlink); + } + } + if (triggerPhiSlinks.empty()) + continue; + min = overlapExtents[4 * currentIndex - 8]; + max = overlapExtents[4 * currentIndex - 7]; + if (m_stripGapParameter != 0.){ + updateRange(*triggerElement, *currentElement, slimit, min, max); + correctPolarRange(currentElement, min, max, minStrip, maxStrip); + } + + for (auto &sourceLink_index : sourceLinks[currentIndex]){ + const auto ¤tLocalPos = sourceLink_index.first.values(); + const auto currentSlink = sourceLink_index.first; + + size_t currentStripIndex = 0; + getStripEnds(currentSlink, currentElement, currentStripIndex); + auto centralValue = currentLocalPos(0, 0); + auto minValue = min; + auto maxValue = max; + if (isEndcap) { + centralValue = currentStripIndex; + minValue = minStrip; + maxValue = maxStrip; + } + if (centralValue < minValue or centralValue > maxValue) + continue; + for (auto &triggerSlink : triggerPhiSlinks) { + ATH_CHECK(makeSpacePoint(ctx, overlapSpacePoints, spBuilder, triggerSlink, currentSlink, triggerElement, + currentElement, limit, slimit, vertex)); + } + } + } + return StatusCode::SUCCESS; + + } // not m_allClusters + + for (int n = 0; n != nElements; ++n){ + + int currentIndex = elementIndex[n]; + const InDetDD::SiDetectorElement *currentElement = elements[currentIndex]; + + if (m_stripGapParameter != 0.){ + computeOffset(*triggerElement, *currentElement, slimit); + } + + for (auto &sourceLink_index : sourceLinks[currentIndex]){ + size_t currentStripIndex = 0; + getStripEnds(sourceLink_index.first, triggerElement, currentStripIndex); + const auto currentSlink = sourceLink_index.first; + + for (auto triggerSlink : triggerSlinks){ + if (currentIndex == otherSideIndex){ + ATH_CHECK(makeSpacePoint(ctx, spacePoints, spBuilder, triggerSlink, currentSlink, triggerElement, + currentElement, limit, slimit, vertex)); + }else{ + ATH_CHECK(makeSpacePoint(ctx, overlapSpacePoints, spBuilder, triggerSlink, currentSlink, triggerElement, + currentElement, limit, slimit, vertex)); + } + } + } + } + return StatusCode::SUCCESS; + } + + + StatusCode ActsCoreStripSpacePointFormationTool::makeSpacePoint(const EventContext &ctx, + std::vector<StripSP>& collection, + std::shared_ptr<Acts::SpacePointBuilder<StripSP>> spBuilder, + const ATLASUncalibSourceLink& currentSlink, + const ATLASUncalibSourceLink& anotherSlink, + const InDetDD::SiDetectorElement *currentElement, + const InDetDD::SiDetectorElement *anotherElement, + const double limit, + const double slimit, + const Acts::Vector3& vertex) const + { + + auto tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context(); + + size_t stripIndex = 0; + auto ends1 = getStripEnds(currentSlink, currentElement, stripIndex); + auto ends2 = getStripEnds(anotherSlink, anotherElement, stripIndex); + std::pair<Acts::Vector3, Acts::Vector3> ends1_acts; + std::pair<Acts::Vector3, Acts::Vector3> ends2_acts; + ends1_acts.first = ends1.first; + ends1_acts.second = ends1.second; + ends2_acts.first = ends2.first; + ends2_acts.second = ends2.second; + auto paramCovAccessor = [&](const Acts::SourceLink &slink) { + auto atlasSLink = slink.get<ATLASUncalibSourceLink>(); + Acts::BoundVector param = atlasSLink.values(); + Acts::BoundSymMatrix cov = atlasSLink.cov(); + return std::make_pair(param, cov); + }; + std::vector<Acts::SourceLink> slinks; + slinks.emplace_back(Acts::SourceLink{currentSlink}); + slinks.emplace_back(Acts::SourceLink{anotherSlink}); + + Acts::SpacePointBuilderOptions spOpt{std::make_pair(ends1_acts, ends2_acts), paramCovAccessor}; + spOpt.vertex = vertex; + spOpt.stripLengthTolerance = limit - 1; + spOpt.stripLengthGapTolerance = slimit; + + + spBuilder->buildSpacePoint(tgContext, slinks, spOpt, + std::back_inserter(collection)); + return StatusCode::SUCCESS; + } + +double ActsCoreStripSpacePointFormationTool::computeOffset(const InDetDD::SiDetectorElement& element1, + const InDetDD::SiDetectorElement& element2, + double& stripLengthGapTolerance) const +{ + // Get transformation matrices and center positions of detector elements + const Amg::Transform3D& t1 = element1.transform(); + const Amg::Transform3D& t2 = element2.transform(); + const Amg::Vector3D& c = element1.center(); + + // Check if first element is an annulus + bool isAnnulus = (element1.design().shape() == InDetDD::Annulus); + + // Compute x12 and radius of detector element + double x12 = t1.linear().col(0).dot(t2.linear().col(0)); + double r = isAnnulus ? c.perp() : std::sqrt(t1(0, 3) * t1(0, 3) + t1(1, 3) * t1(1, 3)); + + // Compute distance between detector elements in the direction of strips + Amg::Vector3D dPos = t1.translation() - t2.translation(); + double s = dPos.dot(t1.linear().col(2)); + + // Compute offset distance + double dm = (m_stripGapParameter * r) * std::abs(s * x12); + double d = isAnnulus ? dm / 0.04 : dm / std::sqrt((1. - x12) * (1. + x12)); + + // Adjust offset distance for z-component of transformation matrix + const double zComponentTolerance = 0.7; + if (std::abs(t1(2, 2)) > zComponentTolerance) + d *= (r / std::abs(t1(2, 3))); + + stripLengthGapTolerance = d; + + return dm; +} + + void ActsCoreStripSpacePointFormationTool::updateRange(const InDetDD::SiDetectorElement &element1, + const InDetDD::SiDetectorElement &element2, + double &stripLengthGapTolerance, + double &min, double &max) const + { + double dm = computeOffset(element1, element2, stripLengthGapTolerance); + min -= dm; + max += dm; + } + + void ActsCoreStripSpacePointFormationTool::correctPolarRange(const InDetDD::SiDetectorElement *element, + double &min, + double &max, + size_t &minStrip, + size_t &maxStrip) const + { + if (element->isBarrel()) + return; + + // design for endcap modules + const InDetDD::StripStereoAnnulusDesign *design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element->design()); + if (!design){ + ATH_MSG_FATAL("Invalid strip annulus design for module with identifier/identifierHash " << element->identify() << "/" << element->identifyHash()); + return; + } + + // converting min and max from cartesian reference frame to polar frame + auto firstPosition = (design->localPositionOfCell(design->strip1Dim(0, 0)) + + design->localPositionOfCell(design->strip1Dim(design->diodesInRow(0) - 1, 0))) * + 0.5; + + double radius = firstPosition.xEta(); + + InDetDD::SiCellId minCellId = element->cellIdOfPosition(InDetDD::SiLocalPosition(radius, min, 0.)); + InDetDD::SiCellId maxCellId = element->cellIdOfPosition(InDetDD::SiLocalPosition(radius, max, 0.)); + + if (not minCellId.isValid()) + minCellId = InDetDD::SiCellId(0); + + if (not maxCellId.isValid()) + maxCellId = InDetDD::SiCellId(design->diodesInRow(0) - 1); + + minStrip = minCellId.strip(); + maxStrip = maxCellId.strip(); + + // re-evaluate min and max in polar coordinate from the strip index + min = design->localPositionOfCellPC(minCellId).xPhi(); + max = design->localPositionOfCellPC(maxCellId).xPhi(); + + // depends on how the reference frame is oriented. If needed swap min and max + if (min > max) + std::swap(min, max); + + min -= 0.5 * design->phiPitchPhi(); + max += 0.5 * design->phiPitchPhi(); + } + + std::pair<Amg::Vector3D, Amg::Vector3D> + ActsCoreStripSpacePointFormationTool::getStripEnds(ATLASUncalibSourceLink sourceLink, + const InDetDD::SiDetectorElement *element, + size_t &stripIndex) const + { + const auto &localPos = sourceLink.values(); + + auto cluster = dynamic_cast<const xAOD::StripCluster *>(&sourceLink.atlasHit()); + if(!cluster){ + ATH_MSG_FATAL("Could not cast UncalibratedMeasurement as StripCluster"); + return {}; + } + if (element->isEndcap()) { + // design for endcap modules + const InDetDD::StripStereoAnnulusDesign *design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element->design()); + if (!design){ + ATH_MSG_FATAL("Invalid strip annulus design for module with identifier/identifierHash " << element->identify() << "/" << element->identifyHash()); + return {}; + } + + // calculate phi pitch for evaluating the strip index + double phiPitchPhi = design->phiWidth()/design->diodesInRow(0); + stripIndex = -std::floor(localPos(0, 0) / phiPitchPhi) + design->diodesInRow(0) *0.5 - 0.5; + + std::pair<Amg::Vector3D, Amg::Vector3D > ends = { + element->globalPosition(design->stripPosAtR(stripIndex, 0, design->minR())), + element->globalPosition(design->stripPosAtR(stripIndex, 0, design->maxR())) + }; + return ends; + } + + InDetDD::SiLocalPosition localPosition(0., localPos(0, 0), 0.); + std::pair<Amg::Vector3D, Amg::Vector3D> ends(element->endsOfStrip(localPosition)); + return ends; + } + +} diff --git a/Tracking/Acts/ActsDataPreparation/src/ActsCoreStripSpacePointFormationTool.h b/Tracking/Acts/ActsDataPreparation/src/ActsCoreStripSpacePointFormationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d2773485620aa09b25a292bfbfeac2136fa8ebfb --- /dev/null +++ b/Tracking/Acts/ActsDataPreparation/src/ActsCoreStripSpacePointFormationTool.h @@ -0,0 +1,114 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSTRK_DATAPREPARATION_ACTSCORESTRIPSPACEPOINTFORMATIONTOOL_H +#define ACTSTRK_DATAPREPARATION_ACTSCORESTRIPSPACEPOINTFORMATIONTOOL_H + +#include "ActsTrkEventCnv/IActsToTrkConverterTool.h" +#include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" + +#include "AthenaBaseComps/AthAlgTool.h" +#include "ActsTrkToolInterfaces/IStripSpacePointFormationTool.h" +#include "StripInformationHelper.h" +#include "InDetReadoutGeometry/SiDetectorElementCollection.h" +#include "SiSpacePointFormation/SiElementPropertiesTable.h" +#include "xAODInDetMeasurement/StripClusterContainer.h" +#include "Acts/SpacePointFormation/SpacePointBuilder.hpp" +#include "ActsGeometry/ATLASSourceLink.h" +#include "InDetIdentifier/SCT_ID.h" + +#include <string> + +namespace ActsTrk { + /// @class ActsCoreStripSpacePointFormationTool + /// Tool to produce strip space points using ACTS SP builder. + /// Strip space points are made by combining clusters (obtained from SourceLinks) + /// from pairs of overlapping detectors. The access to overlapping detector elements is + /// possible using the ContainerAccessor. + /// The user can choose just to process the detector element and + /// its opposite on the stereo layer, or also to consider overlaps with the + /// four nearest neighbours of the opposite elements. + /// + /// Space points are then recorded to storege as StripSP, and then + /// stored as xAOD::SpacePoint in StripSpacePointFormationAlg + + class ActsCoreStripSpacePointFormationTool: public extends<AthAlgTool, ActsTrk::IStripSpacePointFormationTool> { + public: + ActsCoreStripSpacePointFormationTool(const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual ~ActsCoreStripSpacePointFormationTool() = default; + + virtual StatusCode initialize() override; + + virtual StatusCode produceSpacePoints( const EventContext& ctx, + const xAOD::StripClusterContainer& clusterContainer, + const InDet::SiElementPropertiesTable& properties, + const InDetDD::SiDetectorElementCollection& elements, + const Amg::Vector3D& beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints, + bool processOverlaps ) const override; + + private: + + StatusCode fillSpacePoints(const EventContext& ctx, + std::shared_ptr<Acts::SpacePointBuilder<StripSP>> spBuilder, + std::array<const InDetDD::SiDetectorElement*,nNeighbours> neighbourElements, + std::array<std::vector<std::pair<ATLASUncalibSourceLink, size_t>>,nNeighbours> neighbourSourceLinks, + std::array<double, 14> overlapExtents, + const Amg::Vector3D& beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints ) const; + + StatusCode makeSpacePoint(const EventContext& ctx, + std::vector<StripSP>& collection, + std::shared_ptr<Acts::SpacePointBuilder<StripSP>> spBuilder, + const ATLASUncalibSourceLink& currentSlink, + const ATLASUncalibSourceLink& anotherSlink, + const InDetDD::SiDetectorElement* currentElement, + const InDetDD::SiDetectorElement* anotherElement, + const double limit, + const double slimit, + const Acts::Vector3& vertex) const; + + void updateRange(const InDetDD::SiDetectorElement& element1, + const InDetDD::SiDetectorElement& element2, + double& stripLengthGapTolerance, double& min, double& max) const; + + double computeOffset(const InDetDD::SiDetectorElement& element1, + const InDetDD::SiDetectorElement& element2, + double& stripLengthGapTolerance) const; + + void correctPolarRange(const InDetDD::SiDetectorElement* element, + double& min, double& max, + size_t& minStrip, size_t& maxStrip) const; + + std::pair<Amg::Vector3D, Amg::Vector3D > getStripEnds(const xAOD::StripCluster* cluster, + const InDetDD::SiDetectorElement* element, + size_t& stripIndex) const; + std::pair<Amg::Vector3D, Amg::Vector3D > getStripEnds(ATLASUncalibSourceLink sourceLink, + const InDetDD::SiDetectorElement* element, + size_t& stripIndex) const; + const SCT_ID* m_stripId{}; + + ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retreive Lorentz angle of SCT"}; + ToolHandle<IActsToTrkConverterTool> m_ATLASConverterTool{this, "ConverterTool", "ActsToTrkConverterTool"}; + ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"}; + + Gaudi::Property<bool> m_allClusters{this, "AllClusters", false, "Process all clusters without limits."}; + Gaudi::Property<float> m_overlapLimitOpposite{this, "OverlapLimitOpposite", 2.8, "Overlap limit for opposite-neighbour."}; + Gaudi::Property<float> m_overlapLimitPhi{this, "OverlapLimitPhi", 5.64, "Overlap limit for phi-neighbours."}; + Gaudi::Property<float> m_overlapLimitEtaMin{this, "OverlapLimitEtaMin", 1.68, "Low overlap limit for eta-neighbours."}; + Gaudi::Property<float> m_overlapLimitEtaMax{this, "OverlapLimitEtaMax", 3.0, "High overlap limit for eta-neighbours."}; + Gaudi::Property<float> m_stripLengthTolerance{this, "StripLengthTolerance", 0.01}; + Gaudi::Property<float> m_stripGapParameter{this, "StripGapParameter", 0.0015, "Recommend 0.001 - 0.0015 for ITK geometry"}; + + + }; + +} + +#endif // ACTSTRKSPACEPOINTFORMATIONTOOL_ACTSCORESTRIPSPACEPOINTFORMATIONTOOL_H diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsPixelClusteringTool.cxx b/Tracking/Acts/ActsDataPreparation/src/ActsPixelClusteringTool.cxx similarity index 86% rename from Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsPixelClusteringTool.cxx rename to Tracking/Acts/ActsDataPreparation/src/ActsPixelClusteringTool.cxx index 2af700c98e7b8b4687aa9bf64513427f631cd579..f10d9b696a85e18910ee4139d6bb6e5148ec10f0 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsPixelClusteringTool.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/ActsPixelClusteringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "ActsPixelClusteringTool.h" @@ -45,10 +45,11 @@ PixelClusteringTool::PixelClusteringTool( } StatusCode + PixelClusteringTool::makeCluster(const PixelClusteringTool::Cluster &cluster, const PixelID& pixelID, const InDetDD::SiDetectorElement* element, - xAOD::PixelClusterContainer& container) const + xAOD::PixelCluster& xaodcluster) const { const InDetDD::PixelModuleDesign& design = dynamic_cast<const InDetDD::PixelModuleDesign&>(element->design()); @@ -114,7 +115,7 @@ PixelClusteringTool::makeCluster(const PixelClusteringTool::Cluster &cluster, // N.B. the cluster is automatically added to the container xAOD::PixelCluster *cl = m_clusterMakerTool->xAODpixelCluster( - container, + xaodcluster, pos_acc, cluster.ids, cluster.lvl1min, @@ -152,8 +153,18 @@ PixelClusteringTool::clusterize(const InDetRawDataCollection<PixelRDORawData>& R Acts::Ccl::createClusters<CellCollection, ClusterCollection, 2> (cells, Acts::Ccl::DefaultConnect<Cell, 2>(m_addCorners)); - for (const Cluster& cluster : clusters) - ATH_CHECK(makeCluster(cluster, pixelID, element, container)); + std::size_t previousSizeContainer = container.size(); + // Fast insertion trick + std::vector<xAOD::PixelCluster*> toAddCollection; + toAddCollection.reserve(clusters.size()); + for (std::size_t i(0); i<clusters.size(); ++i) + toAddCollection.push_back(new xAOD::PixelCluster()); + container.insert(container.end(), toAddCollection.begin(), toAddCollection.end()); + + for (std::size_t i(0); i<clusters.size(); ++i) { + const Cluster& cluster = clusters[i]; + ATH_CHECK(makeCluster(cluster, pixelID, element, *container[previousSizeContainer+i])); + } return StatusCode::SUCCESS; } diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsPixelClusteringTool.h b/Tracking/Acts/ActsDataPreparation/src/ActsPixelClusteringTool.h similarity index 91% rename from Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsPixelClusteringTool.h rename to Tracking/Acts/ActsDataPreparation/src/ActsPixelClusteringTool.h index 7de50570d84db935def22cac9117554404f20428..637c74cfc7598bed693ae7a92ac967313604f707 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsPixelClusteringTool.h +++ b/Tracking/Acts/ActsDataPreparation/src/ActsPixelClusteringTool.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTS_PIXEL_CLUSTERING_TOOL_H -#define ACTS_PIXEL_CLUSTERING_TOOL_H +#ifndef ACTSTRK_DATAPREPARATION_PIXEL_CLUSTERING_TOOL_H +#define ACTSTRK_DATAPREPARATION_PIXEL_CLUSTERING_TOOL_H #include "ActsTrkToolInterfaces/IPixelClusteringTool.h" @@ -68,7 +68,7 @@ private: StatusCode makeCluster(const PixelClusteringTool::Cluster &cluster, const PixelID& pixelID, const InDetDD::SiDetectorElement* element, - xAOD::PixelClusterContainer& container) const; + xAOD::PixelCluster& container) const; BooleanProperty m_addCorners{this, "AddCorners", true}; ToolHandle<InDet::PixelRDOTool> m_pixelRDOTool {this, "PixelRDOTool", "InDet::PixelRDOTool"}; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsStripClusteringTool.cxx b/Tracking/Acts/ActsDataPreparation/src/ActsStripClusteringTool.cxx similarity index 90% rename from Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsStripClusteringTool.cxx rename to Tracking/Acts/ActsDataPreparation/src/ActsStripClusteringTool.cxx index aea65955213b16cdbf16ab63f1bf3a819d0c68f8..b687103cdb58119970f16a56cc29b1b7d0cda627 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsStripClusteringTool.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/ActsStripClusteringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "ActsStripClusteringTool.h" @@ -90,17 +90,26 @@ StripClusteringTool::clusterize(const InDetRawDataCollection<StripRDORawData>& R ClusterCollection clusters = Acts::Ccl::createClusters<CellCollection, ClusterCollection, 1>(cells); + std::size_t previousSizeContainer = container.size(); + // Fast insertion trick + std::vector<xAOD::StripCluster*> toAddCollection; + toAddCollection.reserve(clusters.size()); + for (std::size_t i(0); i<clusters.size(); ++i) + toAddCollection.push_back(new xAOD::StripCluster()); + container.insert(container.end(), toAddCollection.begin(), toAddCollection.end()); + double lorentzShift = m_lorentzAngleTool->getLorentzShift(element->identifyHash()); - for (Cluster& cl : clusters) { + for (std::size_t i(0); i<clusters.size(); ++i) { + Cluster& cl = clusters[i]; // Bad strips on a module invalidates the hitsInThirdTimeBin word. // Therefore set it to 0 if that's the case. if (badStripOnModule) { cl.hitsInThirdTimeBin = 0; } try { - ATH_CHECK(makeCluster(cl, lorentzShift, stripID, element, container)); + ATH_CHECK(makeCluster(cl, lorentzShift, stripID, element, *container[previousSizeContainer+i])); } catch (const std::exception& e) { ATH_MSG_FATAL("Exception thrown while creating xAOD::StripCluster:" << e.what()); @@ -162,20 +171,17 @@ StripClusteringTool::makeCluster(const Cluster &cluster, double lorentzShift, const StripID& stripID, const InDetDD::SiDetectorElement* element, - xAOD::StripClusterContainer& container) const + xAOD::StripCluster& cl) const { IdentifierHash idHash = element->identifyHash(); auto [localPos, localCov, globalPos] = computePosition(cluster, lorentzShift, stripID, element); - xAOD::StripCluster *cl = new xAOD::StripCluster(); - container.push_back(cl); - cl->setMeasurement<1>(idHash, localPos, localCov); - cl->globalPosition() = globalPos; - cl->setRDOlist(cluster.ids); - cl->setChannelsInPhi(cluster.ids.size()); - cl->setHitsInThirdTimeBin(cluster.hitsInThirdTimeBin); + cl.setMeasurement<1>(idHash, localPos, localCov); + cl.globalPosition() = globalPos; + cl.setRDOlist(cluster.ids); + cl.setChannelsInPhi(cluster.ids.size()); return StatusCode::SUCCESS; } @@ -256,10 +262,4 @@ StripClusteringTool::unpackRDOs(const InDetRawDataCollection<StripRDORawData>& R return std::make_pair(cells, badStripOnModule); } -StatusCode StripClusteringTool::finalize() -{ - ATH_MSG_DEBUG("Finalizing " << name() << "..."); - return StatusCode::SUCCESS; -} - } // namespace ActsTrk diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsStripClusteringTool.h b/Tracking/Acts/ActsDataPreparation/src/ActsStripClusteringTool.h similarity index 92% rename from Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsStripClusteringTool.h rename to Tracking/Acts/ActsDataPreparation/src/ActsStripClusteringTool.h index e6096b0788cf4eda65c359d0e20ee6c19896e5a3..33b52e3a7863f3701b3f52c57fb39bbd769f7aba 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/ActsStripClusteringTool.h +++ b/Tracking/Acts/ActsDataPreparation/src/ActsStripClusteringTool.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTS_STRIP_CLUSTERING_TOOL_H -#define ACTS_STRIP_CLUSTERING_TOOL_H +#ifndef ACTSTRK_DATAPREPARATION_STRIP_CLUSTERING_TOOL_H +#define ACTSTRK_DATAPREPARATION_STRIP_CLUSTERING_TOOL_H #include <optional> #include <vector> @@ -52,7 +52,6 @@ public: const IInterface* parent); virtual StatusCode initialize() override; - virtual StatusCode finalize() override; virtual StatusCode clusterize(const InDetRawDataCollection<StripRDORawData>& RDOs, @@ -82,7 +81,7 @@ private: double LorentzShift, const StripID& stripID, const InDetDD::SiDetectorElement* element, - xAOD::StripClusterContainer& container) const; + xAOD::StripCluster& container) const; StringProperty m_timeBinStr{this, "timeBins", ""}; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripSpacePointFormationTool.cxx b/Tracking/Acts/ActsDataPreparation/src/ActsTrkStripSpacePointFormationTool.cxx similarity index 93% rename from Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripSpacePointFormationTool.cxx rename to Tracking/Acts/ActsDataPreparation/src/ActsTrkStripSpacePointFormationTool.cxx index 0715ec2027f2025aed295d32da0fe04f076e7fad..d0276ba560b2bdfff3ecb12d2f5588d54d59e0fb 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripSpacePointFormationTool.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/ActsTrkStripSpacePointFormationTool.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "StripSpacePointFormationTool.h" +#include "ActsTrkStripSpacePointFormationTool.h" #include "InDetIdentifier/SCT_ID.h" #include "ReadoutGeometryBase/SiCellId.h" #include "InDetCondTools/ISiLorentzAngleTool.h" @@ -13,13 +13,13 @@ namespace ActsTrk { - StripSpacePointFormationTool::StripSpacePointFormationTool(const std::string& type, + ActsTrkStripSpacePointFormationTool::ActsTrkStripSpacePointFormationTool(const std::string& type, const std::string& name, const IInterface* parent) : base_class(type, name, parent) {} - StatusCode StripSpacePointFormationTool::initialize() { + StatusCode ActsTrkStripSpacePointFormationTool::initialize() { ATH_CHECK(detStore()->retrieve(m_stripId,"SCT_ID")); @@ -28,15 +28,16 @@ namespace ActsTrk { return StatusCode::SUCCESS; } - StatusCode StripSpacePointFormationTool::produceStripSpacePoints(const xAOD::StripClusterContainer& clusterContainer, - const InDet::SiElementPropertiesTable& properties, - const InDetDD::SiDetectorElementCollection& elements, - const Amg::Vector3D& beamSpotVertex, - std::vector<StripSP>& spacePoints, - std::vector<StripSP>& overlapSpacePoints, - bool processOverlaps) const + StatusCode ActsTrkStripSpacePointFormationTool::produceSpacePoints(const EventContext& , + const xAOD::StripClusterContainer& clusterContainer, + const InDet::SiElementPropertiesTable& properties, + const InDetDD::SiDetectorElementCollection& elements, + const Amg::Vector3D& beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints, + bool processOverlaps) const { - /// Production of ActsTrk::SpacePoint from strip clusters + /// Production of StripSP from strip clusters /// Strip space points involves a more complex logic since /// they are made combining clusters from pairs of /// overlapping detectors. @@ -212,7 +213,7 @@ namespace ActsTrk { } StatusCode - StripSpacePointFormationTool::fillStripSpacePoints( + ActsTrkStripSpacePointFormationTool::fillStripSpacePoints( const std::array<const InDetDD::SiDetectorElement*, nNeighbours>& elements, const std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>, nNeighbours>& clusters, const std::array<double, 14>& overlapExtents, @@ -395,7 +396,7 @@ namespace ActsTrk { } return StatusCode::SUCCESS; } - + for(int n=0; n!=nElements; ++n) { int currentIndex = elementIndex[n]; @@ -423,9 +424,8 @@ namespace ActsTrk { } return StatusCode::SUCCESS; } - - StatusCode StripSpacePointFormationTool::makeStripSpacePoint( + StatusCode ActsTrkStripSpacePointFormationTool::makeStripSpacePoint( std::vector<StripSP>& collection, const StripInformationHelper& firstInfo, const StripInformationHelper& secondInfo, @@ -517,8 +517,7 @@ namespace ActsTrk { return StatusCode::SUCCESS; } - - double StripSpacePointFormationTool::offset(const InDetDD::SiDetectorElement* element1, + double ActsTrkStripSpacePointFormationTool::offset(const InDetDD::SiDetectorElement* element1, const InDetDD::SiDetectorElement* element2, double& stripLengthGapTolerance) const { @@ -541,7 +540,7 @@ namespace ActsTrk { return dm; } - void StripSpacePointFormationTool::updateRange(const InDetDD::SiDetectorElement* element1, + void ActsTrkStripSpacePointFormationTool::updateRange(const InDetDD::SiDetectorElement* element1, const InDetDD::SiDetectorElement* element2, double& stripLengthGapTolerance, double& min, double& max) const @@ -551,7 +550,7 @@ namespace ActsTrk { max += dm; } - void StripSpacePointFormationTool::correctPolarRange(const InDetDD::SiDetectorElement* element, + void ActsTrkStripSpacePointFormationTool::correctPolarRange(const InDetDD::SiDetectorElement* element, double& min, double& max, size_t& minStrip, @@ -602,12 +601,11 @@ namespace ActsTrk { } std::pair<Amg::Vector3D, Amg::Vector3D > - StripSpacePointFormationTool::getStripEnds(const xAOD::StripCluster* cluster, + ActsTrkStripSpacePointFormationTool::getStripEnds(const xAOD::StripCluster* cluster, const InDetDD::SiDetectorElement* element, size_t& stripIndex) const { const Eigen::Matrix<float,1,1>& localPos = cluster->localPosition<1>(); - InDetDD::SiLocalPosition localPosition(0., localPos(0, 0), 0.); if (element->isEndcap()) { // design for endcap modules @@ -618,22 +616,21 @@ namespace ActsTrk { return std::pair<Amg::Vector3D, Amg::Vector3D >(); } - auto& rdoList = cluster->rdoList(); - // obtain cluster information to evaluate position on the readout - const Identifier& firstStripId = rdoList.front(); - int firstStrip = m_stripId->strip(firstStripId); - int stripRow = m_stripId->row(firstStripId); - int clusterSizeInStrips = cluster->channelsInPhi(); - // Evaluate position on the readout from first strip and cluster width - auto clusterPosition = design->localPositionOfCluster(design->strip1Dim(firstStrip, stripRow), clusterSizeInStrips); - double shift = m_lorentzAngleTool->getLorentzShift(element->identifyHash()); - localPosition = InDetDD::SiLocalPosition(clusterPosition.xEta(), clusterPosition.xPhi()+shift, 0.); - - auto cellid = design->cellIdOfPosition(localPosition); - stripIndex = cellid.strip(); + // calculate phi pitch for evaluating the strip index + double phiPitchPhi = design->phiWidth()/design->diodesInRow(0); + stripIndex = -std::floor(localPos(0, 0) / phiPitchPhi) + design->diodesInRow(0) *0.5 - 0.5; + + std::pair<Amg::Vector3D, Amg::Vector3D > ends = { + element->globalPosition(design->stripPosAtR(stripIndex, 0, design->minR())), + element->globalPosition(design->stripPosAtR(stripIndex, 0, design->maxR())) + }; + return ends; + } + InDetDD::SiLocalPosition localPosition(0., localPos(0, 0), 0.); std::pair<Amg::Vector3D, Amg::Vector3D > ends(element->endsOfStrip(localPosition)); + return ends; } } diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripSpacePointFormationTool.h b/Tracking/Acts/ActsDataPreparation/src/ActsTrkStripSpacePointFormationTool.h similarity index 78% rename from Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripSpacePointFormationTool.h rename to Tracking/Acts/ActsDataPreparation/src/ActsTrkStripSpacePointFormationTool.h index fd1be3418cc51ba55c41a7befac45e07ba58e879..63b3e7f02d00b095f200d5d6bf4a954153f1b5d2 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripSpacePointFormationTool.h +++ b/Tracking/Acts/ActsDataPreparation/src/ActsTrkStripSpacePointFormationTool.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKSPACEPOINTFORMATIONTOOL_STRIPSPACEPOINTFORMATIONTOOL_H -#define ACTSTRKSPACEPOINTFORMATIONTOOL_STRIPSPACEPOINTFORMATIONTOOL_H +#ifndef ACTSTRK_DATAPREPARATION_ACTSTRKSTRIPSPACEPOINTFORMATIONTOOL_H +#define ACTSTRK_DATAPREPARATION_ACTSTRKSTRIPSPACEPOINTFORMATIONTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "ActsTrkToolInterfaces/IStripSpacePointFormationTool.h" @@ -20,7 +20,7 @@ class SCT_ID; namespace ActsTrk { - /// @class StripSpacePointFormationTool + /// @class ActsTrkStripSpacePointFormationTool /// Tool to produce strip space points. /// Strip space points are made by combining clusters from pairs of /// overlapping detectors. The access to overlapping detector elements is @@ -29,32 +29,29 @@ namespace ActsTrk { /// its opposite on the stereo layer, or also to consider overlaps with the /// four nearest neighbours of the opposite elements. /// - /// Space points are then recorded to storegate as ActsTrk::SpacePoint - /// into an ActsTrk::SpacePointContainer. + /// Space points are then recorded to storegate as StripSP - /// @brief Total number of neightbours and indices - enum NeighbourIndices{ThisOne, Opposite, PhiMinus, PhiPlus, EtaMinus, EtaPlus, nNeighbours}; - - class StripSpacePointFormationTool: public extends<AthAlgTool, ActsTrk::IStripSpacePointFormationTool> { + class ActsTrkStripSpacePointFormationTool: public extends<AthAlgTool, ActsTrk::IStripSpacePointFormationTool> { public: /// @name AthAlgTool methods //@{ - StripSpacePointFormationTool(const std::string& type, + ActsTrkStripSpacePointFormationTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~StripSpacePointFormationTool() = default; + virtual ~ActsTrkStripSpacePointFormationTool() = default; virtual StatusCode initialize() override; //@} /// @name Production of space points //@{ - virtual StatusCode produceStripSpacePoints(const xAOD::StripClusterContainer& clusterContainer, - const InDet::SiElementPropertiesTable& properties, - const InDetDD::SiDetectorElementCollection& elements, - const Amg::Vector3D& beamSpotVertex, - std::vector<StripSP>& spacePoints, - std::vector<StripSP>& overlapSpacePoints, - bool processOverlaps) const override; + virtual StatusCode produceSpacePoints(const EventContext& ctx, + const xAOD::StripClusterContainer& clusterContainer, + const InDet::SiElementPropertiesTable& properties, + const InDetDD::SiDetectorElementCollection& elements, + const Amg::Vector3D& beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints, + bool processOverlaps) const override; //@} private: @@ -62,8 +59,8 @@ namespace ActsTrk { /// @name Production of space points //@{ StatusCode - fillStripSpacePoints(const std::array<const InDetDD::SiDetectorElement*, nNeighbours>& neighbourElements, - const std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>, nNeighbours>& neighbourClusters, + fillStripSpacePoints(const std::array<const InDetDD::SiDetectorElement*,nNeighbours>& neighbourElements, + const std::array<std::vector<std::pair<const xAOD::StripCluster*, size_t>>,nNeighbours>& neighbourClusters, const std::array<double, 14>& overlapExtents, const Amg::Vector3D& beamSpotVertex, std::vector<StripSP>& spacePoints, @@ -128,4 +125,4 @@ namespace ActsTrk { } -#endif // ACTSTRKSPACEPOINTFORMATIONTOOL_STRIPSPACEPOINTFORMATIONTOOL_H +#endif // ACTSTRKSPACEPOINTFORMATIONTOOL_ACTSTRKSTRIPSPACEPOINTFORMATIONTOOL_H diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/PixelClusterizationAlg.cxx b/Tracking/Acts/ActsDataPreparation/src/PixelClusterizationAlg.cxx similarity index 61% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/PixelClusterizationAlg.cxx rename to Tracking/Acts/ActsDataPreparation/src/PixelClusterizationAlg.cxx index 549bc74b97d4bb30a100d00ffb457883ad73a8ca..b64248c44afcfc37b5fd936dcd6aa947d5b91e9a 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/PixelClusterizationAlg.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/PixelClusterizationAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "PixelClusterizationAlg.h" #include "AthenaMonitoringKernel/Monitored.h" @@ -31,23 +31,27 @@ StatusCode PixelClusterizationAlg::execute(const EventContext& ctx) const auto timer = Monitored::Timer<std::chrono::milliseconds>( "TIME_execute" ); auto mon = Monitored::Group( m_monTool, timer ); - SG::ReadHandle<PixelRDO_Container> rdoContainer(m_rdoContainerKey, ctx); + SG::ReadHandle<PixelRDO_Container> rdoContainer = SG::makeHandle(m_rdoContainerKey, ctx); ATH_CHECK(rdoContainer.isValid()); SG::WriteHandle<xAOD::PixelClusterContainer> clusterHandle = SG::makeHandle(m_clusterContainerKey, ctx); - ATH_CHECK(clusterHandle.record(std::make_unique<xAOD::PixelClusterContainer>(), - std::make_unique<xAOD::PixelClusterAuxContainer>())); + std::unique_ptr<xAOD::PixelClusterContainer> pixelContainer = std::make_unique<xAOD::PixelClusterContainer>(); + std::unique_ptr<xAOD::PixelClusterAuxContainer> pixelAuxContainer = std::make_unique<xAOD::PixelClusterAuxContainer>(); + pixelContainer->setStore(pixelAuxContainer.get()); + + // Reserve space, estimate of mean clusters to reduce re-allocations + pixelContainer->reserve( m_expectedClustersPerRDO.value() * rdoContainer->size() ); for (const InDetRawDataCollection<PixelRDORawData> *rdos: *rdoContainer) { if (rdos != nullptr && !rdos->empty()) - ATH_CHECK(m_clusteringTool->clusterize(*rdos, *m_idHelper, ctx, *clusterHandle)); + ATH_CHECK(m_clusteringTool->clusterize(*rdos, *m_idHelper, ctx, *pixelContainer.get())); else ATH_MSG_DEBUG("No input RDOs for this container element"); } - + ATH_CHECK(clusterHandle.record(std::move(pixelContainer), std::move(pixelAuxContainer))); return StatusCode::SUCCESS; } diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/PixelClusterizationAlg.h b/Tracking/Acts/ActsDataPreparation/src/PixelClusterizationAlg.h similarity index 71% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/PixelClusterizationAlg.h rename to Tracking/Acts/ActsDataPreparation/src/PixelClusterizationAlg.h index fb72fcd29da02292727fe88dc7fb44269004e69e..74650ba001664105d40f426acd5ca4e06ae33efb 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/PixelClusterizationAlg.h +++ b/Tracking/Acts/ActsDataPreparation/src/PixelClusterizationAlg.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKCLUSTERIZATION_PIXELCLUSTERIZATIONALG_H -#define ACTSTRKCLUSTERIZATION_PIXELCLUSTERIZATIONALG_H +#ifndef ACTSTRK_DATAPREPARATION_PIXELCLUSTERIZATIONALG_H +#define ACTSTRK_DATAPREPARATION_PIXELCLUSTERIZATIONALG_H #include <ActsTrkToolInterfaces/IPixelClusteringTool.h> #include <AthenaBaseComps/AthReentrantAlgorithm.h> @@ -35,6 +35,12 @@ private: ToolHandle<IPixelClusteringTool> m_clusteringTool {this, "PixelClusteringTool", "", "Pixel Clustering Tool"}; ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "", "Monitoring tool"}; + // expected number of clusters for RDO + // This values is used for reserving enough memory of the cluster container + // reserve = m_expectedClustersPerRDO * nRDOs + // The default values has been computed on a tt-bar PU200 sample comparing the memory usage and the container capacity + Gaudi::Property<int> m_expectedClustersPerRDO {this, "expectedClustersPerRDO", 32, "Expected number of clusters for RDO"}; + const PixelID* m_idHelper = nullptr; }; diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/PixelSpacePointFormationAlg.cxx b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationAlg.cxx similarity index 100% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/PixelSpacePointFormationAlg.cxx rename to Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationAlg.cxx diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/PixelSpacePointFormationAlg.h b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationAlg.h similarity index 96% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/PixelSpacePointFormationAlg.h rename to Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationAlg.h index 6a8a5ed2e8827a277279d29e7f747836cb333a6e..fc46d73ce01fdd324e9ea8cc1b7b7072764c7974 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/PixelSpacePointFormationAlg.h +++ b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationAlg.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKSPACEPOINTFORMATION_PIXELSPACEPOINTFORMATIONALG_H -#define ACTSTRKSPACEPOINTFORMATION_PIXELSPACEPOINTFORMATIONALG_H +#ifndef ACTSTRK_DATAPREPARATION_PIXELSPACEPOINTFORMATIONALG_H +#define ACTSTRK_DATAPREPARATION_PIXELSPACEPOINTFORMATIONALG_H #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/PixelSpacePointFormationTool.cxx b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationTool.cxx similarity index 56% rename from Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/PixelSpacePointFormationTool.cxx rename to Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationTool.cxx index 33c023c593b3432e7edafeaafac9e0c7338e7d64..74f23451c2efa3a4a1708f128bab383b5301ca14 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/PixelSpacePointFormationTool.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationTool.cxx @@ -29,29 +29,8 @@ namespace ActsTrk { const std::vector<std::size_t>& measIndexes, const InDetDD::SiDetectorElement& element) const { - // evaluate the cluster width for space point covariance evaluation - const InDetDD::PixelModuleDesign* design - (dynamic_cast<const InDetDD::PixelModuleDesign*>(&element.design())); - if (not design){ - ATH_MSG_ERROR("Cast to InDetDD::PixelModuleDesign failed."); - return StatusCode::FAILURE; - } - - // Implementing space point covariance calculation as defined in - // InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/ITkSiSpacePointForSeed.cxx - // SiSpacePointForSeed::set(const Trk::SpacePoint*const& sp,const float* r) - - auto rdoList = cluster.rdoList(); - auto min_max = - std::minmax_element(rdoList.begin(), rdoList.end(), - [this] (Identifier const& lh, Identifier const& rh) { - return m_pixelId->eta_index(lh) < m_pixelId->eta_index(rh); - }); - - // this is the width expressed in mm - float width = - design->widthFromColumnRange(m_pixelId->eta_index(*min_max.first), - m_pixelId->eta_index(*min_max.second)); + // this is the width expressed in mm + float width = cluster.widthInEta(); // using width to scale the cluster covariance for space points float covTerm = width*width*s_oneOverTwelve; @@ -61,8 +40,8 @@ namespace ActsTrk { // use xz, yz, zz terms of rotation matrix to scale the covariance term const Amg::Transform3D &Tp = element.surface().transform(); - float cov_z = 6.*covTerm*(float(Tp(0, 2))*float(Tp(0, 2))+float(Tp(1, 2))*float(Tp(1, 2))); - float cov_r = 6.*covTerm*(float(Tp(2, 2))*float(Tp(2, 2))); + float cov_z = 6.*covTerm*static_cast<float>(Tp(0, 2)*Tp(0, 2)+Tp(1, 2)*Tp(1, 2)); + float cov_r = 6.*covTerm*static_cast<float>(Tp(2, 2)*Tp(2, 2)); sp.setSpacePoint(cluster.identifierHash(), cluster.globalPosition(), diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/PixelSpacePointFormationTool.h b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationTool.h similarity index 92% rename from Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/PixelSpacePointFormationTool.h rename to Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationTool.h index 1b1206c4191a76bbac5c49d3bc427f08d55c710b..8a7b712f6582f799086c0ae473488289e3924c6a 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/PixelSpacePointFormationTool.h +++ b/Tracking/Acts/ActsDataPreparation/src/PixelSpacePointFormationTool.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKSPACEPOINTFORMATIONTOOL_PIXELSPACEPOINTFORMATIONTOOL_H -#define ACTSTRKSPACEPOINTFORMATIONTOOL_PIXELSPACEPOINTFORMATIONTOOL_H +#ifndef ACTSTRK_DATAPREPARATION_PIXELSPACEPOINTFORMATIONTOOL_H +#define ACTSTRK_DATAPREPARATION_PIXELSPACEPOINTFORMATIONTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "ActsTrkToolInterfaces/IPixelSpacePointFormationTool.h" diff --git a/Tracking/Acts/ActsDataPreparation/src/StripClusterizationAlg.cxx b/Tracking/Acts/ActsDataPreparation/src/StripClusterizationAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1866514ed403cf8ed23c235b07dd4fbee4ab6cb5 --- /dev/null +++ b/Tracking/Acts/ActsDataPreparation/src/StripClusterizationAlg.cxx @@ -0,0 +1,109 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "StripClusterizationAlg.h" + +#include <AthenaMonitoringKernel/Monitored.h> +#include <xAODInDetMeasurement/StripClusterAuxContainer.h> + +namespace ActsTrk { + +StripClusterizationAlg::StripClusterizationAlg(const std::string& name, + ISvcLocator* pSvcLocator) + : AthReentrantAlgorithm(name, pSvcLocator) {} + +StatusCode StripClusterizationAlg::initialize() { + ATH_MSG_DEBUG("Initializing " << name() << "... "); + + ATH_CHECK(m_rdoContainerKey.initialize()); + ATH_CHECK(m_stripDetElStatus.initialize(!m_stripDetElStatus.empty())); + ATH_CHECK(m_stripDetEleCollKey.initialize()); + ATH_CHECK(m_clusterContainerKey.initialize()); + ATH_CHECK(m_clusteringTool.retrieve()); + ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID")); + + bool disableSmry = + !m_stripDetElStatus.empty() && !VALIDATE_STATUS_ARRAY_ACTIVATED; + ATH_CHECK(m_summaryTool.retrieve(DisableTool{disableSmry})); + + if (!m_monTool.empty()) + ATH_CHECK(m_monTool.retrieve()); + + return StatusCode::SUCCESS; +} + +StatusCode StripClusterizationAlg::execute(const EventContext& ctx) const { + Monitored::Timer<std::chrono::milliseconds> timer("TIME_execute"); + Monitored::Group mon(m_monTool, timer); + + SG::ReadHandle<SCT_RDO_Container> rdoContainer = + SG::makeHandle(m_rdoContainerKey, ctx); + ATH_CHECK(rdoContainer.isValid()); + + SG::WriteHandle<xAOD::StripClusterContainer> clusterHandle = + SG::makeHandle(m_clusterContainerKey, ctx); + + SG::ReadHandle<InDet::SiDetectorElementStatus> status; + if (!m_stripDetElStatus.empty()) { + status = SG::makeHandle(m_stripDetElStatus, ctx); + if (!status.isValid()) { + ATH_MSG_FATAL("Invalid SiDetectorelementStatus"); + return StatusCode::FAILURE; + } + } + + SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> stripDetEleHandle( + m_stripDetEleCollKey, ctx); + const InDetDD::SiDetectorElementCollection* stripDetEle(*stripDetEleHandle); + if (!stripDetEleHandle.isValid() || stripDetEle == nullptr) { + ATH_MSG_FATAL("Invalid SiDetectorElementCollection"); + return StatusCode::FAILURE; + } + + std::unique_ptr<xAOD::StripClusterContainer> stripContainer = + std::make_unique<xAOD::StripClusterContainer>(); + std::unique_ptr<xAOD::StripClusterAuxContainer> stripAuxContainer = + std::make_unique<xAOD::StripClusterAuxContainer>(); + stripContainer->setStore(stripAuxContainer.get()); + + // Reserve space, estimate of mean clusters to reduce re-allocations + stripContainer->reserve(m_expectedClustersPerRDO.value() * + rdoContainer->size()); + + for (const InDetRawDataCollection<SCT_RDORawData>* rdos : *rdoContainer) { + if (rdos == nullptr or rdos->empty()) { + ATH_MSG_DEBUG("No input strip RDOs for this container element"); + continue; + } + IdentifierHash idHash = rdos->identifyHash(); + + bool goodModule = true; + if (m_checkBadModules.value()) { + if (!m_stripDetElStatus.empty()) { + goodModule = status->isGood(idHash); + } else { + goodModule = m_summaryTool->isGood(idHash, ctx); + } + } + VALIDATE_STATUS_ARRAY( + m_checkBadModules.value() && !m_stripDetElStatus.empty(), + status->isGood(idHash), m_summaryTool->isGood(idHash)); + + if (!goodModule) { + ATH_MSG_DEBUG("Strip module failed status check"); + continue; + } + + ATH_CHECK(m_clusteringTool->clusterize( + *rdos, *m_idHelper, stripDetEle->getDetectorElement(idHash), + m_stripDetElStatus.empty() ? nullptr : status.cptr(), + *stripContainer.get())); + } + + ATH_CHECK(clusterHandle.record(std::move(stripContainer), + std::move(stripAuxContainer))); + return StatusCode::SUCCESS; +} + +} // namespace ActsTrk diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/StripClusterizationAlg.h b/Tracking/Acts/ActsDataPreparation/src/StripClusterizationAlg.h similarity index 79% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/StripClusterizationAlg.h rename to Tracking/Acts/ActsDataPreparation/src/StripClusterizationAlg.h index e23e987d09f2399f73721a15eb1135b69048304d..3f6d24e3ef816708d655c6c5ebec780a231b297b 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/StripClusterizationAlg.h +++ b/Tracking/Acts/ActsDataPreparation/src/StripClusterizationAlg.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKCLUSTERIZATION_STRIPCLUSTERIZATIONALG_H -#define ACTSTRKCLUSTERIZATION_STRIPCLUSTERIZATIONALG_H +#ifndef ACTSTRK_DATAPREPARATION_STRIPCLUSTERIZATIONALG_H +#define ACTSTRK_DATAPREPARATION_STRIPCLUSTERIZATIONALG_H #include <ActsTrkToolInterfaces/IStripClusteringTool.h> #include <AthenaBaseComps/AthReentrantAlgorithm.h> @@ -23,7 +23,6 @@ public: StripClusterizationAlg(const std::string& name, ISvcLocator* pSvcLocator); virtual ~StripClusterizationAlg() = default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; virtual StatusCode execute(const EventContext& ctx) const override; private: @@ -83,6 +82,11 @@ private: "Check bad modules using the conditions summary tool" }; + // expected number of clusters for RDO + // This values is used for reserving enough memory of the cluster container + // reserve = m_expectedClustersPerRDO * nRDOs + // The default values has been computed on a tt-bar PU200 sample comparing the memory usage and the container capacity + Gaudi::Property<int> m_expectedClustersPerRDO {this, "expectedClustersPerRDO", 6, "Expected number of clusters for RDO"}; const StripID* m_idHelper = nullptr; }; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripInformationHelper.cxx b/Tracking/Acts/ActsDataPreparation/src/StripInformationHelper.cxx similarity index 96% rename from Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripInformationHelper.cxx rename to Tracking/Acts/ActsDataPreparation/src/StripInformationHelper.cxx index 267fb0f4cc1b9a2c9b1cce3e3c7a5315be7d94fa..9691f076d21f3301e3dd4783388c503bca4d972e 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripInformationHelper.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/StripInformationHelper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "StripInformationHelper.h" diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripInformationHelper.h b/Tracking/Acts/ActsDataPreparation/src/StripInformationHelper.h similarity index 91% rename from Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripInformationHelper.h rename to Tracking/Acts/ActsDataPreparation/src/StripInformationHelper.h index 40d633d0670642e0f7721244e98e180bd4d847b2..1b8c64de7123c4c99bf6ec0114c6fa7bebdac479 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/StripInformationHelper.h +++ b/Tracking/Acts/ActsDataPreparation/src/StripInformationHelper.h @@ -1,14 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKSPACEPOINTFORMATIONTOOL_STRIPINFORMATIONHELPER_H -#define ACTSTRKSPACEPOINTFORMATIONTOOL_STRIPINFORMATIONHELPER_H +#ifndef ACTSTRK_DATAPREPARATION_STRIPINFORMATIONHELPER_H +#define ACTSTRK_DATAPREPARATION_STRIPINFORMATIONHELPER_H #include "GeoPrimitives/GeoPrimitives.h" namespace ActsTrk { + /// @brief Total number of neightbours and indices + enum NeighbourIndices {ThisOne, Opposite, PhiMinus, PhiPlus, EtaMinus, EtaPlus, nNeighbours}; + class StripInformationHelper { /// @class StripInformationHelper diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/StripSpacePointFormationAlg.cxx b/Tracking/Acts/ActsDataPreparation/src/StripSpacePointFormationAlg.cxx similarity index 95% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/StripSpacePointFormationAlg.cxx rename to Tracking/Acts/ActsDataPreparation/src/StripSpacePointFormationAlg.cxx index 9a02dc9f7721abf3720f502022a6ef6e63d00b22..1edc541ff598108da4a79a8b770718051d7fc212 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/StripSpacePointFormationAlg.cxx +++ b/Tracking/Acts/ActsDataPreparation/src/StripSpacePointFormationAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "StripSpacePointFormationAlg.h" @@ -79,13 +79,14 @@ namespace ActsTrk { sps.reserve(inputStripClusterContainer->size() * 0.5); osps.reserve(inputStripClusterContainer->size() * 0.5); - ATH_CHECK( m_spacePointMakerTool->produceStripSpacePoints(*inputStripClusterContainer.cptr(), - *properties, - *stripElements, - vertex, - sps, - osps, - m_processOverlapForStrip) ); + ATH_CHECK( m_spacePointMakerTool->produceSpacePoints(ctx, + *inputStripClusterContainer.cptr(), + *properties, + *stripElements, + vertex, + sps, + osps, + m_processOverlapForStrip) ); // using trick for fast insertion std::unique_ptr<xAOD::SpacePointContainer> spacePoints = diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/StripSpacePointFormationAlg.h b/Tracking/Acts/ActsDataPreparation/src/StripSpacePointFormationAlg.h similarity index 97% rename from Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/StripSpacePointFormationAlg.h rename to Tracking/Acts/ActsDataPreparation/src/StripSpacePointFormationAlg.h index 12c1ec7b28853c6780608e51a650c76dfdc82557..9c8b93ba88b817715dffb8bf643ab5f3e9877eee 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/StripSpacePointFormationAlg.h +++ b/Tracking/Acts/ActsDataPreparation/src/StripSpacePointFormationAlg.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKSPACEPOINTFORMATION_STRIPSPACEPOINTFORMATIONALG_H -#define ACTSTRKSPACEPOINTFORMATION_STRIPSPACEPOINTFORMATIONALG_H +#ifndef ACTSTRK_DATAPREPARATION_STRIPSPACEPOINTFORMATIONALG_H +#define ACTSTRK_DATAPREPARATION_STRIPSPACEPOINTFORMATIONALG_H #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Tracking/Acts/ActsDataPreparation/src/components/ActsDataPreparation_entries.cxx b/Tracking/Acts/ActsDataPreparation/src/components/ActsDataPreparation_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f2e34e9f9b7fad844b3d866bcd178e311804a484 --- /dev/null +++ b/Tracking/Acts/ActsDataPreparation/src/components/ActsDataPreparation_entries.cxx @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "src/PixelClusterizationAlg.h" +#include "src/StripClusterizationAlg.h" +#include "src/PixelSpacePointFormationAlg.h" +#include "src/StripSpacePointFormationAlg.h" +#include "src/ActsPixelClusteringTool.h" +#include "src/ActsStripClusteringTool.h" +#include "src/PixelSpacePointFormationTool.h" +#include "src/ActsCoreStripSpacePointFormationTool.h" +#include "src/ActsTrkStripSpacePointFormationTool.h" + +// Algs +DECLARE_COMPONENT(ActsTrk::PixelClusterizationAlg) +DECLARE_COMPONENT(ActsTrk::StripClusterizationAlg) +DECLARE_COMPONENT( ActsTrk::PixelSpacePointFormationAlg ) +DECLARE_COMPONENT( ActsTrk::StripSpacePointFormationAlg ) +// Tools +DECLARE_COMPONENT(ActsTrk::PixelClusteringTool) +DECLARE_COMPONENT(ActsTrk::StripClusteringTool) +DECLARE_COMPONENT( ActsTrk::PixelSpacePointFormationTool ) +DECLARE_COMPONENT( ActsTrk::ActsCoreStripSpacePointFormationTool ) +DECLARE_COMPONENT( ActsTrk::ActsTrkStripSpacePointFormationTool ) diff --git a/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt b/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt old mode 100755 new mode 100644 index 749c0c198b26470f5d3d11135384c7321d78a181..e7bdf017d3da5d4c08324336d6456e5379d1852e --- a/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt +++ b/Tracking/Acts/ActsGeantFollowing/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ActsGeantFollowing ) @@ -37,4 +37,3 @@ atlas_add_library( ActsGeantFollowing # Install files from the package: atlas_install_joboptions( share/*.py ) -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Tracking/Acts/ActsGeantFollowing/share/ActsGeantFollowing_jobOptions_ITk.py b/Tracking/Acts/ActsGeantFollowing/share/ActsGeantFollowing_jobOptions_ITk.py index 2f44dd09c98fa27ae0b562b8a990fdecb14d9939..494cd61ea585b9a482e5b39e9b4c5dd6c3bb985f 100644 --- a/Tracking/Acts/ActsGeantFollowing/share/ActsGeantFollowing_jobOptions_ITk.py +++ b/Tracking/Acts/ActsGeantFollowing/share/ActsGeantFollowing_jobOptions_ITk.py @@ -18,9 +18,6 @@ from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -from ActsGeometry.ActsGeometryConfig import ActsExtrapolationToolCfg - - def defaultTestFlags(flags, args): @@ -116,15 +113,16 @@ def ActsGeantFollowerCfg(flags, name="ActsGeantFollowerTool", **kwargs): from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg result.merge(TrackingGeometrySvcCfg(flags)) - from ActsGeometry.ActsGeometryConfig import NominalAlignmentCondAlgCfg + from ActsConfig.ActsTrkGeometryConfig import NominalAlignmentCondAlgCfg nomAli = NominalAlignmentCondAlgCfg(flags, OutputLevel=INFO) result.merge(nomAli) - from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometrySvcCfg + from ActsConfig.ActsTrkGeometryConfig import ActsTrackingGeometrySvcCfg tgSvc = ActsTrackingGeometrySvcCfg(flags, OutputLevel=INFO) result.merge(tgSvc) print('DEF WRITER : ') + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg Actsextrapol = result.popToolsAndMerge(ActsExtrapolationToolCfg(flags, InteractionMultiScatering = True, InteractionEloss = True, @@ -147,7 +145,7 @@ def ActsGeantFollowerCfg(flags, name="ActsGeantFollowerTool", **kwargs): result.addPublicTool(followingHelper) #Setting up the CA for the ActsGeantFollower - from ActsGeantFollowing.ActsGeantFollowingConfig import ActsGeantFollowerToolCfg + from ActsConfig.ActsTrkGeantFollowingConfig import ActsGeantFollowerToolCfg actionAcc = ComponentAccumulator() actions = [] actions += [actionAcc.popToolsAndMerge(ActsGeantFollowerToolCfg(flags)) diff --git a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollower.cxx b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollower.cxx old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollower.h b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollower.h old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerHelper.cxx b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerHelper.cxx old mode 100755 new mode 100644 index 6bf202b2e2af59149182b67a5f87c612cb5fd28b..932a662669737520e372a39cbcd2cafe48c1b7d3 --- a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerHelper.cxx +++ b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerHelper.cxx @@ -259,14 +259,14 @@ void ActsGeantFollowerHelper::trackParticle(const G4ThreeVector& pos, std::optional<Acts::BoundTrackParameters> actsParameters = m_actsExtrapolator->propagate(ctx, *m_actsParameterCache, *destinationSurfaceActs, - Acts::NavigationDirection::Forward, + Acts::Direction::Forward, std::numeric_limits<double>::max(), particleHypo); float X0Acts = m_actsExtrapolator->propagationSteps(ctx, *m_actsParameterCache, *destinationSurfaceActs, - Acts::NavigationDirection::Forward, + Acts::Direction::Forward, std::numeric_limits<double>::max(), particleHypo).second.materialInX0; diff --git a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerHelper.h b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerHelper.h old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerTool.cxx b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerTool.cxx old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerTool.h b/Tracking/Acts/ActsGeantFollowing/src/ActsGeantFollowerTool.h old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeantFollowing/src/components/ActsFollowing_entries.cxx b/Tracking/Acts/ActsGeantFollowing/src/components/ActsFollowing_entries.cxx old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASSourceLink.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASSourceLink.h index 73025247cdb4cda3c64fc5497cc694f55f14cbf9..ddf20ddb2459f5dbdab6cc43d57eab3bd93e1598 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASSourceLink.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ATLASSourceLink.h @@ -108,7 +108,7 @@ struct ATLASSourceLinkCalibrator final template <typename trajectory_t, typename sourceLink_t> void ATLASSourceLinkCalibrator::calibrate(const Acts::GeometryContext& /*gctx*/, typename Acts::MultiTrajectory<trajectory_t>::TrackStateProxy trackState) { - const auto& sourceLink = trackState.uncalibratedSourceLink().template get<sourceLink_t>(); + auto sourceLink = trackState.getUncalibratedSourceLink().template get<sourceLink_t>(); trackState.allocateCalibrated(sourceLink.dim()); if (sourceLink.dim() == 0) { diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsAlignmentCondAlg.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsAlignmentCondAlg.h deleted file mode 100644 index 30823c3dee6cb7938db2582a47a06abcb9d2adc3..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsAlignmentCondAlg.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ACTSGEOMETRY_ACTSALIGNMENTCONDALG_H -#define ACTSGEOMETRY_ACTSALIGNMENTCONDALG_H - -// ATHENA -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "StoreGate/WriteCondHandleKey.h" - -// PACKAGE - -// STL -#include <string> - -class ICondSvc; -class StoreGateSvc; -class IActsTrackingGeometrySvc; -class ActsAlignmentStore; -class GeoAlignableTransform; -class ActsGeometryContext; -class GeoAlignmentStore; - -class ActsAlignmentCondAlg : public AthAlgorithm { - -public: - ActsAlignmentCondAlg(const std::string &name, ISvcLocator *pSvcLocator); - virtual ~ActsAlignmentCondAlg(); - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - -private: - - SG::ReadCondHandleKey<GeoAlignmentStore> m_sctAlignStoreReadKey{ - this, "SCTAlignStoreReadKey", "SCTAlignmentStore", ""}; - - SG::ReadCondHandleKey<GeoAlignmentStore> m_pixelAlignStoreReadKey{ - this, "PixelAlignStoreReadKey", "PixelAlignmentStore", ""}; - - SG::WriteCondHandleKey<ActsGeometryContext> m_wchk{ - this, "ActsAlignmentKey", "ActsAlignment", "cond handle key"}; - - ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeometrySvc; -}; - -#endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h index d4ba766b1d1370aa46c61f6623b099b2182c9701..00fd865ccee964cb877009778b38359ad9a2f4da 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsDetectorElement.h @@ -9,6 +9,7 @@ #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "ActsGeometryInterfaces/IDetectorElement.h" // ATHENA INCLUDES #include "HGTD_ReadoutGeometry/HGTD_DetectorElement.h" #include "HGTD_Identifier/HGTD_ID.h" @@ -25,21 +26,23 @@ // STL #include <iostream> -#include <mutex> namespace Acts { class SurfaceBounds; } class ActsTrackingGeometrySvc; -class ActsAlignmentStore; class IdentityHelper; /// @class ActsDetectorElement /// -class ActsDetectorElement : public Acts::DetectorElementBase { +class ActsDetectorElement : public ActsTrk::IDetectorElement { public: + using DetectorType = ActsTrk::DetectorType; + using RawGeomAlignStore = ActsTrk::RawGeomAlignStore; + + ActsDetectorElement(const InDetDD::SiDetectorElement &detElem); /// Constructor for a straw surface. @@ -59,17 +62,24 @@ public: virtual ~ActsDetectorElement() = default; /// Identifier - Identifier identify() const; + Identifier identify() const override final; + /// Detector type + DetectorType detectorType() const override final; + /// Return local to global transform associated with this identifier + bool storeAlignment(RawGeomAlignStore& store) const override final; + - void storeTransform(ActsAlignmentStore *gas) const; virtual const Acts::Transform3 & transform(const Acts::GeometryContext &gctx) const final override; /// Return surface associated with this identifier, which should come from the virtual const Acts::Surface &surface() const final override; + /// Mutable surface to this detector element + virtual Acts::Surface &surface() final override; + /// Return a shared pointer on the ATLAS surface associated with this /// identifier, const Trk::Surface &atlasSurface() const; @@ -82,28 +92,29 @@ public: /// Returns default transform. For TRT this is static and set in constructor. /// For silicon detectors it is calulated from GM, and stored. Thus the method /// is not const. The store is mutexed. - const Acts::Transform3 &getDefaultTransformMutexed() const; + const Acts::Transform3 &getDefaultTransform() const; /// Returns the underllying GeoModel detectorelement that this one /// is based on. const GeoVDetectorElement *upstreamDetectorElement() const; private: + DetectorType m_type{DetectorType::UnDefined}; /// Detector element as variant - const GeoVDetectorElement *m_detElement; + const GeoVDetectorElement *m_detElement{nullptr}; /// Boundaries of the detector element - std::shared_ptr<const Acts::SurfaceBounds> m_bounds; + std::shared_ptr<const Acts::SurfaceBounds> m_bounds{}; /// Thickness of this detector element - double m_thickness; + double m_thickness{0.}; /// Corresponding Surface - std::shared_ptr<const Acts::Surface> m_surface; - std::vector<std::shared_ptr<const Acts::Surface>> m_surfaces; + std::shared_ptr<Acts::Surface> m_surface{}; + std::vector<std::shared_ptr<const Acts::Surface>> m_surfaces{}; - CxxUtils::CachedValue<Acts::Transform3> m_defTransform; + CxxUtils::CachedValue<Acts::Transform3> m_defTransform{}; Acts::Transform3 m_extraTransform{Acts::Transform3::Identity()}; - Identifier m_explicitIdentifier; + Identifier m_explicitIdentifier{0}; }; #endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h index d90964cf3358388de459ff48be6dee0487cd4a54..e5fa52338918925e8630177c0e65848546ac3a06 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsExtrapolationTool.h @@ -72,7 +72,7 @@ public: ActsPropagationOutput propagationSteps(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const override; @@ -80,7 +80,7 @@ public: std::optional<const Acts::CurvilinearTrackParameters> propagate(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const override; @@ -89,7 +89,7 @@ public: propagationSteps(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, const Acts::Surface& target, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const override; @@ -98,7 +98,7 @@ public: propagate(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, const Acts::Surface& target, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const override; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsGeometryDict.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsGeometryDict.h new file mode 100644 index 0000000000000000000000000000000000000000..b16ac859ff9c5cc7d5216eaaea7cfd02c15cc792 --- /dev/null +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsGeometryDict.h @@ -0,0 +1,7 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef ACTSGEOMETRY_ACTSGEOMETRY_DICT_H +#define ACTSGEOMETRY_ACTSGEOMETRY_DICT_H +#include "ActsGeometryInterfaces/GeometryDefs.h" +#endif diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h index 1e5c7f3115b6fa25960ca7b3162f6830a6e17dc0..5cd27fca0b12f1f996ec98caa5989b343e4a48e4 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometrySvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSGEOMETRY_ACTSTRACKINGGEOMETRYSVC_H @@ -7,8 +7,6 @@ // ATHENA #include "AthenaBaseComps/AthService.h" -#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/EventContext.h" // PACKAGE #include "ActsGeometryInterfaces/IActsTrackingGeometrySvc.h" @@ -54,18 +52,17 @@ class ActsTrackingGeometrySvc : public extends<AthService, IActsTrackingGeometry public: StatusCode initialize() override; - //virtual StatusCode finalize() override; ActsTrackingGeometrySvc( const std::string& name, ISvcLocator* pSvcLocator ); std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry() override; - void - populateAlignmentStore(ActsAlignmentStore *store) const override; + unsigned int populateAlignmentStore(ActsTrk::RawGeomAlignStore& store) const override; - const ActsAlignmentStore* - getNominalAlignmentStore() const override; + const ActsGeometryContext& getNominalContext() const override; + + StatusCode checkAlignComplete(const ActsGeometryContext& ctx) const override; private: ActsLayerBuilder::Config @@ -88,22 +85,22 @@ private: bool runConsistencyChecks() const; ServiceHandle<StoreGateSvc> m_detStore; - const InDetDD::SiDetectorManager* p_pixelManager; - const InDetDD::SiDetectorManager* p_SCTManager; - const InDetDD::TRT_DetectorManager* p_TRTManager; - const InDetDD::SiDetectorManager* p_ITkPixelManager; - const InDetDD::SiDetectorManager* p_ITkStripManager; - const BeamPipeDetectorManager* p_beamPipeMgr; - const HGTD_DetectorManager* p_HGTDManager; - - std::shared_ptr<ActsElementVector> m_elementStore; - std::shared_ptr<const Acts::TrackingGeometry> m_trackingGeometry; - - const TRT_ID *m_TRT_idHelper; - const HGTD_ID *m_HGTD_idHelper; - - std::unique_ptr<const ActsAlignmentStore> m_nominalAlignmentStore{nullptr}; - + const InDetDD::SiDetectorManager* p_pixelManager{nullptr}; + const InDetDD::SiDetectorManager* p_SCTManager{nullptr}; + const InDetDD::TRT_DetectorManager* p_TRTManager{nullptr}; + const InDetDD::SiDetectorManager* p_ITkPixelManager{nullptr}; + const InDetDD::SiDetectorManager* p_ITkStripManager{nullptr}; + const BeamPipeDetectorManager* p_beamPipeMgr{nullptr}; + const HGTD_DetectorManager* p_HGTDManager{nullptr}; + + std::shared_ptr<ActsElementVector> m_elementStore{nullptr}; + std::shared_ptr<const Acts::TrackingGeometry> m_trackingGeometry{nullptr}; + + const TRT_ID *m_TRT_idHelper{nullptr}; + const HGTD_ID *m_HGTD_idHelper{nullptr}; + + ActsGeometryContext m_nominalContext{}; + Gaudi::Property<bool> m_useMaterialMap{this, "UseMaterialMap", false, ""}; Gaudi::Property<bool> m_objDebugOutput{this, "ObjDebugOutput", false, ""}; Gaudi::Property<std::string> m_materialMapInputFileBase{this, "MaterialMapInputFile", "", ""}; @@ -125,6 +122,10 @@ private: ToolHandle<IActsTrackingVolumeBuilder> m_caloVolumeBuilder{this, "CaloVolumeBuilder", "", "CaloVolumeBuilder"}; + /// Define the subdetectors for which the tracking geometry does not expect a valid alignment store + Gaudi::Property<std::vector<unsigned int>> m_subDetNoAlignProp{this, "NotAlignDetectors", {}}; + std::set<ActsTrk::DetectorType> m_subDetNoAlign{}; + }; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h index 80c9985e746614f56f2cba6f4659aef986d06870..eee4035b43bc1f652f87bb34399acf7fecc0e6f3 100644 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/ActsTrackingGeometryTool.h @@ -42,11 +42,11 @@ public: virtual const ActsGeometryContext& - getGeometryContext(const EventContext& ctx = Gaudi::Hive::currentContext()) const override; + getGeometryContext(const EventContext& ctx) const override; + const ActsGeometryContext& + getGeometryContext() const override; - virtual - ActsGeometryContext - getNominalGeometryContext() const override; + virtual const ActsGeometryContext& getNominalGeometryContext() const override; private: ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeometrySvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h b/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h deleted file mode 100644 index 0ad13238f3534434c2debc8b1a22db7b86210f87..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsGeometry/ActsGeometry/NominalAlignmentCondAlg.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#pragma once - -// ATHENA -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ICondSvc.h" -#include "StoreGate/WriteCondHandleKey.h" - -// PACKAGE - -// STL -#include <string> - -class IActsTrackingGeometrySvc; -class ActsAlignmentStore; - -class ActsGeometryContext; - -/// @class NominalAlignmentCondAlg -/// Conditions algorithm which produces an (effectively) -/// infinitely valid ActsAlignmentStore which has -/// nominal alignments (= identity deltas) -/// -class NominalAlignmentCondAlg : public AthAlgorithm { - -public: - NominalAlignmentCondAlg(const std::string &name, ISvcLocator *pSvcLocator); - virtual ~NominalAlignmentCondAlg(); - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - -private: - SG::WriteCondHandleKey<ActsGeometryContext> m_wchk{ - this, "ActsAlignmentKey", "ActsAlignment", "cond handle key"}; - - ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeometrySvc; -}; diff --git a/Tracking/Acts/ActsGeometry/ActsGeometry/selection.xml b/Tracking/Acts/ActsGeometry/ActsGeometry/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..e362e2328d752e79641bfed7fb5b78a7c355bf36 --- /dev/null +++ b/Tracking/Acts/ActsGeometry/ActsGeometry/selection.xml @@ -0,0 +1,7 @@ + +<!-- $Id: selection.xml 618909 2014-09-29 10:16:52Z krasznaa $ --> +<lcgdict> + + <!-- An attempt to make the ObjectType enumeration visible in Python... --> + <enum name="ActsTrk::DetectorType" /> +</lcgdict> diff --git a/Tracking/Acts/ActsGeometry/CMakeLists.txt b/Tracking/Acts/ActsGeometry/CMakeLists.txt index 72ab4f8981481735536fb56c230068611b26b694..7cf4076fcbc5569774d2c5c4c42cb8d6e8db40fd 100644 --- a/Tracking/Acts/ActsGeometry/CMakeLists.txt +++ b/Tracking/Acts/ActsGeometry/CMakeLists.txt @@ -13,7 +13,7 @@ find_package( TBB ) # Component(s) in the package: atlas_add_library( ActsGeometryLib - src/ActsAlignmentStore.cxx + src/AlignmentStore.cxx src/ActsDetectorElement.cxx src/ActsLayerBuilder.cxx src/ActsStrawLayerBuilder.cxx @@ -31,7 +31,7 @@ atlas_add_library( ActsGeometryLib AthenaBaseComps AthenaKernel CaloDetDescrLib - CaloDetDescrUtils + CaloDetDescrUtils GaudiKernel GeoModelUtilities GeoPrimitives @@ -69,7 +69,7 @@ atlas_add_component( ActsGeometry src/ActsMaterialJsonWriterTool.cxx src/ActsMaterialTrackWriterSvc.cxx src/ActsAlignmentCondAlg.cxx - src/NominalAlignmentCondAlg.cxx + src/ActsDetAlignCondAlg.cxx src/ActsTrackingGeometryTool.cxx src/ActsPropStepRootWriterSvc.cxx src/ActsCaloTrackingVolumeBuilder.cxx @@ -103,3 +103,8 @@ atlas_add_component( ActsGeometry atlas_install_joboptions( scripts/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + +atlas_add_dictionary( ActsGeometryDict + ActsGeometry/ActsGeometryDict.h + ActsGeometry/selection.xml + LINK_LIBRARIES ActsGeometryLib) diff --git a/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py b/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py index fd7e18cf11554988f224a77a87fe6b01a022fc3a..5a0961de13d009a7426a67616e81ece0c7953c61 100644 --- a/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py +++ b/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py @@ -22,20 +22,21 @@ class ConfiguredActsTrackingGeometry( ActsTrackingGeometryTool ) : subDetectors = [] if DetFlags.pixel_on(): subDetectors += ["Pixel"] - + from ActsGeometry.ActsGeometryConf import ActsAlignmentCondAlg + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "NominalAlignmentCondAlg"): + condSeq += ActsAlignmentCondAlg(name = "NominalAlignmentCondAlg") from ActsGeometry.ActsGeometryConf import ActsTrackingGeometrySvc + from ROOT.ActsTrk import DetectorType actsTrackingGeometrySvc = ActsTrackingGeometrySvc(name = "ActsTrackingGeometrySvc", - BuildSubDetectors = subDetectors) + BuildSubDetectors = subDetectors, + NotAlignDetectors = [DetectorType.Pixel]) from AthenaCommon.AppMgr import ServiceMgr ServiceMgr += actsTrackingGeometrySvc - from ActsGeometry.ActsGeometryConf import NominalAlignmentCondAlg - from AthenaCommon.AlgSequence import AthSequencer - condSeq = AthSequencer("AthCondSeq") - if not hasattr(condSeq, "NominalAlignmentCondAlg"): - condSeq += NominalAlignmentCondAlg(name = "NominalAlignmentCondAlg") ActsTrackingGeometryTool.__init__(self, name, diff --git a/Tracking/Acts/ActsGeometry/python/__init__.py b/Tracking/Acts/ActsGeometry/python/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialMapping.py b/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialMapping.py index 2edf94a1ff557b9e23ce885df54cb3f62642e4ee..49b941843f20a10985c8318f7ee43eff84e0dfe8 100644 --- a/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialMapping.py +++ b/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialMapping.py @@ -93,7 +93,7 @@ if args.verboseStoreGate: log.debug('Dumping of ConfigFlags now.') flags.dump() -from ActsGeometry.ActsGeometryConfig import ActsMaterialTrackWriterSvcCfg +from ActsConfig.ActsTrkGeometryConfig import ActsMaterialTrackWriterSvcCfg cfg.merge(ActsMaterialTrackWriterSvcCfg(flags, "ActsMaterialTrackWriterSvc", FilePath="MaterialTracks_mapping.root", @@ -102,7 +102,7 @@ cfg.merge(ActsMaterialTrackWriterSvcCfg(flags, from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(flags)) -from ActsGeometry.ActsGeometryConfig import ActsMaterialMappingCfg +from ActsConfig.ActsTrkGeometryConfig import ActsMaterialMappingCfg cfg.merge(ActsMaterialMappingCfg(flags, "ActsMaterialMappingCfg", mapSurfaces = True, mapVolumes = True)) diff --git a/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialValidation.py b/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialValidation.py index 058eeb67c27f6c86e1b6de9ae03a5c75aa4896d1..04b325fc9a150c92825d08fc2b6394d0847dd630 100644 --- a/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialValidation.py +++ b/Tracking/Acts/ActsGeometry/scripts/RunActsMaterialValidation.py @@ -86,14 +86,14 @@ if args.verboseStoreGate: log.debug('Dumping of ConfigFlags now.') flags.dump() -from ActsGeometry.ActsGeometryConfig import ActsExtrapolationToolCfg +from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg extrapol = cfg.popToolsAndMerge(ActsExtrapolationToolCfg(flags, "ActsExtrapolationTool", InteractionMultiScatering = True, InteractionEloss = True, InteractionRecord = True)) -from ActsGeometry.ActsGeometryConfig import ActsExtrapolationAlgCfg +from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationAlgCfg cfg.merge(ActsExtrapolationAlgCfg(flags, "ActsExtrapolationAlg", NParticlesPerEvent=int(1e4), diff --git a/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py b/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py index 63e450e7621e71c12c0638da2c90f287ffdeb6ac..af6e4a5b78adc696b841351970c680f8f0523506 100644 --- a/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py +++ b/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py @@ -83,11 +83,11 @@ if args.verboseStoreGate: log.debug('Dumping of ConfigFlags now.') flags.dump() -from ActsGeometry.ActsGeometryConfig import ActsAlignmentCondAlgCfg +from ActsConfig.ActsTrkGeometryConfig import ActsAlignmentCondAlgCfg cfg.merge(ActsAlignmentCondAlgCfg(flags, name="ActsAlignmentCondAlg")) -from ActsGeometry.ActsGeometryConfig import ActsWriteTrackingGeometryCfg +from ActsConfig.ActsTrkGeometryConfig import ActsWriteTrackingGeometryCfg cfg.merge(ActsWriteTrackingGeometryCfg(flags, name="ActsWriteTrackingGeometry")) diff --git a/Tracking/Acts/ActsGeometry/scripts/util/geo_id.py b/Tracking/Acts/ActsGeometry/scripts/util/geo_id.py old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx index 8630f6b85dc3642cbbc024ac917cfaaa7af8d0a2..a43ff4ee402a7617719f4ee95b594fb76229933c 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx @@ -2,131 +2,81 @@ Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ -#include "ActsGeometry/ActsAlignmentCondAlg.h" +#include "ActsAlignmentCondAlg.h" // PACKAGE -#include "ActsGeometry/ActsDetectorElement.h" #include "ActsGeometry/ActsAlignmentStore.h" +#include "ActsGeometry/ActsDetectorElement.h" #include "ActsGeometry/ActsGeometryContext.h" #include "ActsGeometryInterfaces/IActsTrackingGeometrySvc.h" - // ATHENA -#include "GaudiKernel/EventIDBase.h" -#include "GaudiKernel/EventIDRange.h" -#include "GaudiKernel/ICondSvc.h" -#include "GeoModelKernel/GeoAlignableTransform.h" -#include "StoreGate/StoreGateSvc.h" +#include "AthenaKernel/IOVInfiniteRange.h" #include "StoreGate/WriteCondHandle.h" // ACTS +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Geometry/DetectorElementBase.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Definitions/Algebra.hpp" // STL #include <memory> -ActsAlignmentCondAlg::ActsAlignmentCondAlg(const std::string &name, - ISvcLocator *pSvcLocator) - : ::AthAlgorithm(name, pSvcLocator), - m_trackingGeometrySvc("ActsTrackingGeometrySvc", name) {} +using namespace ActsTrk; +ActsAlignmentCondAlg::ActsAlignmentCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) {} -ActsAlignmentCondAlg::~ActsAlignmentCondAlg() {} +ActsAlignmentCondAlg::~ActsAlignmentCondAlg() = default; StatusCode ActsAlignmentCondAlg::initialize() { - ATH_MSG_DEBUG("initialize " << name()); - - ATH_CHECK(m_pixelAlignStoreReadKey.initialize()); - ATH_CHECK(m_sctAlignStoreReadKey.initialize()); - - ATH_CHECK(m_wchk.initialize()); - - return StatusCode::SUCCESS; + ATH_MSG_DEBUG("initialize " << name()); + ATH_CHECK(m_alignStoreKeys.initialize()); + ATH_CHECK(m_wchk.initialize()); + return StatusCode::SUCCESS; } -StatusCode ActsAlignmentCondAlg::execute() { - ATH_MSG_DEBUG("execute " << name()); - - auto trkGeom = m_trackingGeometrySvc->trackingGeometry(); - - EventIDBase now(getContext().eventID()); - SG::WriteCondHandle<ActsGeometryContext> wch(m_wchk); - - if (wch.isValid(now)) { - ATH_MSG_DEBUG( - "CondHandle is already valid for " - << now << ". In theory this should not be called, but may happen" - << " if multiple concurrent events are being processed out of order."); - - } else { +StatusCode ActsAlignmentCondAlg::execute(const EventContext& ctx) const { + ATH_MSG_DEBUG("execute " << name()); - ATH_MSG_DEBUG(" CondHandle " << wch.key() << " not valid now (" << now - << "). Getting new info for dbKey \"" - << wch.dbKey() << "\" from CondDb"); + EventIDBase now(ctx.eventID()); + SG::WriteCondHandle<ActsGeometryContext> wch{m_wchk, ctx}; - // Pixel - SG::ReadCondHandle<GeoAlignmentStore> pixelAlignStore(m_pixelAlignStoreReadKey); - SG::ReadCondHandle<GeoAlignmentStore> sctAlignStore(m_sctAlignStoreReadKey); + if (wch.isValid(now)) { + ATH_MSG_DEBUG("CondHandle is already valid for " << now << ". In theory this should not be called, but may happen" + << " if multiple concurrent events are being processed out of order."); - - EventIDRange pixelRange; - if(!pixelAlignStore.range(pixelRange)) { - ATH_MSG_FATAL("Failed to retrieve validity range for " << pixelAlignStore.key()); - return StatusCode::FAILURE; + return StatusCode::SUCCESS; } + wch.addDependency(EventIDRange(IOVInfiniteRange::infiniteRunLB())); - EventIDRange sctRange; - if(!sctAlignStore.range(sctRange)) { - ATH_MSG_FATAL("Failed to retrieve validity range for " << sctAlignStore.key()); - return StatusCode::FAILURE; - } + ATH_MSG_DEBUG(" CondHandle " << wch.key() << " not valid now (" << now << "). Getting new info for dbKey \"" << wch.dbKey() + << "\" from CondDb"); // create an Acts aware geo alignment store from the one given // (this makes a copy for now, which is not ideal) - auto actsAlignStore = - std::make_unique<ActsAlignmentStore>(**pixelAlignStore); - - actsAlignStore->append(**sctAlignStore); - - //std::unique_ptr<ActsAlignmentStore> sctActsAlignStore = - //std::make_unique<ActsAlignmentStore>(**sctAlignStore); - - // deltas are set, now populate sensitive element transforms - ATH_MSG_DEBUG("Populating ActsAlignmentStore for IOV"); - size_t nElems = 0; - trkGeom->visitSurfaces([&actsAlignStore, &nElems](const Acts::Surface *srf) { - const Acts::DetectorElementBase *detElem = - srf->associatedDetectorElement(); - const auto *gmde = static_cast<const ActsDetectorElement *>(detElem); - gmde->storeTransform(actsAlignStore.get()); - nElems++; - }); - ATH_MSG_DEBUG("ActsAlignmentStore populated for " << nElems - << " detector elements"); - - EventIDRange r = EventIDRange::intersect(pixelRange, sctRange); + std::unique_ptr<ActsGeometryContext> gctx = std::make_unique<ActsGeometryContext>(); + + for (const SG::ReadCondHandleKey<RawGeomAlignStore>& key : m_alignStoreKeys) { + SG::ReadCondHandle<RawGeomAlignStore> alignStore{key, ctx}; + if (!alignStore.isValid()) { + ATH_MSG_FATAL("Failed to retrieve alignment from " << key.fullKey()); + return StatusCode::FAILURE; + } + wch.addDependency(alignStore); + GeoModel::TransientConstSharedPtr<AlignmentStore>& newStore = gctx->alignmentStores[alignStore->detType]; + if (newStore) { + ATH_MSG_FATAL("The alignment constants of " << to_string(alignStore->detType) << " are already added to the context"); + return StatusCode::FAILURE; + } + newStore = alignStore->trackingAlignment; + } // get a nominal alignment store from the tracking geometry service // and plug it into a geometry context - auto gctx = std::make_unique<ActsGeometryContext>(); - gctx->ownedAlignmentStore = - std::move(actsAlignStore); // GCTX owns the alignment store - gctx->alignmentStore = gctx->ownedAlignmentStore.get(); - - if (wch.record(r, gctx.release()).isFailure()) { - ATH_MSG_ERROR("could not record alignment store " - << wch.key() << " = " << gctx.get() << " with EventRange " - << r); - return StatusCode::FAILURE; - } - + ATH_CHECK(m_trackingGeometrySvc->checkAlignComplete(*gctx)); + ATH_CHECK(wch.record(std::move(gctx))); ATH_MSG_INFO("Recorded new " << wch.key() << " " - << " with range " << r); - } - - + << " with range " << wch.getRange()); - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } diff --git a/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.h b/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..ac61bcc9bfd1961fc20f6c336c90c598a88b86ee --- /dev/null +++ b/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSGEOMETRY_ACTSALIGNMENTCONDALG_H +#define ACTSGEOMETRY_ACTSALIGNMENTCONDALG_H + +// ATHENA +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "StoreGate/CondHandleKeyArray.h" + +// PACKAGE +#include "ActsGeometryInterfaces/ActsGeometryContext.h" +#include "ActsGeometryInterfaces/IActsTrackingGeometrySvc.h" +#include "ActsGeometryInterfaces/RawGeomAlignStore.h" + +class ActsAlignmentCondAlg : public AthReentrantAlgorithm { +public: + ActsAlignmentCondAlg(const std::string &name, ISvcLocator *pSvcLocator); + virtual ~ActsAlignmentCondAlg(); + + StatusCode initialize() override; + StatusCode execute(const EventContext &ctx) const override; + + // Switch off reentrancy to avoid condition clashes + bool isReEntrant() const override final { return false; } + +private: + SG::ReadCondHandleKeyArray<ActsTrk::RawGeomAlignStore> m_alignStoreKeys{ + this, "AlignmentStores", {}, ""}; + + SG::WriteCondHandleKey<ActsGeometryContext> m_wchk{this, "ActsAlignmentKey", "ActsAlignment", "cond handle key"}; + + ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeometrySvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}; +}; + +#endif diff --git a/Tracking/Acts/ActsGeometry/src/ActsAlignmentStore.cxx b/Tracking/Acts/ActsGeometry/src/ActsAlignmentStore.cxx deleted file mode 100644 index 024a79f61353508718dec7c05e461a8915961d7a..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsGeometry/src/ActsAlignmentStore.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "ActsGeometry/ActsDetectorElement.h" -#include "ActsGeometry/ActsAlignmentStore.h" -#include "Acts/Definitions/Algebra.hpp" - -ActsAlignmentStore::ActsAlignmentStore(const GeoAlignmentStore &gas){ - - m_deltas = gas.getDeltas(); - m_absPositions = gas.getAbsPositions(); - m_defAbsPositions = gas.getDefAbsPositions(); - -} - -void ActsAlignmentStore::setTransform(const ActsDetectorElement *ade, - const Acts::Transform3 &xf) { - if (!m_transforms.setTransform(ade, xf)) { - throw ExcAlignmentStore( - "Attempted to overwrite Delta in the Alignment Store"); - } -} - -const Acts::Transform3 * -ActsAlignmentStore::getTransform(const ActsDetectorElement *ade) const { - return m_transforms.getTransform(ade); -} - -void ActsAlignmentStore::append(const GeoAlignmentStore& gas) { - for(const auto& it : gas.getDeltas().container()) { - setDelta(it.first, it.second); - } - - for(const auto& it : gas.getAbsPositions().container()) { - setAbsPosition(it.first, it.second); - } - - for(const auto& it : gas.getDefAbsPositions().container()) { - setDefAbsPosition(it.first, it.second); - } -} diff --git a/Tracking/Acts/ActsGeometry/src/ActsCaloTrackingVolumeBuilder.cxx b/Tracking/Acts/ActsGeometry/src/ActsCaloTrackingVolumeBuilder.cxx index e81834ad38bf9d263c4fb06e9341d19f875870e1..3a11b98a206fbb28b0c393e13bede94515208848 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsCaloTrackingVolumeBuilder.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsCaloTrackingVolumeBuilder.cxx @@ -204,13 +204,13 @@ ActsCaloTrackingVolumeBuilder::trackingVolume( // Attach that volume array to the calo inner cover ATH_MSG_VERBOSE("Glueing " << calo->volumeName() << " inner cover to " << idOutVolArray->arrayObjects().size() << " volumes"); std::const_pointer_cast<BoundarySurface>(calo->boundarySurfaces().at(Acts::tubeInnerCover)) - ->attachVolumeArray(idOutVolArray, Acts::NavigationDirection::Backward); + ->attachVolumeArray(idOutVolArray, Acts::Direction::Backward); // Loop through the array and attach their boundary surfaces to the calo for(const auto& idVol : idOutVolArray->arrayObjects()){ ATH_MSG_VERBOSE("Glueing outer cover of " << idVol->volumeName() << " to inner cover of " << calo->volumeName()); std::const_pointer_cast<BoundarySurface>(idVol->boundarySurfaces().at(Acts::tubeOuterCover)) - ->attachVolume(calo.get(), Acts::NavigationDirection::Forward); + ->attachVolume(calo.get(), Acts::Direction::Forward); } // Glue positive XY face of ID to inner positive XY face of Calo. @@ -219,13 +219,13 @@ ActsCaloTrackingVolumeBuilder::trackingVolume( ATH_MSG_VERBOSE("Glueing " << calo->volumeName() << " positive inner cutout disc to " << idPosXYVolArray->arrayObjects().size() << " volumes"); std::const_pointer_cast<BoundarySurface>(calo->boundarySurfaces().at(Acts::index5)) - ->attachVolumeArray(idPosXYVolArray, Acts::NavigationDirection::Backward); + ->attachVolumeArray(idPosXYVolArray, Acts::Direction::Backward); // Other way round, attach ID volumes to calo for(const auto& idVol : idPosXYVolArray->arrayObjects()){ ATH_MSG_VERBOSE("Glueing positive XY face of " << idVol->volumeName() << " to positive inner coutout disc of " << calo->volumeName()); std::const_pointer_cast<BoundarySurface>(idVol->boundarySurfaces().at(Acts::positiveFaceXY)) - ->attachVolume(calo.get(), Acts::NavigationDirection::Forward); + ->attachVolume(calo.get(), Acts::Direction::Forward); } // Glue negative XY face of ID to inner negative XY face of Calo. @@ -234,13 +234,13 @@ ActsCaloTrackingVolumeBuilder::trackingVolume( ATH_MSG_VERBOSE("Glueing " << calo->volumeName() << " negative inner cutout disc to " << idNegXYVolArray->arrayObjects().size() << " volumes"); std::const_pointer_cast<BoundarySurface>(calo->boundarySurfaces().at(Acts::index4)) - ->attachVolumeArray(idNegXYVolArray, Acts::NavigationDirection::Forward); + ->attachVolumeArray(idNegXYVolArray, Acts::Direction::Forward); // Other way round, attach ID volumes to calo for(const auto& idVol : idNegXYVolArray->arrayObjects()){ ATH_MSG_VERBOSE("Glueing negative XY face of " << idVol->volumeName() << " to negative inner coutout disc of " << calo->volumeName()); std::const_pointer_cast<BoundarySurface>(idVol->boundarySurfaces().at(Acts::negativeFaceXY)) - ->attachVolume(calo.get(), Acts::NavigationDirection::Backward); + ->attachVolume(calo.get(), Acts::Direction::Backward); } // For navigational purposes we need to create three pseudo container cylinders. diff --git a/Tracking/Acts/ActsGeometry/src/ActsDetAlignCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/ActsDetAlignCondAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3c2270198cab3e41d0bb072b474211d97cb3ca35 --- /dev/null +++ b/Tracking/Acts/ActsGeometry/src/ActsDetAlignCondAlg.cxx @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "ActsDetAlignCondAlg.h" + +#include "StoreGate/ReadCondHandle.h" +#include "StoreGate/WriteCondHandle.h" + +using namespace ActsTrk; +ActsDetAlignCondAlg::ActsDetAlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) {} + +ActsDetAlignCondAlg::~ActsDetAlignCondAlg() = default; + +StatusCode ActsDetAlignCondAlg::initialize() { + ATH_CHECK(m_inputKey.initialize()); + ATH_CHECK(m_outputKey.initialize()); + ATH_CHECK(m_trackingGeoSvc.retrieve()); + try { + m_Type = static_cast<DetectorType>(m_detType.value()); + } catch (const std::exception& what) { + ATH_MSG_FATAL("Invalid detType is configured " << m_detType); + return StatusCode::FAILURE; + } + if (m_Type == DetectorType::UnDefined) { + ATH_MSG_FATAL("Please configure the deType " << m_detType << " to be something not undefined"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +StatusCode ActsDetAlignCondAlg::execute(const EventContext& ctx) const { + SG::WriteCondHandle<RawGeomAlignStore> writeHandle{m_outputKey, ctx}; + if (writeHandle.isValid()) { + ATH_MSG_DEBUG("Nothing needs to be done for " << ctx.eventID().event_number()); + return StatusCode::SUCCESS; + } + SG::ReadCondHandle<GeoAlignmentStore> readHandle{m_inputKey, ctx}; + if (!readHandle.isValid()) { + ATH_MSG_FATAL("Failed to retrieve " << m_inputKey.fullKey()); + return StatusCode::FAILURE; + } + writeHandle.addDependency(readHandle); + /// Create the new alignment + std::unique_ptr<RawGeomAlignStore> newAlignment = std::make_unique<RawGeomAlignStore>(); + /// We need to copy over the cache from the GeoModel alignment store + newAlignment->geoModelAlignment->append(**readHandle); + newAlignment->detType = m_Type; + /// Process using the tracking geometry + if (!m_trackingGeoSvc->populateAlignmentStore(*newAlignment)) { + ATH_MSG_WARNING("No detector elements of " << to_string(m_Type) << " are part of the tracking geometry"); + } + if (m_whipeGeoStore) newAlignment->geoModelAlignment.reset(); + ATH_CHECK(writeHandle.record(std::move(newAlignment))); + return StatusCode::SUCCESS; +} diff --git a/Tracking/Acts/ActsGeometry/src/ActsDetAlignCondAlg.h b/Tracking/Acts/ActsGeometry/src/ActsDetAlignCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..a936bac0210ded13bb56e6834f642274409afd73 --- /dev/null +++ b/Tracking/Acts/ActsGeometry/src/ActsDetAlignCondAlg.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef ACTSGEOMETRY_ACTSDETALIGNCONDALG_H +#define ACTSGEOMETRY_ACTSDETALIGNCONDALG_H + +#include "ActsGeometryInterfaces/IActsTrackingGeometrySvc.h" +#include "ActsGeometryInterfaces/RawGeomAlignStore.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/WriteCondHandleKey.h" +/** + * The ActsDetAlignCondAlg loads the rigid alignment transformations and pipes them into + * through the ActsDetectorElements associated to 1 subdetector. The detector elements then + * cache all internal transformations needed to build the readoutgeometry of the measurement layers. + * The created cache object is then published to the ConditionsStore to be pickedup by the ActsGeometryContext + */ + +class ActsDetAlignCondAlg : public AthReentrantAlgorithm { +public: + /// Standard constructor + ActsDetAlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator); + + virtual ~ActsDetAlignCondAlg(); + + StatusCode initialize() override final; + + StatusCode execute(const EventContext& ctx) const override final; + /// Switch off reentrancy to avoid condition clashes + bool isReEntrant() const override final { return false; } + +private: + /// Key to the alignment transformations for the detector volumes + SG::ReadCondHandleKey<GeoAlignmentStore> m_inputKey{this, "InputTransforms", ""}; + /// Key to the alignment transformations written by the alg + SG::WriteCondHandleKey<ActsTrk::RawGeomAlignStore> m_outputKey{this, "ActsTransforms", ""}; + /// ServiceHandle to the ActsTrackingGeometry + ServiceHandle<IActsTrackingGeometrySvc> m_trackingGeoSvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}; + /// Flag determining the subdetector. Needs to be static castable to ActsTrk::DetectorType + Gaudi::Property<int> m_detType{this, "DetectorType", static_cast<int>(ActsTrk::DetectorType::UnDefined)}; + /// Flag toggling whether the GeoAlignmentStore is whiped before written to storgate + Gaudi::Property<bool> m_whipeGeoStore{this, "WhipeGeoStore", true}; + /// Static cast of >DetectorType< property + ActsTrk::DetectorType m_Type{ActsTrk::DetectorType::UnDefined}; +}; +#endif \ No newline at end of file diff --git a/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx b/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx index d1cd824782df1adab7919fee714d2afb19957f16..b9d217cd668466a20f66c7ff27347bb982910429 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsDetectorElement.cxx @@ -6,8 +6,6 @@ // ATHENA #include "ActsInterop/IdentityHelper.h" -#include "GeoPrimitives/CLHEPtoEigenConverter.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "SCT_ReadoutGeometry/StripBoxDesign.h" #include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" #include "TRT_ReadoutGeometry/TRT_BarrelElement.h" @@ -19,10 +17,7 @@ #include "TrkSurfaces/TrapezoidBounds.h" // PACKAGE -#include "ActsGeometry/ActsAlignmentStore.h" -#include "ActsGeometry/ActsGeometryContext.h" -#include "ActsGeometry/ActsTrackingGeometrySvc.h" - +#include "ActsGeometryInterfaces/ActsGeometryContext.h" // ACTS #include "Acts/Definitions/Units.hpp" #include "Acts/Geometry/GeometryContext.hpp" @@ -36,8 +31,6 @@ #include "Acts/Visualization/ObjVisualization3D.hpp" #include "Acts/Visualization/PlyVisualization3D.hpp" -// STL -#include <mutex> // BOOST #include <boost/variant.hpp> @@ -47,12 +40,15 @@ using Acts::Surface; using Acts::Transform3; using namespace Acts::UnitLiterals; +using namespace ActsTrk; +using SubDetAlignments = ActsGeometryContext::SubDetAlignments; + + constexpr double length_unit = 1_mm; -ActsDetectorElement::ActsDetectorElement( - const InDetDD::SiDetectorElement &detElem) { - m_detElement = &detElem; +ActsDetectorElement::ActsDetectorElement(const InDetDD::SiDetectorElement &detElem) : m_detElement{&detElem} { + m_type = detElem.isPixel() ? DetectorType::Pixel : DetectorType::Sct; auto boundsType = detElem.bounds().type(); @@ -151,13 +147,9 @@ ActsDetectorElement::ActsDetectorElement( } } -ActsDetectorElement::ActsDetectorElement( - const Acts::Transform3 &trf, const InDetDD::TRT_BaseElement &detElem, - const Identifier &id) - : m_detElement (&detElem), - m_defTransform (trf), - m_explicitIdentifier (id) -{ +ActsDetectorElement::ActsDetectorElement(const Acts::Transform3 &trf, const InDetDD::TRT_BaseElement &detElem, const Identifier &id) : + m_type{DetectorType::Trt}, m_detElement{&detElem}, m_defTransform{trf}, m_explicitIdentifier(id) { + // we know this is a straw double length = detElem.strawLength() * 0.5 * length_unit; @@ -184,12 +176,9 @@ ActsDetectorElement::ActsDetectorElement( m_surface = Acts::Surface::makeShared<Acts::StrawSurface>(lineBounds, *this); } -ActsDetectorElement::ActsDetectorElement( - const InDetDD::HGTD_DetectorElement &detElem, const Identifier &id) - : m_detElement (&detElem), - m_thickness (detElem.thickness()), - m_explicitIdentifier (id) -{ +ActsDetectorElement::ActsDetectorElement(const InDetDD::HGTD_DetectorElement &detElem, const Identifier &id) : + m_type{DetectorType::Hgtd}, m_detElement{&detElem}, m_thickness{detElem.thickness()}, m_explicitIdentifier{id} { + auto boundsType = detElem.bounds().type(); if (boundsType == Trk::SurfaceBounds::Rectangle) { @@ -213,124 +202,92 @@ ActsDetectorElement::ActsDetectorElement( } IdentityHelper ActsDetectorElement::identityHelper() const { - if (const auto *detElem = - dynamic_cast<const InDetDD::SiDetectorElement *>(m_detElement); - detElem != nullptr) { - return IdentityHelper(detElem); + if (detectorType() == DetectorType::Pixel || detectorType() == DetectorType::Sct) { + return IdentityHelper(static_cast<const InDetDD::SiDetectorElement *>(m_detElement)); } else { throw std::domain_error("Cannot get IdentityHelper for TRT element"); } } -const Acts::Transform3 & -ActsDetectorElement::transform(const Acts::GeometryContext &anygctx) const { - // any cast to known context type - const ActsGeometryContext *gctx = anygctx.get<const ActsGeometryContext *>(); - - // This is needed for initial geometry construction. At that point, we don't - // have a consistent view of the geometry yet, and thus we can't populate an - // alignment store at that time. - if (gctx->construction) { - // this should only happen at initialize (1 thread, but mutex anyway) - return getDefaultTransformMutexed(); - } +const Acts::Transform3 &ActsDetectorElement::transform(const Acts::GeometryContext &anygctx) const { + // any cast to known context type + const ActsGeometryContext *gctx = anygctx.get<const ActsGeometryContext *>(); + + // This is needed for initial geometry construction. At that point, we don't + // have a consistent view of the geometry yet, and thus we can't populate an + // alignment store at that time. + + // unpack the alignment store from the context + SubDetAlignments::const_iterator itr = gctx->alignmentStores.find(detectorType()); - // unpack the alignment store from the context - const ActsAlignmentStore *alignmentStore = gctx->alignmentStore; - // no GAS, is this initialization? - assert(alignmentStore != nullptr); + /// Does this mean that the alignment is not cached for this detector element? + if (itr == gctx->alignmentStores.end()) return getDefaultTransform(); + const GeoModel::TransientConstSharedPtr<AlignmentStore> &alignmentStore = itr->second; - // get the correct cached transform - // units should be fine here since we converted at construction - const Acts::Transform3 *cachedTrf = alignmentStore->getTransform(this); + // get the correct cached transform + // units should be fine here since we converted at construction + const Acts::Transform3 *cachedTrf = alignmentStore->getTransform(this); - assert(cachedTrf != nullptr); + assert(cachedTrf != nullptr); + return *cachedTrf; - return *cachedTrf; } -void ActsDetectorElement::storeTransform(ActsAlignmentStore *gas) const { - Amg::Transform3D trf; - if (const auto *detElem = - dynamic_cast<const InDetDD::SiDetectorElement *>(m_detElement); - detElem != nullptr) { - Amg::Transform3D l2g = - detElem->getMaterialGeom()->getAbsoluteTransform(gas) - * m_extraTransform; - - // need to make sure translation has correct units - l2g.translation() *= 1.0 / CLHEP::mm * length_unit; - - trf = l2g; - } else if (const auto *detElem = - dynamic_cast<const InDetDD::HGTD_DetectorElement *>(m_detElement); - detElem!= nullptr) { - Amg::Transform3D l2g = - detElem->getMaterialGeom()->getAbsoluteTransform(gas) - * m_extraTransform; - // need to make sure translation has correct units - l2g.translation() *= 1.0 / CLHEP::mm * length_unit; - - trf = l2g; - } else if (const auto *detElem = - dynamic_cast<const InDetDD::TRT_BaseElement *>(m_detElement); - detElem != nullptr && m_defTransform.isValid()) - { - // So far: NO ALIGNMENT for the ACTS TRT version. Default transform set in - // constructor, should be safe to access without mutex. - trf = *m_defTransform.ptr(); +bool ActsDetectorElement::storeAlignment(RawGeomAlignStore &store) const { + if (store.detType != detectorType()) return false; + + Amg::Transform3D trf{Amg::Transform3D::Identity()}; + static constexpr std::array<DetectorType, 3> useGeoModel{DetectorType::Pixel, DetectorType::Sct, DetectorType::Hgtd}; + if (std::find(useGeoModel.begin(), useGeoModel.end(), detectorType()) != useGeoModel.end()) { + Amg::Transform3D l2g = m_detElement->getMaterialGeom()->getAbsoluteTransform(store.geoModelAlignment.get()) * m_extraTransform; + // need to make sure translation has correct units + l2g.translation() *= 1.0 / CLHEP::mm * length_unit; + + trf = l2g; + } else if (detectorType() == DetectorType::Trt && m_defTransform.isValid()) { + // So far: NO ALIGNMENT for the ACTS TRT version. Default transform set in + // constructor, should be safe to access without mutex. + trf = *m_defTransform.ptr(); } else { - throw std::runtime_error{"Unknown detector element type"}; + throw std::runtime_error{"Unknown detector element type "+to_string(detectorType())}; } - gas->setTransform(this, trf); - if (gas->getTransform(this) == nullptr) { - throw std::runtime_error( - "Detector element was unable to store transform in GAS"); - } + store.trackingAlignment->setTransform(this, trf); +#ifndef NDEBUG + if (!store.trackingAlignment->getTransform(this)) { throw std::runtime_error("Detector element was unable to store transform in GAS"); } +#endif + return true; + } const Acts::Transform3 & -ActsDetectorElement::getDefaultTransformMutexed() const { +ActsDetectorElement::getDefaultTransform() const { if (!m_defTransform.isValid()) { // transform not yet set - if (const auto *detElem = - dynamic_cast<const InDetDD::SiDetectorElement *>(m_detElement); - detElem != nullptr) { - Amg::Transform3D l2g = - detElem->getMaterialGeom()->getDefAbsoluteTransform() - * m_extraTransform; - - l2g.translation() *= 1.0 / CLHEP::mm * length_unit; - - m_defTransform.set (l2g); - } else if (const auto *detElem = - dynamic_cast<const InDetDD::HGTD_DetectorElement *>(m_detElement); - detElem!= nullptr) { - Amg::Transform3D l2g = - detElem->getMaterialGeom()->getDefAbsoluteTransform() - * m_extraTransform; - // need to make sure translation has correct units - l2g.translation() *= 1.0 / CLHEP::mm * length_unit; - - m_defTransform.set(l2g); - } else if (const auto *detElem = - dynamic_cast<const InDetDD::TRT_BaseElement *>(m_detElement); - detElem != nullptr) { - throw std::logic_error{ - "TRT transform should have been set in the constructor"}; - } else { - throw std::runtime_error{"Unknown detector element type"}; + static constexpr std::array<DetectorType, 3> useGeoModel{DetectorType::Pixel, DetectorType::Sct, DetectorType::Hgtd}; + if (std::find(useGeoModel.begin(), useGeoModel.end(), detectorType()) != useGeoModel.end()) { + Amg::Transform3D l2g = m_detElement->getMaterialGeom()->getAbsoluteTransform() * m_extraTransform; + // need to make sure translation has correct units + l2g.translation() *= 1.0 / CLHEP::mm * length_unit; + + m_defTransform.set(std::move(l2g)); + } else if (const auto *detElem = dynamic_cast<const InDetDD::TRT_BaseElement *>(m_detElement); detElem != nullptr) { + throw std::logic_error{"TRT transform should have been set in the constructor"}; + } else { + throw std::runtime_error{"Unknown detector element type"}; + } } - } - - return *m_defTransform.ptr(); + return *m_defTransform.ptr(); } const Acts::Surface &ActsDetectorElement::surface() const { return (*m_surface); } +Acts::Surface &ActsDetectorElement::surface() { + return (*m_surface); +} + const Trk::Surface &ActsDetectorElement::atlasSurface() const { if (const auto *detElem = dynamic_cast<const InDetDD::SiDetectorElement *>(m_detElement); @@ -363,3 +320,4 @@ const GeoVDetectorElement * ActsDetectorElement::upstreamDetectorElement() const { return m_detElement; } +DetectorType ActsDetectorElement::detectorType() const { return m_type; } diff --git a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx index 2203dc75dc4144007f379ac540cb5d1e9e34f202..6f67ab7df7aef5ae8b475eb01e61e7633ae3b882 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsExtrapolationTool.cxx @@ -138,7 +138,7 @@ ActsExtrapolationTool::initialize() ActsPropagationOutput ActsExtrapolationTool::propagationSteps(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, - Acts::NavigationDirection navDir /*= Acts::NavigationDirection::Forward*/, + Acts::Direction navDir /*= Acts::Direction::Forward*/, double pathLimit /*= std::numeric_limits<double>::max()*/, Trk::ParticleHypothesis particleHypo /*= Trk::pion*/) const { @@ -217,7 +217,7 @@ ActsExtrapolationTool::propagationSteps(const EventContext& ctx, std::optional<const Acts::CurvilinearTrackParameters> ActsExtrapolationTool::propagate(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, - Acts::NavigationDirection navDir /*= Acts::NavigationDirection::Forward*/, + Acts::Direction navDir /*= Acts::Direction::Forward*/, double pathLimit /*= std::numeric_limits<double>::max()*/, Trk::ParticleHypothesis particleHypo /*= Trk::pion*/) const { @@ -272,7 +272,7 @@ ActsPropagationOutput ActsExtrapolationTool::propagationSteps(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, const Acts::Surface& target, - Acts::NavigationDirection navDir /*= Acts::NavigationDirection::Forward*/, + Acts::Direction navDir /*= Acts::Direction::Forward*/, double pathLimit /*= std::numeric_limits<double>::max()*/, Trk::ParticleHypothesis particleHypo /*= Trk::pion*/) const { @@ -343,7 +343,7 @@ std::optional<const Acts::BoundTrackParameters> ActsExtrapolationTool::propagate(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, const Acts::Surface& target, - Acts::NavigationDirection navDir /*= Acts::NavigationDirection::Forward*/, + Acts::Direction navDir /*= Acts::Direction::Forward*/, double pathLimit /*= std::numeric_limits<double>::max()*/, Trk::ParticleHypothesis particleHypo /*= Trk::pion*/) const { diff --git a/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx b/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx index cad59556a54e2173c2afb0930f21749d66a5c201..f9c708ae849cfe63fc513a7bfd259a0ca3030191 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsMaterialTrackWriterSvc.cxx @@ -278,10 +278,9 @@ ActsMaterialTrackWriterSvc::doWrite(const Acts::RecordedMaterialTrack& mTrack) const Acts::Surface* surface = mint.surface; Acts::GeometryIdentifier layerID; if (surface) { - auto gctx = std::make_unique<ActsGeometryContext>(); - gctx->alignmentStore = m_trackingGeometrySvc->getNominalAlignmentStore(); + const ActsGeometryContext& gctx{m_trackingGeometrySvc->getNominalContext()}; auto sfIntersection = surface->intersect( - gctx->context(), mint.position, mint.direction, true); + gctx.context(), mint.position, mint.direction, true); layerID = surface->geometryId(); m_sur_id.push_back(layerID.value()); m_sur_type.push_back(surface->type()); diff --git a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx index a4d23c0b156ee971476cdd54161209531b6f87e2..bf34d97d98ba230908c7e7107dcc10ad45057118 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometrySvc.cxx @@ -40,9 +40,8 @@ #include <Acts/Surfaces/RectangleBounds.hpp> // PACKAGE -#include "ActsGeometry/ActsAlignmentStore.h" -#include "ActsGeometry/ActsDetectorElement.h" -#include "ActsGeometry/ActsGeometryContext.h" +#include "ActsGeometryInterfaces/IDetectorElement.h" +#include "ActsGeometryInterfaces/ActsGeometryContext.h" #include "ActsGeometry/ActsLayerBuilder.h" #include "ActsGeometry/ActsStrawLayerBuilder.h" #include "ActsGeometry/ActsHGTDLayerBuilder.h" @@ -54,7 +53,7 @@ #include <stdexcept> using namespace Acts::UnitLiterals; - +using namespace ActsTrk; ActsTrackingGeometrySvc::ActsTrackingGeometrySvc(const std::string &name, ISvcLocator *svc) : base_class(name, svc), @@ -65,6 +64,15 @@ ActsTrackingGeometrySvc::ActsTrackingGeometrySvc(const std::string &name, StatusCode ActsTrackingGeometrySvc::initialize() { ATH_MSG_INFO(name() << " is initializing"); + for (unsigned int skipAlign : m_subDetNoAlignProp) { + try { + m_subDetNoAlign.insert(static_cast<DetectorType>(skipAlign)); + } catch (...) { + ATH_MSG_FATAL("Failed to interpret " << m_subDetNoAlignProp << " as ActsDetectorElements"); + return StatusCode::FAILURE; + } +} + // FIXME: ActsCaloTrackingVolumeBuilder holds ReadHandle to // CaloDetDescrManager. Hopefully this service is never called before that @@ -154,10 +162,6 @@ StatusCode ActsTrackingGeometrySvc::initialize() { tgbConfig.materialDecorator = matDeco; } - // default geometry context, this is nominal - ActsGeometryContext constructionContext; - constructionContext.construction = true; - std::array<double, 2> sctECEnvelopeZ{20_mm, 20_mm}; try { @@ -393,7 +397,7 @@ StatusCode ActsTrackingGeometrySvc::initialize() { ATH_MSG_VERBOSE("Begin building process"); m_trackingGeometry = - trackingGeometryBuilder->trackingGeometry(constructionContext.context()); + trackingGeometryBuilder->trackingGeometry(getNominalContext().context()); ATH_MSG_VERBOSE("Building process completed"); if (!m_trackingGeometry) { @@ -401,15 +405,7 @@ StatusCode ActsTrackingGeometrySvc::initialize() { return StatusCode::FAILURE; } - ATH_MSG_VERBOSE("Building nominal alignment store"); - ActsAlignmentStore *nominalAlignmentStore = new ActsAlignmentStore(); - - populateAlignmentStore(nominalAlignmentStore); - - // manage ownership - m_nominalAlignmentStore = - std::unique_ptr<const ActsAlignmentStore>(nominalAlignmentStore); - + if(m_runConsistencyChecks) { ATH_MSG_INFO("Running extra consistency check! (this is SLOW)"); if(!runConsistencyChecks()) { @@ -446,9 +442,7 @@ bool ActsTrackingGeometrySvc::runConsistencyChecks() const { localPoints.emplace_back(dist(gen), dist(gen)); } - ActsGeometryContext explicitContext; - explicitContext.construction = true; - Acts::GeometryContext gctx = explicitContext.context(); + Acts::GeometryContext gctx = getNominalContext().context(); size_t nTotalSensors = 0; std::array<size_t,3> nInconsistent{0,0,0}; @@ -1009,24 +1003,19 @@ ActsTrackingGeometrySvc::makeSCTTRTAssembly( return container; } -void ActsTrackingGeometrySvc::populateAlignmentStore( - ActsAlignmentStore *store) const { - ATH_MSG_DEBUG("Populate the alignment store with all detector elements"); - size_t nElements = 0; - m_trackingGeometry->visitSurfaces([store, - &nElements](const Acts::Surface *srf) { - const Acts::DetectorElementBase *detElem = srf->associatedDetectorElement(); - const auto *gmde = dynamic_cast<const ActsDetectorElement *>(detElem); - gmde->storeTransform(store); - nElements++; - }); - ATH_MSG_DEBUG("Populated with " << nElements << " elements"); +unsigned int ActsTrackingGeometrySvc::populateAlignmentStore(RawGeomAlignStore &store) const { + ATH_MSG_DEBUG("Populate the alignment store with all detector elements"); + unsigned int nElements = 0; + m_trackingGeometry->visitSurfaces([&store, &nElements](const Acts::Surface *srf) { + const Acts::DetectorElementBase *detElem = srf->associatedDetectorElement(); + const IDetectorElement *gmde = dynamic_cast<const IDetectorElement *>(detElem); + nElements += gmde->storeAlignment(store); + }); + ATH_MSG_DEBUG("Populated with " << nElements << " elements"); + return nElements; } -const ActsAlignmentStore * -ActsTrackingGeometrySvc::getNominalAlignmentStore() const { - return m_nominalAlignmentStore.get(); -} +const ActsGeometryContext &ActsTrackingGeometrySvc::getNominalContext() const { return m_nominalContext; } Acts::CylinderVolumeBuilder::Config ActsTrackingGeometrySvc::makeBeamPipeConfig( @@ -1114,3 +1103,25 @@ ActsTrackingGeometrySvc::makeBeamPipeConfig( return cfg; } +StatusCode ActsTrackingGeometrySvc::checkAlignComplete(const ActsGeometryContext &ctx) const { + /// Look up what subdetectors are part of the tracking geometry + std::set<DetectorType> activeDets{}; + m_trackingGeometry->visitSurfaces([&activeDets](const Acts::Surface *srf) { + const Acts::DetectorElementBase *detElem = srf->associatedDetectorElement(); + const IDetectorElement *gmde = dynamic_cast<const IDetectorElement *>(detElem); + activeDets.insert(gmde->detectorType()); + }); + + /// Loop over the detector types. Check whether for each of them a dedicated alignment store exists + for (const DetectorType &type : activeDets) { + if (m_subDetNoAlign.count(type)) { + ATH_MSG_DEBUG("Detector " << to_string(type) << " does not expect any alignment store. Do not check"); + continue; + } + if (ctx.alignmentStores.find(type) == ctx.alignmentStores.end()) { + ATH_MSG_FATAL("No alignment constants have been defined for subdetector " << to_string(type) << ". Please check."); + return StatusCode::FAILURE; + } + } + return StatusCode::SUCCESS; +} \ No newline at end of file diff --git a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx index 8eef4b1154e63fda2383034cf59a1fdb84c7181e..ada433f1b7325006b77bda511151dd662130f5f7 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsTrackingGeometryTool.cxx @@ -1,19 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "ActsGeometry/ActsTrackingGeometryTool.h" -// ATHENA -#include "GaudiKernel/EventContext.h" - -// PACKAGE -#include "ActsGeometry/ActsAlignmentStore.h" - -// STL -#include <iostream> -#include <memory> - ActsTrackingGeometryTool::ActsTrackingGeometryTool(const std::string& type, const std::string& name, const IInterface* parent) : base_class(type, name, parent) @@ -51,12 +41,12 @@ ActsTrackingGeometryTool::getGeometryContext(const EventContext& ctx) const return **rch; } -ActsGeometryContext -ActsTrackingGeometryTool::getNominalGeometryContext() const -{ - - ActsGeometryContext gctx; - gctx.alignmentStore = m_trackingGeometrySvc->getNominalAlignmentStore(); +const ActsGeometryContext& +ActsTrackingGeometryTool::getNominalGeometryContext() const { - return gctx; + return m_trackingGeometrySvc->getNominalContext(); } +const ActsGeometryContext& ActsTrackingGeometryTool::getGeometryContext() const { + return getGeometryContext(Gaudi::Hive::currentContext()); +} + diff --git a/Tracking/Acts/ActsGeometry/src/AlignmentStore.cxx b/Tracking/Acts/ActsGeometry/src/AlignmentStore.cxx new file mode 100644 index 0000000000000000000000000000000000000000..729d5342dfb095facb7d3cd0f2d048d310c666b6 --- /dev/null +++ b/Tracking/Acts/ActsGeometry/src/AlignmentStore.cxx @@ -0,0 +1,15 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "ActsGeometryInterfaces/AlignmentStore.h" + +#include "Acts/Definitions/Algebra.hpp" +#include "ActsGeometry/ActsDetectorElement.h" + +namespace ActsTrk { + void AlignmentStore::setTransform(const void *ade, const Acts::Transform3 &xf) { + if (!m_transforms.setTransform(ade, xf)) { throw ExcAlignmentStore("Attempted to overwrite Delta in the Alignment Store"); } + } + + const Acts::Transform3 *AlignmentStore::getTransform(const void *ade) const { return m_transforms.getTransform(ade); } +} // namespace ActsTrk diff --git a/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx deleted file mode 100644 index 17beada31bf8b30d4b198e950df1518658bb3bcf..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsGeometry/src/NominalAlignmentCondAlg.cxx +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -// ATHENA -#include "ActsGeometry/NominalAlignmentCondAlg.h" - -#include "StoreGate/WriteCondHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/EventIDBase.h" -#include "GaudiKernel/EventIDRange.h" -#include "TRT_ReadoutGeometry/TRT_DetectorManager.h" - -// PACKAGE -#include "ActsGeometryInterfaces/IActsTrackingGeometrySvc.h" -#include "ActsGeometry/ActsDetectorElement.h" -#include "ActsGeometry/ActsAlignmentStore.h" -#include "ActsGeometry/ActsGeometryContext.h" - -// ACTS -#include "Acts/Definitions/Algebra.hpp" -#include "Acts/Geometry/TrackingGeometry.hpp" -#include "Acts/Surfaces/Surface.hpp" - - -NominalAlignmentCondAlg::NominalAlignmentCondAlg( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::AthAlgorithm( name, pSvcLocator ), - m_trackingGeometrySvc("ActsTrackingGeometrySvc", name) -{ -} - -NominalAlignmentCondAlg::~NominalAlignmentCondAlg() {} - -StatusCode NominalAlignmentCondAlg::initialize() { - ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); - - ATH_CHECK(m_wchk.initialize()); - - return StatusCode::SUCCESS; -} - - -StatusCode NominalAlignmentCondAlg::execute() { - ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); - - SG::WriteCondHandle<ActsGeometryContext> wch(m_wchk); - - EventIDBase now(getContext().eventID()); - - // do we have a valid m_wch for current time? - if ( wch.isValid(now) ) { - ATH_MSG_DEBUG("CondHandle is already valid for " << now - << ". In theory this should not be called, but may happen" - << " if multiple concurrent events are being processed out of order."); - - } else { - - ATH_MSG_DEBUG(" CondHandle " << wch.key() - << " not valid now (" << now << "). Setting nominal alignment cond"); - - - EventIDBase start(1, EventIDBase::UNDEFEVT); - EventIDBase end(1, EventIDBase::UNDEFEVT); - start.set_lumi_block(0); - end.set_lumi_block(std::numeric_limits<EventIDBase::number_type>::max()); - - start.set_time_stamp(0); - end.set_time_stamp(std::numeric_limits<EventIDBase::number_type>::max()); - - EventIDRange r(start, end); - - ATH_MSG_DEBUG("Will register nominal alignment for range: " << r); - - // get a nominal alignment store from the tracking geometry service - // and plug it into a geometry context - auto gctx = std::make_unique<ActsGeometryContext>(); - gctx->alignmentStore = m_trackingGeometrySvc->getNominalAlignmentStore(); - - // and write it to the conditions store - if (wch.record(r, gctx.release()).isFailure()) { - ATH_MSG_ERROR("could not record nominal ActsGeometryContext " << wch.key() - << " with EventRange " << r); - return StatusCode::FAILURE; - } - - ATH_MSG_DEBUG("WCH is valid now? " << wch.isValid(now)); - } - return StatusCode::SUCCESS; -} diff --git a/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx b/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx index f1c02e8e6e9dce5727cf854769515ba564af6dd7..3a7a434464765e42fbb312888a40430f94155f53 100644 --- a/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx +++ b/Tracking/Acts/ActsGeometry/src/components/ActsGeometry_entries.cxx @@ -1,50 +1,45 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include "EventPrimitives/EventPrimitives.h" -//needed here to get the ATLAS eigen plugins in before the ACTS eigen plugins - +#include "EventPrimitives/EventPrimitives.h" +// needed here to get the ATLAS eigen plugins in before the ACTS eigen plugins +#include "../ActsAlignmentCondAlg.h" +#include "../ActsDetAlignCondAlg.h" +#include "ActsGeometry/ActsCaloTrackingVolumeBuilder.h" #include "ActsGeometry/ActsExtrapolationAlg.h" -#include "ActsGeometry/ActsWriteTrackingGeometry.h" -#include "ActsGeometry/ActsWriteTrackingGeometryTransforms.h" -#include "ActsGeometry/ActsTrackingGeometrySvc.h" #include "ActsGeometry/ActsExtrapolationTool.h" - +#include "ActsGeometry/ActsMaterialJsonWriterTool.h" #include "ActsGeometry/ActsMaterialMapping.h" -#include "ActsGeometry/ActsSurfaceMappingTool.h" -#include "ActsGeometry/ActsVolumeMappingTool.h" -#include "ActsGeometry/ActsObjWriterTool.h" -//#include "ActsGeometry/ActsExCellWriterSvc.h" +#include "ActsGeometry/ActsMaterialStepConverterTool.h" #include "ActsGeometry/ActsMaterialTrackWriterSvc.h" - -#include "ActsGeometry/NominalAlignmentCondAlg.h" -#include "ActsGeometry/ActsAlignmentCondAlg.h" -#include "ActsGeometry/ActsTrackingGeometryTool.h" - +#include "ActsGeometry/ActsObjWriterTool.h" #include "ActsGeometry/ActsPropStepRootWriterSvc.h" -#include "ActsGeometry/ActsCaloTrackingVolumeBuilder.h" -#include "ActsGeometry/ActsMaterialStepConverterTool.h" -#include "ActsGeometry/ActsMaterialJsonWriterTool.h" - -DECLARE_COMPONENT( ActsExtrapolationAlg ) -DECLARE_COMPONENT( ActsWriteTrackingGeometry ) -DECLARE_COMPONENT( ActsWriteTrackingGeometryTransforms ) -DECLARE_COMPONENT( ActsTrackingGeometrySvc ) -DECLARE_COMPONENT( ActsExtrapolationTool ) - -DECLARE_COMPONENT( ActsMaterialMapping ) -DECLARE_COMPONENT( ActsSurfaceMappingTool ) -DECLARE_COMPONENT( ActsVolumeMappingTool ) -DECLARE_COMPONENT( ActsObjWriterTool ) -//DECLARE_COMPONENT( ActsExCellWriterSvc ) -DECLARE_COMPONENT( ActsMaterialTrackWriterSvc ) -DECLARE_COMPONENT( ActsMaterialStepConverterTool ) -DECLARE_COMPONENT( ActsMaterialJsonWriterTool ) - -DECLARE_COMPONENT( NominalAlignmentCondAlg ) -DECLARE_COMPONENT( ActsTrackingGeometryTool ) +#include "ActsGeometry/ActsSurfaceMappingTool.h" +#include "ActsGeometry/ActsTrackingGeometrySvc.h" +#include "ActsGeometry/ActsTrackingGeometryTool.h" +#include "ActsGeometry/ActsVolumeMappingTool.h" +#include "ActsGeometry/ActsWriteTrackingGeometry.h" +#include "ActsGeometry/ActsWriteTrackingGeometryTransforms.h" -DECLARE_COMPONENT( ActsPropStepRootWriterSvc ) -DECLARE_COMPONENT( ActsAlignmentCondAlg ) -DECLARE_COMPONENT( ActsCaloTrackingVolumeBuilder ) +DECLARE_COMPONENT(ActsExtrapolationAlg) +DECLARE_COMPONENT(ActsWriteTrackingGeometry) +DECLARE_COMPONENT(ActsWriteTrackingGeometryTransforms) +DECLARE_COMPONENT(ActsTrackingGeometrySvc) +DECLARE_COMPONENT(ActsExtrapolationTool) + +DECLARE_COMPONENT(ActsMaterialMapping) +DECLARE_COMPONENT(ActsSurfaceMappingTool) +DECLARE_COMPONENT(ActsVolumeMappingTool) +DECLARE_COMPONENT(ActsObjWriterTool) +// DECLARE_COMPONENT( ActsExCellWriterSvc ) +DECLARE_COMPONENT(ActsMaterialTrackWriterSvc) +DECLARE_COMPONENT(ActsMaterialStepConverterTool) +DECLARE_COMPONENT(ActsMaterialJsonWriterTool) + +DECLARE_COMPONENT(ActsTrackingGeometryTool) + +DECLARE_COMPONENT(ActsPropStepRootWriterSvc) +DECLARE_COMPONENT(ActsAlignmentCondAlg) +DECLARE_COMPONENT(ActsDetAlignCondAlg) +DECLARE_COMPONENT(ActsCaloTrackingVolumeBuilder) diff --git a/Tracking/Acts/ActsGeometry/test/ActsExtrapolationAlgTest.py b/Tracking/Acts/ActsGeometry/test/ActsExtrapolationAlgTest.py index 96c16032ec10511bf6e4bc8ade41d9f0c2d2c6f7..8dd39b6dc4e68ba6d475c24e822391690e9f4d75 100755 --- a/Tracking/Acts/ActsGeometry/test/ActsExtrapolationAlgTest.py +++ b/Tracking/Acts/ActsGeometry/test/ActsExtrapolationAlgTest.py @@ -1,16 +1,11 @@ #!/usr/bin/env python +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + """ This job options file will run an example extrapolation using the Acts tracking geometry and the Acts extrapolation toolchain. - -Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration """ -# start from scratch with component accumulator -from AthenaConfiguration.ComponentFactory import CompFactory - -from ActsGeometry.ActsGeometryConfig import ActsExtrapolationAlgCfg - if "__main__" == __name__: from AthenaCommon.Logging import log from AthenaCommon.Constants import INFO @@ -45,7 +40,7 @@ if "__main__" == __name__: from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg cfg.merge(BeamPipeGeometryCfg(flags)) - + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationAlgCfg alg = ActsExtrapolationAlgCfg(flags, OutputLevel=INFO, NParticlesPerEvent = int(100), @@ -63,10 +58,11 @@ if "__main__" == __name__: "TRT", "Calo" ] + # needed to construct the calo geometry in ACTS + from AthenaConfiguration.ComponentFactory import CompFactory tgSvc.CaloVolumeBuilder = CompFactory.ActsCaloTrackingVolumeBuilder() - cfg.printConfig() log.info("CONFIG DONE") diff --git a/Tracking/Acts/ActsGeometry/test/ActsITkTest.py b/Tracking/Acts/ActsGeometry/test/ActsITkTest.py index ebe060301efba65e0d0fd8bfbc6614db71381071..c9acb16dd77f6a298d7bfefcd85c244cea586341 100755 --- a/Tracking/Acts/ActsGeometry/test/ActsITkTest.py +++ b/Tracking/Acts/ActsGeometry/test/ActsITkTest.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -"""Run ACTS geometry construction for ITk - -Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +""" + Run ACTS geometry construction for ITk """ from AthenaConfiguration.AllConfigFlags import initConfigFlags flags = initConfigFlags() @@ -29,7 +29,7 @@ flags.dump() from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg( flags ) -from ActsGeometry.ActsGeometryConfig import ActsExtrapolationAlgCfg, ActsTrackingGeometrySvcCfg +from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationAlgCfg, ActsTrackingGeometrySvcCfg from AthenaCommon.Constants import INFO tgSvc = ActsTrackingGeometrySvcCfg(flags, diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsAlignmentStore.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsAlignmentStore.h index 5457c18119827ab985d9a715ddc8114bcf644950..3ea0a8b5ae60e076b8cd8a1e1c0d8445904b3966 100644 --- a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsAlignmentStore.h +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsAlignmentStore.h @@ -1,37 +1,8 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSGEOMETRYINTERFACES_ACTSALIGNMENTSTORE_H #define ACTSGEOMETRYINTERFACES_ACTSALIGNMENTSTORE_H - -#include "GeoModelUtilities/GeoAlignmentStore.h" -#include "GeoModelUtilities/TransformMap.h" -#include "AthenaKernel/CLASS_DEF.h" -#include "AthenaKernel/CondCont.h" - -#include "Acts/Definitions/Algebra.hpp" - -#include <stdexcept> - -class ActsDetectorElement; - -class ActsAlignmentStore : public GeoAlignmentStore -{ - public: - ActsAlignmentStore() {} - ActsAlignmentStore(const GeoAlignmentStore& gas); - - void setTransform(const ActsDetectorElement* key, const Acts::Transform3&); - const Acts::Transform3* getTransform(const ActsDetectorElement* key) const; - - void append(const GeoAlignmentStore& gas); - - private: - TransformMap<ActsDetectorElement, Acts::Transform3> m_transforms; -}; - -CLASS_DEF(ActsAlignmentStore, 58496671, 1) -CONDCONT_DEF( ActsAlignmentStore , 44989665 ); - +/// Empty file to be removed in a follow-up MR #endif diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsGeometryContext.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsGeometryContext.h index 843711c3a4a4dcd67e390fbf9c6e564a001e7c53..0a91aacdd97785f5ae761e9c6ecfc2d6376928eb 100644 --- a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsGeometryContext.h +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/ActsGeometryContext.h @@ -1,35 +1,36 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSGEOMETRYINTERFACES_ACTSGEOMETRYCONTEXT_H #define ACTSGEOMETRYINTERFACES_ACTSGEOMETRYCONTEXT_H -#include "ActsGeometryInterfaces/ActsAlignmentStore.h" - +#include <map> +#include <memory> +/// Includes the GeoPrimitives +#include "ActsGeometryInterfaces/GeometryDefs.h" +/// To be put first +#include "Acts/Geometry/GeometryContext.hpp" +#include "ActsGeometryInterfaces/AlignmentStore.h" #include "AthenaKernel/CLASS_DEF.h" #include "AthenaKernel/CondCont.h" - -#include "Acts/Geometry/GeometryContext.hpp" - -#include <memory> +#include "GeoModelUtilities/TransientConstSharedPtr.h" class ActsGeometryContext { public: - bool construction{false}; - - std::unique_ptr<const ActsAlignmentStore> ownedAlignmentStore{nullptr}; + using DetectorType = ActsTrk::DetectorType; + using AlignmentStore = ActsTrk::AlignmentStore; + /// Populate a map containing the alignment stores of each + /// sub detector --> Avoid duplication of copying the transforms if + /// only one subsystem updates alignment + using SubDetAlignments = std::map<DetectorType, GeoModel::TransientConstSharedPtr<AlignmentStore>>; - const ActsAlignmentStore* alignmentStore{nullptr}; + SubDetAlignments alignmentStores{}; - Acts::GeometryContext - context() const - { - return Acts::GeometryContext(this); - } + Acts::GeometryContext context() const { return Acts::GeometryContext(this); } }; CLASS_DEF(ActsGeometryContext, 51464195, 1) -CONDCONT_DEF( ActsGeometryContext , 11228079 ); +CONDCONT_DEF(ActsGeometryContext, 11228079); #endif diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/AlignmentStore.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/AlignmentStore.h new file mode 100644 index 0000000000000000000000000000000000000000..4d3662e283d8e64320f3574db9b42f7834412493 --- /dev/null +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/AlignmentStore.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSGEOMETRYINTERFACES_ALIGNMENTSTORE_H +#define ACTSGEOMETRYINTERFACES_ALIGNMENTSTORE_H + +/// Includes the GeoPrimitives +#include "ActsGeometryInterfaces/GeometryDefs.h" +/// To be put first + +#include "AthenaKernel/CLASS_DEF.h" +#include "AthenaKernel/CondCont.h" +#include "GeoModelUtilities/GeoAlignmentStore.h" +#include "GeoModelUtilities/TransformMap.h" + +namespace ActsTrk { + + class AlignmentStore { + public: + AlignmentStore() = default; + + void setTransform(const void* key, const Acts::Transform3&); + const Acts::Transform3* getTransform(const void* key) const; + + private: + TransformMap<void, Acts::Transform3> m_transforms; + }; + +} // namespace ActsTrk + +CLASS_DEF(ActsTrk::AlignmentStore, 134756361, 1); +CONDCONT_DEF(ActsTrk::AlignmentStore, 7514121); + +#endif diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/GeometryDefs.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/GeometryDefs.h new file mode 100644 index 0000000000000000000000000000000000000000..c9d8e5bf3f67df95e11fdd84b6b4263299282d1f --- /dev/null +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/GeometryDefs.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef ACTSGEOMETRYINTERFACES_GEOMETRYDEFS_H +#define ACTSGEOMETRYINTERFACES_GEOMETRYDEFS_H + +/// Load ATLAS Eigen library with custom geometry functions +#include "GeoPrimitives/GeoPrimitives.h" +/// Then load the Acts TypeDef definitions for Eigen +#include <string> + +#include "Acts/Definitions/Algebra.hpp" + +namespace ActsTrk { + /// Simple enum to Identify the Type of the + /// ACTS sub detector + enum class DetectorType { + UnDefined = 0, + /// Inner detector legacy + Pixel, + Sct, + /// Maybe the Sct / Pixel for Itk become seperate entries? + Trt, + Hgtd, + /// MuonSpectrometer + Mdt, /// Monitored Drift Tubes + Rpc, /// Resitive Plate Chambers + Tgc, /// Thin gap champers + Csc, /// Maybe not needed in the migration + Mm, /// Micromegas (NSW) + sTgc /// Small Thing Gap chambers (NSW) + }; + + inline std::string to_string(const DetectorType& type) { + if (type == DetectorType::Pixel) + return "Pixel"; + else if (type == DetectorType::Pixel) + return "Pixel"; + else if (type == DetectorType::Sct) + return "Sct"; + else if (type == DetectorType::Trt) + return "Trt"; + else if (type == DetectorType::Hgtd) + return "Hgtd"; + else if (type == DetectorType::Mdt) + return "Mdt"; + else if (type == DetectorType::Rpc) + return "Rpc"; + else if (type == DetectorType::Tgc) + return "Tgc"; + else if (type == DetectorType::Csc) + return "Csc"; + else if (type == DetectorType::Mm) + return "Mm"; + else if (type == DetectorType::sTgc) + return "sTgc"; + return "Unknown"; + } + +} // namespace ActsTrk +#endif \ No newline at end of file diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsExtrapolationTool.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsExtrapolationTool.h index a4f7a0191c23ab8756f04bf25ef4fcddea2383ed..a9652593e6ebde5d380566c356117e74cd5446ce 100644 --- a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsExtrapolationTool.h +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsExtrapolationTool.h @@ -37,7 +37,7 @@ class IActsExtrapolationTool : virtual public IAlgTool { ActsPropagationOutput propagationSteps(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const = 0; @@ -45,7 +45,7 @@ class IActsExtrapolationTool : virtual public IAlgTool { std::optional<const Acts::CurvilinearTrackParameters> propagate(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const = 0; @@ -54,7 +54,7 @@ class IActsExtrapolationTool : virtual public IAlgTool { propagationSteps(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, const Acts::Surface& target, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const = 0; @@ -63,7 +63,7 @@ class IActsExtrapolationTool : virtual public IAlgTool { propagate(const EventContext& ctx, const Acts::BoundTrackParameters& startParameters, const Acts::Surface& target, - Acts::NavigationDirection navDir = Acts::NavigationDirection::Forward, + Acts::Direction navDir = Acts::Direction::Forward, double pathLimit = std::numeric_limits<double>::max(), Trk::ParticleHypothesis particleHypo = Trk::pion) const = 0; diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometrySvc.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometrySvc.h index 8c45898863b739206036ce07a80903bc98eddcd3..850351936022d3a42fe715988f30aab4a4c372f3 100644 --- a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometrySvc.h +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometrySvc.h @@ -1,37 +1,37 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSGEOMETRYINTERFACES_IACTSTRACKINGGEOMETRYSVC_H #define ACTSGEOMETRYINTERFACES_IACTSTRACKINGGEOMETRYSVC_H -#include "GaudiKernel/IInterface.h" +#include "GaudiKernel/IService.h" +#include "ActsGeometryInterfaces/ActsGeometryContext.h" +#include "ActsGeometryInterfaces/RawGeomAlignStore.h" + +#include <memory> -class EventContext; -class ActsAlignmentStore; namespace Acts { - class TrackingGeometry; + class TrackingGeometry; } - -class IActsTrackingGeometrySvc : virtual public IInterface { - public: - - DeclareInterfaceID(IActsTrackingGeometrySvc, 1, 0); - - virtual - std::shared_ptr<const Acts::TrackingGeometry> - trackingGeometry() = 0; - - virtual - void - populateAlignmentStore(ActsAlignmentStore *store) const = 0; - - virtual - const ActsAlignmentStore* - getNominalAlignmentStore() const = 0; - +class IActsTrackingGeometrySvc : virtual public IService { +public: + DeclareInterfaceID(IActsTrackingGeometrySvc, 1, 0); + + virtual ~IActsTrackingGeometrySvc() = default; + /// Returns a pointer to the internal ACTS tracking geometry + virtual std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry() = 0; + + /// Caches the final transformations in the alignment store for a given sub detector type + /// (defined by an internal flag in the Store). Returns the number of added elements + virtual unsigned int populateAlignmentStore(ActsTrk::RawGeomAlignStore& store) const = 0; + /// Checks whether the GeometryContext has alignment stores foreach active subdetector + /// excluding the TRTs. Returns a StatusCode::FAILURE if an AlignmentStore is missing + virtual StatusCode checkAlignComplete(const ActsGeometryContext& ctx) const = 0; + /// Returns an empty nominal context without any alignment caches + virtual const ActsGeometryContext& getNominalContext() const = 0; }; #endif diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometryTool.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometryTool.h index 0971edd2a12b41e58e9928b6a6b62e198d908b7a..562a5b4aff1360902d0c7a25ccf9fb8faf51ce01 100644 --- a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometryTool.h +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IActsTrackingGeometryTool.h @@ -1,37 +1,34 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSGEOMETRYINTERFACES_IACTSTRACKINGGEOMETRYTOOL_H #define ACTSGEOMETRYINTERFACES_IACTSTRACKINGGEOMETRYTOOL_H +#include "ActsGeometryInterfaces/ActsGeometryContext.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/IInterface.h" -#include "GaudiKernel/IAlgTool.h" #include "GaudiKernel/EventContext.h" -#include "ActsGeometryInterfaces/ActsGeometryContext.h" +#include "GaudiKernel/IAlgTool.h" +#include "GaudiKernel/IInterface.h" namespace Acts { - class TrackingGeometry; + class TrackingGeometry; } - class IActsTrackingGeometryTool : virtual public IAlgTool { - public: - - DeclareInterfaceID(IActsTrackingGeometryTool, 1, 0); +public: + DeclareInterfaceID(IActsTrackingGeometryTool, 1, 0); - virtual - std::shared_ptr<const Acts::TrackingGeometry> - trackingGeometry() const = 0; + virtual std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry() const = 0; - virtual - const ActsGeometryContext& - getGeometryContext(const EventContext& ctx = Gaudi::Hive::currentContext()) const = 0; + /// Return the ActsGeometryContext for the current event with the cached alignment constants + virtual const ActsGeometryContext& getGeometryContext(const EventContext& ctx) const = 0; + /// Method without explicitly piping the event context + virtual const ActsGeometryContext& getGeometryContext() const = 0; - virtual - ActsGeometryContext - getNominalGeometryContext() const = 0; + /// Returns the refrence to the nominal ActsGeometryContext. The context is hold + /// by the tracking geometry service and does not contain any alignable transforms + virtual const ActsGeometryContext& getNominalGeometryContext() const = 0; }; #endif diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IDetectorElement.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IDetectorElement.h new file mode 100644 index 0000000000000000000000000000000000000000..ec118246e549baf70ff518dfda52cc87fb93fff9 --- /dev/null +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/IDetectorElement.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef ACTSGEOMETRYINTERFACES_IACTSDETECTORELEMENT_H +#define ACTSGEOMETRYINTERFACES_IACTSDETECTORELEMENT_H + +/// Includes the GeoPrimitives +#include "ActsGeometryInterfaces/GeometryDefs.h" +/// To be put first + +#include "Acts/Geometry/DetectorElementBase.hpp" +#include "ActsGeometryInterfaces/RawGeomAlignStore.h" +#include "Identifier/Identifier.h" + +namespace ActsTrk { + class IDetectorElement : public Acts::DetectorElementBase { + public: + virtual ~IDetectorElement() = default; + + /// Returns the ATLAS identifier + virtual Identifier identify() const = 0; + /// Returns the detector element type + virtual DetectorType detectorType() const = 0; + /// Cache the detector element transformations in the Geometry Context + /// Returns false if the detectorType() of the DetectorElement does not + /// match the one in the alignment store + virtual bool storeAlignment(RawGeomAlignStore& store) const = 0; + }; +} // namespace ActsTrk + +#endif \ No newline at end of file diff --git a/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/RawGeomAlignStore.h b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/RawGeomAlignStore.h new file mode 100644 index 0000000000000000000000000000000000000000..0d7bb730645b1372dab04e4c55d1783df2bcd594 --- /dev/null +++ b/Tracking/Acts/ActsGeometryInterfaces/ActsGeometryInterfaces/RawGeomAlignStore.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef ACTSGEOMETRYINTERFACES_RawGeomAlignStore_H +#define ACTSGEOMETRYINTERFACES_RawGeomAlignStore_H + +/// Includes the GeoPrimitives +#include "ActsGeometryInterfaces/GeometryDefs.h" +/// To be put first +#include "ActsGeometryInterfaces/AlignmentStore.h" +#include "AthenaKernel/CLASS_DEF.h" +#include "AthenaKernel/CondCont.h" +#include "GeoModelUtilities/GeoAlignmentStore.h" +#include "GeoModelUtilities/TransientConstSharedPtr.h" + +/// The ActsFromGeoAlignStore is an adaptor to go from the GeoModel world caching the +/// rigid transformations of the detector elements to the Acts world where transformations + +namespace ActsTrk { + + class RawGeomAlignStore { + public: + /// Default constructor + RawGeomAlignStore() = default; + /// Default virtual destructor + virtual ~RawGeomAlignStore() = default; + /// Store written by the conditions algorithm aligning each subsystem + GeoModel::TransientConstSharedPtr<GeoAlignmentStore> geoModelAlignment{std::make_unique<GeoAlignmentStore>()}; + /// Store holding the alignment of each Acts Detector Element transformation + GeoModel::TransientConstSharedPtr<AlignmentStore> trackingAlignment{std::make_unique<AlignmentStore>()}; + /// The aligned detector element type + DetectorType detType{DetectorType::UnDefined}; + }; +} // namespace ActsTrk +CLASS_DEF(ActsTrk::RawGeomAlignStore, 267137212, 1); +CONDCONT_DEF(ActsTrk::RawGeomAlignStore, 27391946); + +#endif diff --git a/Tracking/Acts/ActsInterop/ActsInterop/Logger.h b/Tracking/Acts/ActsInterop/ActsInterop/Logger.h index c7618676a3d14cb28a17904792d3a6b3fc088374..04074371147c20cc0563c99243dcae60b12d516a 100644 --- a/Tracking/Acts/ActsInterop/ActsInterop/Logger.h +++ b/Tracking/Acts/ActsInterop/ActsInterop/Logger.h @@ -40,8 +40,6 @@ class ActsAthenaFilterPolicy final : public Acts::Logging::OutputFilterPolicy { public: ActsAthenaFilterPolicy(std::shared_ptr<MsgStream> msg) : m_msg(msg) {} - //~AthenaFilterPolicy() = default; - bool doPrint(const Acts::Logging::Level& lvl) const override; virtual diff --git a/Tracking/Acts/ActsInterop/ActsInterop/LoggerUtils.h b/Tracking/Acts/ActsInterop/ActsInterop/LoggerUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..9b99e3101ef1e064d101390111b7d96511d92a0e --- /dev/null +++ b/Tracking/Acts/ActsInterop/ActsInterop/LoggerUtils.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSINTEROP_LOGGER_UTILS_H +#define ACTSINTEROP_LOGGER_UTILS_H + +#include "Acts/Utilities/Logger.hpp" +#include "GaudiKernel/MsgStream.h" + +namespace ActsTrk { + Acts::Logging::Level actsLevelVector(MSG::Level lvl); + MSG::Level athLevelVector(Acts::Logging::Level lvl); +} + +#endif diff --git a/Tracking/Acts/ActsInterop/CMakeLists.txt b/Tracking/Acts/ActsInterop/CMakeLists.txt old mode 100755 new mode 100644 index 6b7774eb633c74b3166046550f9be084be5505f5..6805ddcede2c454be360371d2822c872e809b194 --- a/Tracking/Acts/ActsInterop/CMakeLists.txt +++ b/Tracking/Acts/ActsInterop/CMakeLists.txt @@ -30,7 +30,10 @@ atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_add_test( Units SCRIPT test/test_units.py POST_EXEC_SCRIPT nopost.sh ) - -atlas_add_test( TrackingComponents - SCRIPT test/TrackingComponents.py ) +atlas_add_test( ActsLogger + SOURCES test/LoggerTest.cxx + LINK_LIBRARIES ActsInteropLib AthenaBaseComps TestTools + POST_EXEC_SCRIPT nopost.sh ) + + diff --git a/Tracking/Acts/ActsInterop/doc/packagedoc.h b/Tracking/Acts/ActsInterop/doc/packagedoc.h old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsInterop/python/ActsPostIncludes.py b/Tracking/Acts/ActsInterop/python/ActsPostIncludes.py deleted file mode 100644 index 1c543501cc517271da748fa392d467c1bdbf3ea6..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsInterop/python/ActsPostIncludes.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator - -def PersistifyActsEDMCfg(flags) -> ComponentAccumulator: - acc = ComponentAccumulator() - - pixel_cluster_shortlist = ['-pixelClusterLink'] - strip_cluster_shortlist = ['-sctClusterLink'] - - pixel_cluster_variables = '.'.join(pixel_cluster_shortlist) - strip_cluster_variables = '.'.join(strip_cluster_shortlist) - - toAOD = ["xAOD::PixelClusterContainer#ITkPixelClusters", - "xAOD::PixelClusterAuxContainer#ITkPixelClustersAux." + pixel_cluster_variables, - "xAOD::StripClusterContainer#ITkStripClusters", - "xAOD::StripClusterAuxContainer#ITkStripClustersAux." + strip_cluster_variables] - - pixel_spacepoint_shortlist = [] - strip_spacepoint_shortlist = ["topHalfStripLength", - "bottomHalfStripLength", - "topStripDirection", - "bottomStripDirection", - "stripCenterDistance", - "topStripCenter"] - - pixel_spacepoint_variables = ".".join(pixel_spacepoint_shortlist) - strip_spacepoint_variables = ".".join(strip_spacepoint_shortlist) - - toAOD += ["xAOD::SpacePointContainer#ITkPixelSpacePoints", - "xAOD::SpacePointAuxContainer#ITkPixelSpacePointsAux." + pixel_spacepoint_variables, - "xAOD::SpacePointContainer#ITkStripSpacePoints", - "xAOD::SpacePointAuxContainer#ITkStripSpacePointsAux." + strip_spacepoint_variables, - "xAOD::SpacePointContainer#ITkStripOverlapSpacePoints", - "xAOD::SpacePointAuxContainer#ITkStripOverlapSpacePointsAux." + strip_spacepoint_variables] - - from OutputStreamAthenaPool.OutputStreamConfig import addToAOD - acc.merge(addToAOD(flags, toAOD)) - return acc diff --git a/Tracking/Acts/ActsInterop/src/Logger.cxx b/Tracking/Acts/ActsInterop/src/Logger.cxx index d6f974cf524edd85e7d51150257deee88d0d1051..7c290bc5d224b0d8fce1ea6445e8b395a0f3624d 100644 --- a/Tracking/Acts/ActsInterop/src/Logger.cxx +++ b/Tracking/Acts/ActsInterop/src/Logger.cxx @@ -3,6 +3,7 @@ */ #include "ActsInterop/Logger.h" +#include "ActsInterop/LoggerUtils.h" #include "GaudiKernel/INamedInterface.h" #include "GaudiKernel/CommonMessaging.h" @@ -17,30 +18,10 @@ #include <iostream> #include <string> -namespace { - static const std::array<MSG::Level, 6> athLevelVector{ - MSG::VERBOSE, - MSG::DEBUG, - MSG::INFO, - MSG::WARNING, - MSG::ERROR, - MSG::FATAL - }; - - static const std::array<Acts::Logging::Level, 6> actsLevelVector{ - Acts::Logging::Level::VERBOSE, - Acts::Logging::Level::DEBUG, - Acts::Logging::Level::INFO, - Acts::Logging::Level::WARNING, - Acts::Logging::Level::ERROR, - Acts::Logging::Level::FATAL - }; -} - void ActsAthenaPrintPolicy::flush(const Acts::Logging::Level& lvl, const std::string& input) { - MSG::Level athLevel = athLevelVector[lvl]; + MSG::Level athLevel = ActsTrk::athLevelVector(lvl); (*m_msg) << athLevel << input << endmsg; } @@ -61,21 +42,21 @@ bool ActsAthenaFilterPolicy::doPrint(const Acts::Logging::Level& lvl) const { - MSG::Level athLevel = athLevelVector[lvl]; + MSG::Level athLevel = ActsTrk::athLevelVector(lvl); return m_msg->level() <= athLevel; } Acts::Logging::Level ActsAthenaFilterPolicy::level() const { - return actsLevelVector[m_msg->level()]; + return ActsTrk::actsLevelVector(m_msg->level()); } std::unique_ptr<Acts::Logging::OutputFilterPolicy> ActsAthenaFilterPolicy::clone(Acts::Logging::Level level) const { auto msg = std::make_shared<MsgStream>(*m_msg.get()); - msg->setLevel(athLevelVector[level]); + msg->setLevel(ActsTrk::athLevelVector(level)); return std::make_unique<ActsAthenaFilterPolicy>(msg); } diff --git a/Tracking/Acts/ActsInterop/src/LoggerUtils.cxx b/Tracking/Acts/ActsInterop/src/LoggerUtils.cxx new file mode 100644 index 0000000000000000000000000000000000000000..45eca04a6bf020f909817c3e5e06c21a46286958 --- /dev/null +++ b/Tracking/Acts/ActsInterop/src/LoggerUtils.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "ActsInterop/LoggerUtils.h" + +namespace ActsTrk { + + Acts::Logging::Level actsLevelVector(MSG::Level lvl) { + // MSG::NIL and MSG::ALWAYS are not available in Acts. Need to protect against these + // For MSG::NIL we can return a Acts::Logging::Level::FATAL; + // For MSG::ALWAYS we can return a Acts::Logging::Level::VERBOSE + + // Gaudi definitions are +1 w.r.t. Acts definitions + static const std::array<Acts::Logging::Level, 8> actsLevelVector{ + Acts::Logging::Level::FATAL, // MSG::NIL + Acts::Logging::Level::VERBOSE, + Acts::Logging::Level::DEBUG, + Acts::Logging::Level::INFO, + Acts::Logging::Level::WARNING, + Acts::Logging::Level::ERROR, + Acts::Logging::Level::FATAL, + Acts::Logging::Level::VERBOSE // MSG::ALWAYS + }; + + return actsLevelVector[static_cast<int>(lvl)]; + } + + MSG::Level athLevelVector(Acts::Logging::Level lvl) { + // All Acts log levels are available in Gaudi, no need for protections + static const std::array<MSG::Level, 6> athLevelVector{ + MSG::VERBOSE, + MSG::DEBUG, + MSG::INFO, + MSG::WARNING, + MSG::ERROR, + MSG::FATAL + }; + return athLevelVector[static_cast<int>(lvl)]; + } + +} diff --git a/Tracking/Acts/ActsInterop/test/LoggerTest.cxx b/Tracking/Acts/ActsInterop/test/LoggerTest.cxx new file mode 100755 index 0000000000000000000000000000000000000000..83b6c7e22ec7390af67f84f9dec8bf589bd49967 --- /dev/null +++ b/Tracking/Acts/ActsInterop/test/LoggerTest.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#define BOOST_TEST_MODULE ActsLoggerTest +#include <boost/test/data/test_case.hpp> +#include <boost/test/included/unit_test.hpp> + +#include <iostream> +#include <memory> +#include <stdexcept> + +#include "AthenaBaseComps/AthMessaging.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/ISvcLocator.h" +#include "GaudiKernel/IMessageSvc.h" +#include "TestTools/initGaudi.h" + +#include "ActsInterop/Logger.h" +#include "ActsInterop/LoggerUtils.h" + +namespace ActsTrk::Test { + static const std::array<MSG::Level, 6> gaudiLogLevels {MSG::FATAL, MSG::ERROR, MSG::WARNING, MSG::INFO, MSG::DEBUG, MSG::VERBOSE}; + static const std::array<Acts::Logging::Level, 6> actsLogLevels {Acts::Logging::Level::FATAL, Acts::Logging::Level::ERROR, Acts::Logging::Level::WARNING, Acts::Logging::Level::INFO, Acts::Logging::Level::DEBUG, Acts::Logging::Level::VERBOSE}; +} + +BOOST_AUTO_TEST_SUITE( loglevel_consistency ) + +BOOST_AUTO_TEST_CASE( loglevel_conversion ) +{ + for (std::size_t i(0); i<6; ++i) { + auto gaudiLevel = ActsTrk::Test::gaudiLogLevels[i]; + auto actsLevel = ActsTrk::Test::actsLogLevels[i]; + + BOOST_CHECK_EQUAL(actsLevel, ActsTrk::actsLevelVector(gaudiLevel)); + BOOST_CHECK_EQUAL(ActsTrk::athLevelVector(actsLevel), gaudiLevel); + BOOST_CHECK_EQUAL(actsLevel, ActsTrk::actsLevelVector(ActsTrk::athLevelVector(actsLevel))); + BOOST_CHECK_EQUAL(gaudiLevel, ActsTrk::athLevelVector(ActsTrk::actsLevelVector(gaudiLevel))); + } +} + +BOOST_AUTO_TEST_CASE( loglevel_propagation ) +{ + ISvcLocator* svcLoc = nullptr; + IMessageSvc* msgSvc = nullptr; + if (!Athena_test::initGaudi(svcLoc)) + throw std::runtime_error("Failure in initializing Gaudi"); + if (svcLoc->service("MessageSvc", msgSvc).isFailure()) + throw std::runtime_error("Failure in retrieving MessageSvc"); + + for (MSG::Level lvl : ActsTrk::Test::gaudiLogLevels) { + std::string name = "MsgStream"; + auto msg = std::make_shared<::MsgStream>(msgSvc, name); + msg->setLevel(lvl); + BOOST_CHECK_EQUAL(lvl, msg->level()); + + auto filter = std::make_unique<ActsAthenaFilterPolicy>(msg); + auto print = std::make_unique<ActsAthenaPrintPolicy>(msg, name); + const auto logger = std::make_unique<const Acts::Logger>(std::move(print), std::move(filter)); + + BOOST_CHECK_EQUAL(logger->name(), name); + BOOST_CHECK_EQUAL(logger->level(), ActsTrk::actsLevelVector(msg->level())); + + // make a clone + auto clonedLogger = logger->clone("ClonedLogger"); + BOOST_CHECK_EQUAL(logger->level(), clonedLogger->level()); + + // make a clone with suffix + auto clonedWithSuffixLogger = logger->cloneWithSuffix("ClonedLogger"); + BOOST_CHECK_EQUAL(logger->level(), clonedWithSuffixLogger->level()); + } +} + +BOOST_AUTO_TEST_SUITE_END() + diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/CMakeLists.txt b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/CMakeLists.txt index 9f677cb55b2a8e0b72a1ea24cd86aa7a562542f5..5eb1c5712964b8e72f614b4701e6412f8a04accf 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ActsTrkAnalysis ) @@ -7,9 +7,25 @@ atlas_subdir( ActsTrkAnalysis ) atlas_add_component( ActsTrkAnalysis src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel Identifier InDetIdentifier InDetReadoutGeometry StoreGateLib ActsTrkEvent xAODInDetMeasurement - AthenaMonitoringKernelLib AthenaMonitoringLib TrkTruthData ActsTrkToolInterfacesLib - PixelReadoutGeometryLib ReadoutGeometryBase InDetReadoutGeometry SCT_ReadoutGeometry ActsTrkEventCnvLib ) + LINK_LIBRARIES + AthenaBaseComps + AthenaKernel + GaudiKernel + Identifier + InDetIdentifier + InDetReadoutGeometry + StoreGateLib + ActsTrkEventLib + xAODInDetMeasurement + AthenaMonitoringKernelLib + AthenaMonitoringLib + TrkTruthData + ActsTrkToolInterfacesLib + InDetRecToolInterfaces + PixelReadoutGeometryLib + ReadoutGeometryBase + InDetReadoutGeometry + SCT_ReadoutGeometry + ActsTrkEventCnvLib ) -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_scripts( test/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/PixelClusterAnalysisAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/PixelClusterAnalysisAlg.cxx index 91028643c85fb99f8d64f5cf2f89dc3ae7903ff8..792f6773d707150b25f747645e699806001c6cbd 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/PixelClusterAnalysisAlg.cxx +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/PixelClusterAnalysisAlg.cxx @@ -122,6 +122,10 @@ namespace ActsTrk { [] (const auto* cluster) -> int { return cluster->channelsInEta(); }); + auto monitor_widthY = Monitored::Collection("widthY", *inputPixelClusterContainer, + [] (const auto* cluster) -> float + { return cluster->widthInEta(); }); + fill("ActsTrkClusterAnalysisAlg", monitor_barrelEndcap, monitor_layerDisk, monitor_phiModule, monitor_etaModule, @@ -130,7 +134,8 @@ namespace ActsTrk { monitor_globalX, monitor_globalY, monitor_globalZ, monitor_localX, monitor_localY, monitor_localCovXX, monitor_localCovYY, - monitor_sizeX, monitor_sizeY); + monitor_sizeX, monitor_sizeY, + monitor_widthY); return StatusCode::SUCCESS; } diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/SeedingAlgorithmAnalysisAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/SeedingAlgorithmAnalysisAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b62e97f39f0ae9e0fbc44096c3c5e446de97a8d3 --- /dev/null +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/SeedingAlgorithmAnalysisAlg.cxx @@ -0,0 +1,95 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "SeedingAlgorithmAnalysisAlg.h" +#include "AthenaMonitoringKernel/Monitored.h" + +#include "SiSPSeededTrackFinderData/SiSpacePointsSeedMakerEventData.h" + +ActsTrk::SeedingAlgorithmAnalysisAlg::SeedingAlgorithmAnalysisAlg(const std::string& name, + ISvcLocator *pSvcLocator) +: AthMonitorAlgorithm(name, pSvcLocator) +{} + +StatusCode ActsTrk::SeedingAlgorithmAnalysisAlg::initialize() { + ATH_MSG_DEBUG( "Initializing SeedingAlgorithmAnalysisAlg" ); + + ATH_CHECK(m_seedingTools.retrieve()); + + if (m_monitoringGroupNames.size() != m_seedingTools.size()) { + ATH_MSG_ERROR("Number of monitoring tools not equal to number of seeding tools! Please check!"); + return StatusCode::FAILURE; + } + + return AthMonitorAlgorithm::initialize(); +} + +StatusCode ActsTrk::SeedingAlgorithmAnalysisAlg::fillHistograms(const EventContext& ctx) const { + ATH_MSG_DEBUG(" In SeedingAlgorithmAnalysisAlg::fillHistograms()" ); + + for (unsigned int index(0); index < m_seedingTools.size() ; ++index) { + const auto& seedingTool = m_seedingTools[index]; + + std::array<Monitored::Timer<std::chrono::milliseconds>, TimeMonitoringType::AllTypes> timeMonitors = { + Monitored::Timer<std::chrono::milliseconds>("TIME_initTimeFirstIter"), + Monitored::Timer<std::chrono::milliseconds>("TIME_initTimeSecondIter"), + Monitored::Timer<std::chrono::milliseconds>("TIME_SSS"), + Monitored::Timer<std::chrono::milliseconds>("TIME_PPP") + }; + + auto eventNumber = Monitored::Scalar<int>("eventNumber", ctx.eventID().event_number()); + + InDet::SiSpacePointsSeedMakerEventData seedEventData; + + timeMonitors[TimeMonitoringType::StripSeedInitialisation].start(); + seedingTool->newEvent(ctx, seedEventData, 0); + timeMonitors[TimeMonitoringType::StripSeedInitialisation].stop(); + auto stripSeedInitialisationTime = Monitored::Scalar<float>("stripSeedInitialisationTime", static_cast<float>(timeMonitors[TimeMonitoringType::StripSeedInitialisation])); + + auto numberStripSpacePoints = Monitored::Scalar<int>("numberStripSpacePoints", seedEventData.nsaz); + + timeMonitors[TimeMonitoringType::StripSeedProduction].start(); + seedingTool->find3Sp(ctx, seedEventData, {}); + timeMonitors[TimeMonitoringType::StripSeedProduction].stop(); + auto stripSeedProductionTime = Monitored::Scalar<float>("stripSeedProductionTime", static_cast<float>(timeMonitors[TimeMonitoringType::StripSeedProduction])); + + auto numberStripSeeds = Monitored::Scalar<int>("numberStripSeeds", 0); + if (not seedEventData.l_ITkSpacePointForSeed.empty()) + numberStripSeeds = seedEventData.i_ITkSeeds.size(); + else if (not seedEventData.v_ActsSpacePointForSeed.empty()) + numberStripSeeds = seedEventData.nsazv; + + timeMonitors[TimeMonitoringType::PixelSeedInitialisation].start(); + seedingTool->newEvent(ctx, seedEventData, 1); + timeMonitors[TimeMonitoringType::PixelSeedInitialisation].stop(); + auto pixelSeedInitialisationTime = Monitored::Scalar<float>("pixelSeedInitialisationTime", static_cast<float>(timeMonitors[TimeMonitoringType::PixelSeedInitialisation])); + + auto numberPixelSpacePoints = Monitored::Scalar<int>("numberPixelSpacePoints", seedEventData.nsaz); + + timeMonitors[TimeMonitoringType::PixelSeedProduction].start(); + seedingTool->find3Sp(ctx, seedEventData, {}); + timeMonitors[TimeMonitoringType::PixelSeedProduction].stop(); + auto pixelSeedProductionTime = Monitored::Scalar<float>("pixelSeedProductionTime", static_cast<float>(timeMonitors[TimeMonitoringType::PixelSeedProduction])); + + auto numberPixelSeeds = Monitored::Scalar<int>("numberPixelSeeds", 0); + if (not seedEventData.l_ITkSpacePointForSeed.empty()) + numberPixelSeeds = seedEventData.i_ITkSeeds.size(); + else if (not seedEventData.v_ActsSpacePointForSeed.empty()) + numberPixelSeeds = seedEventData.nsazv; + + auto monGroup = getGroup(m_monitoringGroupNames[index]); + fill(monGroup, + eventNumber, + stripSeedInitialisationTime, + stripSeedProductionTime, + pixelSeedInitialisationTime, + pixelSeedProductionTime, + numberPixelSpacePoints, + numberStripSpacePoints, + numberPixelSeeds, + numberStripSeeds); + } + + return StatusCode::SUCCESS; +} diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/SeedingAlgorithmAnalysisAlg.h b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/SeedingAlgorithmAnalysisAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..5bf79cf83bd68d8c6a12e2a1d9725878a9d1cf95 --- /dev/null +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/SeedingAlgorithmAnalysisAlg.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSTRKALGS_SEEDINGALGORITHMANALYSISALG_H +#define ACTSTRKALGS_SEEDINGALGORITHMANALYSISALG_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" + +#include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h" + +namespace ActsTrk { + class SeedingAlgorithmAnalysisAlg final: public AthMonitorAlgorithm { + + public: + SeedingAlgorithmAnalysisAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~SeedingAlgorithmAnalysisAlg() override = default; + + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms(const EventContext& ctx) const override; + + private: + ToolHandleArray<InDet::ISiSpacePointsSeedMaker> m_seedingTools{this, + "SeedingTools", {}, "List of seeding tools to test"}; + + StringArrayProperty m_monitoringGroupNames{this, + "MonitorNames", {}, "List of names of the monitoring groups"}; + + enum TimeMonitoringType : int { + StripSeedInitialisation = 0, + PixelSeedInitialisation, + StripSeedProduction, + PixelSeedProduction, + AllTypes + }; + + }; + +} + +#endif // ACTSTRKALGS_SEEDINGALGORITHMANALYSISALG_H diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/StripClusterAnalysisAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/StripClusterAnalysisAlg.cxx index c5978964075517107259d3e1f65c04e714e0c0d5..f0678a20f2241f048336aa98a99bac6b13849c68 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/StripClusterAnalysisAlg.cxx +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/StripClusterAnalysisAlg.cxx @@ -89,21 +89,17 @@ namespace ActsTrk { auto monitor_localX = Monitored::Collection("localX", *inputStripClusterContainer, [] (const auto cluster) -> float { - const auto& localPos = cluster->template localPosition<2>(); + const auto& localPos = cluster->template localPosition<1>(); return localPos(0,0); }); auto monitor_localCovXX = Monitored::Collection("localCovXX", *inputStripClusterContainer, [] (const auto* cluster) -> float - { return cluster->template localCovariance<2>()(0, 0); }); + { return cluster->template localCovariance<1>()(0, 0); }); auto monitor_sizeX = Monitored::Collection("sizeX", *inputStripClusterContainer, [] (const auto* cluster) -> int { return cluster->channelsInPhi(); }); - - auto monitor_hitsInThirdTimeBin = Monitored::Collection("hitsInThirdTimeBin", *inputStripClusterContainer, - [] (const auto* cluster) -> int - { return static_cast<int>(cluster->hitsInThirdTimeBin()); }); fill("ActsTrkClusterAnalysisAlg", monitor_barrelEndcap, monitor_layerDisk, @@ -111,7 +107,7 @@ namespace ActsTrk { monitor_eta, monitor_perp, monitor_globalX, monitor_globalY, monitor_globalZ, monitor_localX, monitor_localCovXX, - monitor_sizeX, monitor_hitsInThirdTimeBin); + monitor_sizeX); return StatusCode::SUCCESS; } diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/components/ActsTrkAnalysis_entries.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/components/ActsTrkAnalysis_entries.cxx index b14b2bc0d9e95178ab7d82ff22f4f2b4ae6101a4..0fecbe21608b21bb62451e7f334ff256d1fd3441 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/components/ActsTrkAnalysis_entries.cxx +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/src/components/ActsTrkAnalysis_entries.cxx @@ -7,9 +7,11 @@ #include "src/SpacePointAnalysisAlg.h" #include "src/SeedAnalysisAlg.h" #include "src/EstimatedTrackParamsAnalysisAlg.h" +#include "src/SeedingAlgorithmAnalysisAlg.h" DECLARE_COMPONENT( ActsTrk::PixelClusterAnalysisAlg ) DECLARE_COMPONENT( ActsTrk::StripClusterAnalysisAlg ) DECLARE_COMPONENT( ActsTrk::SpacePointAnalysisAlg ) DECLARE_COMPONENT( ActsTrk::SeedAnalysisAlg ) +DECLARE_COMPONENT( ActsTrk::SeedingAlgorithmAnalysisAlg ) DECLARE_COMPONENT( ActsTrk::EstimatedTrackParamsAnalysisAlg ) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsReadEDM.py b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsReadEDM.py index 423e91fa250b147aa4f9151cde84fd7e3101caa3..e0bb9db61b0cba232db7c51a25b0bdad7b6b25d5 100755 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsReadEDM.py +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsReadEDM.py @@ -29,11 +29,11 @@ if __name__ == "__main__": acc.merge(PoolReadCfg(flags)) if flags.readClusters: - from ActsTrkAnalysis.ActsTrkAnalysisConfig import ActsTrkClusterAnalysisCfg + from ActsConfig.ActsTrkAnalysisConfig import ActsTrkClusterAnalysisCfg acc.merge(ActsTrkClusterAnalysisCfg(flags)) if flags.readSpacePoints: - from ActsTrkAnalysis.ActsTrkAnalysisConfig import ActsTrkSpacePointAnalysisCfg + from ActsConfig.ActsTrkAnalysisConfig import ActsTrkSpacePointAnalysisCfg acc.merge(ActsTrkSpacePointAnalysisCfg(flags)) acc.printConfig() diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsSeedingAlgorithmTest.py b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsSeedingAlgorithmTest.py new file mode 100644 index 0000000000000000000000000000000000000000..023597fe2afb6bd274465fe2e3fb4857c06370de --- /dev/null +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkAnalysis/test/ActsSeedingAlgorithmTest.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +if __name__ == "__main__": + from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.ComponentAccumulator import printProperties + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + from AthenaCommon.Logging import logging + # import os + + flags = initConfigFlags() + flags.Detector.GeometryCalo = False + flags.Detector.GeometryMuon = False + flags.Concurrency.NumThreads = 1 + flags.Concurrency.NumConcurrentEvents = 1 + flags.DQ.useTrigger = False + flags.ITk.doTruth = False + flags.Exec.MaxEvents = 2 + flags.Output.HISTFileName = "ActsMonitoringOutput.root" + + # flags.Input.Files = ["../mc15_14TeV.600012.PhPy8EG_A14_ttbar_hdamp258p75_nonallhad.recon.RDO.e8185_s3856_r13998/RDO.30640759._000008.pool.root.1"] + + flags.lock() + + acc = MainServicesCfg(flags) + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + acc.merge(PoolReadCfg(flags)) + + from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg + acc.merge(BeamSpotCondAlgCfg(flags)) + + from InDetConfig.SiliconPreProcessing import ITkRecPreProcessingSiliconCfg + acc.merge(ITkRecPreProcessingSiliconCfg(flags)) + + from InDetConfig.InDetPrepRawDataFormationConfig import ITkInDetToXAODClusterConversionCfg + acc.merge(ITkInDetToXAODClusterConversionCfg(flags)) + + from InDetConfig.SiSpacePointFormationConfig import InDetToXAODSpacePointConversionCfg + acc.merge(InDetToXAODSpacePointConversionCfg(flags)) + + from InDetConfig.ITkTrackRecoConfig import CombinedTrackingPassFlagSets + flags_set = CombinedTrackingPassFlagSets(flags) + + print(flags_set[0].dump()) + + from ActsConfig.ActsTrkAnalysisConfig import ActsTrkSeedingAlgorithmAnalysisAlgCfg + acc.merge(ActsTrkSeedingAlgorithmAnalysisAlgCfg(flags_set[0])) + + mlog = logging.getLogger("SeedingAlgorithmAnalysis") + mlog.info("Configuring SeedingAlgorithmAnalysis: ") + printProperties( + mlog, + acc.getEventAlgo("ActsTrkSeedingAlgorithmAnalysis"), + nestLevel=2, + printDefaults=True, + ) + + flags.dump() + + # debug printout + acc.printConfig(withDetails=True, summariseProps=True) + + # run the job + status = acc.run() + + # report the execution status (0 ok, else error) + import sys + sys.exit(not status.isSuccess()) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 39d81fea67dcc70a2ac6e49997a90b645bc5dcfa..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization \ No newline at end of file diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/CMakeLists.txt b/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/CMakeLists.txt deleted file mode 100644 index fa9a84994292a51997e3a2444a4a926af4cda5db..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir(ActsTrkClusterization) - -# External dependencies: - -atlas_add_component( ActsTrkClusterization - src/*.cxx - src/components/*.cxx - LINK_LIBRARIES - ActsTrkToolInterfacesLib - AthenaBaseComps - AthenaMonitoringKernelLib - GaudiKernel - InDetConditionsSummaryService - InDetIdentifier - InDetRawData - xAODInDetMeasurement - ) - -atlas_install_python_modules(python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8}) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/StripClusterizationAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/StripClusterizationAlg.cxx deleted file mode 100644 index 255aea50236203255092794a8b4ea359538e736f..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/StripClusterizationAlg.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "StripClusterizationAlg.h" - -#include <AthenaMonitoringKernel/Monitored.h> -#include <xAODInDetMeasurement/StripClusterAuxContainer.h> - -namespace ActsTrk { - -StripClusterizationAlg::StripClusterizationAlg(const std::string& name, - ISvcLocator* pSvcLocator) - : AthReentrantAlgorithm(name, pSvcLocator) {} - -StatusCode StripClusterizationAlg::initialize() -{ - ATH_MSG_DEBUG("Initializing " << name() << "... "); - - ATH_CHECK(m_rdoContainerKey.initialize()); - ATH_CHECK(m_stripDetElStatus.initialize(!m_stripDetElStatus.empty())); - ATH_CHECK(m_stripDetEleCollKey.initialize()); - ATH_CHECK(m_clusterContainerKey.initialize()); - ATH_CHECK(m_clusteringTool.retrieve()); - ATH_CHECK(detStore()->retrieve(m_idHelper,"SCT_ID")); - - bool disableSmry = - !m_stripDetElStatus.empty() && !VALIDATE_STATUS_ARRAY_ACTIVATED; - ATH_CHECK(m_summaryTool.retrieve(DisableTool{disableSmry})); - - if (!m_monTool.empty()) - ATH_CHECK(m_monTool.retrieve()); - - return StatusCode::SUCCESS; -} - - -StatusCode StripClusterizationAlg::execute(const EventContext& ctx) const -{ - Monitored::Timer<std::chrono::milliseconds> timer("TIME_execute"); - Monitored::Group mon(m_monTool, timer); - - SG::ReadHandle<SCT_RDO_Container> rdoContainer - = SG::makeHandle(m_rdoContainerKey, ctx); - ATH_CHECK(rdoContainer.isValid()); - - SG::WriteHandle<xAOD::StripClusterContainer> clusterHandle - = SG::makeHandle(m_clusterContainerKey, ctx); - - SG::ReadHandle<InDet::SiDetectorElementStatus> status; - if (!m_stripDetElStatus.empty()) { - status = SG::makeHandle(m_stripDetElStatus, ctx); - if (!status.isValid()) { - ATH_MSG_FATAL("Invalid SiDetectorelementStatus"); - return StatusCode::FAILURE; - } - } - - SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> - stripDetEleHandle(m_stripDetEleCollKey, ctx); - const InDetDD::SiDetectorElementCollection* stripDetEle(*stripDetEleHandle); - if (!stripDetEleHandle.isValid() || stripDetEle == nullptr) { - ATH_MSG_FATAL("Invalid SiDetectorElementCollection"); - return StatusCode::FAILURE; - } - - ATH_CHECK( - clusterHandle.record(std::make_unique<xAOD::StripClusterContainer>(), - std::make_unique<xAOD::StripClusterAuxContainer>())); - - for (const InDetRawDataCollection<SCT_RDORawData> *rdos : *rdoContainer) { - if (rdos == nullptr or rdos->empty()) { - ATH_MSG_DEBUG("No input strip RDOs for this container element"); - continue; - } - IdentifierHash idHash = rdos->identifyHash(); - - bool goodModule = true; - if (m_checkBadModules.value()) { - if (!m_stripDetElStatus.empty()) { - goodModule = status->isGood(idHash); - } else { - goodModule = m_summaryTool->isGood(idHash, ctx); - } - } - VALIDATE_STATUS_ARRAY( - m_checkBadModules.value() && !m_stripDetElStatus.empty(), - status->isGood(idHash), - m_summaryTool->isGood(idHash)); - - if (!goodModule) { - ATH_MSG_DEBUG("Strip module failed status check"); - continue; - } - - ATH_CHECK(m_clusteringTool->clusterize( - *rdos, - *m_idHelper, - stripDetEle->getDetectorElement(idHash), - m_stripDetElStatus.empty() ? nullptr : status.cptr(), - *clusterHandle)); - - } - - return StatusCode::SUCCESS; -} - -StatusCode StripClusterizationAlg::finalize() -{ - ATH_MSG_DEBUG("Finalizing " << name() << "..."); - return StatusCode::SUCCESS; -} - -} // namespace ActsTrk diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/components/ActsTrkClusterization_entries.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/components/ActsTrkClusterization_entries.cxx deleted file mode 100644 index 34585d71fd003e2fedc961d1c54bc1274281bfb4..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkClusterization/src/components/ActsTrkClusterization_entries.cxx +++ /dev/null @@ -1,9 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "src/PixelClusterizationAlg.h" -#include "src/StripClusterizationAlg.h" - -DECLARE_COMPONENT(ActsTrk::PixelClusterizationAlg) -DECLARE_COMPONENT(ActsTrk::StripClusterizationAlg) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/CMakeLists.txt b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/CMakeLists.txt index 86d663331a58433e5fd2eddbc50579baa148ef67..164c71efb7cb66ba43f991bf5cc2ab655e3bc660 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/CMakeLists.txt @@ -13,7 +13,7 @@ atlas_add_component( ActsTrkFinding GaudiKernel BeamSpotConditionsData ActsCore - ActsTrkEvent + ActsTrkEventLib ActsTrkToolInterfacesLib MagFieldConditions ActsGeometryInterfacesLib @@ -22,5 +22,3 @@ atlas_add_component( ActsTrkFinding ActsTrkEventCnvLib ) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/python/ActsTrkFindingConfig.py b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/python/ActsTrkFindingConfig.py deleted file mode 100644 index b8992630be3e2b6ab93072e2eeee89ab4bc5dbe2..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/python/ActsTrkFindingConfig.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -from ActsTrkFindingTool.ActsTrkFindingToolConfig import ActsTrkFindingToolCfg - -# ACTS only algorithm -def ActsTrkFindingCfg(flags, name: str = "ActsTrkFindingAlg", **kwargs): - acc = ComponentAccumulator() - - # tools - if "TrackFindingTool" not in kwargs: - kwargs["TrackFindingTool"] = acc.popToolsAndMerge(ActsTrkFindingToolCfg(flags)) - - kwargs.setdefault("PixelClusterContainerKey", "ITkPixelClusters") - kwargs.setdefault("StripClusterContainerKey", "ITkStripClusters") - kwargs.setdefault("PixelDetectorElements", "ITkPixelDetectorElementCollection") - kwargs.setdefault("StripDetectorElements", "ITkStripDetectorElementCollection") - kwargs.setdefault("InputEstimatedTrackParameters", "ITkPixelEstimatedTrackParams") - kwargs.setdefault("TracksLocation", "SiSPSeededActsTracks") - - if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkFindingMonitoringCfg - kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkFindingMonitoringCfg(flags))) - - acc.addEventAlgo(CompFactory.ActsTrk.TrackFindingAlg(name, **kwargs)) - return acc diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.cxx index 4c1fbfc472358644a9b5e0bbdc5ded1955258038..f6fc03b95c856d195009af3701cf2babd309ccde 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.cxx +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.cxx @@ -112,7 +112,7 @@ namespace ActsTrk {{pixelClusterContainer, pixelDetEleColl}, {stripClusterContainer, stripDetEleColl}}, *estimatedTrackParameters, - *trackPtrs.get())); + *trackPtrs)); ATH_MSG_DEBUG(" \\__ Created " << trackPtrs->size() << " tracks"); // ================================================== // diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.h b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.h index 62f2bf58ff787aed505c57e91cf4b36e7912bb66..82c3d8ee977e6a6dfc75e355374c01103d488b38 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.h +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFinding/src/TrackFindingAlg.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSTRKSEEDING_TRACKFINDINGALG_H -#define ACTSTRKSEEDING_TRACKFINDINGALG_H 1 +#ifndef ACTSTRKFINDING_TRACKFINDINGALG_H +#define ACTSTRKFINDING_TRACKFINDINGALG_H 1 // Base Class #include "AthenaBaseComps/AthReentrantAlgorithm.h" @@ -26,7 +26,6 @@ // Handle Keys #include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/ReadHandleKeyArray.h" #include "StoreGate/WriteHandleKey.h" namespace ActsTrk diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/CMakeLists.txt b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/CMakeLists.txt index 46c155a03467611f4abc2d0b0534bdeaa5794654..9fe14d0d73eaeaa54420e7d4750d32b5b3e18963 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/CMakeLists.txt @@ -39,5 +39,4 @@ atlas_add_component( ActsTrkFittingAlgs # Install files from the package: atlas_install_joboptions( share/*.py ) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) + diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/python/ActsTrkFittingAlgsConfig.py b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/python/ActsTrkFittingAlgsConfig.py deleted file mode 100755 index bb5a4986d71ce5ba4845e8e55c7153adcc65daaa..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/python/ActsTrkFittingAlgsConfig.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory - - -from ActsTrkFittingTools.ActsTrkFittingToolsConfig import ActsKalmanFitterCfg - -def ActsReFitterAlgCfg(flags, name="ActsReFitterAlg", **kwargs): - result = ComponentAccumulator() - - actsKF = result.popToolsAndMerge(ActsKalmanFitterCfg(flags)) - - kwargs.setdefault("ActsKalmanFitter", actsKF) - kwargs.setdefault("TrackName", "ResolvedTracks") - - result.addEventAlgo( - CompFactory.ActsReFitterAlg( - name=name, - **kwargs, - ) - ) - - return result - - - diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/share/postInclude_ActsRefitting.py b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/share/postInclude_ActsRefitting.py index 2f005c4f5f5ff2742d124c452421e263f4bef7f9..e56e14a52f87c47e23f709ecdb563349b11a8314 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/share/postInclude_ActsRefitting.py +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/share/postInclude_ActsRefitting.py @@ -45,7 +45,7 @@ ToolSvc += actsReFittingTrackingGeometry actsExtrapolationTool = CfgMgr.ActsExtrapolationTool("ActsExtrapolationTool", TrackingGeometryTool = actsReFittingTrackingGeometry, MaxSteps = 10000) -from ActsTrkEventCnv.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg +from ActsConfig.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg actsAtlasConverter = ActsToTrkConverterToolCfg( TrackingGeometryTool = actsReFittingTrackingGeometry) ToolSvc+=actsAtlasConverter diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsCompareTrackAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsCompareTrackAlg.cxx old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsCompareTrackAlg.h b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsCompareTrackAlg.h old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.cxx old mode 100755 new mode 100644 index f22feebaa26b3374b8d94e03a50c9bde82c0ac1f..02e2d34138ebc13cb102e0c8b8ff2fda04a12584 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.cxx +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.cxx @@ -25,7 +25,7 @@ ActsReFitterAlg::ActsReFitterAlg(const std::string &name, StatusCode ActsReFitterAlg::initialize() { ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); - ATH_CHECK(m_actsKalmanFitter.retrieve()); + ATH_CHECK(m_actsFitter.retrieve()); ATH_CHECK(m_trackName.initialize()); ATH_CHECK(m_newTrackName.initialize()); @@ -51,24 +51,35 @@ StatusCode ActsReFitterAlg::execute(const EventContext &ctx) const { // Perform the fit for each input track for (TrackCollection::const_iterator track = (*tracks).begin(); track < (*tracks).end(); ++track){ - auto newtrack = m_actsKalmanFitter->fit(ctx, (**track)); - - if (msgLvl(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "ATLAS param : " << endmsg; - msg(MSG::VERBOSE) << *((**track).perigeeParameters()) << endmsg; - msg(MSG::VERBOSE) << *((**track).perigeeParameters()->covariance()) << endmsg; - msg(MSG::VERBOSE) << "ACTS param : " << endmsg; - msg(MSG::VERBOSE) << *(newtrack->perigeeParameters()) << endmsg; - msg(MSG::VERBOSE) << *(newtrack->perigeeParameters()->covariance()) << endmsg; - - msg(MSG::VERBOSE) << "ATLAS INFO : " << endmsg; - msg(MSG::VERBOSE) << *((**track).trackSummary()) << endmsg; - msg(MSG::VERBOSE) << "ACTS INFO : " << endmsg; - msg(MSG::VERBOSE) << *(newtrack->trackSummary()) << endmsg; - msg(MSG::VERBOSE) << "==========================" << endmsg; + auto newtrack = m_actsFitter->fit(ctx, (**track)); + + if (newtrack) { + if (msgLvl(MSG::VERBOSE)) { + msg(MSG::VERBOSE) << "ATLAS param : " << endmsg; + msg(MSG::VERBOSE) << *((**track).perigeeParameters()) << endmsg; + msg(MSG::VERBOSE) << *((**track).perigeeParameters()->covariance()) << endmsg; + msg(MSG::VERBOSE) << "ACTS param : " << endmsg; + msg(MSG::VERBOSE) << *(newtrack->perigeeParameters()) << endmsg; + msg(MSG::VERBOSE) << *(newtrack->perigeeParameters()->covariance()) << endmsg; + + msg(MSG::VERBOSE) << "ATLAS INFO : " << endmsg; + msg(MSG::VERBOSE) << *((**track).trackSummary()) << endmsg; + msg(MSG::VERBOSE) << "ACTS INFO : " << endmsg; + msg(MSG::VERBOSE) << *(newtrack->trackSummary()) << endmsg; + msg(MSG::VERBOSE) << "==========================" << endmsg; + } + new_tracks.push_back(std::move(newtrack)); + } + else if (msgLvl(MSG::DEBUG)) { // newtrack might be equal to a nullptr + msg(MSG::DEBUG) << "The Acts Refitting (KF or GSF) has returned a nullptr. Below is information on the offending track." << endmsg; // TODO: solve the cases where we return a nullptr + msg(MSG::DEBUG) << "ATLAS param : " << endmsg; + msg(MSG::DEBUG) << *((**track).perigeeParameters()) << endmsg; + msg(MSG::DEBUG) << *((**track).perigeeParameters()->covariance()) << endmsg; + + msg(MSG::DEBUG) << "ATLAS INFO : " << endmsg; + msg(MSG::DEBUG) << *((**track).trackSummary()) << endmsg; + msg(MSG::DEBUG) << "==========================" << endmsg; } - - new_tracks.push_back(std::move(newtrack)); } // Create a new track collection with the refitted tracks @@ -79,7 +90,7 @@ StatusCode ActsReFitterAlg::execute(const EventContext &ctx) const { new_track_collection->push_back(std::move(new_track)); } - ATH_MSG_VERBOSE ("Saving tracks"); + ATH_MSG_DEBUG ("Saving tracks"); ATH_CHECK(SG::WriteHandle<TrackCollection>(m_newTrackName, ctx).record(std::move(new_track_collection))); return StatusCode::SUCCESS; } diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.h b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.h old mode 100755 new mode 100644 index 4fd5d308d7374ffc06c9a214619b3408cfbae701..0e93e02eadb5279e1088f0c4b5d00c0024fe9f61 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.h +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/ActsReFitterAlg.h @@ -35,7 +35,7 @@ public: private: - ToolHandle<Trk::ITrackFitter> m_actsKalmanFitter{this, "ActsKalmanFitter", "ActsKalmanFitter", "the Acts Kalman Fitter"}; + ToolHandle<Trk::ITrackFitter> m_actsFitter{this, "ActsFitter", "ActsKalmanFitter", "Choice of Acts Fitter (Kalman by default)"}; // --- job options SG::ReadHandleKey<TrackCollection> m_trackName{this, "TrackName", "Tracks", "Collection name for tracks to be refitted"}; SG::WriteHandleKey<TrackCollection> m_newTrackName{this, "NewTrackName", "ReFitted_Tracks", "Collection name for output tracks"}; diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/components/ActsTrkFittingAlgs_entries.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkFittingAlgs/src/components/ActsTrkFittingAlgs_entries.cxx old mode 100755 new mode 100644 diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/CMakeLists.txt b/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/CMakeLists.txt index b25f71613b7e7e5412b990a063e2ff1551508940..80b11b7c98fb5cb611ebb1d0a5c8aa0c0acb7cd3 100644 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ActsTrkSeeding ) @@ -13,17 +13,15 @@ atlas_add_component( ActsTrkSeeding GaudiKernel BeamSpotConditionsData ActsCore - ActsTrkEvent + ActsTrkEventLib ActsTrkToolInterfacesLib MagFieldConditions ActsGeometryInterfacesLib SiSPSeededTrackFinderData - AthenaMonitoringKernelLib + AthenaMonitoringKernelLib ActsTrkEventCnvLib ) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/python/ActsTrkSeedingConfig.py b/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/python/ActsTrkSeedingConfig.py deleted file mode 100644 index 0ec8771375b70d28bc74f0d1eac3bdb8119f8a8a..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSeeding/python/ActsTrkSeedingConfig.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -from ActsTrkSeedingTool.ActsTrkSeedingToolConfig import ActsTrkITkPixelSeedingToolCfg, ActsTrkITkStripSeedingToolCfg -from ActsTrkSeedingTool.ActsTrkSeedingToolConfig import ActsTrkITkPixelOrthogonalSeedingToolCfg, ActsTrkITkStripOrthogonalSeedingToolCfg -from ActsTrkTrackParamsEstimationTool.ActsTrkTrackParamsEstimationToolConfig import TrackParamsEstimationToolCfg -from ActsGeometry.ActsGeometryConfig import ActsTrackingGeometryToolCfg -from ActsInterop.ActsConfigFlags import SeedingStrategy -from ActsTrkEventCnv.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg - -# ACTS algorithm using Athena objects upstream -def ActsTrkITkPixelSeedingCfg(flags, - name: str = 'ActsTrkPixelSeedingAlg', - **kwargs): - acc = ComponentAccumulator() - - # Need To add additional tool(s) - # Tracking Geometry Tool - geoTool = acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) - acc.addPublicTool(geoTool) - - # ATLAS Converter Tool - converterTool = acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) - - # Track Param Estimation Tool - trackEstimationTool = acc.popToolsAndMerge(TrackParamsEstimationToolCfg(flags)) - - seedTool = None - if "SeedTool" not in kwargs: - if flags.Acts.SeedingStrategy is SeedingStrategy.Orthogonal: - seedTool = acc.popToolsAndMerge(ActsTrkITkPixelOrthogonalSeedingToolCfg(flags)) - else: - seedTool = acc.popToolsAndMerge(ActsTrkITkPixelSeedingToolCfg(flags)) - - kwargs.setdefault('InputSpacePoints', ['ITkPixelSpacePoints']) - kwargs.setdefault('OutputSeeds', 'ITkPixelSeeds') - kwargs.setdefault('SeedTool', seedTool) - kwargs.setdefault('TrackingGeometryTool', acc.getPublicTool(geoTool.name)) # PublicToolHandle - kwargs.setdefault('ATLASConverterTool', converterTool) - kwargs.setdefault('TrackParamsEstimationTool', trackEstimationTool) - kwargs.setdefault('OutputEstimatedTrackParameters', 'ITkPixelEstimatedTrackParams') - kwargs.setdefault('UsePixel', True) - kwargs.setdefault('DetectorElements', 'ITkPixelDetectorElementCollection') - - if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkITkPixelSeedingMonitoringCfg - kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkITkPixelSeedingMonitoringCfg(flags))) - - acc.addEventAlgo(CompFactory.ActsTrk.SeedingAlg(name, **kwargs)) - return acc - - -def ActsTrkITkStripSeedingCfg(flags, - name: str = 'ActsTrkStripSeedingAlg', - **kwargs): - acc = ComponentAccumulator() - - # Need To add additional tool(s) - # Tracking Geometry Tool - geoTool = acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) - acc.addPublicTool(geoTool) - - # ATLAS Converter Tool - converterTool = acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) - - # Track Param Estimation Tool - trackEstimationTool = acc.popToolsAndMerge(TrackParamsEstimationToolCfg(flags)) - - seedTool = None - if "SeedTool" not in kwargs: - if flags.Acts.SeedingStrategy is SeedingStrategy.Orthogonal: - seedTool = acc.popToolsAndMerge(ActsTrkITkStripOrthogonalSeedingToolCfg(flags)) - else: - seedTool = acc.popToolsAndMerge(ActsTrkITkStripSeedingToolCfg(flags)) - - kwargs.setdefault('InputSpacePoints', ['ITkStripSpacePoints', 'ITkStripOverlapSpacePoints']) - kwargs.setdefault('OutputSeeds', 'ITkStripSeeds') - kwargs.setdefault('SeedTool', seedTool) - kwargs.setdefault('TrackingGeometryTool', acc.getPublicTool(geoTool.name)) # PublicToolHandle - kwargs.setdefault('ATLASConverterTool', converterTool) - kwargs.setdefault('TrackParamsEstimationTool', trackEstimationTool) - kwargs.setdefault('OutputEstimatedTrackParameters', 'ITkStripEstimatedTrackParams') - kwargs.setdefault('UsePixel', False) - kwargs.setdefault('DetectorElements', 'ITkStripDetectorElementCollection') - - if flags.Acts.doMonitoring: - from ActsTrkAnalysis.ActsTrkMonitoringConfig import ActsTrkITkStripSeedingMonitoringCfg - kwargs.setdefault('MonTool', acc.popToolsAndMerge(ActsTrkITkStripSeedingMonitoringCfg(flags))) - - acc.addEventAlgo(CompFactory.ActsTrk.SeedingAlg(name, **kwargs)) - return acc - - -def ActsTrkSeedingCfg(flags): - acc = ComponentAccumulator() - if flags.Detector.EnableITkPixel: - acc.merge(ActsTrkITkPixelSeedingCfg(flags)) - if flags.Detector.EnableITkStrip: - acc.merge(ActsTrkITkStripSeedingCfg(flags)) - - if flags.Acts.doAnalysis: - from ActsTrkAnalysis.ActsTrkAnalysisConfig import ActsTrkSeedAnalysisCfg, ActsTrkEstimatedTrackParamsAnalysisCfg - acc.merge(ActsTrkSeedAnalysisCfg(flags)) - acc.merge(ActsTrkEstimatedTrackParamsAnalysisCfg(flags)) - - return acc - diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 5caf632f87d3c1631d6f010bded1c8c312386c74..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/CMakeLists.txt b/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/CMakeLists.txt deleted file mode 100644 index a23542e0b56b99cbddba2678075f92e59afe0eab..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( ActsTrkSpacePointFormation ) - -# External dependencies: - -atlas_add_component( ActsTrkSpacePointFormation - src/*.cxx - src/components/*.cxx - LINK_LIBRARIES - AthenaBaseComps - AthenaMonitoringKernelLib - GaudiKernel - ActsTrkEvent - ActsTrkToolInterfacesLib - BeamSpotConditionsData - MagFieldConditions - PixelReadoutGeometryLib - SCT_ReadoutGeometry - SiSpacePointFormationLib - xAODInDetMeasurement - ) diff --git a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/components/ActsTrkSpacePointFormation_entries.cxx b/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/components/ActsTrkSpacePointFormation_entries.cxx deleted file mode 100644 index 45c65c7e478903fbb4348a00a95fcb2f6304a8a7..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkAlgs/ActsTrkSpacePointFormation/src/components/ActsTrkSpacePointFormation_entries.cxx +++ /dev/null @@ -1,9 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "src/PixelSpacePointFormationAlg.h" -#include "src/StripSpacePointFormationAlg.h" - -DECLARE_COMPONENT( ActsTrk::PixelSpacePointFormationAlg ) -DECLARE_COMPONENT( ActsTrk::StripSpacePointFormationAlg ) diff --git a/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.h b/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.h index e9ad840d06acd1a636430d526e90e118a47615da..d8deb6b01439f34579dd075d94afc9f29a371b38 100644 --- a/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.h +++ b/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.h @@ -5,16 +5,20 @@ #define ActsTrkEvent_MultiTrajectory_h #include <type_traits> #include "Acts/EventData/MultiTrajectory.hpp" +#include "Acts/EventData/SourceLink.hpp" #include "Acts/EventData/TrackStatePropMask.hpp" #include "Acts/EventData/VectorMultiTrajectory.hpp" #include "Acts/Utilities/HashedString.hpp" -#include "Acts/EventData/SourceLink.hpp" #include "CxxUtils/concepts.h" +#include "xAODTracking/TrackJacobianAuxContainer.h" #include "xAODTracking/TrackJacobianContainer.h" #include "xAODTracking/TrackMeasurement.h" +#include "xAODTracking/TrackMeasurementAuxContainer.h" #include "xAODTracking/TrackMeasurementContainer.h" +#include "xAODTracking/TrackParametersAuxContainer.h" #include "xAODTracking/TrackParametersContainer.h" +#include "xAODTracking/TrackStateAuxContainer.h" #include "xAODTracking/TrackStateContainer.h" namespace ActsTrk { @@ -30,6 +34,15 @@ constexpr static bool IsReadWrite = false; } // namespace ActsTrk namespace Acts { +template <typename T> +struct IsReadOnlyMultiTrajectory {}; + +template <typename T> +struct IsReadOnlyMultiTrajectory<T&> : IsReadOnlyMultiTrajectory<T> {}; + +template <typename T> +struct IsReadOnlyMultiTrajectory<T&&> : IsReadOnlyMultiTrajectory<T> {}; + template <> struct IsReadOnlyMultiTrajectory<ActsTrk::MultiTrajectory<ActsTrk::IsReadOnly>> : std::true_type {}; @@ -42,8 +55,8 @@ namespace ActsTrk { /** * @brief Athena implementation of ACTS::MultiTrajectory * - * @tparam MOD - generates variant of the class that allows ro (if == CANMODIFY) - * or rw (when not CANMODIFY) + * @tparam RWState - generates variant of the class that allows r/o (if == + * IsReadOnly) or r/w (when not IsReadWrite) */ template <bool RWState> class MultiTrajectory final @@ -69,16 +82,35 @@ class MultiTrajectory final using ConstTrackStateProxy = typename Acts::MultiTrajectory< ActsTrk::MultiTrajectory<RWState>>::ConstTrackStateProxy; + /** + * @brief Construct a new Multi Trajectory object owning backends + */ + MultiTrajectory(); + /** * @brief Construct a new Multi Trajectory object given backends * @note the MTJ does claim ownership over the data in the backend - * @param state - track state (indices) backend + * @param state, parametrs, jacobians, measuremnts - pointers to xAOD + * interface backend containers */ MultiTrajectory(TrackStateContainerBackendPtr states, TrackParametersContainerBackendPtr parameters, TrackJacobianContainerBackendPtr jacobians, TrackMeasurementContainerBackendPtr measurements); + /** + * @brief Construct a new Multi Trajectory object given r/w input MTJ + * @note constructed MTJ does not copy backends, they remain shared + * @param other - source MTJ + */ + template <bool OtherRWState> + MultiTrajectory(const MultiTrajectory<OtherRWState>& other); + + /** + * @brief Destructor needed for MTJ owing backends + */ + ~MultiTrajectory(); + /** * @brief Add state with stograge for data that depends on the mask * @@ -140,6 +172,18 @@ class MultiTrajectory final void unset_impl(Acts::TrackStatePropMask target, ActsTrk::MultiTrajectory<RWState>::IndexType istate); + /** + * @brief shares from a given state + * + * @param shareSource, shareTarget - property + * @param iself, iother - indexes + */ + + void shareFrom_impl(ActsTrk::MultiTrajectory<RWState>::IndexType iself, + ActsTrk::MultiTrajectory<RWState>::IndexType iother, + Acts::TrackStatePropMask shareSource, + Acts::TrackStatePropMask shareTarget); + /** * @brief obtains proxy to the track state under given index * @@ -197,59 +241,71 @@ class MultiTrajectory final */ inline typename ConstTrackStateProxy::Covariance jacobian_impl( - IndexType index) const { - return trackJacobians().at(index)->jacEigen(); + IndexType istate) const { + xAOD::TrackStateIndexType jacIdx = (*m_trackStates)[istate]->jacobian(); + return trackJacobians().at(jacIdx)->jacEigen(); } ATH_MEMBER_REQUIRES(RWState == IsReadWrite, typename TrackStateProxy::Covariance) - jacobian_impl(IndexType index) { - return trackJacobians().at(index)->jacEigen(); + jacobian_impl(IndexType istate) { + xAOD::TrackStateIndexType jacIdx = (*m_trackStates)[istate]->jacobian(); + return trackJacobians().at(jacIdx)->jacEigen(); + } + + /** + * @brief obtain measurements for a state at given index + * + * @param index + * @return TrackStateProxy::Measurement + */ + + template <std::size_t measdim> + inline typename ConstTrackStateProxy::template Measurement<measdim> + measurement_impl(IndexType index) const { + xAOD::TrackStateIndexType measIdx = (*m_trackStates)[index]->calibrated(); + return trackMeasurements().at(measIdx)->template measEigen<measdim>(); + } + template <std::size_t measdim, bool Enable = true> + std::enable_if_t<Enable && (RWState == IsReadWrite), + typename TrackStateProxy::template Measurement<measdim>> + measurement_impl(IndexType index) { + xAOD::TrackStateIndexType measIdx = (*m_trackStates)[index]->calibrated(); + return trackMeasurements().at(measIdx)->template measEigen<measdim>(); } - /** - * @brief obtain measurements for a state at given index - * - * @param index - * @return TrackStateProxy::Measurement - */ - - template<std::size_t measdim> - inline typename ConstTrackStateProxy::template Measurement<measdim> measurement_impl(IndexType index) const { - return trackMeasurements().at(index)->template measEigen<measdim>(); - } - template<std::size_t measdim, bool Enable = true> - std::enable_if_t<Enable && (RWState==IsReadWrite), typename TrackStateProxy::template Measurement<measdim>> - measurement_impl(IndexType index) { - return trackMeasurements().at(index)->template measEigen<measdim>(); - } - /** - * @brief obtain measurements covariance for a state at given index - * - * @param index - * @return TrackStateProxy::Covariance - */ - - template<std::size_t measdim> - inline typename ConstTrackStateProxy::template MeasurementCovariance<measdim> measurementCovariance_impl(IndexType index) const { - return trackMeasurements().at(index)->template covMatrixEigen<measdim>(); - } - template<std::size_t measdim, bool Enable = true> - std::enable_if_t<Enable && (RWState==IsReadWrite), typename TrackStateProxy::template MeasurementCovariance<measdim>> - measurementCovariance_impl(IndexType index) { - return trackMeasurements().at(index)->template covMatrixEigen<measdim>(); - } - - /** - * @brief size of the MTJ - * - * @return size_t - */ + /** + * @brief obtain measurements covariance for a state at given index + * + * @param index + * @return TrackStateProxy::Covariance + */ + + template <std::size_t measdim> + inline typename ConstTrackStateProxy::template MeasurementCovariance<measdim> + measurementCovariance_impl(IndexType index) const { + xAOD::TrackStateIndexType measIdx = (*m_trackStates)[index]->calibrated(); + return trackMeasurements().at(measIdx)->template covMatrixEigen<measdim>(); + } + template <std::size_t measdim, bool Enable = true> + std::enable_if_t< + Enable && (RWState == IsReadWrite), + typename TrackStateProxy::template MeasurementCovariance<measdim>> + measurementCovariance_impl(IndexType index) { + xAOD::TrackStateIndexType measIdx = (*m_trackStates)[index]->calibrated(); + return trackMeasurements().at(measIdx)->template covMatrixEigen<measdim>(); + } + + /** + * @brief size of the MTJ + * + * @return size_t + */ inline size_t size_impl() const { return m_trackStates->size(); } /** * @brief clears backends - * + * decoration columns are still declared */ inline void clear_impl() { m_trackStates->clear(); @@ -265,8 +321,8 @@ class MultiTrajectory final bool has_backends() const; /** - * Implementation of allocation of calibrated measurements - */ + * Implementation of allocation of calibrated measurements + */ void allocateCalibrated_impl(IndexType istate, std::size_t measdim) { // resize the calibrated measurement to the size measdim const auto& trackStates = *m_trackStates; @@ -275,7 +331,7 @@ class MultiTrajectory final /** * Implementation of calibrated size - */ + */ IndexType calibratedSize_impl(IndexType istate) const { // Retrieve the calibrated measurement size const auto& trackStates = *m_trackStates; @@ -283,25 +339,31 @@ class MultiTrajectory final } /** - * Implementation of calibrated link insertion - */ + * Implementation of uncalibrated link insertion + */ ATH_MEMBER_REQUIRES(RWState == IsReadWrite, void) - setUncalibratedSourceLink_impl(const Acts::SourceLink& sourceLink, - IndexType istate); - + setUncalibratedSourceLink_impl(IndexType istate, + const Acts::SourceLink& sourceLink) { + auto el = + sourceLink.get<ElementLink<xAOD::UncalibratedMeasurementContainer>>(); + trackStates()[istate]->setUncalibratedMeasurementLink(el); + trackStates()[istate]->setGeometryId(sourceLink.geometryId().value()); + } /** - * Implementation of calibrated link fetch - */ - ATH_MEMBER_REQUIRES(RWState == IsReadWrite, Acts::SourceLink) - getUncalibratedSourceLink_impl(IndexType istate); + * Implementation of uncalibrated link fetch + */ + typename Acts::SourceLink getUncalibratedSourceLink_impl( + ActsTrk::MultiTrajectory<RWState>::IndexType istate) const; - ATH_MEMBER_REQUIRES(RWState == IsReadOnly, Acts::SourceLink) - getUncalibratedSourceLink_impl(IndexType istate) const; + ATH_MEMBER_REQUIRES(RWState == IsReadWrite, Acts::SourceLink) + getUncalibratedSourceLink_impl( + ActsTrk::MultiTrajectory<RWState>::IndexType istate); private: // bare pointers to the backend (need to be fast and we do not claim ownership // anyways) TrackStateContainerBackendPtr m_trackStates = nullptr; + xAOD::TrackStateAuxContainer* m_trackStatesAux = nullptr; inline const xAOD::TrackStateContainer& trackStates() const { return *m_trackStates; @@ -309,6 +371,7 @@ class MultiTrajectory final inline xAOD::TrackStateContainer& trackStates() { return *m_trackStates; } TrackParametersContainerBackendPtr m_trackParameters = nullptr; + xAOD::TrackParametersAuxContainer* m_trackParametersAux = nullptr; inline const xAOD::TrackParametersContainer& trackParameters() const { return *m_trackParameters; @@ -318,6 +381,7 @@ class MultiTrajectory final } TrackJacobianContainerBackendPtr m_trackJacobians = nullptr; + xAOD::TrackJacobianAuxContainer* m_trackJacobiansAux = nullptr; inline const xAOD::TrackJacobianContainer& trackJacobians() const { return *m_trackJacobians; @@ -327,6 +391,7 @@ class MultiTrajectory final } TrackMeasurementContainerBackendPtr m_trackMeasurements = nullptr; + xAOD::TrackMeasurementAuxContainer* m_trackMeasurementsAux = nullptr; inline const xAOD::TrackMeasurementContainer& trackMeasurements() const { return *m_trackMeasurements; @@ -344,7 +409,6 @@ class MultiTrajectory final std::any decorationSetter(IndexType, const std::string&); template <typename T> const std::any decorationGetter(IndexType, const std::string&) const; - }; typedef ActsTrk::MultiTrajectory<ActsTrk::IsReadOnly> ConstMultiTrajectory; @@ -365,7 +429,6 @@ struct Decoration { GetterType getter; }; } // namespace detail - } // namespace ActsTrk #include "MultiTrajectory.icc" @@ -373,4 +436,9 @@ struct Decoration { #include "AthenaKernel/CLASS_DEF.h" CLASS_DEF(ActsTrk::ConstMultiTrajectory, 237752966, 1) +// These two lines shouldn't be here, but necessary until we have a proper +// solution +#include "Acts/EventData/VectorTrackContainer.hpp" +CLASS_DEF(Acts::ConstVectorTrackContainer, 1074811884, 1) + #endif diff --git a/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.icc b/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.icc index fe4831d6c58840f78e15db95699b41491c839978..b6bbf1f9fc8c157c815ad062099566e9af65bec0 100644 --- a/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.icc +++ b/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/MultiTrajectory.icc @@ -14,6 +14,42 @@ ActsTrk::MultiTrajectory<RWState>::MultiTrajectory( addColumn_impl<IndexType>("calibratedSourceLink"); } +template <bool RWState> +template <bool OtherRWState> +ActsTrk::MultiTrajectory<RWState>::MultiTrajectory( + const MultiTrajectory<OtherRWState>& other) + : m_trackStates(other.m_trackStates), + m_trackParameters(other.m_trackParameters), + m_trackJacobians(other.m_trackJacobians), + m_trackMeasurements(other.m_trackMeasurements) { + if (other.m_trackStatesAux or other.m_trackParametersAux or + other.m_trackJacobiansAux or other.m_trackMeasurementsAux) { + throw std::runtime_error( + "ActsTrk::MultiTrajectory that was default constructed can not be " + "copied"); + } + for (auto& decoration : other.m_decorations) { + m_decorations.push_back(decoration); + } +} +namespace ActsTrk { +template <bool RWState> +MultiTrajectory<RWState>::~MultiTrajectory() { + // this is MTJ owning backends + if (m_trackStatesAux or m_trackParametersAux or m_trackJacobiansAux or + m_trackMeasurementsAux) { + delete m_trackStatesAux; + delete m_trackParametersAux; + delete m_trackJacobiansAux; + delete m_trackMeasurementsAux; + delete m_trackStates; + delete m_trackParameters; + delete m_trackJacobians; + delete m_trackMeasurements; + } +} +} // namespace ActsTrk + template <bool RWState> bool ActsTrk::MultiTrajectory<RWState>::has_backends() const { return m_trackStates != nullptr and m_trackParameters != nullptr and @@ -74,20 +110,16 @@ ActsTrk::MultiTrajectory<RWState>::addTrackState_impl( state->setSmoothed(addParam()); } - state->setCalibrated(kInvalid); if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Calibrated)) { xAOD::TrackMeasurement* meas = new xAOD::TrackMeasurement(); m_trackMeasurements->push_back(meas); state->setCalibrated(m_trackMeasurements->size() - 1); } - - state->setProjector(kInvalid); if (ACTS_CHECK_BIT(mask, TrackStatePropMask::Calibrated)) { state->setCalibrated(addMeasurement()); // TODO: in Acts there is m_projections collection // https://github.com/acts-project/acts/blob/main/Core/src/EventData/VectorMultiTrajectory.cpp#L83 - state->setProjector(addParam()); } state->setJacobian(kInvalid); @@ -124,13 +156,15 @@ constexpr bool ActsTrk::MultiTrajectory<RWState>::has_impl( case "jacobian"_hash: return trackStates[istate]->jacobian() < kInvalid; case "projector"_hash: - return trackStates[istate]->projector() < kInvalid; + return trackStates[istate]->calibrated() < kInvalid; case "calibrated"_hash: return trackStates[istate]->calibrated() < kInvalid; case "calibratedCov"_hash: return trackStates[istate]->calibrated() < kInvalid; case "measdim"_hash: return trackStates[istate]->measDim() < kInvalid; + case "uncalibratedSourceLink"_hash: + return !trackStates[istate]->uncalibratedMeasurementLink().isDefault(); default: for (auto& d : m_decorations) { if (d.hash == key) { @@ -193,7 +227,9 @@ const std::any ActsTrk::MultiTrajectory<RWState>::component_impl( case "jacobian"_hash: return trackStates[istate]->jacobianPtr(); case "projector"_hash: - return trackStates[istate]->projectorPtr(); + return trackMeasurements() + .at(trackStates[istate]->calibrated()) + ->projectorPtr(); case "calibrated"_hash: { return trackStates[istate]->calibratedPtr(); } @@ -234,14 +270,10 @@ std::any ActsTrk::MultiTrajectory<RWState>::component_impl( return (*m_trackStates)[istate]->filteredPtr(); case "smoothed"_hash: return (*m_trackStates)[istate]->smoothedPtr(); - case "jacobian"_hash: - return (*m_trackStates)[istate]->jacobianPtr(); case "projector"_hash: - return (*m_trackStates)[istate]->projectorPtr(); - case "calibrated"_hash: - return (*m_trackStates)[istate]->calibratedPtr(); - case "calibratedCov"_hash: - return (*m_trackStates)[istate]->calibratedPtr(); + return trackMeasurements() + .at((*m_trackStates)[istate]->calibrated()) + ->projectorPtr(); case "measdim"_hash: return (*m_trackStates)[istate]->measDimPtr(); default: { @@ -255,36 +287,26 @@ std::any ActsTrk::MultiTrajectory<RWState>::component_impl( } } +/** + * Implementation of uncalibrated link fetch + */ template <bool RWState> -ATH_MEMBER_REQUIRES_DEF(RWState == ActsTrk::IsReadWrite, void) -ActsTrk::MultiTrajectory<RWState>::setUncalibratedSourceLink_impl( - const Acts::SourceLink& sourceLink, - ActsTrk::MultiTrajectory<RWState>::IndexType istate) { - auto el = - sourceLink.get<ElementLink<xAOD::UncalibratedMeasurementContainer>>(); - (*m_trackStates)[istate]->setUncalibratedMeasurementLink(el); - (*m_trackStates)[istate]->setGeometryId(sourceLink.geometryId().value()); -} - -template <bool RWState> -ATH_MEMBER_REQUIRES_DEF(RWState == ActsTrk::IsReadOnly, Acts::SourceLink) +typename Acts::SourceLink ActsTrk::MultiTrajectory<RWState>::getUncalibratedSourceLink_impl( ActsTrk::MultiTrajectory<RWState>::IndexType istate) const { - auto el = (*m_trackStates)[istate]->uncalibratedMeasurementLink(); - auto geoID = (*m_trackStates)[istate]->geometryId(); + auto el = trackStates()[istate]->uncalibratedMeasurementLink(); + auto geoID = trackStates()[istate]->geometryId(); return Acts::SourceLink(geoID, el); } - template <bool RWState> ATH_MEMBER_REQUIRES_DEF(RWState == ActsTrk::IsReadWrite, Acts::SourceLink) ActsTrk::MultiTrajectory<RWState>::getUncalibratedSourceLink_impl( ActsTrk::MultiTrajectory<RWState>::IndexType istate) { - auto el = (*m_trackStates)[istate]->uncalibratedMeasurementLink(); - auto geoID = (*m_trackStates)[istate]->geometryId(); + auto el = trackStates()[istate]->uncalibratedMeasurementLink(); + auto geoID = trackStates()[istate]->geometryId(); return Acts::SourceLink(geoID, el); } - // Implementation of unset template <bool RWState> void ActsTrk::MultiTrajectory<RWState>::unset_impl( @@ -363,3 +385,62 @@ const std::any ActsTrk::MultiTrajectory<RWState>::decorationGetter( el->auxdecor<T>(name)); // yeah, xAOD auxdecor returns nonconst ref even // for const AuxElements, here we shield } + +// Implementation of shareFrom +template <bool RWState> +void ActsTrk::MultiTrajectory<RWState>::shareFrom_impl( + ActsTrk::MultiTrajectory<RWState>::IndexType iself, + ActsTrk::MultiTrajectory<RWState>::IndexType iother, + Acts::TrackStatePropMask shareSource, + Acts::TrackStatePropMask shareTarget) { + auto self = (*m_trackStates)[iself]; + auto other = (*m_trackStates)[iother]; + + assert(ACTS_CHECK_BIT(this->getTrackState(iother).getMask(), shareSource) && + "Source has incompatible allocation"); + + using PM = Acts::TrackStatePropMask; + // set kInvalid + using Acts::MultiTrajectoryTraits::kInvalid; + + IndexType sourceIndex{kInvalid}; + switch (shareSource) { + case PM::Predicted: + sourceIndex = other->predicted(); + break; + case PM::Filtered: + sourceIndex = other->filtered(); + break; + case PM::Smoothed: + sourceIndex = other->smoothed(); + break; + case PM::Jacobian: + sourceIndex = other->jacobian(); + break; + default: + throw std::domain_error{"Unable to share this component"}; + } + + assert(sourceIndex != kInvalid); + + switch (shareTarget) { + case PM::Predicted: + assert(shareSource != PM::Jacobian); + self->setPredicted(sourceIndex); + break; + case PM::Filtered: + assert(shareSource != PM::Jacobian); + self->setFiltered(sourceIndex); + break; + case PM::Smoothed: + assert(shareSource != PM::Jacobian); + self->setSmoothed(sourceIndex); + break; + case PM::Jacobian: + assert(shareSource == PM::Jacobian); + self->setJacobian(sourceIndex); + break; + default: + throw std::domain_error{"Unable to share this component"}; + } +} diff --git a/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/TrackContainer.h b/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/TrackContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..ad243a17c793d91bba95e974512e7fa2e3caf347 --- /dev/null +++ b/Tracking/Acts/ActsTrkEvent/ActsTrkEvent/TrackContainer.h @@ -0,0 +1,19 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSTRKEVENT_TRACKCONTAINER_H +#define ACTSTRKEVENT_TRACKCONTAINER_H 1 + +#include "Acts/EventData/VectorMultiTrajectory.hpp" +#include "Acts/EventData/VectorTrackContainer.hpp" + +namespace ActsTrk +{ + using TrackStateBackend = Acts::VectorMultiTrajectory; + using ConstTrackStateBackend = Acts::ConstVectorMultiTrajectory; + using TrackContainer = Acts::TrackContainer<Acts::VectorTrackContainer, TrackStateBackend, Acts::detail::ValueHolder>; + using ConstTrackContainer = Acts::TrackContainer<Acts::ConstVectorTrackContainer, ConstTrackStateBackend, Acts::detail::ValueHolder>; +} + +#endif diff --git a/Tracking/Acts/ActsTrkEvent/CMakeLists.txt b/Tracking/Acts/ActsTrkEvent/CMakeLists.txt index abe6dcce9b6ea9c4b709f3f5d80eb4e2d2f64f02..c29db9cb9d355c4a243e49df3cc95a063791a895 100644 --- a/Tracking/Acts/ActsTrkEvent/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkEvent/CMakeLists.txt @@ -8,7 +8,7 @@ find_package( Acts COMPONENTS Core ) find_package( Boost ) find_package( Eigen ) -atlas_add_library( ActsTrkEvent +atlas_add_library( ActsTrkEventLib Root/*.cxx PUBLIC_HEADERS ActsTrkEvent INCLUDE_DIRS ${Acts_INCLUDE_DIR} @@ -21,7 +21,7 @@ atlas_add_library( ActsTrkEvent atlas_add_dictionary( ActsTrkEventDict ActsTrkEvent/ActsTrkEventDict.h ActsTrkEvent/selection.xml - LINK_LIBRARIES xAODCore ActsTrkEvent + LINK_LIBRARIES xAODCore ActsTrkEventLib DATA_LINKS ActsTrk::SeedContainer ActsTrk::BoundTrackParametersContainer @@ -29,5 +29,5 @@ atlas_add_dictionary( ActsTrkEventDict atlas_add_test( MultiTrajectoryBasic_test SOURCES test/MultiTrajectoryBasic_test.cxx - LINK_LIBRARIES TestTools ActsTrkEvent xAODTracking ActsTrkEvent + LINK_LIBRARIES TestTools ActsTrkEventLib POST_EXEC_SCRIPT nopost.sh) diff --git a/Tracking/Acts/ActsTrkEvent/Root/MultiTrajectory.cxx b/Tracking/Acts/ActsTrkEvent/Root/MultiTrajectory.cxx index 0da57566a60e1e9cd858839b45013ee3fc15cfbe..7744940b7143af61d978718fd978db5ea887fd8c 100644 --- a/Tracking/Acts/ActsTrkEvent/Root/MultiTrajectory.cxx +++ b/Tracking/Acts/ActsTrkEvent/Root/MultiTrajectory.cxx @@ -5,5 +5,27 @@ namespace ActsTrk { +template <> +ActsTrk::MultiTrajectory<ActsTrk::IsReadOnly>::MultiTrajectory() = + delete; // read-only owning MTJ does not make sense -} // EOF namespace ActsTrk +template <> +ActsTrk::MultiTrajectory<ActsTrk::IsReadWrite>::MultiTrajectory() { + m_trackStates = new xAOD::TrackStateContainer; + m_trackStatesAux = new xAOD::TrackStateAuxContainer; + m_trackStates->setStore(m_trackStatesAux); + + m_trackParameters = new xAOD::TrackParametersContainer; + m_trackParametersAux = new xAOD::TrackParametersAuxContainer; + m_trackParameters->setStore(m_trackParametersAux); + + m_trackJacobians = new xAOD::TrackJacobianContainer; + m_trackJacobiansAux = new xAOD::TrackJacobianAuxContainer; + m_trackJacobians->setStore(m_trackJacobiansAux); + + m_trackMeasurements = new xAOD::TrackMeasurementContainer; + m_trackMeasurementsAux = new xAOD::TrackMeasurementAuxContainer; + m_trackMeasurements->setStore(m_trackMeasurementsAux); +} + +} // namespace ActsTrk diff --git a/Tracking/Acts/ActsTrkEvent/test/MultiTrajectoryBasic_test.cxx b/Tracking/Acts/ActsTrkEvent/test/MultiTrajectoryBasic_test.cxx index 0fd2ad318785e4a60e84634c16bfee5cbe1af293..e7bb37eea42fa2e0b280b21887aa6e35517dbae3 100644 --- a/Tracking/Acts/ActsTrkEvent/test/MultiTrajectoryBasic_test.cxx +++ b/Tracking/Acts/ActsTrkEvent/test/MultiTrajectoryBasic_test.cxx @@ -1,6 +1,7 @@ /* Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ +#undef NDEBUG #define BOOST_TEST_MODULE MultiTrajectoryBasic_test #include <boost/test/data/test_case.hpp> #include <boost/test/included/unit_test.hpp> @@ -175,9 +176,12 @@ struct EmptyMTJ { // setup empty MTJ trackStateBackend.get(), parametersBackend.get(), jacobianBackend.get(), measurementsBackend.get()); // backends can be shared - ro_mtj = std::make_unique<ActsTrk::ConstMultiTrajectory>( - trackStateBackend.get(), parametersBackend.get(), jacobianBackend.get(), - measurementsBackend.get()); + ro_mtj = std::make_unique<ActsTrk::ConstMultiTrajectory>(*mtj.get()); + // construction below should not work + // ActsTrk::MutableMultiTrajectory mtest(*ro_mtj.get()); + ActsTrk::MutableMultiTrajectory mtest1(*mtj.get()); + ActsTrk::ConstMultiTrajectory mtest2(*ro_mtj.get()); + } std::unique_ptr<xAOD::TrackStateContainer> trackStateBackend; std::unique_ptr<xAOD::TrackStateAuxContainer> trackStateBackendAux; @@ -192,6 +196,12 @@ struct EmptyMTJ { // setup empty MTJ std::unique_ptr<ActsTrk::ConstMultiTrajectory> ro_mtj; }; +BOOST_AUTO_TEST_CASE(OwningMTJ) { + std::cout << "constructing owning MTJ\n"; + ActsTrk::MutableMultiTrajectory mtj; + // ActsTrk::ConstMultiTrajectory cmtj; // this should not compile (undefined reference) +} + // cppcheck-suppress syntaxError BOOST_FIXTURE_TEST_CASE(Fill, EmptyMTJ) { BOOST_CHECK(mtj->has_backends()); @@ -235,12 +245,12 @@ BOOST_FIXTURE_TEST_CASE(Fill, EmptyMTJ) { BOOST_FIXTURE_TEST_CASE(Dynamic_columns, EmptyMTJ) { using namespace Acts::HashedStringLiteral; BOOST_CHECK(mtj->has_backends()); - BOOST_CHECK_EQUAL(mtj->hasColumn_impl("jacobian"_hash), + BOOST_CHECK_EQUAL(mtj->hasColumn("jacobian"_hash), true); // not dynamic column - BOOST_CHECK_EQUAL(mtj->hasColumn_impl("author"_hash), + BOOST_CHECK_EQUAL(mtj->hasColumn("author"_hash), false); // dynamic column absent initially - mtj->addColumn_impl<short>("author"); // add dynamic column - BOOST_CHECK_EQUAL(mtj->hasColumn_impl("author"_hash), + mtj->addColumn<short>("author"); // add dynamic column + BOOST_CHECK_EQUAL(mtj->hasColumn("author"_hash), true); // dynamic column present now constexpr auto kMask = Acts::TrackStatePropMask::Predicted; @@ -248,7 +258,7 @@ BOOST_FIXTURE_TEST_CASE(Dynamic_columns, EmptyMTJ) { auto i1 = mtj->addTrackState(kMask, i0); auto i2 = mtj->addTrackState(kMask, i1); // dynamic column enabled late - mtj->addColumn_impl<float>("mcprob"); + mtj->addColumn<float>("mcprob"); auto ts0 = mtj->getTrackState(i0); auto ts1 = mtj->getTrackState(i1); auto ts2 = mtj->getTrackState(i2); @@ -277,7 +287,7 @@ BOOST_FIXTURE_TEST_CASE(Dynamic_columns, EmptyMTJ) { // FIXME - test below should use ACTS::MTJ api once available in needed shape BOOST_FIXTURE_TEST_CASE(UncalibratedSourceLink, EmptyMTJ) { - mtj->addTrackState(); + auto index = mtj->addTrackState(); using namespace Acts::HashedStringLiteral; // BOOST_CHECK_EQUAL((ts0.component<Acts::SourceLink *, "uncalibratedSourceLink"_hash>()), @@ -285,15 +295,15 @@ BOOST_FIXTURE_TEST_CASE(UncalibratedSourceLink, EmptyMTJ) { auto el1 = ElementLink<xAOD::UncalibratedMeasurementContainer>("hello", 7); // EL to a fictional container & a fictional index auto link1 = Acts::SourceLink(99, el1); // a fictional geometry ID - mtj->setUncalibratedSourceLink_impl(link1, 0); // set link at position 0 - + auto ts = mtj->getTrackState(index); + ts.setUncalibratedSourceLink(link1); // set link at position 0 // get it back - auto link1Back = mtj->getUncalibratedSourceLink_impl(0); + auto link1Back = ts.getUncalibratedSourceLink(); BOOST_CHECK_EQUAL( link1.geometryId(), link1Back.geometryId()); auto el1Back = link1Back.get<ElementLink<xAOD::UncalibratedMeasurementContainer>>(); // compare them by key & index because equality, requires proper has key generation and is bound to SG BOOST_CHECK_EQUAL( el1.key(), el1Back.key()); - BOOST_CHECK_EQUAL( el1.index(), el1Back.index()); + BOOST_CHECK_EQUAL( el1.index(), el1Back.index()); } @@ -673,5 +683,157 @@ BOOST_FIXTURE_TEST_CASE(TrackStateProxyAllocations, EmptyMTJ) { BOOST_CHECK(!tsall.has<"calibrated"_hash>()); } + +BOOST_FIXTURE_TEST_CASE(TrackStateProxyShare, EmptyMTJ) { + std::default_random_engine rng(12345); + TestTrackState pc(rng, 2u); + + { + size_t ia = mtj->addTrackState(TrackStatePropMask::All); + size_t ib = mtj->addTrackState(TrackStatePropMask::None); + + auto tsa = mtj->getTrackState(ia); + auto tsb = mtj->getTrackState(ib); + + fillTrackState(pc, TrackStatePropMask::All, tsa); + + BOOST_CHECK(tsa.hasPredicted()); + BOOST_CHECK(!tsb.hasPredicted()); + tsb.shareFrom(tsa, TrackStatePropMask::Predicted); + BOOST_CHECK(tsa.hasPredicted()); + BOOST_CHECK(tsb.hasPredicted()); + BOOST_CHECK_EQUAL(tsa.predicted(), tsb.predicted()); + BOOST_CHECK_EQUAL(tsa.predictedCovariance(), tsb.predictedCovariance()); + + BOOST_CHECK(tsa.hasFiltered()); + BOOST_CHECK(!tsb.hasFiltered()); + tsb.shareFrom(tsa, TrackStatePropMask::Filtered); + BOOST_CHECK(tsa.hasFiltered()); + BOOST_CHECK(tsb.hasFiltered()); + BOOST_CHECK_EQUAL(tsa.filtered(), tsb.filtered()); + BOOST_CHECK_EQUAL(tsa.filteredCovariance(), tsb.filteredCovariance()); + + BOOST_CHECK(tsa.hasSmoothed()); + BOOST_CHECK(!tsb.hasSmoothed()); + tsb.shareFrom(tsa, TrackStatePropMask::Smoothed); + BOOST_CHECK(tsa.hasSmoothed()); + BOOST_CHECK(tsb.hasSmoothed()); + BOOST_CHECK_EQUAL(tsa.smoothed(), tsb.smoothed()); + BOOST_CHECK_EQUAL(tsa.smoothedCovariance(), tsb.smoothedCovariance()); + + BOOST_CHECK(tsa.hasJacobian()); + BOOST_CHECK(!tsb.hasJacobian()); + tsb.shareFrom(tsa, TrackStatePropMask::Jacobian); + BOOST_CHECK(tsa.hasJacobian()); + BOOST_CHECK(tsb.hasJacobian()); + BOOST_CHECK_EQUAL(tsa.jacobian(), tsb.jacobian()); + } + + { + size_t i = mtj->addTrackState(TrackStatePropMask::All & + ~TrackStatePropMask::Filtered & + ~TrackStatePropMask::Smoothed); + + auto ts = mtj->getTrackState(i); + + BOOST_CHECK(ts.hasPredicted()); + BOOST_CHECK(!ts.hasFiltered()); + BOOST_CHECK(!ts.hasSmoothed()); + ts.predicted().setRandom(); + ts.predictedCovariance().setRandom(); + + ts.shareFrom(TrackStatePropMask::Predicted, TrackStatePropMask::Filtered); + BOOST_CHECK(ts.hasPredicted()); + BOOST_CHECK(ts.hasFiltered()); + BOOST_CHECK(!ts.hasSmoothed()); + BOOST_CHECK_EQUAL(ts.predicted(), ts.filtered()); + BOOST_CHECK_EQUAL(ts.predictedCovariance(), ts.filteredCovariance()); + + ts.shareFrom(TrackStatePropMask::Predicted, TrackStatePropMask::Smoothed); + BOOST_CHECK(ts.hasPredicted()); + BOOST_CHECK(ts.hasFiltered()); + BOOST_CHECK(ts.hasSmoothed()); + BOOST_CHECK_EQUAL(ts.predicted(), ts.filtered()); + BOOST_CHECK_EQUAL(ts.predicted(), ts.smoothed()); + BOOST_CHECK_EQUAL(ts.predictedCovariance(), ts.filteredCovariance()); + BOOST_CHECK_EQUAL(ts.predictedCovariance(), ts.smoothedCovariance()); + } +} + + +BOOST_FIXTURE_TEST_CASE(TrackStateProjector, EmptyMTJ) { + + std::default_random_engine rng(12345); + TestTrackState pc(rng, 2u); + + size_t ia = mtj->addTrackState(TrackStatePropMask::All); + auto ts = mtj->getTrackState(ia); + + fillTrackState(pc, TrackStatePropMask::All, ts); + + // reset only the effective measurements + auto [measPar, measCov] = generateBoundParametersCovariance(rng); + ts.allocateCalibrated(eBoundSize); + ts.calibrated<eBoundSize>() = measPar; + ts.calibratedCovariance<eBoundSize>() = measCov; + + // assert contents of original measurement (just to be safe) + BOOST_CHECK_EQUAL(ts.calibratedSize(), eBoundSize); + BOOST_CHECK_EQUAL(ts.effectiveCalibrated(), measPar); + BOOST_CHECK_EQUAL(ts.effectiveCalibratedCovariance(), measCov); + + // Set and test projector + Acts::ActsMatrix<eBoundSize, eBoundSize> proj; + proj.setZero(); + proj(Acts::eBoundLoc0, Acts::eBoundLoc0) = 1; + proj(Acts::eBoundLoc1, Acts::eBoundLoc1) = 1; + ts.setProjector(proj); + + BOOST_CHECK_EQUAL(ts.effectiveProjector(), proj); +} + + +BOOST_FIXTURE_TEST_CASE(TrackStateProxyStorage, EmptyMTJ) { + + std::default_random_engine rng(12345); + TestTrackState pc(rng, 2u); + + size_t ia = mtj->addTrackState(TrackStatePropMask::All); + auto ts = mtj->getTrackState(ia); + fillTrackState(pc, TrackStatePropMask::All, ts); + + // check that the track parameters are set + BOOST_CHECK(ts.hasPredicted()); + BOOST_CHECK_EQUAL(ts.predicted(), pc.predicted.parameters()); + BOOST_CHECK(pc.predicted.covariance().has_value()); + BOOST_CHECK_EQUAL(ts.predictedCovariance(), *pc.predicted.covariance()); + BOOST_CHECK(ts.hasFiltered()); + BOOST_CHECK_EQUAL(ts.filtered(), pc.filtered.parameters()); + BOOST_CHECK(pc.filtered.covariance().has_value()); + BOOST_CHECK_EQUAL(ts.filteredCovariance(), *pc.filtered.covariance()); + BOOST_CHECK(ts.hasSmoothed()); + BOOST_CHECK_EQUAL(ts.smoothed(), pc.smoothed.parameters()); + BOOST_CHECK(pc.smoothed.covariance().has_value()); + BOOST_CHECK_EQUAL(ts.smoothedCovariance(), *pc.smoothed.covariance()); + + // check that the jacobian is set + BOOST_CHECK(ts.hasJacobian()); + BOOST_CHECK_EQUAL(ts.jacobian(), pc.jacobian); + BOOST_CHECK_EQUAL(ts.pathLength(), pc.pathLength); + // check that chi2 is set + BOOST_CHECK_EQUAL(ts.chi2(), pc.chi2); + + // set SourceLink and get it back + auto el = ElementLink<xAOD::UncalibratedMeasurementContainer>("hello", 7); // EL to a fictional container & a fictional index + auto link = Acts::SourceLink(99, el); // a fictional geometry ID + ts.setUncalibratedSourceLink(link); + // check that the uncalibratedSourceLink source link is set + BOOST_CHECK_EQUAL(ts.getUncalibratedSourceLink().geometryId(), link.geometryId()); + BOOST_CHECK_EQUAL(ts.getUncalibratedSourceLink().get<ElementLink<xAOD::UncalibratedMeasurementContainer>>().index(), + link.get<ElementLink<xAOD::UncalibratedMeasurementContainer>>().index()); + BOOST_CHECK_EQUAL(ts.getUncalibratedSourceLink().get<ElementLink<xAOD::UncalibratedMeasurementContainer>>().key(), + link.get<ElementLink<xAOD::UncalibratedMeasurementContainer>>().key()); +} + // TODO remaining tests BOOST_AUTO_TEST_SUITE_END() diff --git a/Tracking/Acts/ActsTrkEventCnv/ActsTrkEventCnv/IActsToTrkConverterTool.h b/Tracking/Acts/ActsTrkEventCnv/ActsTrkEventCnv/IActsToTrkConverterTool.h index 42c505fd9503a7b7e618ef12f805dffd738fe0bc..1d5efe13eac0043523197f70d31dd64e53960f6d 100644 --- a/Tracking/Acts/ActsTrkEventCnv/ActsTrkEventCnv/IActsToTrkConverterTool.h +++ b/Tracking/Acts/ActsTrkEventCnv/ActsTrkEventCnv/IActsToTrkConverterTool.h @@ -6,49 +6,54 @@ #define ACTSGEOMETRYINTERFACES_IActsToTrkConverterTool_H // ATHENA -#include "GaudiKernel/IInterface.h" +#include <memory> + +#include "ActsGeometry/ATLASSourceLink.h" // inner class, cannot fwd declare #include "GaudiKernel/IAlgTool.h" -#include "TrkParameters/TrackParameters.h" //typedef, cannot fwd declare -#include "xAODMeasurementBase/UncalibratedMeasurement.h" //typedef, cannot fwd declare +#include "GaudiKernel/IInterface.h" +#include "StoreGate/WriteHandle.h" +#include "TrkParameters/TrackParameters.h" //typedef, cannot fwd declare +#include "TrkTrack/TrackCollection.h" +#include "xAODMeasurementBase/UncalibratedMeasurement.h" //typedef, cannot fwd declare +#include "xAODTracking/TrackJacobianContainer.h" +#include "xAODTracking/TrackMeasurementContainer.h" +#include "xAODTracking/TrackParametersContainer.h" +#include "xAODTracking/TrackStateContainer.h" #include "Acts/EventData/TrackParameters.hpp" -#include "ActsGeometry/ATLASSourceLink.h" // inner class, cannot fwd declare -#include <memory> +#include "Acts/EventData/VectorTrackContainer.hpp" +#include "ActsTrkEvent/MultiTrajectory.h" namespace Trk { - class Surface; - class Track; - class MeasurementBase; -} +class Surface; +class Track; +class MeasurementBase; +} // namespace Trk namespace InDetDD { - class SiDetectorElementCollection; +class SiDetectorElementCollection; } namespace Acts { - class Surface; +class Surface; } class IActsTrackingGeometryTool; namespace ActsTrk { class IActsToTrkConverterTool : virtual public IAlgTool { - public: - + public: DeclareInterfaceID(IActsToTrkConverterTool, 1, 0); - virtual - const Trk::Surface& - actsSurfaceToTrkSurface(const Acts::Surface &actsSurface) const = 0; + virtual const Trk::Surface& actsSurfaceToTrkSurface( + const Acts::Surface& actsSurface) const = 0; - virtual - const Acts::Surface& - trkSurfaceToActsSurface(const Trk::Surface &atlasSurface) const = 0; + virtual const Acts::Surface& trkSurfaceToActsSurface( + const Trk::Surface& atlasSurface) const = 0; - virtual - const ATLASSourceLink - trkMeasurementToSourceLink(const Acts::GeometryContext& gctx, - const Trk::MeasurementBase &measurement, - std::vector<ATLASSourceLink::ElementsType>& Collection) const = 0; + virtual const ATLASSourceLink trkMeasurementToSourceLink( + const Acts::GeometryContext& gctx, + const Trk::MeasurementBase& measurement, + std::vector<ATLASSourceLink::ElementsType>& Collection) const = 0; virtual const ATLASUncalibSourceLink @@ -56,24 +61,27 @@ class IActsToTrkConverterTool : virtual public IAlgTool { const xAOD::UncalibratedMeasurement &measurement, std::vector<ATLASUncalibSourceLink::ElementsType>& Collection) const = 0; - virtual - const std::vector<ATLASSourceLink> - trkTrackToSourceLinks(const Acts::GeometryContext& gctx, - const Trk::Track &track, - std::vector<ATLASSourceLink::ElementsType>& collection) const = 0; + virtual const std::vector<ATLASSourceLink> trkTrackToSourceLinks( + const Acts::GeometryContext& gctx, const Trk::Track& track, + std::vector<ATLASSourceLink::ElementsType>& collection) const = 0; - virtual - const Acts::BoundTrackParameters - trkTrackParametersToActsParameters(const Trk::TrackParameters &atlasParameter) const = 0; - - virtual - std::unique_ptr<const Trk::TrackParameters> - actsTrackParametersToTrkParameters(const Acts::BoundTrackParameters &actsParameter, const Acts::GeometryContext& gctx) const = 0; + virtual const Acts::BoundTrackParameters trkTrackParametersToActsParameters( + const Trk::TrackParameters& atlasParameter) const = 0; - virtual - const IActsTrackingGeometryTool* - trackingGeometryTool() const = 0; + virtual std::unique_ptr<const Trk::TrackParameters> + actsTrackParametersToTrkParameters( + const Acts::BoundTrackParameters& actsParameter, + const Acts::GeometryContext& gctx) const = 0; + + + virtual void trkTrackCollectionToActsTrackContainer( + Acts::TrackContainer<Acts::VectorTrackContainer, + ActsTrk::MultiTrajectory<ActsTrk::IsReadWrite>> &tc, + const TrackCollection& trackColl, + const Acts::GeometryContext& gctx) const = 0; + + virtual const IActsTrackingGeometryTool* trackingGeometryTool() const = 0; }; -} // end of namespace +} // namespace ActsTrk #endif diff --git a/Tracking/Acts/ActsTrkEventCnv/CMakeLists.txt b/Tracking/Acts/ActsTrkEventCnv/CMakeLists.txt index edda900ca014902a71ea38c039ed27aec987a429..5b11f4580f8d2a20b8a6160b856ab4aef2aa4d9c 100644 --- a/Tracking/Acts/ActsTrkEventCnv/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkEventCnv/CMakeLists.txt @@ -1,45 +1,43 @@ # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( ActsTrkEventCnv ) +atlas_subdir(ActsTrkEventCnv) # External dependencies: -find_package( Acts COMPONENTS Core ) +find_package(Acts COMPONENTS Core) # Component(s) in the package: -atlas_add_library( ActsTrkEventCnvLib - ActsTrkEventCnv/*.h - src/*.cxx - PUBLIC_HEADERS ActsTrkEventCnv - INTERFACE - LINK_LIBRARIES - ActsCore - ActsGeometryLib - AthenaBaseComps - AthenaKernel - GaudiKernel - Identifier - StoreGateLib - TrkGeometry - TrkSurfaces - TrkTrackSummary - TrkTrack - xAODMeasurementBase - TrkExUtils - xAODTracking - ) +atlas_add_library(ActsTrkEventCnvLib + ActsTrkEventCnv/*.h + src/*.cxx + PUBLIC_HEADERS ActsTrkEventCnv + INTERFACE + LINK_LIBRARIES + ActsCore + ActsGeometryLib + GaudiKernel + StoreGateLib + TrkTrack + TrkParameters + xAODMeasurementBase + xAODTracking + ActsTrkEventLib +) -atlas_add_component( ActsTrkEventCnv - src/ActsToTrkConverterTool.cxx - src/components/*.cxx - LINK_LIBRARIES - ActsTrkEventCnvLib - ) +atlas_add_component(ActsTrkEventCnv + src/ActsToTrkConverterTool.cxx + src/components/*.cxx + LINK_LIBRARIES + ActsTrkEventCnvLib + AthenaBaseComps + AthenaKernel + TrkGeometry + TrkSurfaces + TrkTrackSummary + TrkExUtils +) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - -atlas_add_test( ActsTrkEventCnvTest -SCRIPT python -m ActsTrkEventCnv.ActsTrkEventCnvConfig --threads=1 -PROPERTIES TIMEOUT 900 -POST_EXEC_SCRIPT noerror.sh ) \ No newline at end of file +atlas_add_test(ActsTrkEventCnvTest + SCRIPT test/testConversion.py + PROPERTIES TIMEOUT 900 + POST_EXEC_SCRIPT noerror.sh) diff --git a/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.cxx b/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.cxx index dffb72e5ccda72341dbf9238a8cd293bb345155c..97be9aa1095da3ca297254acbbc50a86d8e7653c 100644 --- a/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.cxx +++ b/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.cxx @@ -28,12 +28,15 @@ // ACTS #include "Acts/Definitions/Units.hpp" #include "Acts/EventData/TrackParameters.hpp" +#include "Acts/EventData/VectorTrackContainer.hpp" #include "Acts/EventData/detail/TransformationBoundToFree.hpp" #include "Acts/EventData/detail/TransformationFreeToBound.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Propagator/CovarianceTransport.hpp" #include "Acts/Surfaces/PerigeeSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "ActsTrkEvent/MultiTrajectory.h" +#include "Acts/EventData/TrackStatePropMask.hpp" // STL #include <cmath> @@ -404,6 +407,112 @@ ActsTrk::ActsToTrkConverterTool::actsTrackParametersToTrkParameters( throw std::domain_error("Surface type not found"); } +void ActsTrk::ActsToTrkConverterTool::trkTrackCollectionToActsTrackContainer( + Acts::TrackContainer<Acts::VectorTrackContainer, + ActsTrk::MultiTrajectory<ActsTrk::IsReadWrite>> &tc, + const TrackCollection &trackColl, + const Acts::GeometryContext & /**gctx*/) const { + ATH_MSG_VERBOSE("Calling trkTrackCollectionToActsTrackContainer with " + << trackColl.size() << " tracks."); + + for (auto trk : trackColl) { + // Do conversions! + const DataVector<const Trk::TrackStateOnSurface> *trackStates = + trk->trackStateOnSurfaces(); + if (!trackStates) { + ATH_MSG_WARNING("No track states on surfaces found for this track."); + continue; + } + + auto track = tc.getTrack(tc.addTrack()); + auto trackStateContainer = tc.trackStateContainer(); + + ATH_MSG_VERBOSE("Track has " << trackStates->size() + << " track states on surfaces."); + + // loop over track states on surfaces, convert and add them to the ACTS + // container + bool first_tsos = true; // We need to handle the first one differently + for (auto tsos : *trackStates) { + + // Setup the mask + Acts::TrackStatePropMask mask = Acts::TrackStatePropMask::None; + if (tsos->measurementOnTrack()) { + mask |= Acts::TrackStatePropMask::Calibrated; + } + if (tsos->trackParameters()) { + mask |= Acts::TrackStatePropMask::Smoothed; + } + + // Setup the index of the trackstate + auto index = Acts::MultiTrajectoryTraits::kInvalid; + if (!first_tsos) { + index = track.tipIndex(); + } + auto actsTSOS = trackStateContainer.getTrackState( + trackStateContainer.addTrackState(mask, index)); + ATH_MSG_VERBOSE("TipIndex: " << track.tipIndex() + << " TSOS index within trajectory: " + << actsTSOS.index()); + track.tipIndex() = actsTSOS.index(); + + ATH_MSG_VERBOSE("TrackProxy has " << track.nTrackStates() + << " track states on surfaces."); + if (tsos->trackParameters()) { + ATH_MSG_VERBOSE("Converting track parameters."); + // TODO - work out whether we should set predicted, filtered, smoothed + const Acts::BoundTrackParameters parameters = + trkTrackParametersToActsParameters(*(tsos->trackParameters())); + + if (first_tsos) { + // This is the first track state, so we need to set the track + // parameters + track.parameters() = parameters.parameters(); + track.covariance() = *parameters.covariance(); + track.setReferenceSurface( + parameters.referenceSurface().getSharedPtr()); + first_tsos = false; + } else { + // Surfaces not yet implemented in MultiTrajectory.icc + // actsTSOS.setReferenceSurface(parameters.referenceSurface().getSharedPtr()); + // Since we're converting final Trk::Tracks, let's assume they're + // smoothed + actsTSOS.smoothed() = parameters.parameters(); + actsTSOS.smoothedCovariance() = *parameters.covariance(); + // Not yet implemented in MultiTrajectory.icc + // actsTSOS.typeFlags() |= Acts::TrackStateFlag::ParameterFlag; + } + } + if (tsos->measurementOnTrack()) { + ATH_MSG_VERBOSE("Converting measurement."); + auto &measurement = *(tsos->measurementOnTrack()); + // const Acts::Surface &surface = + // trkSurfaceToActsSurface(measurement.associatedSurface()); + // Commented for the moment because Surfaces not yet implemented in + // MultiTrajectory.icc + + int dim = measurement.localParameters().dimension(); + actsTSOS.allocateCalibrated(dim); + if (dim == 1) { + actsTSOS.calibrated<1>() = measurement.localParameters(); + actsTSOS.calibratedCovariance<1>() = measurement.localCovariance(); + ; + } else if (dim == 2) { + actsTSOS.calibrated<2>() = measurement.localParameters(); + actsTSOS.calibratedCovariance<2>() = measurement.localCovariance(); + } else { + throw std::domain_error("Cannot handle measurement dim>2"); + } + } // end if measurement + } // end loop over track states + + ATH_MSG_VERBOSE("TrackProxy has " << track.nTrackStates() + << " track states on surfaces."); + } + ATH_MSG_VERBOSE("Finished converting " << trackColl.size() << " tracks."); + ATH_MSG_VERBOSE("ACTS Track container has " << tc.size() << " tracks."); +} + // Local functions to check/debug Annulus bounds static void ActsTrk::ActsMeasurementCheck( @@ -498,12 +607,11 @@ static void ActsTrk::ActsMeasurementCheck( } } -void ActsTrk::ActsTrackParameterCheck(const Acts::BoundTrackParameters &actsParameter, - const Acts::GeometryContext &gctx, - const Acts::BoundSymMatrix &covpc, - const Acts::BoundVector &targetPars, - const Acts::BoundSymMatrix &targetCov, - const Trk::PlaneSurface *planeSurface) { +void ActsTrk::ActsTrackParameterCheck( + const Acts::BoundTrackParameters &actsParameter, + const Acts::GeometryContext &gctx, const Acts::BoundSymMatrix &covpc, + const Acts::BoundVector &targetPars, const Acts::BoundSymMatrix &targetCov, + const Trk::PlaneSurface *planeSurface) { std::cout << "ANNULUS PAR COV: "; std::cout << actsParameter.referenceSurface().geometryId(); diff --git a/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.h b/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.h index 96f205009822b7fbb7efb23289633065c7237dd8..b6284f0ef3c65a10599bb6be8ae62416cf9d0ae8 100644 --- a/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.h +++ b/Tracking/Acts/ActsTrkEventCnv/src/ActsToTrkConverterTool.h @@ -5,6 +5,8 @@ #ifndef ACTSTRKEVENTCNV_ActsToTrkConverterTool_H #define ACTSTRKEVENTCNV_ActsToTrkConverterTool_H +#include <tuple> + // ATHENA #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/IInterface.h" @@ -12,12 +14,14 @@ #include "Gaudi/Property.h" #include "GaudiKernel/EventContext.h" #include "TrkParameters/TrackParameters.h" //typedef, cannot fwd declare - +#include "xAODTracking/TrackJacobianContainer.h" +#include "xAODTracking/TrackParametersContainer.h" +#include "xAODTracking/TrackStateContainer.h" +#include "xAODTracking/TrackMeasurementContainer.h" // PACKAGE #include "ActsTrkEventCnv/IActsToTrkConverterTool.h" #include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" - #include "Acts/EventData/TrackParameters.hpp" namespace ActsTrk { @@ -82,6 +86,16 @@ public: std::unique_ptr<const Trk::TrackParameters> actsTrackParametersToTrkParameters(const Acts::BoundTrackParameters &actsParameter, const Acts::GeometryContext& gctx) const override; + /** Convert TrackCollection to Acts track container. + * @param states The track state container + * @param jacobians The track jacobian container + * @param measurements The track measurement container + * @param parameters The track parameters container + */ + virtual + void trkTrackCollectionToActsTrackContainer(Acts::TrackContainer<Acts::VectorTrackContainer, + ActsTrk::MultiTrajectory<ActsTrk::IsReadWrite>> &tc, const TrackCollection& trackColl, const Acts::GeometryContext& gctx) const override; + virtual const IActsTrackingGeometryTool* trackingGeometryTool() const override diff --git a/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.cxx b/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.cxx index a2a5e903fa5766fcf6eac5dba8e83ededaf3fab3..d77f0b8277fb6944e50f4837102d836ada3dc44c 100644 --- a/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.cxx +++ b/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.cxx @@ -6,11 +6,19 @@ Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #include "Acts/EventData/VectorTrackContainer.hpp" #include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" +#include "xAODTracking/TrackJacobianAuxContainer.h" +#include "xAODTracking/TrackMeasurementAuxContainer.h" +#include "xAODTracking/TrackParametersAuxContainer.h" #include "xAODTracking/TrackStateAuxContainer.h" -#include "xAODTracking/TrackStateContainer.h" +#include "ActsTrkEvent/MultiTrajectory.h" StatusCode ActsTrk::TrkToActsConvertorAlg::initialize() { ATH_CHECK(m_trackCollectionKeys.initialize()); + ATH_CHECK(m_vectorTrackContainer.initialize()); + ATH_CHECK(m_trackStatesKey.initialize()); + ATH_CHECK(m_jacobiansKey.initialize()); + ATH_CHECK(m_measurementsKey.initialize()); + ATH_CHECK(m_parametersKey.initialize()); ATH_CHECK(m_convertorTool.retrieve()); return StatusCode::SUCCESS; } @@ -22,40 +30,60 @@ StatusCode ActsTrk::TrkToActsConvertorAlg::execute( "Convertor Tool is not returning tracking geometry. Cannot proceed."); return StatusCode::SUCCESS; } - Acts::GeometryContext tgContext = m_convertorTool->trackingGeometryTool() - ->getGeometryContext(ctx) - .context(); - std::vector<ATLASSourceLink::ElementsType> elementCollection; + ATH_MSG_VERBOSE("create containers"); + + SG::WriteHandle<xAOD::TrackStateContainer> states( + m_trackStatesKey, ctx); + ATH_CHECK(states.record(std::make_unique<xAOD::TrackStateContainer>(), + std::make_unique<xAOD::TrackStateAuxContainer>())); - // Not used yet, but will be used once I have proper track conversions - // Acts::TrackContainer tc{Acts::VectorTrackContainer{}, - // Acts::VectorMultiTrajectory{}}; + SG::WriteHandle<xAOD::TrackJacobianContainer> jacobians( + m_jacobiansKey, ctx); + ATH_CHECK(jacobians.record(std::make_unique<xAOD::TrackJacobianContainer>(), + std::make_unique<xAOD::TrackJacobianAuxContainer>())); + SG::WriteHandle<xAOD::TrackMeasurementContainer> measurements( + m_measurementsKey, ctx); + ATH_CHECK(measurements.record(std::make_unique<xAOD::TrackMeasurementContainer>(), + std::make_unique<xAOD::TrackMeasurementAuxContainer>())); + + SG::WriteHandle<xAOD::TrackParametersContainer> parameters( + m_parametersKey, ctx); + ATH_CHECK(parameters.record(std::make_unique<xAOD::TrackParametersContainer>(), + std::make_unique<xAOD::TrackParametersAuxContainer>())); + + ATH_MSG_VERBOSE("About to create multiTraj"); + auto multiTraj = std::make_unique<MutableMultiTrajectory>(&(*states), &(*parameters), &(*jacobians), &(*measurements)); + Acts::VectorTrackContainer vecTrk; + Acts::TrackContainer<Acts::VectorTrackContainer, + ActsTrk::MultiTrajectory<ActsTrk::IsReadWrite>> + tc{vecTrk, *multiTraj}; + // auto constMultiTraj = multiTraj->convertToReadOnly(); + Acts::GeometryContext tgContext = m_convertorTool->trackingGeometryTool() + ->getGeometryContext(ctx) + .context(); + + + ATH_MSG_VERBOSE("Loop over track collections"); for (auto handle : m_trackCollectionKeys.makeHandles(ctx)) { - // bool conversionSuccessful{false}; Commented out for the moment. Will be - // used soon. - ATH_MSG_VERBOSE("Trying to load " << handle.key()); ATH_CHECK(handle.isValid()); - ATH_MSG_VERBOSE("Got back " << handle->size()); - for (auto trk : *handle) { - // Cannot yet convert tracks, so let's just call this to do *something* - std::vector<ATLASSourceLink> trackSourceLinks = - m_convertorTool->trkTrackToSourceLinks(tgContext, *trk, - elementCollection); - } - - // Will be adding this back in once I have proper track conversions - // implemented - // - // if (conversionSuccessful) { - // SG::WriteHandle<xAOD::TrackStateContainer> wh_xaodout( - // handle.key() + "ActsStates", ctx); - // // Write out the TrackStateContainer - // ATH_CHECK( - // wh_xaodout.record(std::make_unique<xAOD::TrackStateContainer>(), - // std::make_unique<xAOD::TrackStateAuxContainer>())); - // } + ATH_MSG_VERBOSE("Got back " << handle->size() << " tracks from "<< handle.key()); + + m_convertorTool->trkTrackCollectionToActsTrackContainer( + tc, *handle, tgContext); + ATH_MSG_VERBOSE("multiTraj has " << multiTraj->size() << " states"); } + // Let's dump some information for debugging (will be removed later) + ATH_MSG_VERBOSE("TrackStateContainer has " << states->size() << " states"); + ATH_MSG_VERBOSE("TrackParametersContainer has " << parameters->size() << " parameters"); + + // Store the VectorTrackContainer + auto constVecTrackCont = std::make_unique<Acts::ConstVectorTrackContainer>(std::move(vecTrk)); + SG::WriteHandle<Acts::ConstVectorTrackContainer> wh_vtc(m_vectorTrackContainer, ctx); + ATH_MSG_VERBOSE("Saving " << constVecTrackCont->size_impl() << " tracks to "<< wh_vtc.key()); + ATH_CHECK(wh_vtc.record(std::move(constVecTrackCont))); return StatusCode::SUCCESS; -} \ No newline at end of file +} + + diff --git a/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.h b/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.h index 0642eee50cc78583214d8997ae49f41a59722d11..dbfa1e6e4bdca67d7614e91971d7ed7bb0a5f761 100644 --- a/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.h +++ b/Tracking/Acts/ActsTrkEventCnv/src/TrkToActsConvertorAlg.h @@ -5,10 +5,18 @@ #ifndef TRKTOACTSCONVERTORALG_H #define TRKTOACTSCONVERTORALG_H + #include "ActsTrkEventCnv/IActsToTrkConverterTool.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "TrkTrack/TrackCollection.h" +// #include "xAODTracking/TrackMeasurement.h" +#include "xAODTracking/TrackJacobianContainer.h" +#include "xAODTracking/TrackParametersContainer.h" +#include "xAODTracking/TrackStateContainer.h" +#include "xAODTracking/TrackMeasurementContainer.h" +#include "StoreGate/WriteHandleKey.h" +#include "ActsTrkEvent/MultiTrajectory.h" namespace ActsTrk { /** Algorithm convert Trk::Track to ACTS multistate objects @@ -27,6 +35,16 @@ class TrkToActsConvertorAlg : public AthReentrantAlgorithm { "TrackCollectionKeys", {"CombinedInDetTracks", "CombinedMuonTracks", "MuonSpectrometerTracks"}, "Keys for Track Containers"}; + + SG::WriteHandleKey<Acts::ConstVectorTrackContainer> m_vectorTrackContainer {this, "VectorTrackContainerLocation", "ConvertedVectorTrackContainer", "Location of the converted VectorTrackContainer"}; + SG::WriteHandleKey<xAOD::TrackStateContainer> m_trackStatesKey {this, "TrackStatesLocation", "ConvertedTrackStates", "Location of the converted TrackStates"}; + SG::WriteHandleKey<xAOD::TrackJacobianContainer> m_jacobiansKey {this, "TrackJacobiansLocation", "ConvertedTrackJacobians", "Location of the converted TrackJacobians"}; + SG::WriteHandleKey<xAOD::TrackMeasurementContainer> m_measurementsKey {this, "TrackMeasurementsLocation", "ConvertedTrackMeasurements", "Location of the converted TrackMeasurements"}; + SG::WriteHandleKey<xAOD::TrackParametersContainer> m_parametersKey {this, "TrackParametersLocation", "ConvertedTrackParameters", "Location of the converted TrackParameters"}; + + }; } // namespace ActsTrk + + #endif diff --git a/Tracking/Acts/ActsTrkEventCnv/test/testConversion.py b/Tracking/Acts/ActsTrkEventCnv/test/testConversion.py new file mode 100755 index 0000000000000000000000000000000000000000..d47474f32c07c6abe56ac6c8e8179ea2f5ad2a52 --- /dev/null +++ b/Tracking/Acts/ActsTrkEventCnv/test/testConversion.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +import json +from ActsConfig.ActsTrkEventCnvConfig import RunConversion +import math + +if "__main__" == __name__: + RunConversion() + + def _dparamsEqual(acts, trk): + for acts_track_params, trk_track_params in zip(acts, trk): + if (not math.isclose(acts_track_params, trk_track_params)): + return False + return True + + # Now compare outputs + import json + success = False + with open('dump.json') as f: + data = json.load(f) + for event in data: + print('Processing', event) + acts = data[event]['TrackContainers']['ConvertedVectorTrackContainer'] + trk = data[event]['Tracks']['CombinedITkTracks'] + if (acts != trk): + # We might need to make this comparison more sophisticated + # Since we do not necessarily expect binary identical results + # ... but we are a ways off of worrying about this right now + print('WARNING: Acts and Trk tracks differ') + print('We have ', len(acts), '/', + len(trk), 'Acts / Trk tracks') + for i, (acts_track, trk_track) in enumerate(zip(acts, trk)): + if (not _dparamsEqual(acts_track['dparams'], trk_track['dparams'])): + print('ERROR: Acts and Trk dparams differ for track', i) + print('Acts dparams:', acts_track['dparams']) + print('Trk dparams:', trk_track['dparams']) + if (acts_track['pos'] != trk_track['pos']): + print('ERROR: Acts and Trk pos differ for track', i) + print('Acts pos:', acts_track['pos']) + print('Trk pos:', trk_track['pos']) + else: + print('SUCCESS: Acts and Trk tracks agree') + success = True + if not success: + print('ERROR: the output of the conversion is not correct') + # Will uncomment this once the conversion is fixed + # import sys + # sys.exit(1) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/CMakeLists.txt index bb8ff8927cbab379954576b545b605dbee858d32..820a07f421176aead13dac426a8465a2fcc6437c 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS coll +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS coll atlas_subdir(ActsTrkAnalysisTools) @@ -11,4 +11,3 @@ atlas_add_component(ActsTrkAnalysisTools AthenaMonitoringLib TrkValHistUtils ) -atlas_install_python_modules(python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8}) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/python/ActsTrkAnalysisToolsConfig.py b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/python/ActsTrkAnalysisToolsConfig.py deleted file mode 100644 index 132f32c7bcbfd5de59d2d206f2f299cb8a921fc0..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/python/ActsTrkAnalysisToolsConfig.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory - -def PhysValActsCfg(flags, - name: str = 'PhysValActs', - **kwargs) -> ComponentAccumulator: - acc = ComponentAccumulator() - acc.setPrivateTools(CompFactory.ActsTrk.PhysValTool(name=name, **kwargs)) - return acc diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.cxx index bd50cd382655a4bd1c7a6818c8404e038abeba88..2fa347602d0c174c67ef0ab01f8024fdf47787c8 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.cxx @@ -60,6 +60,9 @@ namespace ActsTrk { m_sizeY_barrel = Book1D("sizeY_barrel", "PixelCluster_sizeY_barrel;Size Y;Entries;", 100, 0, 400, false); m_sizeY_endcap = Book1D("sizeY_endcap", "PixelCluster_sizeY_endcap;Size Y;Entries;", 100, 0, 400, false); + m_widthY_barrel = Book1D("widthY_barrel", "PixelCluster_widthY_barrel;Width Y;Entries;", 60, 0, 30, false); + m_widthY_endcap = Book1D("widthY_endcap", "PixelCluster_widthY_endcap;Width Y;Entries;", 60, 0, 30, false); + m_global_xy_barrel = Book2D("global_xy_barrel", "PixelCluster_global_xy_barrel;x [mm];y [mm];", 64, -320, 320, 64, -350, 350, false); m_global_xy_endcap = Book2D("global_xy_endcap", "PixelCluster_global_xy_endcap;x [mm];y [mm];", 64, -320, 320, 64, -350, 350, false); @@ -110,6 +113,8 @@ namespace ActsTrk { m_sizeX_barrel->Fill(cluster->channelsInPhi(), beamSpotWeight); m_sizeY_barrel->Fill(cluster->channelsInEta(), beamSpotWeight); + m_widthY_barrel->Fill(cluster->widthInEta(), beamSpotWeight); + m_global_xy_barrel->Fill(globalPos(0, 0), globalPos(1, 0), beamSpotWeight); m_global_zr_barrel->Fill(globalPos(2, 0), globalPosition.perp(), beamSpotWeight); } else { @@ -135,6 +140,8 @@ namespace ActsTrk { m_sizeX_endcap->Fill(cluster->channelsInPhi(), beamSpotWeight); m_sizeY_endcap->Fill(cluster->channelsInEta(), beamSpotWeight); + m_widthY_endcap->Fill(cluster->widthInEta(), beamSpotWeight); + m_global_xy_endcap->Fill(globalPos(0, 0), globalPos(1, 0), beamSpotWeight); m_global_zr_endcap->Fill(globalPos(2, 0), globalPosition.perp(), beamSpotWeight); } diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.h b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.h index fe4557a07f9c429836dae35990da94e7ca363815..0a76552e0cd316e3047388ef85ad2a6ccdb09a81 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/PixelClusterValidationPlots.h @@ -76,6 +76,9 @@ namespace ActsTrk { TH1* m_sizeY_barrel {}; TH1* m_sizeY_endcap {}; + TH1* m_widthY_barrel {}; + TH1* m_widthY_endcap {}; + TH2* m_global_xy_barrel {}; TH2* m_global_xy_endcap {}; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.cxx index b2939cad6ea6ac565ffb50b19c7e849f92a314f3..ce1ceb32785f1281fcbf86bfbe1a248f3a55aede 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.cxx @@ -48,9 +48,6 @@ namespace ActsTrk { m_sizeX_barrel = Book1D("sizeX_barrel", "StripCluster_sizeX_barrel;Size X;Entries;", 100, 0, 400, false); m_sizeX_endcap = Book1D("sizeX_endcap", "StripCluster_sizeX_endcap;Size X;Entries;", 100, 0, 400, false); - m_hitsInThirdTimeBin_barrel = Book1D("hitsInThirdTimeBin_barrel", "StripCluster_hitsInThirdTimeBin_barrel;Hits In Third Time Bin;Entries", 4, -2, 2, false); - m_hitsInThirdTimeBin_endcap = Book1D("hitsInThirdTimeBin_endcap", "StripCluster_hitsInThirdTimeBin_endcap;Hits In Third Time Bin;Entries", 4, -2, 2, false); - m_global_xy_barrel = Book2D("global_xy_barrel", "StripCluster_global_xy_barrel;x [mm];y [mm];", 100, -1100, 1100, 100, -1100, 1100, false); m_global_xy_endcap = Book2D("global_xy_endcap", "StripCluster_global_xy_endcap;x [mm];y [mm];", 100, -1100, 1100, 100, -1100, 1100, false); @@ -92,7 +89,6 @@ namespace ActsTrk { m_localCovXX_barrel->Fill(local_covariance(0, 0), beamSpotWeight); m_sizeX_barrel->Fill(cluster->channelsInPhi(), beamSpotWeight); - m_hitsInThirdTimeBin_barrel->Fill(cluster->hitsInThirdTimeBin(), beamSpotWeight); m_global_xy_barrel->Fill(globalPos(0, 0), globalPos(1, 0), beamSpotWeight); m_global_zr_barrel->Fill(globalPos(2, 0), globalPosition.perp(), beamSpotWeight); @@ -114,7 +110,6 @@ namespace ActsTrk { m_localCovXX_endcap->Fill(local_covariance(0, 0), beamSpotWeight); m_sizeX_endcap->Fill(cluster->channelsInPhi(), beamSpotWeight); - m_hitsInThirdTimeBin_endcap->Fill(cluster->hitsInThirdTimeBin(), beamSpotWeight); m_global_xy_endcap->Fill(globalPos(0, 0), globalPos(1, 0), beamSpotWeight); m_global_zr_endcap->Fill(globalPos(2, 0), globalPosition.perp(), beamSpotWeight); diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.h b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.h index f018d77c765354d04f225741014710ebe4201a6e..6ba93aac977c2fb3396171045f660f0a1cc49269 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkAnalysisTools/src/StripClusterValidationPlots.h @@ -64,9 +64,6 @@ namespace ActsTrk { TH1* m_sizeX_barrel {}; TH1* m_sizeX_endcap {}; - TH1* m_hitsInThirdTimeBin_barrel {}; - TH1* m_hitsInThirdTimeBin_endcap {}; - TH2* m_global_xy_barrel {}; TH2* m_global_xy_endcap {}; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index a8f637eec06e776e6bbbc9a53606b10110bd438b..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Tracking/Acts/ActsTrkTools/ActsTrkClusterization \ No newline at end of file diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/CMakeLists.txt deleted file mode 100644 index 78eba844c523ca09ae1f39422168e0ced4cb82ff..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -atlas_subdir(ActsTrkClusterizationTools) - -find_package(Acts COMPONENTS Core) -find_package(Eigen) - -atlas_add_component(ActsTrkClusterizationTools - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS - ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES - ${EIGEN_LIBRARIES} - ActsCore - ActsTrkToolInterfacesLib - InDetRawData - InDetReadoutGeometry - SiClusterizationToolLib - xAODInDetMeasurement) - -atlas_install_python_modules(python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8}) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/python/ActsTrkClusterizationToolsConfig.py b/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/python/ActsTrkClusterizationToolsConfig.py deleted file mode 100644 index 0e18aa9fb68d85f2b24c7ed703e5e08d75b19817..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/python/ActsTrkClusterizationToolsConfig.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -from AthenaConfiguration.Enums import BeamType -from InDetConfig.SiClusterizationToolConfig import ITkClusterMakerToolCfg, ITkPixelRDOToolCfg -from SCT_ConditionsTools.ITkStripConditionsToolsConfig import ITkStripConditionsSummaryToolCfg -from SiLorentzAngleTool.ITkStripLorentzAngleConfig import ITkStripLorentzAngleToolCfg - - -def ActsTrkITkPixelClusteringToolCfg(flags, name="ActsITkPixelClusteringTool", **kwargs): - acc = ComponentAccumulator() - kwargs.setdefault("PixelRDOTool", acc.popToolsAndMerge(ITkPixelRDOToolCfg(flags))) - kwargs.setdefault("ClusterMakerTool", acc.popToolsAndMerge(ITkClusterMakerToolCfg(flags))) - kwargs.setdefault("AddCorners", True) - kwargs.setdefault("ErrorStrategy", 1) - kwargs.setdefault("PixelChargeCalibCondData", "ITkPixelChargeCalibCondData") - kwargs.setdefault("PixelOfflineCalibData", "") - acc.setPrivateTools(CompFactory.ActsTrk.PixelClusteringTool(name, **kwargs)) - return acc - - -def ActsTrkITkStripClusteringToolCfg(flags, name="ActsITkStripClusteringTool", **kwargs): - acc = ComponentAccumulator() - kwargs.setdefault("StripConditionsTool", acc.popToolsAndMerge(ITkStripConditionsSummaryToolCfg(flags))) - kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge(ITkStripLorentzAngleToolCfg(flags))) - - if flags.ITk.selectStripIntimeHits: - coll_25ns = flags.Beam.BunchSpacing<=25 and flags.Beam.Type is BeamType.Collisions - kwargs.setdefault("timeBins", "01X" if coll_25ns else "X1X") - - acc.setPrivateTools(CompFactory.ActsTrk.StripClusteringTool(name, **kwargs)) - return acc - diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/components/ActsClusterization_entries.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/components/ActsClusterization_entries.cxx deleted file mode 100644 index 7dedb04a80437cbee862e13d166d3e2222d19afa..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkClusterizationTools/src/components/ActsClusterization_entries.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include "../ActsPixelClusteringTool.h" -#include "../ActsStripClusteringTool.h" - -DECLARE_COMPONENT(ActsTrk::PixelClusteringTool) -DECLARE_COMPONENT(ActsTrk::StripClusteringTool) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/CMakeLists.txt index 43e8bff23e995f050448797a66649946d64e6a65..002b758a88e5a0554b799db3d1bf7a07ffd06174 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/CMakeLists.txt @@ -13,7 +13,7 @@ atlas_add_component( ActsTrkFindingTool LINK_LIBRARIES GaudiKernel ActsCore - ActsTrkEvent + ActsTrkEventLib ActsTrkToolInterfacesLib ActsInteropLib @@ -24,8 +24,5 @@ atlas_add_component( ActsTrkFindingTool ActsTrkEventCnvLib ) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/python/ActsTrkFindingToolConfig.py b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/python/ActsTrkFindingToolConfig.py deleted file mode 100644 index fa5d12f165328b693ef4fd43d9987a3189645ad0..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/python/ActsTrkFindingToolConfig.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -from ActsGeometry.ActsGeometryConfig import ( - ActsExtrapolationToolCfg, - ActsTrackingGeometryToolCfg, -) -from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg -from ActsTrkEventCnv.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg - - -def ActsTrkFindingToolCfg(flags, **kwargs) -> ComponentAccumulator: - acc = ComponentAccumulator() - - kwargs.setdefault("maxPropagationStep", 10000) - kwargs.setdefault("etaBins", []) - kwargs.setdefault("chi2CutOff", [15.0]) - kwargs.setdefault("numMeasurementsCutOff", [10]) - kwargs.setdefault("doPrintTrackStates", flags.Acts.doPrintTrackStates) - - kwargs.setdefault( - "TrackingGeometryTool", - acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)), - ) # PrivateToolHandle - kwargs.setdefault( - "ExtrapolationTool", - acc.popToolsAndMerge(ActsExtrapolationToolCfg(flags, MaxSteps=10000)), - ) # PrivateToolHandle - - kwargs.setdefault( - "SummaryTool", acc.popToolsAndMerge(InDetTrackSummaryToolCfg(flags)) - ) # PrivateToolHandle - - kwargs.setdefault( - "ATLASConverterTool", - acc.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)), - ) - - if flags.Detector.GeometryITk: - from InDetConfig.InDetBoundaryCheckToolConfig import ITkBoundaryCheckToolCfg - - BoundaryCheckToolCfg = ITkBoundaryCheckToolCfg - else: - from InDetConfig.InDetBoundaryCheckToolConfig import InDetBoundaryCheckToolCfg - - BoundaryCheckToolCfg = InDetBoundaryCheckToolCfg - - kwargs.setdefault( - "BoundaryCheckTool", - acc.popToolsAndMerge(BoundaryCheckToolCfg(flags)), - ) - - if flags.Acts.doRotCorrection: - if flags.Detector.GeometryITk: - from TrkConfig.TrkRIO_OnTrackCreatorConfig import ITkRotCreatorCfg - - RotCreatorCfg = ITkRotCreatorCfg - else: - from TrkConfig.TrkRIO_OnTrackCreatorConfig import InDetRotCreatorCfg - - RotCreatorCfg = InDetRotCreatorCfg - - kwargs.setdefault( - "RotCreatorTool", - acc.popToolsAndMerge(RotCreatorCfg(flags, name="ActsRotCreatorTool")), - ) - - acc.setPrivateTools( - CompFactory.ActsTrk.TrackFindingTool(name="ActsTrackFindingTool", **kwargs) - ) - return acc diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/ITrackStatePrinter.h b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/ITrackStatePrinter.h new file mode 100644 index 0000000000000000000000000000000000000000..67525548092405ede56118a180d7aca83d5156b9 --- /dev/null +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/ITrackStatePrinter.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSTRKFINDINGTOOL_ITRACKSTATEPRINTER_H +#define ACTSTRKFINDINGTOOL_ITRACKSTATEPRINTER_H 1 + +// Base +#include "GaudiKernel/IAlgTool.h" + +// ATHENA +#include "GeoPrimitives/GeoPrimitives.h" +#include "GaudiKernel/EventContext.h" + +// ACTS CORE +#include "Acts/Geometry/TrackingGeometry.hpp" +#include "Acts/EventData/TrackParameters.hpp" + +// PACKAGE +#include "ActsGeometry/ATLASSourceLink.h" +#include "ActsTrkEvent/TrackContainer.h" + +// Other +#include <vector> + +namespace ActsTrk +{ + class ITrackStatePrinter + : virtual public IAlgTool + { + public: + DeclareInterfaceID(ITrackStatePrinter, 1, 0); + + virtual void + printSourceLinks(const EventContext &ctx, + const Acts::GeometryContext &tgContext, + const std::vector<ATLASUncalibSourceLink> &sourceLinks, + const std::vector<size_t> &ncoll) const = 0; + + virtual void + printTracks(const Acts::GeometryContext &tgContext, + const ActsTrk::TrackContainer &tracks, + const std::vector<ActsTrk::TrackContainer::TrackProxy> &fitResult, + const Acts::BoundTrackParameters &seed, + size_t iseed, + size_t ntracks) const = 0; + }; + +} // namespace + +#endif diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.cxx index 38b02d540754a9ed011384a30dbc22beb18b46ea..6364486510230556db69e2e9059484849048effd 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.cxx @@ -5,6 +5,7 @@ #include "src/TrackFindingTool.h" // Athena +#include "TrkParameters/TrackParameters.h" #include "TrkTrackSummary/TrackSummary.h" #include "InDetPrepRawData/PixelClusterCollection.h" #include "InDetPrepRawData/SCT_ClusterCollection.h" @@ -18,25 +19,18 @@ #include "Acts/Definitions/Units.hpp" #include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/EventData/Measurement.hpp" +#include "Acts/Geometry/GeometryIdentifier.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/TrackFinding/SourceLinkAccessorConcept.hpp" #include "Acts/Surfaces/PerigeeSurface.hpp" -#include "Acts/Utilities/Delegate.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/Propagator.hpp" #include "Acts/TrackFitting/GainMatrixSmoother.hpp" #include "Acts/TrackFitting/GainMatrixUpdater.hpp" -#include "Acts/EventData/detail/TransformationFreeToBound.hpp" -#include "Acts/EventData/MultiTrajectory.hpp" -#include "Acts/Surfaces/AnnulusBounds.hpp" -#include "Acts/Surfaces/DiscTrapezoidBounds.hpp" -#include "Acts/Surfaces/RadialBounds.hpp" -#include "Acts/Surfaces/RectangleBounds.hpp" -#include "Acts/Surfaces/SurfaceBounds.hpp" -#include "Acts/Surfaces/TrapezoidBounds.hpp" +// ACTS glue +#include "ActsTrkEvent/TrackContainer.h" // PACKAGE #include "ActsGeometry/ATLASSourceLink.h" @@ -46,12 +40,11 @@ #include "ActsInterop/Logger.h" // Other -#include <boost/container/flat_map.hpp> #include <boost/container/flat_set.hpp> #include <sstream> #include <functional> -#include <vector> #include <tuple> +#include <algorithm> namespace { @@ -67,22 +60,22 @@ namespace static Acts::Result<void> gainMatrixUpdate(const Acts::GeometryContext &gctx, - typename Acts::MultiTrajectory<ActsTrk::TrackFindingTool::traj_Type>::TrackStateProxy trackState, - Acts::NavigationDirection direction, + typename Acts::MultiTrajectory<ActsTrk::TrackStateBackend>::TrackStateProxy trackState, + Acts::Direction direction, const Acts::Logger &logger) { Acts::GainMatrixUpdater updater; - return updater.template operator()<ActsTrk::TrackFindingTool::traj_Type>(gctx, trackState, direction, logger); + return updater.template operator()<ActsTrk::TrackStateBackend>(gctx, trackState, direction, logger); } static Acts::Result<void> gainMatrixSmoother(const Acts::GeometryContext &gctx, - Acts::MultiTrajectory<ActsTrk::TrackFindingTool::traj_Type> &trajectory, + Acts::MultiTrajectory<ActsTrk::TrackStateBackend> &trajectory, size_t entryIndex, const Acts::Logger &logger) { Acts::GainMatrixSmoother smoother; - return smoother.template operator()<ActsTrk::TrackFindingTool::traj_Type>(gctx, trajectory, entryIndex, logger); + return smoother.template operator()<ActsTrk::TrackStateBackend>(gctx, trajectory, entryIndex, logger); } /// Borrowed from Acts Examples/Framework/include/ActsExamples/EventData/GeometryContainers.hpp @@ -207,7 +200,7 @@ namespace using Stepper = Acts::EigenStepper<>; using Navigator = Acts::Navigator; using Propagator = Acts::Propagator<Stepper, Navigator>; - using CKF = Acts::CombinatorialKalmanFilter<Propagator, ActsTrk::TrackFindingTool::traj_Type>; + using CKF = Acts::CombinatorialKalmanFilter<Propagator, ActsTrk::TrackStateBackend>; // get Athena SiDetectorElement from Acts surface static const InDetDD::SiDetectorElement *actsToDetElem(const Acts::Surface &surface) @@ -220,317 +213,6 @@ namespace return dynamic_cast<const InDetDD::SiDetectorElement *>(actsElement->upstreamDetectorElement()); } - /// ========================================================================= - /// Debug printout routines - /// This is only required by code in this file, so we keep it in the anonymous namespace. - /// The actual TrackFindingTool class definition comes later. - /// ========================================================================= - - /// format all arguments and return as a string. - /// Used here to apply std::setw() to the combination of values. - template <typename... Types> - static std::string to_string(Types &&...values) - { - std::ostringstream os; - (os << ... << values); - return os.str(); - } - - static std::string trackStateName(Acts::TrackStateType trackState) - { - static constexpr std::array<std::tuple<bool, Acts::TrackStateFlag, char>, Acts::TrackStateFlag::NumTrackStateFlags> trackStateNames{{ - {false, Acts::TrackStateFlag::ParameterFlag, '-'}, - {true, Acts::TrackStateFlag::MeasurementFlag, 'M'}, - {true, Acts::TrackStateFlag::OutlierFlag, 'O'}, - {true, Acts::TrackStateFlag::HoleFlag, 'H'}, - {true, Acts::TrackStateFlag::MaterialFlag, 'm'}, - {true, Acts::TrackStateFlag::SharedHitFlag, 'S'}, - }}; - std::string s; - for (auto [b, f, c] : trackStateNames) - { - if (trackState[f] == b) - s += c; - } - return s; - } - - // compact surface/boundary name - static std::string surfaceName(const Acts::Surface &surface) - { - std::string name = surface.name(); - if (name.compare(0, 6, "Acts::") == 0) - { - name.erase(0, 6); - } - if (name.size() > 7 && name.compare(name.size() - 7, 7, "Surface") == 0) - { - name.erase(name.size() - 7, 7); - } - static const std::map<Acts::SurfaceBounds::BoundsType, const char *> boundsNames{{ - {Acts::SurfaceBounds::BoundsType::eCone, "Cone"}, - {Acts::SurfaceBounds::BoundsType::eCylinder, "Cylinder"}, - {Acts::SurfaceBounds::BoundsType::eDiamond, "Diamond"}, - {Acts::SurfaceBounds::BoundsType::eDisc, "Disc"}, - {Acts::SurfaceBounds::BoundsType::eEllipse, "Ellipse"}, - {Acts::SurfaceBounds::BoundsType::eLine, "Line"}, - {Acts::SurfaceBounds::BoundsType::eRectangle, "Rectangle"}, - {Acts::SurfaceBounds::BoundsType::eTrapezoid, "Trapezoid"}, - {Acts::SurfaceBounds::BoundsType::eTriangle, "Triangle"}, - {Acts::SurfaceBounds::BoundsType::eDiscTrapezoid, "DiscTrapezoid"}, - {Acts::SurfaceBounds::BoundsType::eConvexPolygon, "ConvexPolygon"}, - {Acts::SurfaceBounds::BoundsType::eAnnulus, "Annulus"}, - {Acts::SurfaceBounds::BoundsType::eBoundless, "Boundless"}, - {Acts::SurfaceBounds::BoundsType::eOther, "Other"}, - }}; - if (auto it = boundsNames.find(surface.bounds().type()); - it != boundsNames.end() && it->second != name) - { - name += ' '; - name += it->second; - } - return name; - } - - static void printHeader(bool isMeasurement = false) - { - std::cout << std::left - << std::setw(5) << "Index" << ' ' - << std::setw(4) << "Type" << ' ' - << std::setw(21) << "SurfaceBounds" << ' '; - if (isMeasurement) - { - std::cout << std::setw(21) << "GeometryId" << ' ' - << std::right - << std::setw(9) << "loc0(-)" << ' ' - << std::setw(9) << "loc1(-)" << ' ' - << std::setw(6) << "Pos R" << ' ' - << std::setw(6) << "phid" << ' ' - << std::setw(7) << "eta" << ' ' - << std::setw(9) << "loc0+" << ' ' - << std::setw(9) << "loc1+" << ' ' - << std::setw(6) << "Pos R" << ' ' - << std::setw(6) << "phid" << ' ' - << std::setw(7) << "eta" << '\n'; - } - else - { - std::cout << std::setw(21) << "GeometryId / stats" << ' ' - << std::right - << std::setw(9) << "loc0" << ' ' - << std::setw(9) << "loc1" << ' ' - << std::setw(6) << "Pos R" << ' ' - << std::setw(6) << "phid" << ' ' - << std::setw(7) << "eta" << ' ' - << std::setw(9) << "q*pT" << ' ' - << std::setw(6) << "phid" << ' ' - << std::setw(7) << "eta" << ' ' - << std::setw(6) << "TrkLen" << ' ' - << std::setw(7) << "chi2" << ' ' - << std::setw(6) << "Flags" << '\n'; - } - } - - // Return local position of the ends of the 1D strips. - static std::array<Acts::Vector2, 2> - stripEnds(const Acts::SurfaceBounds &bounds, const Acts::Vector2 &loc) - { - auto b = bounds.values(); - switch (bounds.type()) - { - case Acts::SurfaceBounds::eRectangle: - { - return {{{loc[0], b[Acts::RectangleBounds::eMinY]}, {loc[0], b[Acts::RectangleBounds::eMaxY]}}}; - } - case Acts::SurfaceBounds::eTrapezoid: - { - auto halfLengthY = b[Acts::TrapezoidBounds::eHalfLengthY]; - return {{{loc[0], -halfLengthY}, {loc[0], halfLengthY}}}; - } - case Acts::SurfaceBounds::eAnnulus: - { - // Annulus needs measurement coordinate as loc1, but is input as 1D in loc[0]. - // This method doesn't rotate into the strip coordinate system, so won't be exact, - // but surely good enough for printout. - return {{{b[Acts::AnnulusBounds::eMinR], loc[0]}, {b[Acts::AnnulusBounds::eMaxR], loc[0]}}}; - } - case Acts::SurfaceBounds::eDiscTrapezoid: - { - auto averagePhi = b[Acts::DiscTrapezoidBounds::eAveragePhi]; - auto alphaMinR = std::atan2(b[Acts::DiscTrapezoidBounds::eMinR], b[Acts::DiscTrapezoidBounds::eHalfLengthXminR]); - auto alphaMaxR = std::atan2(b[Acts::DiscTrapezoidBounds::eMaxR], b[Acts::DiscTrapezoidBounds::eHalfLengthXmaxR]); - auto alpha = std::max(alphaMinR, alphaMaxR); - return {{{loc[0], averagePhi - alpha}, {loc[0], averagePhi + alpha}}}; - } - case Acts::SurfaceBounds::eDisc: - { - auto averagePhi = b[Acts::RadialBounds::eAveragePhi]; - auto halfPhiSector = b[Acts::RadialBounds::eHalfPhiSector]; - return {{{loc[0], averagePhi - halfPhiSector}, {loc[0], averagePhi + halfPhiSector}}}; - } - default: - { - return {{loc, loc}}; - } - } - } - - static void - printMeasurement(const Acts::GeometryContext &tgContext, const Acts::Surface &surface, const Acts::Vector2 &loc) - { - auto p = surface.localToGlobal(tgContext, loc, Acts::Vector3{0.0, 0.0, 0.0}); - std::cout << ' ' - << std::setw(9) << std::setprecision(3) << loc[0] << ' ' - << std::setw(9) << std::setprecision(3) << loc[1] << ' ' - << std::setw(6) << std::setprecision(1) << p.head<2>().norm() << ' ' - << std::setw(6) << std::setprecision(1) << std::atan2(p[1], p[0]) / Acts::UnitConstants::degree << ' ' - << std::setw(7) << std::setprecision(3) << std::atanh(p[2] / p.norm()); - } - - static void - printSourceLink(const Acts::GeometryContext &tgContext, - const Acts::TrackingGeometry &trackingGeometry, - const ATLASUncalibSourceLink &sl, - size_t index) - { - std::cout << std::setw(5) << index << ' ' - << std::setw(3) << sl.dim() << "D "; - auto surface = trackingGeometry.findSurface(sl.geometryId()); - if (!surface) - { - std::cout << "*** no surface ***\n"; - return; - } - std::cout << std::left - << std::setw(21) << surfaceName(*surface) << ' ' - << std::setw(21) << to_string(surface->geometryId()) - << std::right << std::defaultfloat << std::fixed; - Acts::Vector2 loc{sl.values().head<2>()}; - if (sl.dim() != 1) - { - printMeasurement(tgContext, *surface, loc); - } - else - { - auto ends = stripEnds(surface->bounds(), loc); - printMeasurement(tgContext, *surface, ends[0]); - if (ends[0] == ends[1]) - { - std::cout << " *** zero strip length ***"; - } - else - { - printMeasurement(tgContext, *surface, ends[1]); - } - } - std::cout << std::defaultfloat << '\n'; - } - - static void printParameters(const Acts::Surface &surface, const Acts::GeometryContext &tgContext, const Acts::BoundVector &bound) - { - auto p = Acts::detail::transformBoundToFreeParameters(surface, tgContext, bound); - std::cout << std::defaultfloat << std::fixed - << std::setw(9) << std::setprecision(3) << bound[Acts::eBoundLoc0] << ' ' - << std::setw(9) << std::setprecision(3) << bound[Acts::eBoundLoc1] << ' ' - << std::setw(6) << std::setprecision(1) << p.segment<2>(Acts::eFreePos0).norm() << ' ' - << std::setw(6) << std::setprecision(1) << std::atan2(p[Acts::eFreePos1], p[Acts::eFreePos0]) / Acts::UnitConstants::degree << ' ' - << std::setw(7) << std::setprecision(3) << std::atanh(p[Acts::eFreePos2] / p.segment<3>(Acts::eFreePos0).norm()) << ' ' - << std::setw(9) << std::setprecision(3) << p.segment<2>(Acts::eFreeDir0).norm() / p[Acts::eFreeQOverP] << ' ' - << std::setw(6) << std::setprecision(1) << std::atan2(p[Acts::eFreeDir1], p[Acts::eFreeDir0]) / Acts::UnitConstants::degree << ' ' - << std::setw(7) << std::setprecision(2) << std::atanh(p[Acts::eFreeDir2]) - << std::defaultfloat; - } - - static void - printTrackState(const Acts::GeometryContext &tgContext, - const Acts::MultiTrajectory<ActsTrk::TrackFindingTool::traj_Type>::ConstTrackStateProxy &state) - { - std::cout << std::defaultfloat << std::fixed - << std::setw(5) << state.index() << ' '; - if (state.hasCalibrated()) - { - std::cout << std::setw(3) << state.calibratedSize() << 'D'; - } - else if (state.typeFlags()[Acts::TrackStateFlag::HoleFlag]) - { - std::cout << std::setw(4) << "hole"; - } - else - { - std::cout << std::setw(4) << " "; - } - std::cout << ' ' - << std::left - << std::setw(21) << surfaceName(state.referenceSurface()) << ' ' - << std::setw(21) << to_string(state.referenceSurface().geometryId()) << ' ' - << std::right; - printParameters(state.referenceSurface(), tgContext, state.parameters()); - std::cout << std::defaultfloat << std::fixed << ' ' - << std::setw(6) << std::setprecision(1) << state.pathLength() << ' ' - << std::setw(7) << std::setprecision(1) << state.chi2() << ' ' - << std::defaultfloat - << std::setw(Acts::TrackStateFlag::NumTrackStateFlags) << trackStateName(state.typeFlags()) << '\n'; - } - - static void - printTracks(const Acts::GeometryContext &tgContext, - const Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder> &tracks, - const std::vector<typename Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>::TrackProxy> &fitResult, - const Acts::BoundTrackParameters &seed, - size_t iseed, - size_t ntracks) - { - printHeader(); - std::cout << std::setw(5) << iseed << ' ' - << std::left - << std::setw(4) << "seed" << ' ' - << std::setw(21) << surfaceName(seed.referenceSurface()) << ' ' - << std::setw(21) << to_string("#traj=", fitResult.size(), ", #trk=", ntracks) << ' ' - << std::right; - printParameters(seed.referenceSurface(), tgContext, seed.parameters()); - std::cout << '\n'; - - for (auto &track : fitResult) - { - const auto lastMeasurementIndex = track.tipIndex(); - // to print track states from inside outward, we need to reverse the order of visitBackwards(). - std::vector<Acts::MultiTrajectory<ActsTrk::TrackFindingTool::traj_Type>::ConstTrackStateProxy> states; - states.reserve(lastMeasurementIndex + 1); // could be an overestimate - size_t npixel = 0, nstrip = 0; - tracks.trackStateContainer().visitBackwards( - lastMeasurementIndex, - [&](const Acts::VectorMultiTrajectory::ConstTrackStateProxy &state) -> void - { - if (state.hasCalibrated()) - { - if (state.calibratedSize() == 1) - ++nstrip; - else if (state.calibratedSize() == 2) - ++npixel; - } - states.push_back(state); - }); - - const Acts::BoundTrackParameters per(track.referenceSurface().getSharedPtr(), - track.parameters(), - track.covariance()); - std::cout << std::setw(5) << lastMeasurementIndex << ' ' - << std::left - << std::setw(4) << "parm" << ' ' - << std::setw(21) << surfaceName(per.referenceSurface()) << ' ' - << std::setw(21) << to_string("#pix=", npixel, ", #strip=", nstrip) << ' ' - << std::right; - printParameters(per.referenceSurface(), tgContext, per.parameters()); - std::cout << '\n'; - - for (auto i = states.size(); i > 0;) - { - printTrackState(tgContext, states[--i]); - } - } - std::cout << std::defaultfloat << std::flush; - } - } // anonymous namespace /// ========================================================================= @@ -558,7 +240,6 @@ namespace ActsTrk ATH_MSG_DEBUG(" " << m_etaBins); ATH_MSG_DEBUG(" " << m_chi2CutOff); ATH_MSG_DEBUG(" " << m_numMeasurementsCutOff); - ATH_MSG_DEBUG(" " << m_doPrintTrackStates); ATH_CHECK(m_trackingGeometryTool.retrieve()); ATH_CHECK(m_extrapolationTool.retrieve()); @@ -570,6 +251,10 @@ namespace ActsTrk ATH_MSG_INFO("RotCreatorTool will be used"); ATH_CHECK(m_RotCreatorTool.retrieve()); } + if (!m_trackStatePrinter.empty()) + { + ATH_CHECK(m_trackStatePrinter.retrieve()); + } m_logger = makeActsAthenaLogger(this, "Acts"); @@ -593,8 +278,8 @@ namespace ActsTrk m_ckfExtensions.updater.connect<&gainMatrixUpdate>(); m_ckfExtensions.smoother.connect<&gainMatrixSmoother>(); - m_ckfExtensions.calibrator.connect<&ATLASSourceLinkCalibrator::calibrate<traj_Type, ATLASUncalibSourceLink>>(); - m_ckfExtensions.measurementSelector.connect<&Acts::MeasurementSelector::select<traj_Type>>(m_measurementSelector.get()); + m_ckfExtensions.calibrator.connect<&ATLASSourceLinkCalibrator::calibrate<ActsTrk::TrackStateBackend, ATLASUncalibSourceLink>>(); + m_ckfExtensions.measurementSelector.connect<&Acts::MeasurementSelector::select<ActsTrk::TrackStateBackend>>(m_measurementSelector.get()); return StatusCode::SUCCESS; } @@ -615,46 +300,47 @@ namespace ActsTrk const ActsTrk::BoundTrackParametersContainer &estimatedTrackParameters, ::TrackCollection &tracksContainer) const { - /// ACTS container is just a std::vector of reconstructed track states for multiple tracks. - /// Athena uses a DataVector. - using TrackParametersContainer = std::vector<Acts::BoundTrackParameters>; - ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); - auto numMeasurements = std::accumulate(measurements.begin(), measurements.end(), size_t{0u}, - [](size_t n, const auto &m) - { return n + std::visit([](auto &&v) -> size_t - { return v->size(); }, - m.first); }); + std::vector<size_t> ncoll; + ncoll.reserve(measurements.size()); + + std::transform(measurements.begin(), measurements.end(), std::back_inserter(ncoll), + [](const auto &m) + { return std::visit([](auto &&v) -> size_t + { return v->size(); }, + m.first); }); + + auto numMeasurements = std::accumulate(ncoll.begin(), ncoll.end(), size_t{0u}); ATH_MSG_DEBUG("Create " << numMeasurements << " source links"); UncalibSourceLinkMultiset sourceLinks; sourceLinks.reserve(numMeasurements); + std::vector<ATLASUncalibSourceLink> sourceLinksVec; + if (!m_trackStatePrinter.empty()) + sourceLinksVec.reserve(numMeasurements); std::vector<ATLASUncalibSourceLink::ElementsType> elementsCollection; elementsCollection.reserve(numMeasurements); - for (auto &[clusterContainerVar, detEleCollPtr] : measurements) + for (auto &[clusterContainerVar, detElemsBind] : measurements) { - auto detEleColl = detEleCollPtr; // structured bindings can't be captured in C++17 + auto *detElems = detElemsBind; // structured bindings can't be captured in C++17 std::visit([&](auto &&clusterContainer) { - for (auto meas : *clusterContainer) { - sourceLinks.insert(sourceLinks.end(), - m_ATLASConverterTool->uncalibratedTrkMeasurementToSourceLink(*detEleColl, *meas, elementsCollection)); - } }, - clusterContainerVar); - } - TrackParametersContainer initialParameters; - initialParameters.reserve(estimatedTrackParameters.size()); - for (auto *trkParms : estimatedTrackParameters) - { - initialParameters.push_back(*trkParms); + for (auto *measurement : *clusterContainer) + { + auto sl = m_ATLASConverterTool->uncalibratedTrkMeasurementToSourceLink(*detElems, *measurement, elementsCollection); + + sourceLinks.insert(sourceLinks.end(), sl); + if (!m_trackStatePrinter.empty()) sourceLinksVec.push_back(sl); + } }, + clusterContainerVar); } // Construct a perigee surface as the target surface - auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3{0., 0., 0.}); + auto pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero()); Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context(); Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx); @@ -667,7 +353,7 @@ namespace ActsTrk slAccessorDelegate.connect<&UncalibSourceLinkAccessor::range>(&slAccessor); // Set the CombinatorialKalmanFilter options - using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions<UncalibSourceLinkAccessor::Iterator, traj_Type>; + using TrackFinderOptions = Acts::CombinatorialKalmanFilterOptions<UncalibSourceLinkAccessor::Iterator, ActsTrk::TrackStateBackend>; TrackFinderOptions options(tgContext, mfContext, calContext, @@ -677,53 +363,47 @@ namespace ActsTrk &(*pSurface)); // Perform the track finding for all initial parameters - ATH_MSG_DEBUG("Invoke track finding with " << initialParameters.size() << " seeds."); + ATH_MSG_DEBUG("Invoke track finding with " << estimatedTrackParameters.size() << " seeds."); Acts::TrackContainer tc{Acts::VectorTrackContainer{}, - Acts::VectorMultiTrajectory{}}; + ActsTrk::TrackStateBackend{}}; - m_nTotalSeeds += initialParameters.size(); + m_nTotalSeeds += estimatedTrackParameters.size(); - auto trackingGeometry = m_trackingGeometryTool->trackingGeometry(); // Loop over the track finding results for all initial parameters - for (std::size_t iseed = 0; iseed < initialParameters.size(); ++iseed) + for (std::size_t iseed = 0; iseed < estimatedTrackParameters.size(); ++iseed) { // Get the Acts tracks, given this seed // Result here contains a vector of TrackProxy objects - auto result = m_trackFinder->findTracks(initialParameters[iseed], options, tc); + auto result = m_trackFinder->findTracks(*estimatedTrackParameters[iseed], options, tc); // The result for this seed if (not result.ok()) { ATH_MSG_WARNING("Track finding failed for seed " << iseed << " with error" << result.error()); - m_nFailedSeeds++; + ++m_nFailedSeeds; continue; } // Get the track finding output and add to tracksContainer size_t ntracks = makeTracks(ctx, tgContext, tc, result.value(), tracksContainer); - if (m_doPrintTrackStates) + if (!m_trackStatePrinter.empty()) { if (iseed == 0) { - ATH_MSG_INFO("CKF input hits:"); - printHeader(true); - size_t index = 0; - for (auto &sourceLink : sourceLinks) - { - printSourceLink(tgContext, *trackingGeometry, sourceLink, index++); - } - std::cout << std::defaultfloat << std::flush; - ATH_MSG_INFO("CKF results for " << initialParameters.size() << " seeds:"); + ATH_MSG_INFO("CKF input measurements:"); + m_trackStatePrinter->printSourceLinks(ctx, tgContext, sourceLinksVec, ncoll); + ATH_MSG_INFO("CKF results for " << estimatedTrackParameters.size() << " seeds:"); } - printTracks(tgContext, tc, result.value(), initialParameters[iseed], iseed, ntracks); + m_trackStatePrinter->printTracks(tgContext, tc, result.value(), *estimatedTrackParameters[iseed], iseed, ntracks); + std::cout << std::flush; } if (ntracks == 0) { ATH_MSG_WARNING("Track finding found no track candidates for seed " << iseed); - m_nFailedSeeds++; + ++m_nFailedSeeds; } } @@ -736,8 +416,8 @@ namespace ActsTrk size_t TrackFindingTool::makeTracks(const EventContext &ctx, const Acts::GeometryContext &tgContext, - const Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder> &tracks, - const std::vector<typename Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>::TrackProxy> &fitResult, + const ActsTrk::TrackContainer &tracks, + const std::vector<ActsTrk::TrackContainer::TrackProxy> &fitResult, ::TrackCollection &tracksContainer) const { size_t ntracks = 0; @@ -754,7 +434,7 @@ namespace ActsTrk // Loop over all the output state to create track state tracks.trackStateContainer().visitBackwards( lastMeasurementIndex, - [&](const Acts::VectorMultiTrajectory::ConstTrackStateProxy &state) -> void + [&](const ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) -> void { // First only consider states with an associated detector element if (!state.referenceSurface().associatedDetectorElement()) @@ -768,7 +448,7 @@ namespace ActsTrk std::unique_ptr<const Trk::TrackParameters> parm; // State is a hole (no associated measurement), use predicted parameters - if (flag[Acts::TrackStateFlag::HoleFlag]) + if (flag.test(Acts::TrackStateFlag::HoleFlag)) { const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), state.predicted(), @@ -803,7 +483,7 @@ namespace ActsTrk typePattern.set(Trk::TrackStateOnSurface::Hole); } // The state was tagged as an outlier or (TODO!) was missed in the reverse filtering, use filtered parameters - else if (flag[Acts::TrackStateFlag::OutlierFlag] + else if (flag.test(Acts::TrackStateFlag::OutlierFlag) // || (fitResult.reversed && // TODO! // std::find(fitResult.passedAgainSurfaces.begin(), // fitResult.passedAgainSurfaces.end(), @@ -832,7 +512,7 @@ namespace ActsTrk std::unique_ptr<const Trk::MeasurementBase> measState; if (state.hasUncalibratedSourceLink()) { - const auto &sl = state.uncalibratedSourceLink().template get<ATLASUncalibSourceLink>(); + auto sl = state.getUncalibratedSourceLink().template get<ATLASUncalibSourceLink>(); const xAOD::UncalibratedMeasurement &uncalibMeas = sl.atlasHit(); measState = makeRIO_OnTrack(uncalibMeas, parm.get()); } @@ -891,14 +571,18 @@ namespace ActsTrk const Trk::TrackParameters *parm) const { const Trk::PrepRawData *rio = nullptr; - if (auto pixcl = dynamic_cast<const xAOD::PixelCluster *>(&uncalibMeas)) + const xAOD::UncalibMeasType measurementType = uncalibMeas.type(); + + if (measurementType == xAOD::UncalibMeasType::PixelClusterType) { static const SG::AuxElement::ConstAccessor<ElementLink<InDet::PixelClusterCollection>> pixelLinkAcc("pixelClusterLink"); - if (!pixelLinkAcc.isAvailable(*pixcl)) + auto pixcl = dynamic_cast<const xAOD::PixelCluster *>(&uncalibMeas); + if (not pixcl or not pixelLinkAcc.isAvailable(*pixcl)) { ATH_MSG_WARNING("no pixelClusterLink for cluster associated to measurement"); return nullptr; } + auto pix = *pixelLinkAcc(*pixcl); if (m_RotCreatorTool.empty()) { @@ -919,14 +603,16 @@ namespace ActsTrk } rio = pix; } - else if (auto stripcl = dynamic_cast<const xAOD::StripCluster *>(&uncalibMeas)) + else if (measurementType == xAOD::UncalibMeasType::StripClusterType) { static const SG::AuxElement::ConstAccessor<ElementLink<InDet::SCT_ClusterCollection>> stripLinkAcc("sctClusterLink"); - if (!stripLinkAcc.isAvailable(*stripcl)) + auto stripcl = dynamic_cast<const xAOD::StripCluster *>(&uncalibMeas); + if (not stripcl or not stripLinkAcc.isAvailable(*stripcl)) { ATH_MSG_WARNING("no sctClusterLink for clusters associated to measurement"); return nullptr; } + auto sct = *stripLinkAcc(*stripcl); if (m_RotCreatorTool.empty()) { diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.h b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.h index 58f9b3efefc5bc5fa5eeaa95da039720af813948..7fe6d87d581d7487e6463b1bd3162357d850bb11 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackFindingTool.h @@ -5,30 +5,30 @@ #ifndef ACTSTRKFINDINGTOOL_TRACKFINDINGTOOL_H #define ACTSTRKFINDINGTOOL_TRACKFINDINGTOOL_H 1 -// ATHENA +// BASE #include "AthenaBaseComps/AthAlgTool.h" -#include "GeoPrimitives/GeoPrimitives.h" +#include "ActsTrkToolInterfaces/ITrackFindingTool.h" + +// ATHENA #include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" #include "TrkToolInterfaces/IBoundaryCheckTool.h" #include "TrkToolInterfaces/IRIO_OnTrackCreator.h" -#include "TrkParameters/TrackParameters.h" #include "xAODMeasurementBase/UncalibratedMeasurement.h" // ACTS CORE -#include "Acts/EventData/VectorMultiTrajectory.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp" #include "Acts/TrackFinding/MeasurementSelector.hpp" -#include "Acts/EventData/VectorTrackContainer.hpp" -#include "Acts/Geometry/GeometryIdentifier.hpp" // PACKAGE -#include "ActsTrkToolInterfaces/ITrackFindingTool.h" +#include "src/ITrackStatePrinter.h" +#include "ActsTrkEvent/TrackContainer.h" #include "ActsGeometryInterfaces/IActsExtrapolationTool.h" #include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" #include "ActsTrkEventCnv/IActsToTrkConverterTool.h" // Other +#include <memory> #include <atomic> namespace ActsTrk @@ -37,8 +37,6 @@ namespace ActsTrk { public: - using traj_Type = Acts::VectorMultiTrajectory; - TrackFindingTool(const std::string &type, const std::string &name, const IInterface *parent); virtual ~TrackFindingTool(); // define in .cxx so std::unique_ptr can delete incomplete type (pimpl) @@ -62,6 +60,7 @@ namespace ActsTrk ToolHandle<ActsTrk::IActsToTrkConverterTool> m_ATLASConverterTool{this, "ATLASConverterTool", "ActsToTrkConverterTool"}; ToolHandle<Trk::IBoundaryCheckTool> m_boundaryCheckTool{this, "BoundaryCheckTool", "InDet::InDetBoundaryCheckTool", "Boundary checking tool for detector sensitivities"}; ToolHandle<Trk::IRIO_OnTrackCreator> m_RotCreatorTool{this, "RotCreatorTool", "", "optional RIO_OnTrack creator tool"}; + ToolHandle<ActsTrk::ITrackStatePrinter> m_trackStatePrinter{this, "TrackStatePrinter", "", "optional track state printer"}; // Configuration Gaudi::Property<unsigned int> m_maxPropagationStep{this, "maxPropagationStep", 1000, "Maximum number of steps for one propagate call"}; @@ -69,14 +68,13 @@ namespace ActsTrk Gaudi::Property<std::vector<double>> m_etaBins{this, "etaBins", {}, "MeasurementSelector: bins in |eta| to specify variable selections"}; Gaudi::Property<std::vector<double>> m_chi2CutOff{this, "chi2CutOff", {std::numeric_limits<double>::max()}, "MeasurementSelector: maximum local chi2 contribution"}; Gaudi::Property<std::vector<size_t>> m_numMeasurementsCutOff{this, "numMeasurementsCutOff", {1}, "MeasurementSelector: maximum number of associated measurements on a single surface"}; - Gaudi::Property<bool> m_doPrintTrackStates{this, "doPrintTrackStates", false, "Print tables of input measurements/seeds and output track parameters/states"}; // Create tracks from one seed's CKF result, appending to tracksContainer size_t makeTracks(const EventContext &ctx, const Acts::GeometryContext &tgContext, - const Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder> &tracks, - const std::vector<typename Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>::TrackProxy> &fitOutput, + const ActsTrk::TrackContainer &tracks, + const std::vector<ActsTrk::TrackContainer::TrackProxy> &fitOutput, ::TrackCollection &tracksContainer) const; std::unique_ptr<const Trk::MeasurementBase> @@ -91,7 +89,7 @@ namespace ActsTrk // CKF configuration Acts::PropagatorPlainOptions m_pOptions; std::unique_ptr<Acts::MeasurementSelector> m_measurementSelector; - Acts::CombinatorialKalmanFilterExtensions<traj_Type> m_ckfExtensions; + Acts::CombinatorialKalmanFilterExtensions<ActsTrk::TrackStateBackend> m_ckfExtensions; // statistics mutable std::atomic<size_t> m_nTotalSeeds{0}; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackStatePrinter.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackStatePrinter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..80284b033739d314f7e20ff5eeeef3a6f6ac0534 --- /dev/null +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackStatePrinter.cxx @@ -0,0 +1,609 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "src/TrackStatePrinter.h" + +// Athena +#include "TrkParameters/TrackParameters.h" + +// ACTS +#include "Acts/Definitions/Units.hpp" +#include "Acts/Definitions/Common.hpp" +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/AnnulusBounds.hpp" +#include "Acts/Surfaces/SurfaceBounds.hpp" +#include "Acts/Surfaces/DiscSurface.hpp" +#include "Acts/EventData/detail/TransformationBoundToFree.hpp" + +#include "ActsTrkEvent/TrackContainer.h" + +// PACKAGE +#include "ActsGeometry/ActsDetectorElement.h" +#include "ActsInterop/Logger.h" + +// Other +#include <sstream> + +namespace ActsTrk +{ + /// ========================================================================= + /// Debug printout routines + /// This is only required by code in this file, so we keep it in the anonymous namespace. + /// The actual TrackStatePrinter class definition comes later. + /// ========================================================================= + + /// format all arguments and return as a string. + /// Used here to apply std::setw() to the combination of values. + template <typename... Types> + static std::string to_string(Types &&...values) + { + std::ostringstream os; + (os << ... << values); + return os.str(); + } + + static std::string trackStateName(Acts::ConstTrackStateType trackStateType) + { + static constexpr std::array<std::tuple<bool, Acts::TrackStateFlag, char>, 6> trackStateNames{{ + {false, Acts::TrackStateFlag::ParameterFlag, '-'}, + {true, Acts::TrackStateFlag::MeasurementFlag, 'M'}, + {true, Acts::TrackStateFlag::OutlierFlag, 'O'}, + {true, Acts::TrackStateFlag::HoleFlag, 'H'}, + {true, Acts::TrackStateFlag::MaterialFlag, 'm'}, + {true, Acts::TrackStateFlag::SharedHitFlag, 'S'}, + }}; + std::string s; + for (const auto &[b, f, c] : trackStateNames) + { + if (trackStateType.test(f) == b) + s += c; + } + return s; + } + + // compact surface/boundary name + static std::string actsSurfaceName(const Acts::Surface &surface) + { + std::string name = surface.name(); + if (name.compare(0, 6, "Acts::") == 0) + { + name.erase(0, 6); + } + if (name.size() > 7 && name.compare(name.size() - 7, 7, "Surface") == 0) + { + name.erase(name.size() - 7, 7); + } + static const std::map<Acts::SurfaceBounds::BoundsType, const char *> boundsNames{{ + {Acts::SurfaceBounds::BoundsType::eCone, "Cone"}, + {Acts::SurfaceBounds::BoundsType::eCylinder, "Cylinder"}, + {Acts::SurfaceBounds::BoundsType::eDiamond, "Diamond"}, + {Acts::SurfaceBounds::BoundsType::eDisc, "Disc"}, + {Acts::SurfaceBounds::BoundsType::eEllipse, "Ellipse"}, + {Acts::SurfaceBounds::BoundsType::eLine, "Line"}, + {Acts::SurfaceBounds::BoundsType::eRectangle, "Rectangle"}, + {Acts::SurfaceBounds::BoundsType::eTrapezoid, "Trapezoid"}, + {Acts::SurfaceBounds::BoundsType::eTriangle, "Triangle"}, + {Acts::SurfaceBounds::BoundsType::eDiscTrapezoid, "DiscTrapezoid"}, + {Acts::SurfaceBounds::BoundsType::eConvexPolygon, "ConvexPolygon"}, + {Acts::SurfaceBounds::BoundsType::eAnnulus, "Annulus"}, + {Acts::SurfaceBounds::BoundsType::eBoundless, "Boundless"}, + {Acts::SurfaceBounds::BoundsType::eOther, "Other"}, + }}; + if (auto it = boundsNames.find(surface.bounds().type()); + it != boundsNames.end() && it->second != name) + { + name += ' '; + name += it->second; + } + return name; + } + + static std::string + atlasSurfaceName(const InDetDD::SiDetectorElement &detElem) + { + if (auto idHelper = detElem.getIdHelper()) + { + auto name = idHelper->show_to_string(detElem.identify()); + if (name.size() >= 2 && name[0] == '[' && name[name.size() - 1] == ']') + { + return name.substr(1, name.size() - 2); + } + else + { + return name; + } + } + return {}; + } + + static void printHeader(int type) + { + std::cout << std::left + << std::setw(5) << "Index" << ' ' + << std::setw(4) << "Type" << ' ' + << std::setw(21) << "SurfaceBounds" << ' '; + if (type == 0) + { + std::cout << std::setw(22) << "GeometryId" << ' ' + << std::setw(20) << "ATLAS ID" << ' ' + << std::right + << std::setw(10) << "loc0" << ' ' + << std::setw(10) << "loc1" + << " " + << std::setw(9) << "R" << ' ' + << std::setw(9) << "phid" << ' ' + << std::setw(9) << "eta" << ' ' + << std::setw(10) << "Trk loc0" << ' ' + << std::setw(10) << "loc1" + << " " + << std::setw(9) << "Trk R" << ' ' + << std::setw(9) << "phid" << ' ' + << std::setw(9) << "eta" << ' ' + << std::setw(10) << "g2l loc0" << ' ' + << std::setw(10) << "loc1" << '\n'; + static std::atomic<int> kilroy = 0; + if (!(kilroy++)) + { + std::cout << "R (mm) and phi (degrees). Estimated local coordinate indicated by \"*\" (from SP), \"o\" (from module center), or \"#\" (globalToLocal(center) failure). Athena/ACTS comparison only shown if different.\n"; + } + } + if (type == 1) + { + std::cout << std::setw(22) << "GeometryId / stats" << ' ' + << std::right + << std::setw(10) << "loc0" << ' ' + << std::setw(10) << "loc1" << ' ' + << std::setw(9) << "Pos R" << ' ' + << std::setw(9) << "phid" << ' ' + << std::setw(9) << "eta" << ' ' + << std::setw(9) << "q*pT" << ' ' + << std::setw(9) << "phid" << ' ' + << std::setw(9) << "eta" << ' ' + << std::setw(6) << "TrkLen" << ' ' + << std::setw(7) << "chi2" << ' ' + << std::setw(6) << "Flags" << '\n'; + } + } + + static void + printVec3(const Acts::Vector3 &p) + { + std::cout << std::fixed << ' ' + << std::setw(9) << std::setprecision(3) << p.head<2>().norm() << ' ' + << std::setw(9) << std::setprecision(3) << std::atan2(p[1], p[0]) / Acts::UnitConstants::degree << ' ' + << std::setw(9) << std::setprecision(5) << std::atanh(p[2] / p.norm()) + << std::defaultfloat << std::setprecision(-1); + } + + static void + printVec3(const Acts::Vector3 &p, const Acts::Vector3 &cmp, int precision = 3) + { + if (((p - cmp).array().abs() >= 0.5 * std::pow(10.0, -precision)).any()) + { + printVec3(p); + } + else + { + std::cout << std::setw(30) << ""; + } + } + + static void + printVec2(const Acts::Vector2 &p, const char *estimated = nullptr) + { + const char e0 = estimated ? estimated[0] : ' '; + const char *e1 = estimated ? estimated + 1 : ""; + std::cout << std::fixed << ' ' + << std::setw(10) << std::setprecision(4) << p[0] << e0 + << std::setw(10) << std::setprecision(4) << p[1] << e1 + << std::defaultfloat << std::setprecision(-1); + } + + static void + printVec2(const Acts::Vector2 &p, const Acts::Vector2 &cmp, const char *estimated = nullptr, int precision = 4) + { + if (((p - cmp).array().abs() >= 0.5 * std::pow(10.0, -precision)).any()) + { + printVec2(p, estimated); + } + else + { + std::cout << std::setw(22 + (estimated ? 1 : 0)) << ""; + } + } + + static void + printMeasurement(const Acts::GeometryContext &tgContext, + const Acts::Surface *surface, + const InDetDD::SiDetectorElement *detElem, + const std::tuple<Acts::Vector2, Amg::Vector2D, int, int> &locData) + { + auto &[loc, locTrk, measInd, est] = locData; + int flag = est < 0 ? est : 2 * est + measInd; + int flagTrk = est < 0 ? est : 2 * est; + // indicates coordinate that is estimated: *=from SP, o=from module center, #=globalToLocal(center) failure + static const std::map<int, const char *> estimated_flags{{-1, " "}, + {0, " *"}, + {1, "* "}, + {2, " o"}, + {3, "o "}, + {4, " #"}, + {5, "# "}}; + printVec2(loc, estimated_flags.at(flag)); + + if (surface) + { + // momentum direction doesn't seem to be needed for measurement surfaces (only LineSurface?) + auto glob = surface->localToGlobal(tgContext, loc, Acts::Vector3::Zero()); + printVec3(glob); + + // if measInd=1: won't match because comparing x,y and R,phi, but at least not phi,R. + // This is still useful for debugging because the next test also fails. + printVec2(locTrk, (measInd == 1 ? loc.reverse() : loc), estimated_flags.at(flagTrk)); + + if (detElem) + { + auto globTrk = detElem->surface().localToGlobal(locTrk); + printVec3(globTrk, glob); + + auto res = surface->globalToLocal(tgContext, globTrk, Acts::Vector3::Zero()); + if (!res.ok()) + { + std::cout << " ** " << res.error() << " **"; + } + else + { + printVec2(res.value(), loc); + } + } + } + std::cout << std::defaultfloat << std::setprecision(-1); + } + + static std::tuple<Acts::Vector2, Amg::Vector2D, int, int> + localPositionStrip2D(const Acts::GeometryContext &tgContext, + const xAOD::UncalibratedMeasurement &measurement, + const Acts::Surface *surface, + const xAOD::SpacePoint *sp) + { + auto *disc = dynamic_cast<const Acts::DiscSurface *>(surface); + Acts::Vector2 loc{Acts::Vector2::Zero()}; + int est = 2; // est = 0 (estimated from SP), 1 (from module center), 2 (globalToLocal(center) failure), -1 (pixel) + if (surface) + { + if (sp) + { + auto res = surface->globalToLocal(tgContext, sp->globalPosition().cast<double>(), Acts::Vector3::Zero()); + if (res.ok()) + { + loc = res.value(); + est = 0; + } + } + + if (est != 0) + { + if (auto *annulus = dynamic_cast<const Acts::AnnulusBounds *>(&surface->bounds())) + { + loc[0] = 0.5 * (annulus->rMin() + annulus->rMax()); + est = 1; + } + else + { + auto res = surface->globalToLocal(tgContext, surface->center(tgContext), Acts::Vector3::Zero()); + if (res.ok()) + { + loc = res.value(); + est = 1; + } + } + } + } + + const int measInd = disc ? 1 : 0; + loc[measInd] = measurement.localPosition<1>()[0]; + if (disc) + { + Amg::Vector2D locTrk{disc->localPolarToCartesian(loc).reverse()}; + locTrk[0] = -locTrk[0]; + return {loc, locTrk, measInd, est}; + } + else + { + return {loc, loc, measInd, est}; + } + } + + static void + printSourceLink(const Acts::GeometryContext &tgContext, + const Acts::TrackingGeometry &trackingGeometry, + const ActsTrk::TrackStatePrinter::MeasurementInfo &measurementInfo) + { + auto &[index, sl, spvec] = measurementInfo; + + auto *measurement = &sl->atlasHit(); + const InDetDD::SiDetectorElement *detElem = nullptr; + if (auto *surface = trackingGeometry.findSurface(sl->geometryId())) + { + if (const auto *actsElement = dynamic_cast<const ActsDetectorElement *>(surface->associatedDetectorElement())) + { + detElem = dynamic_cast<const InDetDD::SiDetectorElement *>(actsElement->upstreamDetectorElement()); + } + } + + std::cout << std::setw(5) << index << ' ' + << std::setw(3) << sl->dim() << "D "; + auto surface = trackingGeometry.findSurface(sl->geometryId()); + std::cout << std::left; + if (!surface) + { + std::cout << std::setw(43) << "** no surface **" << ' '; + } + else + { + std::cout << std::setw(21) << actsSurfaceName(*surface) << ' ' + << std::setw(22) << to_string(surface->geometryId()) << ' '; + } + if (!detElem) + { + std::cout << std::setw(20) << "** no DetElem **"; + } + else + { + std::cout << std::setw(20) << atlasSurfaceName(*detElem); + } + std::cout << std::right; + if (sl->dim() != 1) + { + const auto loc = measurement->localPosition<2>().cast<double>(); + printMeasurement(tgContext, surface, detElem, {loc, loc, -1, -1}); + } + else if (spvec.empty()) + { + printMeasurement(tgContext, surface, detElem, + localPositionStrip2D(tgContext, *measurement, surface, nullptr)); + } + else + { + size_t isp = 0; + for (auto *sp : spvec) + { + if (isp++) + { + std::cout << '\n' + << std::left + << std::setw(76) << to_string("** Spacepoint ", isp, " **") + << std::right; + } + printMeasurement(tgContext, surface, detElem, + localPositionStrip2D(tgContext, *measurement, surface, sp)); + } + } + std::cout << '\n'; + } + + static void printParameters(const Acts::Surface &surface, const Acts::GeometryContext &tgContext, const Acts::BoundVector &bound) + { + auto p = Acts::detail::transformBoundToFreeParameters(surface, tgContext, bound); + std::cout << std::fixed + << std::setw(10) << std::setprecision(4) << bound[Acts::eBoundLoc0] << ' ' + << std::setw(10) << std::setprecision(4) << bound[Acts::eBoundLoc1] << ' ' + << std::setw(9) << std::setprecision(3) << p.segment<2>(Acts::eFreePos0).norm() << ' ' + << std::setw(9) << std::setprecision(3) << std::atan2(p[Acts::eFreePos1], p[Acts::eFreePos0]) / Acts::UnitConstants::degree << ' ' + << std::setw(9) << std::setprecision(5) << std::atanh(p[Acts::eFreePos2] / p.segment<3>(Acts::eFreePos0).norm()) << ' ' + << std::setw(9) << std::setprecision(3) << p.segment<2>(Acts::eFreeDir0).norm() / p[Acts::eFreeQOverP] << ' ' + << std::setw(9) << std::setprecision(3) << std::atan2(p[Acts::eFreeDir1], p[Acts::eFreeDir0]) / Acts::UnitConstants::degree << ' ' + << std::setw(9) << std::setprecision(5) << std::atanh(p[Acts::eFreeDir2]) + << std::defaultfloat << std::setprecision(-1); + } + + static void + printTrackState(const Acts::GeometryContext &tgContext, + const Acts::MultiTrajectory<ActsTrk::TrackStateBackend>::ConstTrackStateProxy &state) + { + std::cout << std::setw(5) << state.index() << ' '; + if (state.hasCalibrated()) + { + std::cout << std::setw(3) << state.calibratedSize() << 'D'; + } + else if (state.typeFlags().test(Acts::TrackStateFlag::HoleFlag)) + { + std::cout << std::setw(4) << "hole"; + } + else + { + std::cout << std::setw(4) << " "; + } + std::cout << ' ' + << std::left + << std::setw(21) << actsSurfaceName(state.referenceSurface()) << ' ' + << std::setw(22) << to_string(state.referenceSurface().geometryId()) << ' ' + << std::right; + printParameters(state.referenceSurface(), tgContext, state.parameters()); + std::cout << ' ' + << std::fixed + << std::setw(6) << std::setprecision(1) << state.pathLength() << ' ' + << std::setw(7) << std::setprecision(1) << state.chi2() << ' ' + << std::defaultfloat << std::setprecision(-1) + << std::setw(Acts::TrackStateFlag::NumTrackStateFlags) << trackStateName(state.typeFlags()) << '\n'; + } + +} // anonymous namespace + +/// ========================================================================= +namespace ActsTrk +{ + TrackStatePrinter::TrackStatePrinter(const std::string &type, + const std::string &name, + const IInterface *parent) + : base_class(type, name, parent) + { + } + + StatusCode TrackStatePrinter::initialize() + { + ATH_MSG_DEBUG("Initializing " << name() << "..."); + ATH_MSG_DEBUG("Properties Summary:"); + ATH_MSG_DEBUG(" " << m_spacePointType); + + ATH_CHECK(m_trackingGeometryTool.retrieve()); + ATH_CHECK(m_spacePointKey.initialize()); + + return StatusCode::SUCCESS; + } + + void + TrackStatePrinter::printTracks(const Acts::GeometryContext &tgContext, + const ActsTrk::TrackContainer &tracks, + const std::vector<ActsTrk::TrackContainer::TrackProxy> &fitResult, + const Acts::BoundTrackParameters &seed, + size_t iseed, + size_t ntracks) const + { + printHeader(1); + std::cout << std::setw(5) << iseed << ' ' + << std::left + << std::setw(4) << "seed" << ' ' + << std::setw(21) << actsSurfaceName(seed.referenceSurface()) << ' ' + << std::setw(22) << to_string("#traj=", fitResult.size(), ", #trk=", ntracks) << ' ' + << std::right; + printParameters(seed.referenceSurface(), tgContext, seed.parameters()); + std::cout << '\n'; + + for (auto &track : fitResult) + { + const auto lastMeasurementIndex = track.tipIndex(); + // to print track states from inside outward, we need to reverse the order of visitBackwards(). + std::vector<Acts::MultiTrajectory<ActsTrk::TrackStateBackend>::ConstTrackStateProxy> states; + states.reserve(lastMeasurementIndex + 1); // could be an overestimate + size_t npixel = 0, nstrip = 0; + tracks.trackStateContainer().visitBackwards( + lastMeasurementIndex, + [&states, &npixel, &nstrip](const ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) -> void + { + if (state.hasCalibrated()) + { + if (state.calibratedSize() == 1) + ++nstrip; + else if (state.calibratedSize() == 2) + ++npixel; + } + states.push_back(state); + }); + + const Acts::BoundTrackParameters per(track.referenceSurface().getSharedPtr(), + track.parameters(), + track.covariance()); + std::cout << std::setw(5) << lastMeasurementIndex << ' ' + << std::left + << std::setw(4) << "parm" << ' ' + << std::setw(21) << actsSurfaceName(per.referenceSurface()) << ' ' + << std::setw(22) << to_string("#pix=", npixel, ", #strip=", nstrip) << ' ' + << std::right; + printParameters(per.referenceSurface(), tgContext, per.parameters()); + std::cout << '\n'; + + for (auto i = states.size(); i > 0;) + { + printTrackState(tgContext, states[--i]); + } + } + } + + void + TrackStatePrinter::printSourceLinks(const EventContext &ctx, + const Acts::GeometryContext &tgContext, + const std::vector<ATLASUncalibSourceLink> &sourceLinks, + const std::vector<size_t> &ncoll) const + { + auto trackingGeometry = m_trackingGeometryTool->trackingGeometry(); + + std::vector<std::vector<MeasurementInfo>> measurementIndices(ncoll.size()); + size_t icoll = 0, jcoll = 0, index = 0; + for (auto &sl : sourceLinks) + { + while (jcoll++ >= ncoll.at(icoll)) + { + jcoll = 0; + ++icoll; + } + if (measurementIndices.at(icoll).empty()) + { + measurementIndices.at(icoll).reserve(ncoll.at(icoll)); + } + measurementIndices.at(icoll).push_back({index++, &sl, {}}); + } + + addSpacePoints(ctx, measurementIndices); + + printHeader(0); + for (auto &measurementIndex : measurementIndices) + { + for (auto &measurementInfo : measurementIndex) + { + printSourceLink(tgContext, *trackingGeometry, measurementInfo); + } + } + } + + void TrackStatePrinter::addSpacePoints(const EventContext &ctx, std::vector<std::vector<MeasurementInfo>> &measurementIndices) const + { + ATH_MSG_DEBUG("Retrieving SpacePoint elements from " << m_spacePointKey.size() << " input collections..."); + size_t icoll = 0; + for (auto &spacePointKey : m_spacePointKey) + { + if (!(icoll < m_spacePointType.size())) + { + ATH_MSG_WARNING("Need spacePointType[" << icoll << "] to use SpacePoint collection '" << spacePointKey.key() << "'"); + continue; + } + auto spType = m_spacePointType[icoll++]; + if (!(spType < measurementIndices.size())) + { + ATH_MSG_WARNING("Invalid spacePointType (" << spType << ") for SpacePoint collection '" << spacePointKey.key() << "'"); + continue; + } + ATH_MSG_DEBUG("Retrieving from input SpacePoint collection '" << spacePointKey.key() << "' ..."); + SG::ReadHandle<xAOD::SpacePointContainer> handle = SG::makeHandle(spacePointKey, ctx); + if (!handle.isValid()) + { + ATH_MSG_ERROR("Error retrieving from input SpacePoint collection '" << spacePointKey.key() << "'"); + continue; + } + ATH_MSG_DEBUG(" \\__ " << handle->size() << " elements!"); + for (const auto *sp : *handle) + { + for (auto imeas : sp->measurementIndexes()) + { + if (!(imeas < measurementIndices[spType].size())) + { + ATH_MSG_WARNING("Invalid measurement index (" << imeas << ") for SpacePoint at (" + << sp->globalPosition()[0] << ',' << sp->globalPosition()[1] << ',' << sp->globalPosition()[2] + << ") in collection '" << spacePointKey.key() << "'"); + continue; + } + auto &meas = measurementIndices[spType][imeas]; + auto &measSp = std::get<std::vector<const xAOD::SpacePoint *>>(meas); + if (measSp.empty()) + { + measSp.reserve(1); + } + else + { + ATH_MSG_INFO("Cluster " + << std::get<size_t>(meas) + << " used by SpacePoints at (" + << sp->globalPosition()[0] << ',' << sp->globalPosition()[1] << ',' << sp->globalPosition()[2] + << ") and (" + << measSp[0]->globalPosition()[0] << ',' << measSp[0]->globalPosition()[1] << ',' << measSp[0]->globalPosition()[2] + << ')'); + } + measSp.push_back(sp); + } + } + } + } + +} // namespace ActsTrk diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackStatePrinter.h b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackStatePrinter.h new file mode 100644 index 0000000000000000000000000000000000000000..d75c34509919453a92b3125981d79768415af84a --- /dev/null +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/TrackStatePrinter.h @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSTRKFINDINGTOOL_TRACKSTATEPRINTER_H +#define ACTSTRKFINDINGTOOL_TRACKSTATEPRINTER_H 1 + +// Base +#include "src/ITrackStatePrinter.h" +#include "AthenaBaseComps/AthAlgTool.h" + +// ATHENA +#include "StoreGate/ReadHandleKeyArray.h" +#include "xAODInDetMeasurement/SpacePoint.h" + +// ACTS CORE +#include "Acts/Geometry/TrackingGeometry.hpp" + +// PACKAGE +#include "ActsGeometry/ActsGeometryContext.h" +#include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" +#include "xAODInDetMeasurement/SpacePointContainer.h" + +// Other +#include <memory> +#include <tuple> + +namespace ActsTrk +{ + class TrackStatePrinter : public extends<AthAlgTool, ActsTrk::ITrackStatePrinter> + { + public: + TrackStatePrinter(const std::string &type, const std::string &name, + const IInterface *parent); + virtual ~TrackStatePrinter() = default; + + // standard Athena methods + virtual StatusCode initialize() override; + + void + printSourceLinks(const EventContext &ctx, + const Acts::GeometryContext &tgContext, + const std::vector<ATLASUncalibSourceLink> &sourceLinks, + const std::vector<size_t> &ncoll) const override; + + void + printTracks(const Acts::GeometryContext &tgContext, + const ActsTrk::TrackContainer &tracks, + const std::vector<ActsTrk::TrackContainer::TrackProxy> &fitResult, + const Acts::BoundTrackParameters &seed, + size_t iseed, + size_t ntracks) const override; + + using MeasurementInfo = std::tuple<size_t, + const ATLASUncalibSourceLink *, + std::vector<const xAOD::SpacePoint *>>; + + private: + // Handles + SG::ReadHandleKeyArray<xAOD::SpacePointContainer> m_spacePointKey{this, "InputSpacePoints", {}, "Input Space Points for debugging"}; + + // Tools + ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"}; + + // Configuration + Gaudi::Property<std::vector<size_t>> m_spacePointType{this, "spacePointType", {}, "Type of each InputSpacePoints collection used for debugging"}; + + void addSpacePoints(const EventContext &ctx, std::vector<std::vector<MeasurementInfo>> &measurementIndices) const; + }; + +} // namespace + +#endif diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/components/ActsTrkFindingTool_entries.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/components/ActsTrkFindingTool_entries.cxx index 68c99fc3f32e7a7f4e1e279ab01a47510b46a424..af6904286d38ed60c305a970a877e285c6f6f5f3 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/components/ActsTrkFindingTool_entries.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFindingTool/src/components/ActsTrkFindingTool_entries.cxx @@ -3,5 +3,7 @@ */ #include "src/TrackFindingTool.h" +#include "src/TrackStatePrinter.h" DECLARE_COMPONENT( ActsTrk::TrackFindingTool ) +DECLARE_COMPONENT( ActsTrk::TrackStatePrinter ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/CMakeLists.txt index ee5b1be52360960cef36351333503ee89dd81252..a69451f9165a50db4795d5d1291496ce554f645c 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ActsTrkFittingTools ) @@ -17,6 +17,7 @@ atlas_add_component( ActsTrkFittingTools ActsGeometryInterfacesLib ActsGeometryLib ActsInteropLib + ActsTrkEventLib EventPrimitives GeoPrimitives AthenaBaseComps @@ -37,5 +38,3 @@ atlas_add_component( ActsTrkFittingTools TrkFitterInterfaces ActsTrkEventCnvLib) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/python/ActsTrkFittingToolsConfig.py b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/python/ActsTrkFittingToolsConfig.py deleted file mode 100755 index 952be4befb25f7c865dde5107009196defe016fd..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/python/ActsTrkFittingToolsConfig.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory - -from ActsInterop import UnitConstants - -from ActsGeometry.ActsGeometryConfig import ( - ActsExtrapolationToolCfg, - ActsTrackingGeometryToolCfg, -) -from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg -from ActsTrkEventCnv.ActsTrkEventCnvConfig import ActsToTrkConverterToolCfg - - -def ActsKalmanFitterCfg(flags, name: str = "ActsKalmanFitter", **kwargs): - result = ComponentAccumulator() - - # Make sure this is set correctly! - # /eos/project-a/acts/public/MaterialMaps/ATLAS/material-maps-Pixel-SCT.json - - if "TrackingGeometryTool" not in kwargs: - kwargs["TrackingGeometryTool"] = result.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)) # PrivateToolHandle - - if "ExtrapolationTool" not in kwargs: - kwargs["ExtrapolationTool"] = result.popToolsAndMerge( - ActsExtrapolationToolCfg(flags, MaxSteps=10000) - ) # PrivateToolHandle - - result.addPublicTool(result.popToolsAndMerge(ActsExtrapolationToolCfg(flags, MaxSteps=10000))) # FIXME redundant? - - kwargs.setdefault("ReverseFilteringPt", 1.0 * UnitConstants.GeV) - kwargs.setdefault("OverstepLimit", 300 * UnitConstants.um) - - actsConverter = result.popToolsAndMerge(ActsToTrkConverterToolCfg(flags)) - kwargs["ATLASConverterTool"] = actsConverter - - if "SummaryTool" not in kwargs: - summary = result.getPrimaryAndMerge( - InDetTrackSummaryToolCfg(flags, - # doHolesInDet=False - ) - ) - kwargs["SummaryTool"] = summary - - if flags.Detector.GeometryITk: - from InDetConfig.InDetBoundaryCheckToolConfig import ITkBoundaryCheckToolCfg - - kwargs.setdefault( - "BoundaryCheckTool", result.popToolsAndMerge(ITkBoundaryCheckToolCfg(flags)) - ) - else: - from InDetConfig.InDetBoundaryCheckToolConfig import InDetBoundaryCheckToolCfg - - kwargs.setdefault( - "BoundaryCheckTool", - result.popToolsAndMerge(InDetBoundaryCheckToolCfg(flags)), - ) - - result.setPrivateTools(CompFactory.ActsKalmanFitter(name, **kwargs)) - - return result - diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsFitterHelperFunctions.h b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsFitterHelperFunctions.h new file mode 100644 index 0000000000000000000000000000000000000000..a1af1ff7b07eb4a3f9d5bd72e1fb2db2ef8d6cc5 --- /dev/null +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsFitterHelperFunctions.h @@ -0,0 +1,99 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSGEOMETRY_ACTSFITTERHELPER_H +#define ACTSGEOMETRY_ACTSFITTERHELPER_H + +// ATHENA +#include "TRT_ReadoutGeometry/TRT_BaseElement.h" + +// ACTS +#include "Acts/TrackFitting/GainMatrixSmoother.hpp" +#include "Acts/TrackFitting/GainMatrixUpdater.hpp" + +// PACKAGE +#include "ActsGeometry/ATLASSourceLink.h" +#include "ActsGeometry/ActsDetectorElement.h" + +namespace ActsTrk::FitterHelperFunctions { + template<typename trajectory_t> + Acts::Result<void> gainMatrixUpdate(const Acts::GeometryContext& gctx, + typename Acts::MultiTrajectory<trajectory_t>::TrackStateProxy trackState, + Acts::Direction direction, + const Acts::Logger& logger) { + Acts::GainMatrixUpdater updater; + return updater.template operator()<trajectory_t>(gctx, trackState, direction, logger); + } + + template<typename trajectory_t> + Acts::Result<void> gainMatrixSmoother(const Acts::GeometryContext& gctx, + Acts::MultiTrajectory<trajectory_t>& trajectory, + size_t entryIndex, + const Acts::Logger& logger) { + Acts::GainMatrixSmoother smoother; + return smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex, logger); + } + + /// Outlier finder using a Chi2 cut. + struct ATLASOutlierFinder { + double StateChiSquaredPerNumberDoFCut = std::numeric_limits<double>::max(); + /// Classify a measurement as a valid one or an outlier. + /// + /// @tparam track_state_t Type of the track state + /// @param state The track state to classify + /// @retval False if the measurement is not an outlier + /// @retval True if the measurement is an outlier + template<typename trajectory_t> + bool operator()(typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy state) const { + // can't determine an outlier w/o a measurement or predicted parameters + if (not state.hasCalibrated() or not state.hasPredicted()) { + return false; + } + return Acts::visit_measurement( + state.calibratedSize(), + [&] (auto N) -> bool { + constexpr size_t kMeasurementSize = decltype(N)::value; + + typename Acts::TrackStateTraits<kMeasurementSize, true>::Measurement calibrated{ + state.template calibrated<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()}; + + typename Acts::TrackStateTraits<kMeasurementSize, true>::MeasurementCovariance + calibratedCovariance{state.template calibratedCovariance<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()}; + + // Take the projector (measurement mapping function) + const auto H = + state.projector() + .template topLeftCorner<kMeasurementSize, Acts::BoundIndices::eBoundSize>() + .eval(); + + const auto residual = calibrated - H * state.predicted(); + double chi2 = (residual.transpose() * (calibratedCovariance + H * state.predictedCovariance() * H.transpose()).inverse() * residual).value(); + return (chi2 > StateChiSquaredPerNumberDoFCut * kMeasurementSize); + }); + } + }; + + /// Determine if the smoothing of a track should be done with or without reverse + /// filtering + struct ReverseFilteringLogic { + double momentumMax = std::numeric_limits<double>::max(); + + /// Determine if the smoothing of a track should be done with or without reverse + /// filtering + /// + /// @tparam track_state_t Type of the track state + /// @param trackState The trackState of the last measurement + /// @retval False if we don't use the reverse filtering for the smoothing of the track + /// @retval True if we use the reverse filtering for the smoothing of the track + template<typename trajectory_t> + bool operator()(typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy trackState) const { + // can't determine an outlier w/o a measurement or predicted parameters + auto momentum = std::abs(1. / trackState.filtered()[Acts::eBoundQOverP]); + return (momentum <= momentumMax); + } + }; + +} // namespace + +#endif diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsGaussianSumFitter.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsGaussianSumFitter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..08f66dcb45b263515a89966d3d5f7e1240a8d8bd --- /dev/null +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsGaussianSumFitter.cxx @@ -0,0 +1,555 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "ActsGaussianSumFitter.h" + +// ATHENA +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkTrackSummary/TrackSummary.h" +#include "TRT_ReadoutGeometry/TRT_BaseElement.h" +#include "TrkTrack/TrackStateOnSurface.h" + +// ACTS +#include "Acts/Propagator/MultiEigenStepperLoop.hpp" +#include "Acts/MagneticField/MagneticFieldContext.hpp" +#include "Acts/Surfaces/PerigeeSurface.hpp" +#include "Acts/Utilities/CalibrationContext.hpp" +#include "Acts/Definitions/TrackParametrization.hpp" +#include "Acts/Definitions/Units.hpp" +#include "Acts/Propagator/EigenStepper.hpp" +#include "Acts/Surfaces/Surface.hpp" +#include "Acts/Utilities/Helpers.hpp" +#include "Acts/EventData/VectorMultiTrajectory.hpp" +#include "Acts/EventData/VectorTrackContainer.hpp" +#include "Acts/EventData/TrackParameters.hpp" +#include "Acts/Utilities/Logger.hpp" +#include "Acts/Utilities/CalibrationContext.hpp" +#include "ActsTrkEvent/TrackContainer.h" + +// PACKAGE +#include "ActsGeometry/ATLASMagneticFieldWrapper.h" +#include "ActsGeometry/ATLASSourceLink.h" +#include "ActsInterop/Logger.h" +#include "ActsGeometry/ActsDetectorElement.h" +#include "ActsGeometry/ActsGeometryContext.h" + +// STL +#include <vector> +#include <bitset> +#include <type_traits> +#include <system_error> + +namespace ActsTrk { + +ActsGaussianSumFitter::ActsGaussianSumFitter(const std::string& t, + const std::string& n, + const IInterface* p) : + base_class(t,n,p) +{} + +StatusCode ActsGaussianSumFitter::initialize() { + ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); + + ATH_CHECK(m_trackingGeometryTool.retrieve()); + ATH_CHECK(m_extrapolationTool.retrieve()); + ATH_CHECK(m_ATLASConverterTool.retrieve()); + ATH_CHECK(m_trkSummaryTool.retrieve()); + + m_logger = makeActsAthenaLogger(this, "Acts Gaussian Sum Refit"); + + auto field = std::make_shared<ATLASMagneticFieldWrapper>(); + Acts::MultiEigenStepperLoop<> stepper(field); + Acts::Navigator navigator( Acts::Navigator::Config{ m_trackingGeometryTool->trackingGeometry() } ); + Acts::Propagator<Acts::MultiEigenStepperLoop<>, Acts::Navigator> propagator(std::move(stepper), + std::move(navigator), + logger().cloneWithSuffix("Prop")); + Acts::Experimental::AtlasBetheHeitlerApprox<6, 5> bha = Acts::Experimental::makeDefaultBetheHeitlerApprox(); + + m_fitter = std::make_unique<Fitter>(std::move(propagator), std::move(bha), + logger().cloneWithSuffix("GaussianSumFitter")); + + m_gsfExtensions.updater.connect<&ActsTrk::FitterHelperFunctions::gainMatrixUpdate<ActsTrk::TrackStateBackend>>(); + m_gsfExtensions.calibrator.connect<&ATLASSourceLinkCalibrator::calibrate<ActsTrk::TrackStateBackend>>(); + + m_outlierFinder.StateChiSquaredPerNumberDoFCut = m_option_outlierChi2Cut; + m_gsfExtensions.outlierFinder.connect<&ActsTrk::FitterHelperFunctions::ATLASOutlierFinder::operator()<ActsTrk::TrackStateBackend>>(&m_outlierFinder); + + return StatusCode::SUCCESS; +} + +// refit a track +// ------------------------------------------------------- +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::fit(const EventContext& ctx, + const Trk::Track& inputTrack, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*prtHypothesis*/) const +{ + std::unique_ptr<Trk::Track> track = nullptr; + ATH_MSG_VERBOSE ("--> enter GaussianSumFitter::fit(Track,,) with Track from author = " + << inputTrack.info().dumpInfo()); + + // protection against not having measurements on the input track + if (!inputTrack.measurementsOnTrack() || inputTrack.measurementsOnTrack()->size() < 2) { + ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit"); + return nullptr; + } + + // protection against not having track parameters on the input track + if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) { + ATH_MSG_DEBUG("input fails to provide track parameters for seeding the GSF, reject fit"); + return nullptr; + } + + // Construct a perigee surface as the target surface + std::shared_ptr<Acts::PerigeeSurface> pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>( + Acts::Vector3{0., 0., 0.}); + + Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context(); + Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx); + // CalibrationContext converter not implemented yet. + Acts::CalibrationContext calContext{}; + + // Set the GaussianSumFitter options + Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend> + gsfOptions = prepareOptions(tgContext, + mfContext, + calContext, + *pSurface); + + std::vector<typename ATLASSourceLink::ElementsType> elementCollection; + + std::vector<ATLASSourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext,inputTrack,elementCollection); + const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters((*inputTrack.perigeeParameters())); + + return performFit(ctx, + tgContext, + gsfOptions, + trackSourceLinks, + initialParams); +} + +// fit a set of MeasurementBase objects +// -------------------------------- +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::fit(const EventContext& ctx, + const Trk::MeasurementSet& inputMeasSet, + const Trk::TrackParameters& estimatedStartParameters, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const +{ + std::unique_ptr<Trk::Track> track = nullptr; + + // protection against not having measurements on the input track + if (inputMeasSet.size() < 2) { + ATH_MSG_DEBUG("called to refit empty measurement set or a measurement set with too little information, reject fit"); + return nullptr; + } + + // Construct a perigee surface as the target surface + std::shared_ptr<Acts::PerigeeSurface> pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>( + Acts::Vector3{0., 0., 0.}); + + Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context(); + Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx); + // CalibrationContext converter not implemented yet. + Acts::CalibrationContext calContext{}; + + // Set the GaussianSumFitter options + Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend> + gsfOptions = prepareOptions(tgContext, + mfContext, + calContext, + *pSurface); + + // Set abortOnError to false, else the refitting crashes if no forward propagation is done. Here, we just skip the event and continue. + gsfOptions.abortOnError = false; + + std::vector< ATLASSourceLink > trackSourceLinks; + trackSourceLinks.reserve(inputMeasSet.size()); + + std::vector< ATLASSourceLink::ElementsType > elementCollection; + elementCollection.reserve(inputMeasSet.size()); + + for (auto* measSet : inputMeasSet) { + trackSourceLinks.push_back(m_ATLASConverterTool->trkMeasurementToSourceLink(tgContext, *measSet, elementCollection)); + } + const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(estimatedStartParameters); + + return performFit(ctx, + tgContext, + gsfOptions, + trackSourceLinks, + initialParams); +} + +// fit a set of PrepRawData objects +// -------------------------------- +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::fit(const EventContext& /*ctx*/, + const Trk::PrepRawDataSet& /*inputPRDColl*/, + const Trk::TrackParameters& /*estimatedStartParameters*/, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*prtHypothesis*/) const +{ + ATH_MSG_DEBUG("Fit of PrepRawDataSet not yet implemented"); + return nullptr; +} + +// extend a track fit to include an additional set of MeasurementBase objects +// re-implements the TrkFitterUtils/TrackFitter.cxx general code in a more +// mem efficient and stable way +// -------------------------------- +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::fit(const EventContext& ctx, + const Trk::Track& inputTrack, + const Trk::MeasurementSet& addMeasColl, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const +{ + ATH_MSG_VERBOSE ("--> enter GaussianSumFitter::fit(Track,Meas'BaseSet,,)"); + ATH_MSG_VERBOSE (" with Track from author = " << inputTrack.info().dumpInfo()); + + // protection, if empty MeasurementSet + if (addMeasColl.empty()) { + ATH_MSG_DEBUG( "client tries to add an empty MeasurementSet to the track fit." ); + return fit(ctx,inputTrack); + } + + // protection against not having measurements on the input track + if (!inputTrack.measurementsOnTrack() || (inputTrack.measurementsOnTrack()->size() < 2 && addMeasColl.empty())) { + ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit"); + return nullptr; + } + + // protection against not having track parameters on the input track + if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) { + ATH_MSG_DEBUG("input fails to provide track parameters for seeding the GSF, reject fit"); + return nullptr; + } + + std::unique_ptr<Trk::Track> track = nullptr; + + // Construct a perigee surface as the target surface + std::shared_ptr<Acts::PerigeeSurface> pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3{0., 0., 0.}); + + Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context(); + Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx); + // CalibrationContext converter not implemented yet. + Acts::CalibrationContext calContext{}; + + // Set the GaussianSumFitter options + Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend> + gsfOptions = prepareOptions(tgContext, + mfContext, + calContext, + *pSurface); + + std::vector< ATLASSourceLink::ElementsType > elementCollection; + + std::vector<ATLASSourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, inputTrack, elementCollection); + const auto& initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(*(inputTrack.perigeeParameters())); + + + std::vector< typename ATLASSourceLink::ElementsType > atlasElementCollection; + atlasElementCollection.reserve(addMeasColl.size()); + + for (auto* meas : addMeasColl) { + trackSourceLinks.push_back(m_ATLASConverterTool->trkMeasurementToSourceLink(tgContext, *meas, atlasElementCollection)); + } + + return performFit(ctx, + tgContext, + gsfOptions, + trackSourceLinks, + initialParams); +} + +// extend a track fit to include an additional set of PrepRawData objects +// -------------------------------- +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::fit(const EventContext& /*ctx*/, + const Trk::Track& /*inputTrack*/, + const Trk::PrepRawDataSet& /*addPrdColl*/, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const +{ + + ATH_MSG_DEBUG("Fit of Track with additional PrepRawDataSet not yet implemented"); + return nullptr; +} + +// combined fit of two tracks +// -------------------------------- +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::fit(const EventContext& ctx, + const Trk::Track& intrk1, + const Trk::Track& intrk2, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const +{ + ATH_MSG_VERBOSE ("--> enter GaussianSumFitter::fit(Track,Track,)"); + ATH_MSG_VERBOSE (" with Tracks from #1 = " << intrk1.info().dumpInfo() + << " and #2 = " << intrk2.info().dumpInfo()); + + // protection, if empty track2 + if (!intrk2.measurementsOnTrack()) { + ATH_MSG_DEBUG( "input #2 is empty try to fit track 1 alone" ); + return fit(ctx,intrk1); + } + + // protection, if empty track1 + if (!intrk1.measurementsOnTrack()) { + ATH_MSG_DEBUG( "input #1 is empty try to fit track 2 alone" ); + return fit(ctx,intrk2); + } + + // protection against not having track parameters on the input track + if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) { + ATH_MSG_DEBUG("input #1 fails to provide track parameters for seeding the GSF, reject fit"); + return nullptr; + } + + std::unique_ptr<Trk::Track> track = nullptr; + + // Construct a perigee surface as the target surface + std::shared_ptr<Acts::PerigeeSurface> pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>( + Acts::Vector3{0., 0., 0.}); + + Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context(); + Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx); + // CalibrationContext converter not implemented yet. + Acts::CalibrationContext calContext{}; + + // Set the GaussianSumFitter options + Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend> + gsfOptions = prepareOptions(tgContext, + mfContext, + calContext, + *pSurface); + + std::vector< typename ATLASSourceLink::ElementsType > elementCollection1; + std::vector< typename ATLASSourceLink::ElementsType > elementCollection2; + + std::vector<ATLASSourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, intrk1, elementCollection1); + std::vector<ATLASSourceLink> trackSourceLinks2 = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext, intrk2, elementCollection2); + trackSourceLinks.insert(trackSourceLinks.end(), trackSourceLinks2.begin(), trackSourceLinks2.end()); + const auto &initialParams = m_ATLASConverterTool->trkTrackParametersToActsParameters(*(intrk1.perigeeParameters())); + + return performFit(ctx, + tgContext, + gsfOptions, + trackSourceLinks, + initialParams); +} + +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::makeTrack(const EventContext& ctx, + const Acts::GeometryContext& tgContext, + ActsTrk::TrackContainer& tracks, + Acts::Result<typename ActsTrk::TrackContainer::TrackProxy, std::error_code>& fitResult) const { + if (not fitResult.ok()) + return nullptr; + + std::unique_ptr<Trk::Track> newtrack = nullptr; + // Get the fit output object + const auto& acts_track = fitResult.value(); + auto finalTrajectory = DataVector<const Trk::TrackStateOnSurface>(); + // initialise the number of dead Pixel and Acts strip + int numberOfDeadPixel = 0; + int numberOfDeadSCT = 0; + + std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam; + // Loop over all the output state to create track state + tracks.trackStateContainer().visitBackwards(acts_track.tipIndex(), + [&] (const auto &state) -> void + { + // First only concider state with an associated detector element not in the TRT + auto flag = state.typeFlags(); + const auto* associatedDetEl = state.referenceSurface().associatedDetectorElement(); + if (not associatedDetEl) + return; + + const auto* actsElement = dynamic_cast<const ActsDetectorElement*>(associatedDetEl); + if (not actsElement) + return; + + const auto* upstreamDetEl = actsElement->upstreamDetectorElement(); + if (not upstreamDetEl) + return; + + ATH_MSG_VERBOSE("Try casting to TRT for if"); + if (dynamic_cast<const InDetDD::TRT_BaseElement*>(upstreamDetEl)) + return; + + const auto* trkDetElem = dynamic_cast<const Trk::TrkDetElementBase*>(upstreamDetEl); + if (not trkDetElem) + return; + + ATH_MSG_VERBOSE("trkDetElem type: " << static_cast<std::underlying_type_t<Trk::DetectorElemType>>(trkDetElem->detectorType())); + + ATH_MSG_VERBOSE("Try casting to SiDetectorElement"); + const auto* detElem = dynamic_cast<const InDetDD::SiDetectorElement*>(upstreamDetEl); + if (not detElem) + return; + ATH_MSG_VERBOSE("detElem = " << detElem); + + // We need to determine the type of state + std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; + std::unique_ptr<const Trk::TrackParameters> parm; + + // State is a hole (no associated measurement), use predicted parameters + if (flag.test(Acts::TrackStateFlag::HoleFlag)){ + ATH_MSG_VERBOSE("State is a hole (no associated measurement), use predicted parameters"); + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.predicted(), + state.predictedCovariance()); + parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); + auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*parm); + + // Check if this is a hole, a dead sensors or a state outside the sensor boundary + ATH_MSG_VERBOSE("Check if this is a hole, a dead sensors or a state outside the sensor boundary"); + if(boundaryCheck == Trk::BoundaryCheckResult::DeadElement){ + if (detElem->isPixel()) { + ++numberOfDeadPixel; + } + else if (detElem->isSCT()) { + ++numberOfDeadSCT; + } + // Dead sensors states are not stored + return; + } else if (boundaryCheck != Trk::BoundaryCheckResult::Candidate){ + // States outside the sensor boundary are ignored + return; + } + typePattern.set(Trk::TrackStateOnSurface::Hole); + } + // The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters + else if (flag.test(Acts::TrackStateFlag::OutlierFlag) or not state.hasSmoothed()) { + ATH_MSG_VERBOSE("The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters"); + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.filtered(), + state.filteredCovariance()); + parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); + typePattern.set(Trk::TrackStateOnSurface::Outlier); + } + // The state is a measurement state, use smoothed parameters + else{ + ATH_MSG_VERBOSE("The state is a measurement state, use smoothed parameters"); + + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.smoothed(), + state.smoothedCovariance()); + + actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam))); + parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); + typePattern.set(Trk::TrackStateOnSurface::Measurement); + } + + std::unique_ptr<const Trk::MeasurementBase> measState; + if (state.hasUncalibratedSourceLink()){ + auto sl = state.getUncalibratedSourceLink().template get<ATLASSourceLink>(); + measState = sl.atlasHit().uniqueClone(); + } + double nDoF = state.calibratedSize(); + auto quality =Trk::FitQualityOnSurface(state.chi2(), nDoF); + const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(quality, std::move(measState), std::move(parm), nullptr, typePattern); + // If a state was succesfully created add it to the trajectory + if (perState) { + ATH_MSG_VERBOSE("State succesfully creates, adding it to the trajectory"); + finalTrajectory.insert(finalTrajectory.begin(), perState); + } + }); + + // Convert the perigee state and add it to the trajectory + const Acts::BoundTrackParameters actsPer(acts_track.referenceSurface().getSharedPtr(), + acts_track.parameters(), + acts_track.covariance()); + std::unique_ptr<const Trk::TrackParameters> per = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext); + std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; + typePattern.set(Trk::TrackStateOnSurface::Perigee); + const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(nullptr, std::move(per), nullptr, typePattern); + if (perState) finalTrajectory.insert(finalTrajectory.begin(), perState); + + // Create the track using the states + Trk::TrackInfo newInfo(Trk::TrackInfo::TrackFitter::GaussianSumFilter, Trk::noHypothesis); + newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::GaussianSumFilter); //Mark the fitter as GaussianSumFilter + newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory), nullptr); + if (newtrack) { + // Create the track summary and update the holes information + if (!newtrack->trackSummary()) { + newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>()); + newtrack->trackSummary()->update(Trk::numberOfPixelHoles, 0); + newtrack->trackSummary()->update(Trk::numberOfSCTHoles, 0); + newtrack->trackSummary()->update(Trk::numberOfTRTHoles, 0); + newtrack->trackSummary()->update(Trk::numberOfPixelDeadSensors, numberOfDeadPixel); + newtrack->trackSummary()->update(Trk::numberOfSCTDeadSensors, numberOfDeadSCT); + } + m_trkSummaryTool->updateTrackSummary(ctx, *newtrack, true); + } + + return newtrack; +} + +const Acts::Experimental::GsfExtensions<typename ActsTrk::TrackStateBackend>& +ActsGaussianSumFitter::getExtensions() const +{ + return m_gsfExtensions; +} + +/// Private access to the logger +const Acts::Logger& +ActsGaussianSumFitter::logger() const +{ + return *m_logger; +} + +Acts::Experimental::GsfOptions<typename ActsTrk::TrackStateBackend> +ActsGaussianSumFitter::prepareOptions(const Acts::GeometryContext& tgContext, + const Acts::MagneticFieldContext& mfContext, + const Acts::CalibrationContext& calContext, + const Acts::PerigeeSurface& surface) const +{ + Acts::PropagatorPlainOptions propagationOption; + propagationOption.maxSteps = m_option_maxPropagationStep; + + Acts::Experimental::GsfOptions<typename ActsTrk::TrackStateBackend> gsfOptions{tgContext, mfContext, calContext, m_gsfExtensions, std::move(propagationOption)}; + gsfOptions.referenceSurface = &surface; + + // Set abortOnError to false, else the refitting crashes if no forward propagation is done. Here, we just skip the event and continue. + gsfOptions.abortOnError = false; + + return gsfOptions; +} + +std::unique_ptr<Trk::Track> +ActsGaussianSumFitter::performFit(const EventContext& ctx, + const Acts::GeometryContext& tgContext, + const Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend>& gsfOptions, + const std::vector<ATLASSourceLink>& trackSourceLinks, + const Acts::BoundTrackParameters& initialParams) const +{ + if (trackSourceLinks.empty()) { + ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit "); + return nullptr; + } + + Acts::TrackContainer tracks{ + Acts::VectorTrackContainer{}, + Acts::VectorMultiTrajectory{}}; + + // Convert to Acts::SourceLink during iteration + Acts::SourceLinkAdapterIterator begin{trackSourceLinks.begin()}; + Acts::SourceLinkAdapterIterator end{trackSourceLinks.end()}; + + // Perform the fit + auto result = m_fitter->fit(begin, end, + initialParams, gsfOptions, tracks); + + // Convert + if (not result.ok()) return nullptr; + return makeTrack(ctx, tgContext, tracks, result); +} + +} diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsGaussianSumFitter.h b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsGaussianSumFitter.h new file mode 100644 index 0000000000000000000000000000000000000000..e012acb843a08a02f714b270a9c04098998861b2 --- /dev/null +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsGaussianSumFitter.h @@ -0,0 +1,159 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ACTSGEOMETRY_ACTSGAUSSIANSUMFITTER_H +#define ACTSGEOMETRY_ACTSGAUSSIANSUMFITTER_H + + + +// ATHENA +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "TrkFitterInterfaces/ITrackFitter.h" +#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" +#include "TrkToolInterfaces/IBoundaryCheckTool.h" + +// ACTS +#include "Acts/EventData/VectorMultiTrajectory.hpp" +#include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Utilities/Result.hpp" +#include "Acts/TrackFitting/GaussianSumFitter.hpp" +#include "Acts/Propagator/Propagator.hpp" +#include "Acts/Propagator/MultiEigenStepperLoop.hpp" +#include "Acts/Propagator/Navigator.hpp" +#include "Acts/TrackFitting/BetheHeitlerApprox.hpp" +#include "Acts/TrackFitting/GsfOptions.hpp" +#include "Acts/Utilities/Logger.hpp" + +// PACKAGE +#include "ActsTrkEvent/TrackContainer.h" +#include "ActsGeometryInterfaces/IActsExtrapolationTool.h" +#include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" +#include "ActsTrkEventCnv/IActsToTrkConverterTool.h" +#include "ActsFitterHelperFunctions.h" + +// STL +#include <string> +#include <memory> + +namespace ActsTrk { + +class ActsGaussianSumFitter : public extends<AthAlgTool, Trk::ITrackFitter> { +public: + + ActsGaussianSumFitter(const std::string&, const std::string&, const IInterface*); + virtual ~ActsGaussianSumFitter() = default; + + // standard Athena methods + virtual StatusCode initialize() override; + + //! refit a track + virtual std::unique_ptr<Trk::Track> fit( + const EventContext& ctx, + const Trk::Track&, + const Trk::RunOutlierRemoval runOutlier = false, + const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; + + //! fit a set of PrepRawData objects + virtual std::unique_ptr<Trk::Track> fit( + const EventContext& ctx, + const Trk::PrepRawDataSet&, + const Trk::TrackParameters&, + const Trk::RunOutlierRemoval runOutlier = false, + const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; + + //! fit a set of MeasurementBase objects + virtual std::unique_ptr<Trk::Track> fit( + const EventContext& ctx, + const Trk::MeasurementSet&, + const Trk::TrackParameters&, + const Trk::RunOutlierRemoval runOutlier = false, + const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; + + //! extend a track fit including a new set of PrepRawData objects + virtual std::unique_ptr<Trk::Track> fit( + const EventContext& ctx, + const Trk::Track&, + const Trk::PrepRawDataSet&, + const Trk::RunOutlierRemoval runOutlier = false, + const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; + + //! extend a track fit including a new set of MeasurementBase objects + virtual std::unique_ptr<Trk::Track> fit( + const EventContext& ctx, + const Trk::Track&, + const Trk::MeasurementSet&, + const Trk::RunOutlierRemoval runOutlier = false, + const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; + + //! combined track fit + virtual std::unique_ptr<Trk::Track> fit( + const EventContext& ctx, + const Trk::Track& intrk1, + const Trk::Track& intrk2, + const Trk::RunOutlierRemoval runOutlier = false, + const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; + + + /////////////////////////////////////////////////////////////////// + // Private methods: + /////////////////////////////////////////////////////////////////// +private: + Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend> prepareOptions(const Acts::GeometryContext& tgContext, + const Acts::MagneticFieldContext& mfContext, + const Acts::CalibrationContext& calContext, + const Acts::PerigeeSurface& surface) const; + + std::unique_ptr<Trk::Track> performFit(const EventContext& ctx, + const Acts::GeometryContext& tgContext, + const Acts::Experimental::GsfOptions<ActsTrk::TrackStateBackend>& gsfOptions, + const std::vector<ATLASSourceLink>& trackSourceLinks, + const Acts::BoundTrackParameters& initialParams) const; + + // Create a track from the fitter result + std::unique_ptr<Trk::Track> makeTrack(const EventContext& ctx, + const Acts::GeometryContext& tgContext, + ActsTrk::TrackContainer& tracks, + Acts::Result<typename ActsTrk::TrackContainer::TrackProxy, std::error_code>& fitResult) const; + + const Acts::Experimental::GsfExtensions<ActsTrk::TrackStateBackend>& getExtensions() const; + + /// Private access to the logger + const Acts::Logger& logger() const; + + private: + ToolHandle<IActsExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool", "ActsExtrapolationTool"}; + ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"}; + ToolHandle<ActsTrk::IActsToTrkConverterTool> m_ATLASConverterTool{this, "ATLASConverterTool", "ActsToTrkConverterTool"}; + ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool {this, "SummaryTool", "", "ToolHandle for track summary tool"}; + ToolHandle<Trk::IBoundaryCheckTool> m_boundaryCheckTool {this, + "BoundaryCheckTool", + "InDet::InDetBoundaryCheckTool", + "Boundary checking tool for detector sensitivities"}; + + // the settable job options + Gaudi::Property< double > m_option_outlierChi2Cut {this, "OutlierChi2Cut", 12.5, + "Chi2 cut used by the outlier finder" }; + Gaudi::Property< int > m_option_maxPropagationStep {this, "MaxPropagationStep", 5000, + "Maximum number of steps for one propagate call"}; + + /// Type erased track fitter function. + using Fitter = Acts::Experimental::GaussianSumFitter< Acts::Propagator<Acts::MultiEigenStepperLoop<>, Acts::Navigator>, + Acts::Experimental::AtlasBetheHeitlerApprox<6, 5>, + ActsTrk::TrackStateBackend>; + std::unique_ptr<Fitter> m_fitter; + + Acts::Experimental::GsfExtensions<ActsTrk::TrackStateBackend> m_gsfExtensions; + + ActsTrk::FitterHelperFunctions::ATLASOutlierFinder m_outlierFinder{0}; + + /// logging instance + std::unique_ptr<const Acts::Logger> m_logger; + +}; // end of namespace + +} + +#endif + diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.cxx old mode 100755 new mode 100644 index 5f49031e99277aea14f7105e18436dd4b38486a9..e33115db153369b12a659081814bdf1974e281c9 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.cxx @@ -24,9 +24,9 @@ #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/CalibrationContext.hpp" -#include "Acts/EventData/VectorMultiTrajectory.hpp" #include "Acts/EventData/VectorTrackContainer.hpp" +#include "ActsTrkEvent/TrackContainer.h" // PACKAGE #include "ActsGeometry/ATLASMagneticFieldWrapper.h" #include "ActsGeometry/ActsGeometryContext.h" @@ -36,6 +36,7 @@ #include <vector> +namespace ActsTrk { ActsKalmanFitter::ActsKalmanFitter(const std::string& t,const std::string& n, const IInterface* p) : @@ -56,33 +57,26 @@ StatusCode ActsKalmanFitter::initialize() { Acts::EigenStepper<> stepper(field, m_overstepLimit); Acts::Navigator navigator( Acts::Navigator::Config{ m_trackingGeometryTool->trackingGeometry() } ); Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator> propagator(std::move(stepper), - std::move(navigator), - logger().cloneWithSuffix("Prop")); + std::move(navigator), + logger().cloneWithSuffix("Prop")); m_fitter = std::make_unique<Fitter>(std::move(propagator), - logger().cloneWithSuffix("KalmanFitter")); + logger().cloneWithSuffix("KalmanFitter")); - m_kfExtensions.updater.connect<&ActsKalmanFitter::gainMatrixUpdate<traj_Type>>(); - m_kfExtensions.smoother.connect<&ActsKalmanFitter::gainMatrixSmoother<traj_Type>>(); - m_kfExtensions.calibrator.connect<&ATLASSourceLinkCalibrator::calibrate<traj_Type>>(); + m_kfExtensions.updater.connect<&ActsTrk::FitterHelperFunctions::gainMatrixUpdate<ActsTrk::TrackStateBackend>>(); + m_kfExtensions.smoother.connect<&ActsTrk::FitterHelperFunctions::gainMatrixSmoother<ActsTrk::TrackStateBackend>>(); + m_kfExtensions.calibrator.connect<&ATLASSourceLinkCalibrator::calibrate<ActsTrk::TrackStateBackend>>(); m_outlierFinder.StateChiSquaredPerNumberDoFCut = m_option_outlierChi2Cut; - m_kfExtensions.outlierFinder.connect<&ATLASOutlierFinder::operator()<traj_Type>>(&m_outlierFinder); + m_kfExtensions.outlierFinder.connect<&ActsTrk::FitterHelperFunctions::ATLASOutlierFinder::operator()<ActsTrk::TrackStateBackend>>(&m_outlierFinder); m_reverseFilteringLogic.momentumMax = m_option_ReverseFilteringPt; - m_kfExtensions.reverseFilteringLogic.connect<&ReverseFilteringLogic::operator()<traj_Type>>(&m_reverseFilteringLogic); + m_kfExtensions.reverseFilteringLogic.connect<&ActsTrk::FitterHelperFunctions::ReverseFilteringLogic::operator()<ActsTrk::TrackStateBackend>>(&m_reverseFilteringLogic); return StatusCode::SUCCESS; } -// finalize -StatusCode ActsKalmanFitter::finalize() -{ - ATH_MSG_INFO ("finalize() successful in " << name()); - return StatusCode::SUCCESS; -} - // refit a track // ------------------------------------------------------- std::unique_ptr<Trk::Track> @@ -93,17 +87,17 @@ ActsKalmanFitter::fit(const EventContext& ctx, { std::unique_ptr<Trk::Track> track = nullptr; ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,,) with Track from author = " - << inputTrack.info().dumpInfo()); + << inputTrack.info().dumpInfo()); // protection against not having measurements on the input track if (!inputTrack.measurementsOnTrack() || inputTrack.measurementsOnTrack()->size() < 2) { - ATH_MSG_INFO ("called to refit empty track or track with too little information, reject fit"); + ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit"); return nullptr; } // protection against not having track parameters on the input track if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) { - ATH_MSG_INFO ("input fails to provide track parameters for seeding the KF, reject fit"); + ATH_MSG_DEBUG("input fails to provide track parameters for seeding the KF, reject fit"); return nullptr; } @@ -122,7 +116,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::KalmanFitterOptions kfOptions(tgContext, mfContext, calContext, m_kfExtensions, - propagationOption, + propagationOption, &(*pSurface)); std::vector<ATLASSourceLink::ElementsType> elementCollection; @@ -130,7 +124,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, std::vector<ATLASSourceLink> trackSourceLinks = m_ATLASConverterTool->trkTrackToSourceLinks(tgContext,inputTrack,elementCollection); // protection against error in the conversion from Atlas masurement to Acts source link if (trackSourceLinks.empty()) { - ATH_MSG_INFO("input contain measurement but no source link created, probable issue with the converter, reject fit "); + ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit "); return track; } @@ -150,17 +144,17 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::TrackContainer tracks{ Acts::VectorTrackContainer{}, - Acts::VectorMultiTrajectory{}}; + ActsTrk::TrackStateBackend{}}; // Convert to Acts::SourceLink during iteration Acts::SourceLinkAdapterIterator begin{trackSourceLinks.begin()}; Acts::SourceLinkAdapterIterator end{trackSourceLinks.end()}; // Perform the fit - auto result = m_fitter->fit(begin, end, + auto result = m_fitter->fit(begin, end, scaledInitialParams, kfOptions, tracks); if (result.ok()) { - track = makeTrack<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>(ctx, tgContext, tracks, result); + track = makeTrack(ctx, tgContext, tracks, result); } return track; } @@ -178,7 +172,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, // protection against not having measurements on the input track if (inputMeasSet.size() < 2) { - ATH_MSG_INFO ("called to refit empty measurement set or a measurement set with too little information, reject fit"); + ATH_MSG_DEBUG("called to refit empty measurement set or a measurement set with too little information, reject fit"); return nullptr; } @@ -197,7 +191,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::KalmanFitterOptions kfOptions(tgContext, mfContext, calContext, m_kfExtensions, - propagationOption, + propagationOption, &(*pSurface)); std::vector<ATLASSourceLink> trackSourceLinks; @@ -211,7 +205,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, } // protection against error in the conversion from Atlas masurement to Acts source link if (trackSourceLinks.empty()) { - ATH_MSG_INFO("input contain measurement but no source link created, probable issue with the converter, reject fit "); + ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit "); return track; } @@ -219,7 +213,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::TrackContainer tracks{ Acts::VectorTrackContainer{}, - Acts::VectorMultiTrajectory{}}; + ActsTrk::TrackStateBackend{}}; // Convert to Acts::SourceLink during iteration Acts::SourceLinkAdapterIterator begin{trackSourceLinks.begin()}; @@ -229,7 +223,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, auto result = m_fitter->fit(begin, end, initialParams, kfOptions, tracks); if (result.ok()) { - track = makeTrack<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>(ctx, tgContext, tracks, result); + track = makeTrack(ctx, tgContext, tracks, result); } return track; } @@ -243,7 +237,7 @@ ActsKalmanFitter::fit(const EventContext& /*ctx*/, const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*prtHypothesis*/) const { - ATH_MSG_INFO ("Fit of PrepRawDataSet not yet implemented"); + ATH_MSG_DEBUG("Fit of PrepRawDataSet not yet implemented"); return nullptr; } @@ -263,19 +257,19 @@ ActsKalmanFitter::fit(const EventContext& ctx, // protection, if empty MeasurementSet if (addMeasColl.empty()) { - ATH_MSG_WARNING( "client tries to add an empty MeasurementSet to the track fit." ); + ATH_MSG_DEBUG( "client tries to add an empty MeasurementSet to the track fit." ); return fit(ctx,inputTrack); } // protection against not having measurements on the input track if (!inputTrack.measurementsOnTrack() || (inputTrack.measurementsOnTrack()->size() < 2 && addMeasColl.empty())) { - ATH_MSG_INFO ("called to refit empty track or track with too little information, reject fit"); + ATH_MSG_DEBUG("called to refit empty track or track with too little information, reject fit"); return nullptr; } // protection against not having track parameters on the input track if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) { - ATH_MSG_INFO ("input fails to provide track parameters for seeding the KF, reject fit"); + ATH_MSG_DEBUG("input fails to provide track parameters for seeding the KF, reject fit"); return nullptr; } @@ -296,7 +290,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::KalmanFitterOptions kfOptions(tgContext, mfContext, calContext, m_kfExtensions, - propagationOption, + propagationOption, &(*pSurface)); std::vector<ATLASSourceLink::ElementsType> elementCollection; @@ -314,13 +308,13 @@ ActsKalmanFitter::fit(const EventContext& ctx, } // protection against error in the conversion from Atlas masurement to Acts source link if (trackSourceLinks.empty()) { - ATH_MSG_INFO("input contain measurement but no source link created, probable issue with the converter, reject fit "); + ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit "); return track; } Acts::TrackContainer tracks{ Acts::VectorTrackContainer{}, - Acts::VectorMultiTrajectory{}}; + ActsTrk::TrackStateBackend{}}; // Convert to Acts::SourceLink during iteration Acts::SourceLinkAdapterIterator begin{trackSourceLinks.begin()}; @@ -330,7 +324,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, auto result = m_fitter->fit(begin, end, initialParams, kfOptions, tracks); if (result.ok()) { - track = makeTrack<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>(ctx, tgContext, tracks, result); + track = makeTrack(ctx, tgContext, tracks, result); } return track; } @@ -345,7 +339,7 @@ ActsKalmanFitter::fit(const EventContext& /*ctx*/, const Trk::ParticleHypothesis /*matEffects*/) const { - ATH_MSG_INFO ("Fit of Track with additional PrepRawDataSet not yet implemented"); + ATH_MSG_DEBUG("Fit of Track with additional PrepRawDataSet not yet implemented"); return nullptr; } @@ -364,19 +358,19 @@ ActsKalmanFitter::fit(const EventContext& ctx, // protection, if empty track2 if (!intrk2.measurementsOnTrack()) { - ATH_MSG_WARNING( "input #2 is empty try to fit track 1 alone" ); + ATH_MSG_DEBUG( "input #2 is empty try to fit track 1 alone" ); return fit(ctx,intrk1); } // protection, if empty track1 if (!intrk1.measurementsOnTrack()) { - ATH_MSG_WARNING( "input #1 is empty try to fit track 2 alone" ); + ATH_MSG_DEBUG( "input #1 is empty try to fit track 2 alone" ); return fit(ctx,intrk2); } // protection against not having track parameters on the input track if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) { - ATH_MSG_INFO ("input #1 fails to provide track parameters for seeding the KF, reject fit"); + ATH_MSG_DEBUG("input #1 fails to provide track parameters for seeding the KF, reject fit"); return nullptr; } @@ -397,7 +391,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::KalmanFitterOptions kfOptions(tgContext, mfContext, calContext, m_kfExtensions, - propagationOption, + propagationOption, &(*pSurface)); std::vector<ATLASSourceLink::ElementsType> elementCollection1; @@ -408,7 +402,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, trackSourceLinks.insert(trackSourceLinks.end(), trackSourceLinks2.begin(), trackSourceLinks2.end()); // protection against error in the conversion from Atlas masurement to Acts source link if (trackSourceLinks.empty()) { - ATH_MSG_INFO("input contain measurement but no source link created, probable issue with the converter, reject fit "); + ATH_MSG_DEBUG("input contain measurement but no source link created, probable issue with the converter, reject fit "); return track; } @@ -429,7 +423,7 @@ ActsKalmanFitter::fit(const EventContext& ctx, Acts::TrackContainer tracks{ Acts::VectorTrackContainer{}, - Acts::VectorMultiTrajectory{}}; + ActsTrk::TrackStateBackend{}}; // Convert to Acts::SourceLink during iteration Acts::SourceLinkAdapterIterator begin{trackSourceLinks.begin()}; @@ -439,8 +433,159 @@ ActsKalmanFitter::fit(const EventContext& ctx, auto result = m_fitter->fit(begin, end, scaledInitialParams, kfOptions, tracks); if (result.ok()) { - track = makeTrack<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>(ctx, tgContext, tracks, result); + track = makeTrack(ctx, tgContext, tracks, result); } return track; } +std::unique_ptr<Trk::Track> +ActsKalmanFitter::makeTrack(const EventContext& ctx, + Acts::GeometryContext& tgContext, + ActsTrk::TrackContainer& tracks, + Acts::Result<ActsTrk::TrackContainer::TrackProxy, std::error_code>& fitResult) const { + + + if (not fitResult.ok()) + return nullptr; + + std::unique_ptr<Trk::Track> newtrack = nullptr; + // Get the fit output object + const auto& acts_track = fitResult.value(); + auto finalTrajectory = DataVector<const Trk::TrackStateOnSurface>(); + // initialise the number of dead Pixel and Acts strip + int numberOfDeadPixel = 0; + int numberOfDeadSCT = 0; + + std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam; + // Loop over all the output state to create track state + tracks.trackStateContainer().visitBackwards(acts_track.tipIndex(), + [&] (const auto &state) -> void + { + // First only concider state with an associated detector element not in the TRT + auto flag = state.typeFlags(); + const auto* associatedDetEl = state.referenceSurface().associatedDetectorElement(); + if (not associatedDetEl) + return; + + const auto* actsElement = dynamic_cast<const ActsDetectorElement*>(associatedDetEl); + if (not actsElement) + return; + + const auto* upstreamDetEl = actsElement->upstreamDetectorElement(); + if (not upstreamDetEl) + return; + + ATH_MSG_VERBOSE("Try casting to TRT for if"); + if (dynamic_cast<const InDetDD::TRT_BaseElement*>(upstreamDetEl)) + return; + + const auto* trkDetElem = dynamic_cast<const Trk::TrkDetElementBase*>(upstreamDetEl); + if (not trkDetElem) + return; + + ATH_MSG_VERBOSE("trkDetElem type: " << static_cast<std::underlying_type_t<Trk::DetectorElemType>>(trkDetElem->detectorType())); + + ATH_MSG_VERBOSE("Try casting to SiDetectorElement"); + const auto* detElem = dynamic_cast<const InDetDD::SiDetectorElement*>(upstreamDetEl); + if (not detElem) + return; + ATH_MSG_VERBOSE("detElem = " << detElem); + + // We need to determine the type of state + std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; + std::unique_ptr<const Trk::TrackParameters> parm; + + // State is a hole (no associated measurement), use predicted parameters + if (flag.test(Acts::TrackStateFlag::HoleFlag)){ + ATH_MSG_VERBOSE("State is a hole (no associated measurement), use predicted parameters"); + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.predicted(), + state.predictedCovariance()); + parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); + auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*parm); + + // Check if this is a hole, a dead sensors or a state outside the sensor boundary + ATH_MSG_VERBOSE("Check if this is a hole, a dead sensors or a state outside the sensor boundary"); + if(boundaryCheck == Trk::BoundaryCheckResult::DeadElement){ + if (detElem->isPixel()) { + ++numberOfDeadPixel; + } + else if (detElem->isSCT()) { + ++numberOfDeadSCT; + } + // Dead sensors states are not stored + return; + } else if (boundaryCheck != Trk::BoundaryCheckResult::Candidate){ + // States outside the sensor boundary are ignored + return; + } + typePattern.set(Trk::TrackStateOnSurface::Hole); + } + // The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters + else if (flag.test(Acts::TrackStateFlag::OutlierFlag) or !state.hasSmoothed()) { + ATH_MSG_VERBOSE("The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters"); + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.filtered(), + state.filteredCovariance()); + parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); + typePattern.set(Trk::TrackStateOnSurface::Outlier); + } + // The state is a measurement state, use smoothed parameters + else{ + ATH_MSG_VERBOSE("The state is a measurement state, use smoothed parameters"); + + const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), + state.smoothed(), + state.smoothedCovariance()); + + actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam))); + parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); + typePattern.set(Trk::TrackStateOnSurface::Measurement); + } + + std::unique_ptr<const Trk::MeasurementBase> measState; + if (state.hasUncalibratedSourceLink()){ + auto sl = state.getUncalibratedSourceLink().template get<ATLASSourceLink>(); + measState = sl.atlasHit().uniqueClone(); + } + double nDoF = state.calibratedSize(); + auto quality =Trk::FitQualityOnSurface(state.chi2(), nDoF); + const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(quality, std::move(measState), std::move(parm), nullptr, typePattern); + // If a state was succesfully created add it to the trajectory + if (perState) { + ATH_MSG_VERBOSE("State succesfully creates, adding it to the trajectory"); + finalTrajectory.insert(finalTrajectory.begin(), perState); + } + }); + + // Convert the perigee state and add it to the trajectory + const Acts::BoundTrackParameters actsPer(acts_track.referenceSurface().getSharedPtr(), + acts_track.parameters(), + acts_track.covariance()); + std::unique_ptr<const Trk::TrackParameters> per = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext); + std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; + typePattern.set(Trk::TrackStateOnSurface::Perigee); + const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(nullptr, std::move(per), nullptr, typePattern); + if (perState) finalTrajectory.insert(finalTrajectory.begin(), perState); + + // Create the track using the states + Trk::TrackInfo newInfo(Trk::TrackInfo::TrackFitter::KalmanFitter, Trk::noHypothesis); + newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::KalmanFitter); //Mark the fitter as KalmanFitter + newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory), nullptr); + if (newtrack) { + // Create the track summary and update the holes information + if (!newtrack->trackSummary()) { + newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>()); + newtrack->trackSummary()->update(Trk::numberOfPixelHoles, 0); + newtrack->trackSummary()->update(Trk::numberOfSCTHoles, 0); + newtrack->trackSummary()->update(Trk::numberOfTRTHoles, 0); + newtrack->trackSummary()->update(Trk::numberOfPixelDeadSensors, numberOfDeadPixel); + newtrack->trackSummary()->update(Trk::numberOfSCTDeadSensors, numberOfDeadSCT); + } + m_trkSummaryTool->updateTrackSummary(ctx, *newtrack, true); + } + + return newtrack; +} + +} diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.h b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.h old mode 100755 new mode 100644 index 5f3910de42e0c98c4d5eee3697aa9f782d416853..5b87f05a7b2c550f08eabf889e6730037ce2e325 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.h @@ -5,6 +5,8 @@ #ifndef ACTSGEOMETRY_ACTSKALMANFITTER_H #define ACTSGEOMETRY_ACTSKALMANFITTER_H +#include "ActsFitterHelperFunctions.h" + #include "GaudiKernel/ToolHandle.h" @@ -20,12 +22,13 @@ #include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/Propagator.hpp" -#include "Acts/EventData/Track.hpp" +#include "Acts/EventData/TrackProxy.hpp" #include "Acts/EventData/VectorTrackContainer.hpp" #include "Acts/Geometry/GeometryIdentifier.hpp" // PACKAGE +#include "ActsTrkEvent/TrackContainer.h" #include "ActsGeometryInterfaces/IActsExtrapolationTool.h" #include "ActsGeometryInterfaces/IActsTrackingGeometryTool.h" #include "ActsTrkEventCnv/IActsToTrkConverterTool.h" @@ -42,21 +45,16 @@ namespace Trk{ class Track; } +namespace ActsTrk { + class ActsKalmanFitter : public extends<AthAlgTool, Trk::ITrackFitter> { public: - using traj_Type = Acts::VectorMultiTrajectory; ActsKalmanFitter(const std::string&,const std::string&,const IInterface*); virtual ~ActsKalmanFitter() = default; // standard Athena methods virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - /* - * Bring in default impl with - * EventContext for now - */ - using Trk::ITrackFitter::fit; //! refit a track virtual std::unique_ptr<Trk::Track> fit( @@ -100,100 +98,22 @@ public: //! combined track fit virtual std::unique_ptr<Trk::Track> fit( const EventContext& ctx, - const Trk::Track&, - const Trk::Track&, + const Trk::Track& intrk1, + const Trk::Track& intrk2, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; - /// Outlier finder using a Chi2 cut. - struct ATLASOutlierFinder { - double StateChiSquaredPerNumberDoFCut = std::numeric_limits<double>::max(); - /// Classify a measurement as a valid one or an outlier. - /// - /// @tparam track_state_t Type of the track state - /// @param state The track state to classify - /// @retval False if the measurement is not an outlier - /// @retval True if the measurement is an outlier - template<typename trajectory_t> - bool operator()(typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy state) const { - // can't determine an outlier w/o a measurement or predicted parameters - if (not state.hasCalibrated() or not state.hasPredicted()) { - return false; - } - return Acts::visit_measurement( - state.calibratedSize(), - [&] (auto N) -> bool { - constexpr size_t kMeasurementSize = decltype(N)::value; - - typename Acts::TrackStateTraits<kMeasurementSize, true>::Measurement calibrated{ - state.template calibrated<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()}; - - typename Acts::TrackStateTraits<kMeasurementSize, true>::MeasurementCovariance - calibratedCovariance{state.template calibratedCovariance<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()}; - - // Take the projector (measurement mapping function) - const auto H = - state.projector() - .template topLeftCorner<kMeasurementSize, Acts::BoundIndices::eBoundSize>() - .eval(); - - const auto residual = calibrated - H * state.predicted(); - double chi2 = (residual.transpose() * ((calibratedCovariance + H * state.predictedCovariance() * H.transpose())).inverse() * residual).value(); - return bool(chi2 > StateChiSquaredPerNumberDoFCut * kMeasurementSize); - }); - } - }; - - /// Determine if the smoothing of a track should be done with or without reverse - /// filtering - struct ReverseFilteringLogic { - double momentumMax = std::numeric_limits<double>::max(); - - /// Determine if the smoothing of a track should be done with or without reverse - /// filtering - /// - /// @tparam track_state_t Type of the track state - /// @param trackState The trackState of the last measurement - /// @retval False if we don't use the reverse filtering for the smoothing of the track - /// @retval True if we use the reverse filtering for the smoothing of the track - template<typename trajectory_t> - bool operator()(typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy trackState) const { - // can't determine an outlier w/o a measurement or predicted parameters - auto momentum = std::abs(1. / trackState.filtered()[Acts::eBoundQOverP]); - return (momentum <= momentumMax); - } - }; - - template<typename trajectory_t> - using TrackFitterResult = - typename Acts::Result<Acts::KalmanFitterResult<trajectory_t>>; - - /////////////////////////////////////////////////////////////////// // Private methods: /////////////////////////////////////////////////////////////////// private: - template<typename trajectory_t> - static Acts::Result<void> gainMatrixUpdate(const Acts::GeometryContext& gctx, - typename Acts::MultiTrajectory<trajectory_t>::TrackStateProxy trackState, - Acts::NavigationDirection direction, - const Acts::Logger& logger = Acts::getDummyLogger()); - - template<typename trajectory_t> - static Acts::Result<void> gainMatrixSmoother(const Acts::GeometryContext& gctx, - Acts::MultiTrajectory<trajectory_t>& trajectory, - size_t entryIndex, - const Acts::Logger& logger = Acts::getDummyLogger()); - // Create a track from the fitter result - template<typename track_container_t, typename traj_t, - template <typename> class holder_t> std::unique_ptr<Trk::Track> makeTrack(const EventContext& ctx, - Acts::GeometryContext& tgContext, - Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>& tracks, - Acts::Result<typename Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>::TrackProxy, std::error_code>& fitResult) const; + Acts::GeometryContext& tgContext, + ActsTrk::TrackContainer& tracks, + Acts::Result<ActsTrk::TrackContainer::TrackProxy, std::error_code>& fitResult) const; ToolHandle<IActsExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool", "ActsExtrapolationTool"}; ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"}; @@ -218,14 +138,14 @@ private: "Overstep limit / tolerance for the Eigen stepper (use ACTS units!)"}; /// Type erased track fitter function. - using Fitter = Acts::KalmanFitter<Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>, traj_Type>; + using Fitter = Acts::KalmanFitter<Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>, ActsTrk::TrackStateBackend>; std::unique_ptr<Fitter> m_fitter; - Acts::KalmanFitterExtensions<traj_Type> getExtensions(); + Acts::KalmanFitterExtensions<ActsTrk::TrackStateBackend> getExtensions(); + Acts::KalmanFitterExtensions<ActsTrk::TrackStateBackend> m_kfExtensions; - ATLASOutlierFinder m_outlierFinder{0}; - ReverseFilteringLogic m_reverseFilteringLogic{0}; - Acts::KalmanFitterExtensions<traj_Type> m_kfExtensions; + ActsTrk::FitterHelperFunctions::ATLASOutlierFinder m_outlierFinder{0}; + ActsTrk::FitterHelperFunctions::ReverseFilteringLogic m_reverseFilteringLogic{0}; /// Private access to the logger const Acts::Logger& logger() const { @@ -237,7 +157,6 @@ private: }; // end of namespace -#include "ActsKalmanFitter.icc" - +} #endif diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.icc b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.icc deleted file mode 100755 index 5ce7c09e12f9fcf2a3ed65918aa1b50ad9df15e1..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/ActsKalmanFitter.icc +++ /dev/null @@ -1,187 +0,0 @@ -// Dear emacs, this is -*- c++ -*- -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -// ATHENA -#include "TRT_ReadoutGeometry/TRT_BaseElement.h" - -// ACTS -#include "Acts/TrackFitting/GainMatrixSmoother.hpp" -#include "Acts/TrackFitting/GainMatrixUpdater.hpp" - -// PACKAGE -#include "ActsGeometry/ATLASSourceLink.h" -#include "ActsGeometry/ActsDetectorElement.h" - -template<typename track_container_t, typename traj_t, - template <typename> class holder_t> -std::unique_ptr<Trk::Track> -ActsKalmanFitter::makeTrack(const EventContext& ctx, - Acts::GeometryContext& tgContext, - Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>& tracks, - Acts::Result<typename Acts::TrackContainer<Acts::VectorTrackContainer, Acts::VectorMultiTrajectory, Acts::detail_tc::ValueHolder>::TrackProxy, std::error_code>& fitResult) const { - - - if (not fitResult.ok()) - return nullptr; - - std::unique_ptr<Trk::Track> newtrack = nullptr; - // Get the fit output object - const auto& acts_track = fitResult.value(); - auto finalTrajectory = DataVector<const Trk::TrackStateOnSurface>(); - // initialise the number of dead Pixel and Acts strip - int numberOfDeadPixel = 0; - int numberOfDeadSCT = 0; - - std::vector<std::unique_ptr<const Acts::BoundTrackParameters>> actsSmoothedParam; - // Loop over all the output state to create track state - tracks.trackStateContainer().visitBackwards(acts_track.tipIndex(), - [&] (const auto &state) -> void - { - // First only concider state with an associated detector element not in the TRT - auto flag = state.typeFlags(); - const auto* associatedDetEl = state.referenceSurface().associatedDetectorElement(); - if (not associatedDetEl) - return; - - const auto* actsElement = dynamic_cast<const ActsDetectorElement*>(associatedDetEl); - if (not actsElement) - return; - - const auto* upstreamDetEl = actsElement->upstreamDetectorElement(); - if (not upstreamDetEl) - return; - - ATH_MSG_VERBOSE("Try casting to TRT for if"); - if (dynamic_cast<const InDetDD::TRT_BaseElement*>(upstreamDetEl)) - return; - - const auto* trkDetElem = dynamic_cast<const Trk::TrkDetElementBase*>(upstreamDetEl); - if (not trkDetElem) - return; - - ATH_MSG_VERBOSE("trkDetElem type: " << static_cast<std::underlying_type_t<Trk::DetectorElemType>>(trkDetElem->detectorType())); - - ATH_MSG_VERBOSE("Try casting to SiDetectorElement"); - const auto* detElem = dynamic_cast<const InDetDD::SiDetectorElement*>(upstreamDetEl); - if (not detElem) - return; - ATH_MSG_VERBOSE("detElem = " << detElem); - - // We need to determine the type of state - std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; - std::unique_ptr<const Trk::TrackParameters> parm; - - // State is a hole (no associated measurement), use predicted parameters - if (flag[Acts::TrackStateFlag::HoleFlag]){ - ATH_MSG_VERBOSE("State is a hole (no associated measurement), use predicted parameters"); - const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), - state.predicted(), - state.predictedCovariance()); - parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); - auto boundaryCheck = m_boundaryCheckTool->boundaryCheck(*parm); - - // Check if this is a hole, a dead sensors or a state outside the sensor boundary - ATH_MSG_VERBOSE("Check if this is a hole, a dead sensors or a state outside the sensor boundary"); - if(boundaryCheck == Trk::BoundaryCheckResult::DeadElement){ - if (detElem->isPixel()) { - ++numberOfDeadPixel; - } - else if (detElem->isSCT()) { - ++numberOfDeadSCT; - } - // Dead sensors states are not stored - return; - } else if (boundaryCheck != Trk::BoundaryCheckResult::Candidate){ - // States outside the sensor boundary are ignored - return; - } - typePattern.set(Trk::TrackStateOnSurface::Hole); - } - // The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters - else if (flag[Acts::TrackStateFlag::OutlierFlag] or - state.template component<std::uint32_t, Acts::hashString("smoothed")>() == Acts::MultiTrajectoryTraits::kInvalid) { - ATH_MSG_VERBOSE("The state was tagged as an outlier or was missed in the reverse filtering, use filtered parameters"); - const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), - state.filtered(), - state.filteredCovariance()); - parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); - typePattern.set(Trk::TrackStateOnSurface::Outlier); - } - // The state is a measurement state, use smoothed parameters - else{ - ATH_MSG_VERBOSE("The state is a measurement state, use smoothed parameters"); - - const Acts::BoundTrackParameters actsParam(state.referenceSurface().getSharedPtr(), - state.smoothed(), - state.smoothedCovariance()); - - actsSmoothedParam.push_back(std::make_unique<const Acts::BoundTrackParameters>(Acts::BoundTrackParameters(actsParam))); - parm = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsParam, tgContext); - typePattern.set(Trk::TrackStateOnSurface::Measurement); - } - - std::unique_ptr<const Trk::MeasurementBase> measState; - if (state.hasUncalibratedSourceLink()){ - const auto& sl = state.uncalibratedSourceLink().template get<ATLASSourceLink>(); - measState = sl.atlasHit().uniqueClone(); - } - double nDoF = state.calibratedSize(); - auto quality =Trk::FitQualityOnSurface(state.chi2(), nDoF); - const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(quality, std::move(measState), std::move(parm), nullptr, typePattern); - // If a state was succesfully created add it to the trajectory - if (perState) { - ATH_MSG_VERBOSE("State succesfully creates, adding it to the trajectory"); - finalTrajectory.insert(finalTrajectory.begin(), perState); - } - }); - - // Convert the perigee state and add it to the trajectory - const Acts::BoundTrackParameters actsPer(acts_track.referenceSurface().getSharedPtr(), - acts_track.parameters(), - acts_track.covariance()); - std::unique_ptr<const Trk::TrackParameters> per = m_ATLASConverterTool->actsTrackParametersToTrkParameters(actsPer, tgContext); - std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; - typePattern.set(Trk::TrackStateOnSurface::Perigee); - const Trk::TrackStateOnSurface *perState = new Trk::TrackStateOnSurface(nullptr, std::move(per), nullptr, typePattern); - if (perState) finalTrajectory.insert(finalTrajectory.begin(), perState); - - // Create the track using the states - Trk::TrackInfo newInfo(Trk::TrackInfo::TrackFitter::KalmanFitter, Trk::noHypothesis); - newInfo.setTrackFitter(Trk::TrackInfo::TrackFitter::KalmanFitter); //Mark the fitter as KalmanFitter - newtrack = std::make_unique<Trk::Track>(newInfo, std::move(finalTrajectory), nullptr); - if (newtrack) { - // Create the track summary and update the holes information - if (!newtrack->trackSummary()) { - newtrack->setTrackSummary(std::make_unique<Trk::TrackSummary>()); - newtrack->trackSummary()->update(Trk::numberOfPixelHoles, 0); - newtrack->trackSummary()->update(Trk::numberOfSCTHoles, 0); - newtrack->trackSummary()->update(Trk::numberOfTRTHoles, 0); - newtrack->trackSummary()->update(Trk::numberOfPixelDeadSensors, numberOfDeadPixel); - newtrack->trackSummary()->update(Trk::numberOfSCTDeadSensors, numberOfDeadSCT); - } - m_trkSummaryTool->updateTrackSummary(ctx, *newtrack, true); - } - - return newtrack; -} - -template<typename trajectory_t> -Acts::Result<void> ActsKalmanFitter::gainMatrixUpdate(const Acts::GeometryContext& gctx, - typename Acts::MultiTrajectory<trajectory_t>::TrackStateProxy trackState, - Acts::NavigationDirection direction, - const Acts::Logger& logger) { - Acts::GainMatrixUpdater updater; - return updater.template operator()<trajectory_t>(gctx, trackState, direction, logger); -} - -template<typename trajectory_t> -Acts::Result<void> ActsKalmanFitter::gainMatrixSmoother(const Acts::GeometryContext& gctx, - Acts::MultiTrajectory<trajectory_t>& trajectory, - size_t entryIndex, - const Acts::Logger& logger) { - Acts::GainMatrixSmoother smoother; - return smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex, logger); -} - diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/components/ActsTrkFittingTools_entries.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/components/ActsTrkFittingTools_entries.cxx old mode 100755 new mode 100644 index a5d8cb92c66c05de21c89944df0149e6f9194175..61aebbc23fb87e0413acd874a78369870b614567 --- a/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/components/ActsTrkFittingTools_entries.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkFittingTools/src/components/ActsTrkFittingTools_entries.cxx @@ -4,5 +4,8 @@ #include "../ActsKalmanFitter.h" +#include "../ActsGaussianSumFitter.h" + +DECLARE_COMPONENT( ActsTrk::ActsKalmanFitter ) +DECLARE_COMPONENT( ActsTrk::ActsGaussianSumFitter ) -DECLARE_COMPONENT( ActsKalmanFitter ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index aff034c520072582b9cc8b1514deed353059417a..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/share/ActsPriVtxFinder_jobOptions.py b/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/share/ActsPriVtxFinder_jobOptions.py deleted file mode 100644 index e49de23a1620aac50962598ee614e5cfc8f3f93e..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/share/ActsPriVtxFinder_jobOptions.py +++ /dev/null @@ -1,237 +0,0 @@ -from AthenaCommon.AppMgr import ServiceMgr -#-------------------------------------------------------------- -# control input -#-------------------------------------------------------------- -# --- specify input type -#if not 'readAOD' in dir(): -readAOD = True -readESD = not readAOD - -# Use Acts AMVF -doAMVF = True -useActs = True -#-------------------------------------------------------------- -# Event related parameters -#-------------------------------------------------------------- -nEvents = 30 - -# Set your input AOD file here -myfile = "" - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - -if readESD: - athenaCommonFlags.FilesInput = [ "ESD.pool.root" ] -elif readAOD: - athenaCommonFlags.FilesInput = [ myfile ] - -import AthenaPython.ConfigLib as apcl -cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput()) - -theApp.EvtMax = nEvents - -#-------------------------------------------------------------- -# control output (here so RecExCommon via auto-config doesn't delete the global flags) -#-------------------------------------------------------------- -# --- controls what is written out. ESD includes AOD, so it's normally enough -doWriteESD = False and readESD -doWriteAOD = True - -#-------------------------------------------------------------- -# control algorithms to be rerun -#-------------------------------------------------------------- -# --- run InDetRecStatistics (only possible if readESD = True) -doInDetRecStatistics = True and readESD -# --- refit the EXISTING tracks in ESD (only possible if readESD = True) -doRefitTracks = False and readESD -# --- redo the pattern reco and the tracking (do not use that in conjunction with doRefitTracks above) -redoPatternRecoAndTracking = False and not doRefitTracks and readESD -# --- redo primary vertexing (will be set to true later automatically if you redid the tracking and want to redo the TrackParticle creation) -reDoPrimaryVertexing = True -# --- redo particle creation (recommended after revertexing on ESD, otherwise trackparticles are inconsistent) -reDoParticleCreation = False and readESD and reDoPrimaryVertexing -# --- redo conversion finding -reDoConversions = False -# --- redo V0 finding -reDoV0Finder = False - -#-------------------------------------------------------------- -# Control - standard options (as in jobOptions.py) -#-------------------------------------------------------------- -# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -OutputLevel = INFO -# --- produce an atlantis data file -doJiveXML = False -# --- run the Virtual Point 1 event visualisation -doVP1 = False -# --- do auditors ? -doAuditors = True - -import os -if os.environ['CMTCONFIG'].endswith('-dbg'): - # --- do EDM monitor (debug mode only) - doEdmMonitor = True - # --- write out a short message upon entering or leaving each algorithm - doNameAuditor = True -else: - doEdmMonitor = False - doNameAuditor = False - -# safety section ... redoing tracking/vertexing is a tricky business to stay consistent ... -if redoPatternRecoAndTracking and reDoParticleCreation: - reDoPrimaryVertexing = True - -if not (readESD or readAOD): - print( "You have to turn on reading of ESD or AOD! That's the purpose of this jobO!") -if readESD and readAOD: - print( "I can either read ESD or AOD but not both at the same time! Turn one or the other off!") -if readESD and reDoPrimaryVertexing and not reDoParticleCreation: - print( "INFO! You are running on ESD, redoing the vertexing but not recreating the TrackParticles!") - print( "INFO! To avoid inconsistencies do not use the old track particles in conjunction with the new vertex!") - if doWriteESD or doWriteAOD: - print( "INFO! To avoid inconsistencies the old track particle (truth) container will not be in the new ESD/AOD!") -if readAOD and reDoPrimaryVertexing: - print( "INFO! You are running on AOD, and redoing the vertexing. At the moment new track particles cannot be made from old ones.") - print( "INFO! To avoid inconsistencies do not use the old track particles in conjunction with the new vertex!") - if doWriteAOD: - print( "INFO! To avoid inconsistencies the old track particle (truth) container will not be in the new AOD!") -if doRefitTracks and (reDoPrimaryVertexing or reDoParticleCreation): - print( "INFO! You are refitting tracks and also revertex and/or recreate track particles") - print( "INFO! The input for that will be the refitted tracks!") - -#-------------------------------------------------------------- -# Additional Detector setup -#-------------------------------------------------------------- - -from RecExConfig.RecFlags import rec -rec.Commissioning=False - -from AthenaCommon.DetFlags import DetFlags -# --- switch on InnerDetector -DetFlags.ID_setOn() -# --- and switch off all the rest -DetFlags.Calo_setOff() -DetFlags.Muon_setOff() -# --- print(out) -DetFlags.Print() - -#-------------------------------------------------------------- -# Load Reconstruction configuration for tools only -#-------------------------------------------------------------- -#-------------------------------------------------------------- -# Load InDet configuration -#-------------------------------------------------------------- -import MagFieldServices.SetupField - -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetDescrVersion = "ATLAS-R2-2016-01-00-01" - -# --- setup InDetJobProperties -from InDetRecExample.InDetJobProperties import InDetFlags -InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool") -InDetFlags.preProcessing = redoPatternRecoAndTracking -InDetFlags.doPRDFormation = False # those two will be (later) automatically false if -InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false -InDetFlags.doNewTracking = redoPatternRecoAndTracking -#InDetFlags.doiPatRec = False -#InDetFlags.doxKalman = False -InDetFlags.doLowPt = False -InDetFlags.doBackTracking = redoPatternRecoAndTracking -InDetFlags.doTRTStandalone = redoPatternRecoAndTracking -InDetFlags.doTrtSegments = redoPatternRecoAndTracking -InDetFlags.postProcessing = reDoPrimaryVertexing or reDoParticleCreation or reDoConversions or doInDetRecStatistics or reDoV0Finder -InDetFlags.doTrackSegmentsPixel = False -InDetFlags.doTrackSegmentsSCT = False -InDetFlags.doTrackSegmentsTRT = False -InDetFlags.doSlimming = False -InDetFlags.loadTools = True -InDetFlags.doVertexFinding = reDoPrimaryVertexing -InDetFlags.doParticleCreation = reDoParticleCreation -InDetFlags.doConversions = reDoConversions -InDetFlags.doSecVertexFinder = False -InDetFlags.doV0Finder = reDoV0Finder -InDetFlags.doSimpleV0Finder = False -InDetFlags.doTrkNtuple = False -InDetFlags.doPixelTrkNtuple = False -InDetFlags.doSctTrkNtuple = False -InDetFlags.doTrtTrkNtuple = False -#InDetFlags.doPixelClusterNtuple = False -InDetFlags.doSctClusterNtuple = False -#InDetFlags.doTrtDriftCircleNtuple = False -InDetFlags.doVtxNtuple = False -InDetFlags.doConvVtxNtuple = False -InDetFlags.doV0VtxNtuple = False -InDetFlags.doRefit = doRefitTracks -InDetFlags.doLowBetaFinder = False -InDetFlags.doPrintConfigurables = True - -# --- activate (memory/cpu) monitoring -#InDetFlags.doPerfMon = True - -# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py! -# This way RecExCommon just needs to import the properties without doing anything else! -# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored! - -from InDetRecExample.InDetKeys import InDetKeys -if InDetFlags.doVertexFinding() and readAOD: - InDetKeys.Tracks = InDetKeys.TrackParticles() - -# uncomment if you don't want to overwrite the original fits (e.g. for comparison) -# this would also require enabling "pass-through" output mode (see bottom of this file) -# or else manually adding the input collection to the output stream -if InDetFlags.doVertexFinding(): - InDetKeys.xAODVertexContainer = "RefitPrimaryVertices" - -if readESD and not redoPatternRecoAndTracking: - InDetKeys.UnslimmedTracks = 'Tracks' - InDetKeys.UnslimmedTracksTruth = 'TrackTruthCollection' - -# Set container names -if doWriteESD: - InDetKeys.OutputESDFileName = "InDetRecESD_new.root" - -toolString = "" -if useActs: - toolString = "acts" -else: - toolString = "athena" - -if doWriteAOD: - InDetKeys.OutputAODFileName = "InDetRecAOD_{}_n{}.root".format(toolString,nEvents) - -print( "Printing InDetKeys") -InDetKeys.lockAllExceptAlias() -InDetKeys.print_JobProperties() - -#-------------------------------------------------------------- -# enable statistics for reading ESD testing -#-------------------------------------------------------------- - -InDetFlags.doStatistics = doInDetRecStatistics -TrackCollectionKeys = [InDetKeys.Tracks()] -TrackCollectionTruthKeys = [InDetKeys.TracksTruth()] - -# Uncomment to use variant vertex seeding and/or finding -if doAMVF: - InDetFlags.primaryVertexSetup = "GaussAdaptiveMultiFinding" -# Use Acts primary vertexing -InDetFlags.useActsPriVertexing = useActs - -#-------------------------------------------------------------- -# load master joboptions file -#-------------------------------------------------------------- - -include("InDetRecExample/InDetRec_all.py") - -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output += ["InDetAdaptiveMultiPriVxFinderTool DATAFILE='AMVF_{}_output_nEvent{}.root' OPT='RECREATE'".format(toolString,nEvents)] - -# Set to True if you want to write out all input data ("pass-through" mode) -if doWriteESD: - StreamESD.TakeItemsFromInput = False - -if doWriteAOD: - StreamAOD.TakeItemsFromInput = True - -from AthenaCommon.ConfigurationShelve import saveToAscii; saveToAscii("config_vertexing_{}.txt".format(toolString)); diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/components/ActsTrkPriVtxFinderTool_entries.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/components/ActsTrkPriVtxFinderTool_entries.cxx deleted file mode 100755 index 7e1d866b789919ad8766e64d228f76f0752bb911..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/components/ActsTrkPriVtxFinderTool_entries.cxx +++ /dev/null @@ -1,9 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "../AdaptiveMultiPriVtxFinderTool.h" -#include "../IterativePriVtxFinderTool.h" - -DECLARE_COMPONENT( ActsTrk::AdaptiveMultiPriVtxFinderTool ) -DECLARE_COMPONENT( ActsTrk::IterativePriVtxFinderTool ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/CMakeLists.txt index 8880c9dc9beef9dc3e134c7713dd7a153f367bcf..b5948fc2cab3c00f09246dfa6567efa89db2c7a2 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ActsTrkSeedingTool ) @@ -13,7 +13,7 @@ atlas_add_component( ActsTrkSeedingTool LINK_LIBRARIES GaudiKernel ActsCore - ActsTrkEvent + ActsTrkEventLib ActsTrkToolInterfacesLib ActsInteropLib CxxUtils @@ -22,8 +22,5 @@ atlas_add_component( ActsTrkSeedingTool xAODInDetMeasurement ) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.cxx index 86dc3f3b38b83f547a5468f39e15a91f4176c528..ad6717d89b1e15aff42dd35abb2a49e94c458c3f 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.cxx @@ -57,7 +57,6 @@ namespace ActsTrk { ATH_MSG_DEBUG(" " << m_maxSeedsPerSpM); ATH_MSG_DEBUG(" " << m_compatSeedLimit); - ATH_MSG_DEBUG(" " << m_curvatureSortingInFilter); ATH_MSG_DEBUG(" " << m_seedWeightIncrement); ATH_MSG_DEBUG(" " << m_numSeedIncrement); @@ -137,7 +136,6 @@ namespace ActsTrk { filterCfg.deltaRMin = m_deltaRMin; filterCfg.maxSeedsPerSpM = m_maxSeedsPerSpM; filterCfg.compatSeedLimit = m_compatSeedLimit; - filterCfg.curvatureSortingInFilter = m_curvatureSortingInFilter; filterCfg.seedWeightIncrement = m_seedWeightIncrement; filterCfg.numSeedIncrement = m_numSeedIncrement; filterCfg.seedConfirmation = m_seedConfirmationInFilter; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.h b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.h index f817d5c950e08d8220eb214f29c4565b24e6188b..32efb1cfdbfe2da9f13648917a51643b2a2cbed9 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/OrthogonalSeedingTool.h @@ -130,9 +130,6 @@ namespace ActsTrk { Gaudi::Property<std::size_t> m_compatSeedLimit {this, "compatSeedLimit", 3, "How often do you want to increase the weight of a seed for finding a compatible seed"}; - Gaudi::Property<bool> m_curvatureSortingInFilter {this, "curvatureSortingInFilter", true, - "Sort vectors by curvature"}; - Gaudi::Property<float> m_seedWeightIncrement {this, "seedWeightIncrement", 0}; Gaudi::Property<float> m_numSeedIncrement {this, "numSeedIncrement", 3.40282e+38}; // cannot use std::numeric_limits<float>::infinity() diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.cxx index 4302f3b82cf8e6233499e3aed31c55ee67593a93..bbbb1af013beff65ce1f1185216429b9c8582979 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.cxx @@ -105,7 +105,6 @@ namespace ActsTrk { ATH_MSG_DEBUG(" " << m_deltaRMin); ATH_MSG_DEBUG(" " << m_maxSeedsPerSpM); ATH_MSG_DEBUG(" " << m_useDeltaRorTopRadius); - ATH_MSG_DEBUG(" " << m_curvatureSortingInFilter); ATH_MSG_DEBUG(" " << m_seedConfirmationInFilter); if (m_seedConfirmationInFilter) { ATH_MSG_DEBUG(" " << m_maxSeedsPerSpMConf); @@ -255,12 +254,40 @@ namespace ActsTrk { //TODO POSSIBLE OPTIMISATION come back here: see MR !52399 ( i.e. use static thread_local) typename decltype(m_finder)::SeedingState state; + state.spacePointData.resize(std::distance(spBegin, spEnd), + m_useDetailedDoubleMeasurementInfo); - auto group = spacePointsGrouping.begin(); - auto groupEnd = spacePointsGrouping.end(); - for (; group != groupEnd; ++group) { - m_finder.createSeedsForGroup(finderOpts, state, std::back_inserter(seeds), group.bottom(), - group.middle(), group.top(), rMiddleSPRange); + if (m_useDetailedDoubleMeasurementInfo) { + for (std::size_t idx(0); idx < spacePointsGrouping.grid().size(); ++idx) { + const std::vector<std::unique_ptr<Acts::InternalSpacePoint<xAOD::SpacePoint>>>& collection = spacePointsGrouping.grid().at(idx); + for (const std::unique_ptr<Acts::InternalSpacePoint<xAOD::SpacePoint>>& sp : collection) { + std::size_t index = sp->index(); + + const float topHalfStripLength = + m_finderCfg.getTopHalfStripLength(sp->sp()); + const float bottomHalfStripLength = + m_finderCfg.getBottomHalfStripLength(sp->sp()); + const Acts::Vector3 topStripDirection = + m_finderCfg.getTopStripDirection(sp->sp()); + const Acts::Vector3 bottomStripDirection = + m_finderCfg.getBottomStripDirection(sp->sp()); + + state.spacePointData.setTopStripVector( + index, topHalfStripLength * topStripDirection); + state.spacePointData.setBottomStripVector( + index, bottomHalfStripLength * bottomStripDirection); + state.spacePointData.setStripCenterDistance( + index, m_finderCfg.getStripCenterDistance(sp->sp())); + state.spacePointData.setTopStripCenterPosition( + index, m_finderCfg.getTopStripCenterPosition(sp->sp())); + + } + } + } + + for (const auto [bottom, middle, top] : spacePointsGrouping) { + m_finder.createSeedsForGroup(finderOpts, state, spacePointsGrouping.grid(), + std::back_inserter(seeds), bottom, middle, top, rMiddleSPRange); } return StatusCode::SUCCESS; @@ -281,7 +308,6 @@ namespace ActsTrk { m_finderCfg.zBinEdges = m_zBinEdges; m_finderCfg.rMax = m_rMax; m_finderCfg.binSizeR = m_binSizeR; - m_finderCfg.forceRadialSorting = m_forceRadialSorting; m_finderCfg.deltaRMin = m_deltaRMin; m_finderCfg.deltaRMax = m_deltaRMax; m_finderCfg.deltaRMinTopSP = m_deltaRMinTopSP; @@ -360,13 +386,13 @@ namespace ActsTrk { filterCfg.deltaRMin = m_deltaRMin; filterCfg.maxSeedsPerSpM = m_maxSeedsPerSpM; filterCfg.useDeltaRorTopRadius = m_useDeltaRorTopRadius; - filterCfg.curvatureSortingInFilter = m_curvatureSortingInFilter; filterCfg.seedConfirmation = m_seedConfirmationInFilter; filterCfg.maxSeedsPerSpMConf = m_maxSeedsPerSpMConf; filterCfg.maxQualitySeedsPerSpMConf = m_maxQualitySeedsPerSpMConf; filterCfg.centralSeedConfirmationRange = m_finderCfg.centralSeedConfirmationRange; filterCfg.forwardSeedConfirmationRange = m_finderCfg.forwardSeedConfirmationRange; filterCfg.impactWeightFactor = m_impactWeightFactor; + filterCfg.zOriginWeightFactor = m_zOriginWeightFactor; filterCfg.compatSeedWeight = m_compatSeedWeight; filterCfg.compatSeedLimit = m_compatSeedLimit; filterCfg.seedWeightIncrement = m_seedWeightIncrement; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.h b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.h index d0af0f7812f651d937368165cf6e3a8203d192e2..2aa7338d21164eaca045ad9eafe7ce5b95385e24 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SeedingTool.h @@ -97,13 +97,13 @@ namespace ActsTrk { Gaudi::Property< float > m_impactMax {this, "impactMax", 2. * Acts::UnitConstants::mm, "maximum impact parameter"}; // Used in SeedfinderConfig as well Gaudi::Property< std::vector< float > > m_zBinEdges {this, "zBinEdges", - {-3000., -2500., -1400., -925., -450., -250., 250., 450., 925., 1400., 2500., 3000.}, + {-3000., -2500., -1400., -925., -500., -250., 250., 500., 925., 1400., 2500., 3000.}, "enable non equidistant binning in z"}; // Used in SeedfinderConfig as well Gaudi::Property< float > m_gridRMax {this, "gridRMax", 320. * Acts::UnitConstants::mm, "radial extension of subdetector to be used in grid building"}; - Gaudi::Property< float > m_gridPhiMin {this, "gridPhiMin", 0, + Gaudi::Property< float > m_gridPhiMin {this, "gridPhiMin", -M_PI, "phi min for space point grid formation"}; - Gaudi::Property< float > m_gridPhiMax {this, "gridPhiMax", 2*M_PI, + Gaudi::Property< float > m_gridPhiMax {this, "gridPhiMax", M_PI, "phi max for space point grid formation"}; Gaudi::Property< int > m_phiBinDeflectionCoverage {this, "phiBinDeflectionCoverage", 3, "sets of consecutive phi bins to cover full deflection of minimum pT particle"}; @@ -113,8 +113,6 @@ namespace ActsTrk { "limiting location of measurements"}; Gaudi::Property< float > m_binSizeR {this, "binSizeR", 1. * Acts::UnitConstants::mm, "defining radial bin for space point sorting"}; - Gaudi::Property< bool > m_forceRadialSorting {this, "forceRadialSorting", true, - "enable radial sorting in space point grid"}; Gaudi::Property< float > m_deltaRMin {this, "deltaRMin", 20. * Acts::UnitConstants::mm, "minimum distance in r between two measurements within one seed"}; // Used in SeedFilterConfig as well Gaudi::Property< float > m_deltaRMinTopSP {this, "deltaRMinTopSP", 6. * Acts::UnitConstants::mm, @@ -123,7 +121,7 @@ namespace ActsTrk { "maximum distance in r between middle and top SP"}; Gaudi::Property< float > m_deltaRMinBottomSP {this, "deltaRMinBottomSP", 6. * Acts::UnitConstants::mm, "minimum distance in r between middle and top SP"}; - Gaudi::Property< float > m_deltaRMaxBottomSP {this, "deltaRMaxBottomSP", 120. * Acts::UnitConstants::mm, + Gaudi::Property< float > m_deltaRMaxBottomSP {this, "deltaRMaxBottomSP", 150. * Acts::UnitConstants::mm, "maximum distance in r between middle and top SP"}; Gaudi::Property< float > m_deltaZMax {this, "deltaZMax", 600, "maximum distance in z between two measurements within one seed"}; @@ -135,7 +133,7 @@ namespace ActsTrk { "how many sigmas of scattering angle should be considered"}; Gaudi::Property< float > m_maxPtScattering {this, "maxPtScattering", 10e6, "Upper pt limit for scattering calculation"}; - Gaudi::Property< float > m_radLengthPerSeed {this, "radLengthPerSeed", 0.1, + Gaudi::Property< float > m_radLengthPerSeed {this, "radLengthPerSeed", 0.098045, "average radiation lengths of material on the length of a seed. used for scattering"}; Gaudi::Property< int > m_maxSeedsPerSpM {this, "maxSeedsPerSpM", 4, "In dense environments many seeds may be found per middle space point. Only seeds with the highest weight will be kept if this limit is reached."}; // Used in SeedFilterConfig as well @@ -149,7 +147,9 @@ namespace ActsTrk { {1, 2, 3, 4, 11, 10, 9, 8, 6, 5, 7} , "defines order of z bins for looping"}; Gaudi::Property< bool > m_useVariableMiddleSPRange {this, "useVariableMiddleSPRange", true, "Enable variable range to search for middle SPs"}; - Gaudi::Property< std::vector<std::vector<double>> > m_rRangeMiddleSP {this, "rRangeMiddleSP", {}, "radial range for middle SP"}; + Gaudi::Property< std::vector<std::vector<double>> > m_rRangeMiddleSP {this, "rRangeMiddleSP", + {{40.0, 90.0}, {40.0, 200.0}, {46.0, 200.0}, {46.0, 200.0}, {46.0, 250.0}, {46.0, 250.0}, {46.0, 250.0}, {46.0, 200.0}, {46.0, 200.0}, {40.0, 200.0}, {40.0, 90.0}}, + "radial range for middle SP"}; Gaudi::Property< float > m_deltaRMiddleMinSPRange {this, "deltaRMiddleMinSPRange", 10., "delta R for middle SP range (min)"}; Gaudi::Property< float > m_deltaRMiddleMaxSPRange {this, "deltaRMiddleMaxSPRange", 10., @@ -209,9 +209,9 @@ namespace ActsTrk { Gaudi::Property<float> m_toleranceParam {this, "toleranceParam", 1.1 * Acts::UnitConstants::mm, "tolerance parameter used to check the compatibility of SPs coordinates in xyz"}; - Gaudi::Property<float> m_phiMin {this, "phiMin", - M_PI, ""}; + Gaudi::Property<float> m_phiMin {this, "phiMin", -M_PI, ""}; Gaudi::Property<float> m_phiMax {this, "phiMax", M_PI, ""}; - Gaudi::Property<float> m_rMin {this, "rMin", 33 * Acts::UnitConstants::mm, ""}; + Gaudi::Property<float> m_rMin {this, "rMin", 0 * Acts::UnitConstants::mm, ""}; Gaudi::Property<float> m_zAlign {this, "zAlign", 0 * Acts::UnitConstants::mm, ""}; Gaudi::Property<float> m_rAlign {this, "rAlign", 0 * Acts::UnitConstants::mm, ""}; Gaudi::Property<float> m_sigmaError {this, "sigmaError", 5, ""}; @@ -219,6 +219,7 @@ namespace ActsTrk { // Properties to set SeedFilterConfig Gaudi::Property< float > m_impactWeightFactor {this, "impactWeightFactor", 100., "the impact parameters (d0) is multiplied by this factor and subtracted from weight"}; + Gaudi::Property< float > m_zOriginWeightFactor {this, "zOriginWeightFactor", 1.}; Gaudi::Property< float > m_compatSeedWeight {this, "compatSeedWeight", 100., "seed weight increased by this value if a compatible seed has been found"}; Gaudi::Property< std::size_t > m_compatSeedLimit {this, "compatSeedLimit", 3, @@ -227,13 +228,11 @@ namespace ActsTrk { "increment in seed weight if needed"}; Gaudi::Property< float > m_numSeedIncrement {this, "numSeedIncrement", 10e6, "increment in seed weight is applied if the number of compatible seeds is larger than numSeedIncrement"}; - Gaudi::Property< bool > m_curvatureSortingInFilter {this, "curvatureSortingInFilter", true, - "sort seed vectors by curvature"}; Gaudi::Property< bool > m_seedConfirmationInFilter {this, "seedConfirmationInFilter", true, "run seed confirmation"}; - Gaudi::Property< int > m_maxSeedsPerSpMConf {this, "maxSeedsPerSpMConf", 5, + Gaudi::Property< std::size_t > m_maxSeedsPerSpMConf {this, "maxSeedsPerSpMConf", 5, "Maximum number of lower quality seeds in seed confirmation."}; - Gaudi::Property< int > m_maxQualitySeedsPerSpMConf {this, "maxQualitySeedsPerSpMConf", 5, + Gaudi::Property< std::size_t > m_maxQualitySeedsPerSpMConf {this, "maxQualitySeedsPerSpMConf", 5, "Maximum number of quality seeds for each middle-bottom SP-duplet in seed confirmation."}; Gaudi::Property< bool > m_useDeltaRorTopRadius {this, "useDeltaRorTopRadius", true, "use deltaR (top radius - middle radius) instead of top radius"}; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.cxx index 321e64a49eb79d1c8e06762f4f33bad192f8d32f..2c86bfb30faa70ee3dec4ebf75e45b45ef661c22 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.cxx +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.cxx @@ -141,6 +141,7 @@ namespace ActsTrk { data.l_ITkSpacePointForSeed.emplace_back(sp, r); data.ns++; + data.nsaz++; } void @@ -149,6 +150,7 @@ namespace ActsTrk { { data.v_ActsSpacePointForSeed.emplace_back(sp); data.ns++; + data.nsaz++; } void SiSpacePointsSeedMaker::pixInform(const Trk::SpacePoint* const& sp, @@ -439,6 +441,8 @@ namespace ActsTrk { // initialising the number of space points as well data.ns = 0; + data.nsaz = 0; + data.nsazv = 0; // Retrieve the Trk::PRDtoTrackMap const Trk::PRDtoTrackMap *prd_to_track_map_cptr = nullptr; @@ -600,6 +604,7 @@ namespace ActsTrk { } ATH_MSG_DEBUG(" \\__ Created " << seedPtrs->size() << " seeds"); + data.nsazv = seedPtrs->size(); // Store seeds to data // We need now to convert the output to Athena object once again (i.e. ITk::SiSpacePointForSeed) @@ -623,7 +628,7 @@ namespace ActsTrk { top_sp, seed->z()); data.i_ITkSeeds.back().setQuality(-seed->seedQuality()); } - } else { + } else if (m_doSeedConversion) { if (isPixel) { SG::ReadHandle<xAOD::PixelClusterContainer> inputClusterContainer( m_pixelClusterContainerKey, ctx ); @@ -696,7 +701,7 @@ namespace ActsTrk { } else { SG::ReadHandle<xAOD::StripClusterContainer> inputClusterContainer( m_stripClusterContainerKey, ctx ); if (!inputClusterContainer.isValid()){ - ATH_MSG_FATAL("xAOD::PixelClusterContainer with key " << m_stripClusterContainerKey.key() << " is not available..."); + ATH_MSG_FATAL("xAOD::StripClusterContainer with key " << m_stripClusterContainerKey.key() << " is not available..."); return; } const xAOD::StripClusterContainer inputContainer = *inputClusterContainer.cptr(); @@ -945,8 +950,11 @@ namespace ActsTrk { out<<"| ns | " <<std::setw(12)<<data.ns <<" |"<<endmsg; - out<<"| seeds | " - <<std::setw(12)<<data.i_ITkSeeds.size() + out<<"| nsaz | " + <<std::setw(12)<<data.nsaz + <<" |"<<endmsg; + out<<"| seeds | " + <<std::setw(12)<< data.nsazv <<" |"<<endmsg; out<<"|---------------------------------------------------------------------|" <<endmsg; diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.h b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.h index 47cdd9b47656fdb5fca6b3435e7ed7346cc4e367..7d7b6f0f5a09e35081de3bd4962def403325c872 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkSeedingTool/src/SiSpacePointsSeedMaker.h @@ -198,6 +198,8 @@ namespace ActsTrk { Gaudi::Property< bool > m_useOverlap {this, "useOverlapSpCollection", true}; Gaudi::Property< bool > m_fastTracking {this, "useFastTracking", false}; Gaudi::Property< bool > m_doSpacePointConversion {this, "doSpacePointConversion", true, "Convert Trk::SpacePoint container into xAOD::SpacePoint container"}; + Gaudi::Property< bool > m_doSeedConversion {this, "doSeedConversion", true, "Convert ActsTrk::Seed into ITk::SiSpacePointsProSeed"}; + private: // Validation diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index ef553c410a5c58194bf5a3e53b1443d6fd89cb14..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/CMakeLists.txt deleted file mode 100644 index 693800a0bb88525700019e25400dc41dc83340fa..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( ActsTrkSpacePointFormationTool ) - -# External dependencies: - -atlas_add_component( ActsTrkSpacePointFormationTool - src/*.cxx - src/components/*.cxx - LINK_LIBRARIES - AthenaBaseComps - GaudiKernel - ActsTrkEvent - ActsTrkToolInterfacesLib - InDetCondTools - PixelReadoutGeometryLib - ReadoutGeometryBase - SCT_ReadoutGeometry - SiSpacePointFormationLib - xAODInDetMeasurement - ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/components/ActsTrkSpacePointFormationTool_entries.cxx b/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/components/ActsTrkSpacePointFormationTool_entries.cxx deleted file mode 100644 index de0637120af629d594b60ba9deb8901af601aab5..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkSpacePointFormationTool/src/components/ActsTrkSpacePointFormationTool_entries.cxx +++ /dev/null @@ -1,9 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "src/PixelSpacePointFormationTool.h" -#include "src/StripSpacePointFormationTool.h" - -DECLARE_COMPONENT( ActsTrk::PixelSpacePointFormationTool ) -DECLARE_COMPONENT( ActsTrk::StripSpacePointFormationTool ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/IStripSpacePointFormationTool.h b/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/IStripSpacePointFormationTool.h index 8eea13d20c96c892afd5566093c8ed1d926b0c61..c5e99f30905b838b040dbae30d06413497eed99d 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/IStripSpacePointFormationTool.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/IStripSpacePointFormationTool.h @@ -35,15 +35,18 @@ namespace ActsTrk { class IStripSpacePointFormationTool : virtual public IAlgTool { public: - DeclareInterfaceID(IStripSpacePointFormationTool, 1, 0); - - virtual StatusCode produceStripSpacePoints(const xAOD::StripClusterContainer& clusterContainer, - const InDet::SiElementPropertiesTable& properties, - const InDetDD::SiDetectorElementCollection& elements, - const Amg::Vector3D& beamSpotVertex, - std::vector<StripSP>& spacePoints, - std::vector<StripSP>& overlapSpacePoints, - bool processOverlaps) const = 0; + DeclareInterfaceID(IStripSpacePointFormationTool, 1, 0); + + + virtual StatusCode produceSpacePoints(const EventContext& ctx, + const xAOD::StripClusterContainer& clusterContainer, + const InDet::SiElementPropertiesTable& properties, + const InDetDD::SiDetectorElementCollection& elements, + const Amg::Vector3D& beamSpotVertex, + std::vector<StripSP>& spacePoints, + std::vector<StripSP>& overlapSpacePoints, + bool processOverlaps) const = 0; + }; } // ACTSTRKTOOLINTERFACES_ISTRIPSPACEPOINTFORMATIONTOOL_H diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/ITrackFindingTool.h b/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/ITrackFindingTool.h index dbc1e6b00c795ab70b11d26436765b26f6d46ca9..573bc297dde49a8c347de11529dbbeed34ec7504 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/ITrackFindingTool.h +++ b/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/ActsTrkToolInterfaces/ITrackFindingTool.h @@ -5,10 +5,12 @@ #ifndef ACTSTRKTOOLINTERFACES_ITRACKFINDINGTOOL_H #define ACTSTRKTOOLINTERFACES_ITRACKFINDINGTOOL_H 1 -// Athena +// Base #include "GaudiKernel/IAlgTool.h" + +// Athena +#include "GeoPrimitives/GeoPrimitives.h" #include "GaudiKernel/EventContext.h" -#include "TrkFitterUtils/FitterTypes.h" #include "TrkTrack/TrackCollection.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "xAODInDetMeasurement/PixelClusterContainer.h" diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/CMakeLists.txt index 2fc2167ef40e5650adcce03808d1baccf39cc41f..53219c67dc8fa06a578ec700e6eb61840b071261 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkTools/ActsTrkToolInterfaces/CMakeLists.txt @@ -16,10 +16,10 @@ atlas_add_library( ActsTrkToolInterfacesLib GaudiKernel BeamSpotConditionsData ActsCore - ActsTrkEvent + ActsTrkEventLib SiSpacePointFormationLib InDetReadoutGeometry - InDetIdentifier + InDetIdentifier xAODInDetMeasurement TrkFitterUtils ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/CMakeLists.txt b/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/CMakeLists.txt index 17039731240de5b5bd11b49abf5057639dcab6aa..028f9a2a9de073174301c7c4b1624c6b6f14d1a7 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/CMakeLists.txt +++ b/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ActsTrkTrackParamsEstimationTool ) @@ -13,14 +13,12 @@ atlas_add_component( ActsTrkTrackParamsEstimationTool LINK_LIBRARIES GaudiKernel ActsCore - ActsTrkEvent + ActsTrkEventLib ActsTrkToolInterfacesLib ActsInteropLib MagFieldConditions ) -# Install files from the package: -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/python/ActsTrkTrackParamsEstimationToolConfig.py b/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/python/ActsTrkTrackParamsEstimationToolConfig.py deleted file mode 100644 index 2cbec27ac37ca2512e677fdfb510bf3a00a1a287..0000000000000000000000000000000000000000 --- a/Tracking/Acts/ActsTrkTools/ActsTrkTrackParamsEstimationTool/python/ActsTrkTrackParamsEstimationToolConfig.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory -from ActsInterop import UnitConstants - -def TrackParamsEstimationToolCfg(ConfigFlags, - name: str = "TrackParamsEstimationTool", - **options) -> ComponentAccumulator: - assert isinstance(name, str) - - acc = ComponentAccumulator() - - options['name'] = name - options.setdefault('bFieldMin', 0.1 * UnitConstants.T) - options.setdefault('sigmaLoc0', 25 * UnitConstants.um) - options.setdefault('sigmaLoc1', 100 * UnitConstants.um) - options.setdefault('sigmaPhi', 0.02 * UnitConstants.degree) - options.setdefault('sigmaTheta', 0.02 * UnitConstants.degree) - options.setdefault('sigmaQOverP', 0.1 / UnitConstants.GeV) - options.setdefault('sigmaT0', 1400 * UnitConstants.s) - # eBoundLoc0, eBoundLoc1, eBoundPhi, eBoundTheta, eBoundQOverP, eBoundTime - options.setdefault('initialVarInflation', [1., 1., 1., 1., 1., 1.]) - - acc.setPrivateTools(CompFactory.ActsTrk.TrackParamsEstimationTool(**options)) - return acc diff --git a/Tracking/Acts/ActsVertexReconstruction/ATLAS_CHECK_THREAD_SAFETY b/Tracking/Acts/ActsVertexReconstruction/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..d1b1576e06fd970749eef8c0695f6a0271c3def6 --- /dev/null +++ b/Tracking/Acts/ActsVertexReconstruction/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1,2 @@ +Tracking/Acts/ActsVertexReconstruction + diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/CMakeLists.txt b/Tracking/Acts/ActsVertexReconstruction/CMakeLists.txt similarity index 83% rename from Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/CMakeLists.txt rename to Tracking/Acts/ActsVertexReconstruction/CMakeLists.txt index 445d17a5bb354cb9960712da9cf52e80b120dc03..32842d929492bf085af5ae78a28e8605c6175191 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/CMakeLists.txt +++ b/Tracking/Acts/ActsVertexReconstruction/CMakeLists.txt @@ -1,13 +1,13 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( ActsTrkPriVtxFinderTool ) +atlas_subdir( ActsVertexReconstruction ) # External dependencies: find_package( Acts COMPONENTS Core ) # Component(s) in the package: -atlas_add_component( ActsTrkPriVtxFinderTool +atlas_add_component( ActsVertexReconstruction src/*.cxx src/components/*.cxx LINK_LIBRARIES diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/AdaptiveMultiPriVtxFinderTool.cxx b/Tracking/Acts/ActsVertexReconstruction/src/AdaptiveMultiPriVtxFinderTool.cxx old mode 100755 new mode 100644 similarity index 100% rename from Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/AdaptiveMultiPriVtxFinderTool.cxx rename to Tracking/Acts/ActsVertexReconstruction/src/AdaptiveMultiPriVtxFinderTool.cxx diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/AdaptiveMultiPriVtxFinderTool.h b/Tracking/Acts/ActsVertexReconstruction/src/AdaptiveMultiPriVtxFinderTool.h similarity index 99% rename from Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/AdaptiveMultiPriVtxFinderTool.h rename to Tracking/Acts/ActsVertexReconstruction/src/AdaptiveMultiPriVtxFinderTool.h index b667446e5dc9ce2159421b55e779ca0157b3d850..2f9a73a2b43cceea577e62f30658147f2d397da9 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/AdaptiveMultiPriVtxFinderTool.h +++ b/Tracking/Acts/ActsVertexReconstruction/src/AdaptiveMultiPriVtxFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/IterativePriVtxFinderTool.cxx b/Tracking/Acts/ActsVertexReconstruction/src/IterativePriVtxFinderTool.cxx old mode 100755 new mode 100644 similarity index 100% rename from Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/IterativePriVtxFinderTool.cxx rename to Tracking/Acts/ActsVertexReconstruction/src/IterativePriVtxFinderTool.cxx diff --git a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/IterativePriVtxFinderTool.h b/Tracking/Acts/ActsVertexReconstruction/src/IterativePriVtxFinderTool.h similarity index 99% rename from Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/IterativePriVtxFinderTool.h rename to Tracking/Acts/ActsVertexReconstruction/src/IterativePriVtxFinderTool.h index 2f289af70b330760d54f0f5385498b7e561f3a7c..9de9573377073524a382cb68a0e8151b7bb1446c 100644 --- a/Tracking/Acts/ActsTrkTools/ActsTrkPriVtxFinderTool/src/IterativePriVtxFinderTool.h +++ b/Tracking/Acts/ActsVertexReconstruction/src/IterativePriVtxFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSTRKPRIVTXFINDERTOOL_ITERATIVEPRIVTXFINDERTOOL_H diff --git a/Tracking/Acts/ActsVertexReconstruction/src/components/ActsVertexReconstruction_entries.cxx b/Tracking/Acts/ActsVertexReconstruction/src/components/ActsVertexReconstruction_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2c0a0fb917e473f0c100317112c32905bdbca8c2 --- /dev/null +++ b/Tracking/Acts/ActsVertexReconstruction/src/components/ActsVertexReconstruction_entries.cxx @@ -0,0 +1,9 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "src/AdaptiveMultiPriVtxFinderTool.h" +#include "src/IterativePriVtxFinderTool.h" + +DECLARE_COMPONENT( ActsTrk::AdaptiveMultiPriVtxFinderTool ) +DECLARE_COMPONENT( ActsTrk::IterativePriVtxFinderTool ) diff --git a/Tracking/TrkConfig/python/TrkConfigFlags.py b/Tracking/TrkConfig/python/TrkConfigFlags.py index 099707417091e93ca07a5b83c195d8a982a0a8ae..45b0ee3e344b3501678bc58d6711719ea2fa6fc2 100644 --- a/Tracking/TrkConfig/python/TrkConfigFlags.py +++ b/Tracking/TrkConfig/python/TrkConfigFlags.py @@ -31,6 +31,8 @@ class TrackingComponent(FlagEnum): ValidateActsSpacePoints = "ValidateActsSpacePoints" ValidateActsSeeds = "ValidateActsSeeds" ValidateActsTracks = "ValidateActsTracks" + # Benchmarking + BenchmarkSpot = "BenchmarkSpot" def createTrackingConfigFlags(): diff --git a/Tracking/TrkConfig/python/TrkExAlgsConfig.py b/Tracking/TrkConfig/python/TrkExAlgsConfig.py index eb75817d6290abb6826fc51b2e5268305da2b685..86ab4f327e8422add4ee4ca4817eeefab900b407 100644 --- a/Tracking/TrkConfig/python/TrkExAlgsConfig.py +++ b/Tracking/TrkConfig/python/TrkExAlgsConfig.py @@ -16,7 +16,7 @@ def ExtrapolatorComparisonTestCfg(flags, name = "ExtrapolatorComparisonTest", ** AtlasExtrapolatorCfg(flags))) if "ExtrapolationTool" not in kwargs: - from ActsGeometry.ActsGeometryConfig import ActsExtrapolationToolCfg + from ActsConfig.ActsTrkGeometryConfig import ActsExtrapolationToolCfg kwargs.setdefault("ExtrapolationTool", result.popToolsAndMerge( ActsExtrapolationToolCfg(flags))) # PrivateToolHandle diff --git a/Tracking/TrkConfig/python/TrkVKalVrtFitterConfig.py b/Tracking/TrkConfig/python/TrkVKalVrtFitterConfig.py index c00acab1e2fc6bf465cfe4d71f9b01a507436c63..dcd0a161a61b7d8d86401f18d334668f1de7b005 100644 --- a/Tracking/TrkConfig/python/TrkVKalVrtFitterConfig.py +++ b/Tracking/TrkConfig/python/TrkVKalVrtFitterConfig.py @@ -63,3 +63,15 @@ def V0VKalVrtFitterCfg(flags, name="V0VKalVrtFitter", **kwargs): def JpsiV0VertexFitCfg(flags, name="JpsiV0VertexFit", **kwargs): kwargs.setdefault("CascadeCnstPrecision", 1e-6) return BPHY_TrkVKalVrtFitterCfg(flags, name, **kwargs) + +def BTAG_TrkVKalVrtFitterCfg(flags, name="BTAG_TrkVKalVrtFitter",**kwargs): + from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg + acc = AtlasFieldCacheCondAlgCfg(flags) # To produce AtlasFieldCacheCondObj + myargs = kwargs.copy() + myargs.setdefault("FirstMeasuredPoint", False) + myargs.setdefault("FrozenVersionForBTagging", True) + if "Extrapolator" in myargs: + del myargs["Extrapolator"] + acc.setPrivateTools(CompFactory.Trk.TrkVKalVrtFitter(name, **myargs)) + return acc + diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx index 1629ac7e2a52a844909c868d39d6823e41247cbf..9b8c8ae8faf80148acbde16429894f15ba408261 100644 --- a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx +++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx @@ -308,7 +308,7 @@ StatusCode Trk::ExtrapolatorComparisonTest::execute(const EventContext& ctx) con ATH_MSG_VERBOSE("Starting extrapolation " << n_extraps << " from : " << pars << " to : " << destinationSurface); auto start_fwd = xclock::now(); - auto destParameters = m_extrapolationTool->propagate(ctx, *startParameters, *destinationSurface, Acts::NavigationDirection::Forward); + auto destParameters = m_extrapolationTool->propagate(ctx, *startParameters, *destinationSurface, Acts::Direction::Forward); auto end_fwd = xclock::now(); float ms_fwd = std::chrono::duration_cast<std::chrono::milliseconds>(end_fwd-start_fwd).count(); @@ -320,7 +320,7 @@ StatusCode Trk::ExtrapolatorComparisonTest::execute(const EventContext& ctx) con // now try backward extrapolation auto start_bkw = xclock::now(); - auto finalperigee = m_extrapolationTool->propagate(ctx, *destParameters, startParameters->referenceSurface(), Acts::NavigationDirection::Backward); + auto finalperigee = m_extrapolationTool->propagate(ctx, *destParameters, startParameters->referenceSurface(), Acts::Direction::Backward); auto end_bkw = xclock::now(); float ms_bkw = std::chrono::duration_cast<std::chrono::milliseconds>(end_bkw-start_bkw).count(); diff --git a/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.h b/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.h index f555931f6ec8cfedfe77804fb2f6fb14559bfb74..996035f2ca2120956f6cc2e3653d66b3ad5212a2 100644 --- a/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.h +++ b/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.h @@ -178,6 +178,7 @@ namespace Trk { std::vector< float >* m_sensitiveCenterPosY; std::vector< float >* m_sensitiveCenterPosZ; std::vector< float >* m_sensitiveCenterPosR; + std::vector< float >* m_sensitiveCenterPosPhi; std::vector< float >* m_sensitiveLocalPosR = nullptr; std::vector< float >* m_sensitiveLocalPosPhi = nullptr; std::vector< int >* m_sensitiveDetector = nullptr; diff --git a/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc b/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc index 65ca0aa7826130c90a1f23b632bfe6c958623b27..6df7437c10a765042bffe228acec8eeaa67e096f 100644 --- a/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc +++ b/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc @@ -90,6 +90,7 @@ template < class T, class P > StatusCode Trk::ExtrapolationEngineTest::runTestT( m_sensitiveCenterPosY->clear(); m_sensitiveCenterPosZ->clear(); m_sensitiveCenterPosR->clear(); + m_sensitiveCenterPosPhi->clear(); m_sensitiveLocalPosX->clear(); m_sensitiveLocalPosY->clear(); m_sensitiveLocalPosR->clear(); @@ -376,6 +377,7 @@ template < class T, class P > StatusCode Trk::ExtrapolationEngineTest::fillStepI m_sensitiveCenterPosY->push_back(parameters->associatedSurface().associatedDetectorElement()->center().y()); m_sensitiveCenterPosZ->push_back(parameters->associatedSurface().associatedDetectorElement()->center().z()); m_sensitiveCenterPosR->push_back(parameters->associatedSurface().associatedDetectorElement()->center().perp()); + m_sensitiveCenterPosPhi->push_back(parameters->associatedSurface().associatedDetectorElement()->center().phi()); bool isHGTD = false; if (m_idHelper->is_pixel(id)) { diff --git a/Tracking/TrkExtrapolation/TrkExUnitTests/scripts/RunExEngineTestITk.py b/Tracking/TrkExtrapolation/TrkExUnitTests/scripts/RunExEngineTestITk.py index e3085e7d1327b62551af58cb961a4ff29986acb6..30cc49a55115fbd50ec074be95fd697a74fea327 100644 --- a/Tracking/TrkExtrapolation/TrkExUnitTests/scripts/RunExEngineTestITk.py +++ b/Tracking/TrkExtrapolation/TrkExUnitTests/scripts/RunExEngineTestITk.py @@ -2,6 +2,17 @@ from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaCommon.Logging import log +import sys + +if(len(sys.argv[1:])): + cmdargs=dict(arg.split('=') for arg in sys.argv[1:]) + if not 'MisalignMode' in cmdargs.keys(): + MisalignMode = -1 + else: + MisalignMode=int(cmdargs.get('MisalignMode',11)) + print("Looking for misalignment files for mode "+str(MisalignMode)) +else: + MisalignMode = -1 ## Just enable ID for the moment. ConfigFlags.Input.isMC = True @@ -15,15 +26,38 @@ if ConfigFlags.ITk.Geometry.AllLocal: "ITkStrip", "Bpipe" ] - from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags - setupDetectorFlags(ConfigFlags, detectors, toggle_geometry=True) - ConfigFlags.TrackingGeometry.MaterialSource = "Input" +from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags +setupDetectorFlags(ConfigFlags, detectors, toggle_geometry=True) +ConfigFlags.TrackingGeometry.MaterialSource = "Input" ConfigFlags.Detector.GeometryHGTD = False ConfigFlags.GeoModel.AtlasVersion = "ATLAS-P2-RUN4-01-01-00" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-SIM-00-00-00" ConfigFlags.GeoModel.Align.Dynamic = False +if(MisalignMode!=-1): + tag="" + BFile="" + DBFile="MisalignmentSet"+str(MisalignMode)+".db" + if(MisalignMode==0): + tag="InDetSi_MisalignmentMode_no Misalignment" + elif(MisalignMode==1): + tag="InDetSi_MisalignmentMode_misalignment by 6 parameters" + elif(MisalignMode==2): + tag="InDetSi_MisalignmentMode_random misalignment" + elif(MisalignMode==3): + tag="InDetSi_MisalignmentMode_IBL-stave temperature dependent bowing" + elif(MisalignMode==11): + tag="InDetSi_MisalignmentMode_R deltaR (radial expansion)" + elif(MisalignMode==21): + tag="InDetSi_MisalignmentMode_R deltaPhi (curl)" + elif(MisalignMode==31): + tag="InDetSi_MisalignmentMode_R deltaZ (telescope)" + elif(MisalignMode==99): + tag="InDetSi_MisalignmentMode_99" + DBFile="MisalignmentSet99.db" + DBName="OFLCOND" + ConfigFlags.IOVDb.DBConnection ="sqlite://;schema="+DBFile+";dbname="+DBName ConfigFlags.Detector.GeometryCalo = False ConfigFlags.Detector.GeometryMuon = False @@ -39,6 +73,9 @@ log.debug('dumping config flags now.') ConfigFlags.dump() cfg=MainServicesCfg(ConfigFlags) +if(MisalignMode!=-1): + from IOVDbSvc.IOVDbSvcConfig import addFolders + cfg.merge(addFolders(ConfigFlags,"/Indet/AlignITk",db=DBName,detDb=DBFile,tag=tag)) from TrkExUnitTests.TrkExUnitTestsConfig import ExtrapolationEngineTestCfg topoAcc=ExtrapolationEngineTestCfg(ConfigFlags, @@ -70,5 +107,10 @@ topoAcc=ExtrapolationEngineTestCfg(ConfigFlags, cfg.merge(topoAcc) cfg.printConfig() +if(MisalignMode!=-1): + cfg.getService("GeoModelSvc").DetectorTools["ITk::PixelDetectorTool"].Alignable=True + print("Pixel manager alignability has been set to: "+ str(cfg.getService("GeoModelSvc").DetectorTools["ITk::PixelDetectorTool"].Alignable)) + cfg.getService("GeoModelSvc").DetectorTools["ITk::StripDetectorTool"].Alignable=True + print("Strip manager alignability has been set to:"+str(cfg.getService("GeoModelSvc").DetectorTools["ITk::StripDetectorTool"].Alignable)) cfg.run(10) diff --git a/Tracking/TrkExtrapolation/TrkExUnitTests/src/ExtrapolationEngineTest.cxx b/Tracking/TrkExtrapolation/TrkExUnitTests/src/ExtrapolationEngineTest.cxx index e1757b1021c2aba2d4b4e6c814985acffd5226a5..8f2b644a39420ddd88280e81773af2b2ec0a26b9 100644 --- a/Tracking/TrkExtrapolation/TrkExUnitTests/src/ExtrapolationEngineTest.cxx +++ b/Tracking/TrkExtrapolation/TrkExUnitTests/src/ExtrapolationEngineTest.cxx @@ -66,6 +66,7 @@ Trk::ExtrapolationEngineTest::ExtrapolationEngineTest(const std::string& name, I m_sensitiveCenterPosY(nullptr), m_sensitiveCenterPosZ(nullptr), m_sensitiveCenterPosR(nullptr), + m_sensitiveCenterPosPhi(nullptr), m_materialThicknessInX0(0.), m_materialThicknessInL0(0.), m_materialThicknessZARho(0.), @@ -173,6 +174,7 @@ StatusCode Trk::ExtrapolationEngineTest::finalize() { delete m_sensitiveCenterPosY; delete m_sensitiveCenterPosZ; delete m_sensitiveCenterPosR; + delete m_sensitiveCenterPosPhi; delete m_sensitiveLocalPosX; delete m_sensitiveLocalPosY; delete m_sensitiveLocalPosR; @@ -323,6 +325,7 @@ StatusCode Trk::ExtrapolationEngineTest::bookTree() { m_sensitiveCenterPosY = new std::vector< float >; m_sensitiveCenterPosZ = new std::vector< float >; m_sensitiveCenterPosR = new std::vector< float >; + m_sensitiveCenterPosPhi = new std::vector< float >; m_sensitiveLocalPosX = new std::vector< float >; m_sensitiveLocalPosY = new std::vector< float >; m_sensitiveLocalPosR = new std::vector< float >; @@ -346,6 +349,7 @@ StatusCode Trk::ExtrapolationEngineTest::bookTree() { m_tree->Branch("SensitiveCenterPosY" , m_sensitiveCenterPosY); m_tree->Branch("SensitiveCenterPosZ" , m_sensitiveCenterPosZ); m_tree->Branch("SensitiveCenterPosR" , m_sensitiveCenterPosR); + m_tree->Branch("SensitiveCenterPosPhi", m_sensitiveCenterPosPhi); m_tree->Branch("SensitiveLocalPosX" , m_sensitiveLocalPosX); m_tree->Branch("SensitiveLocalPosY" , m_sensitiveLocalPosY); m_tree->Branch("SensitiveLocalPosR" , m_sensitiveLocalPosR); diff --git a/Tracking/TrkFitter/TrkRefitAlg/CMakeLists.txt b/Tracking/TrkFitter/TrkRefitAlg/CMakeLists.txt index e009ab1294b5bccf5d72ab048836b199faea23e6..d3b258cc76de0ee3bb0a366634d8145cd89e1a1e 100644 --- a/Tracking/TrkFitter/TrkRefitAlg/CMakeLists.txt +++ b/Tracking/TrkFitter/TrkRefitAlg/CMakeLists.txt @@ -7,4 +7,4 @@ atlas_subdir( TrkRefitAlg ) atlas_add_component( TrkRefitAlg src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel TrkEventPrimitives TrkEventUtils TrkTrack TrkFitterUtils InDetReadoutGeometry StoreGateLib TrkSurfaces TrkMeasurementBase TrkParameters TrkTrackSummary TrkVertexOnTrack VxVertex TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces BeamSpotConditionsData ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel TrkEventPrimitives TrkEventUtils TrkTrack TrkFitterUtils InDetReadoutGeometry StoreGateLib TrkSurfaces TrkMeasurementBase TrkParameters TrkTrackSummary TrkVertexOnTrack VxVertex TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces BeamSpotConditionsData InDetSimData InDetSimEvent InDetPrepRawData TrkTruthData InDetRIO_OnTrack InDetIdentifier) diff --git a/Tracking/TrkFitter/TrkRefitAlg/TrkRefitAlg/ReFitTrackWithTruth.h b/Tracking/TrkFitter/TrkRefitAlg/TrkRefitAlg/ReFitTrackWithTruth.h new file mode 100644 index 0000000000000000000000000000000000000000..154944d80c60581e6ab7fac5c94e952f8a383ad3 --- /dev/null +++ b/Tracking/TrkFitter/TrkRefitAlg/TrkRefitAlg/ReFitTrackWithTruth.h @@ -0,0 +1,129 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// ReFitTrackWithTruth.h, (c) ATLAS Detector Software +// Take a track and replace the cluster position with the +// associated truth particle truth position +/////////////////////////////////////////////////////////////////// + +#ifndef TRKREFITALG_REFITTRACKWITHTRUTH_H +#define TRKREFITALG_REFITTRACKWITHTRUTH_H + +// Base class +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/MsgStream.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetSimData/InDetSimDataCollection.h" +#include "InDetSimEvent/SiHitCollection.h" +#include "InDetSimEvent/SiHit.h" +#include "InDetReadoutGeometry/SiDetectorDesign.h" +#include "InDetPrepRawData/PixelCluster.h" +#include "StoreGate/WriteHandle.h" +#include "TrkTrack/Track.h" +#include "TrkFitterUtils/FitterTypes.h" +#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" +#include "TrkToolInterfaces/IPRDtoTrackMapTool.h" +#include "TrkTrack/TrackCollection.h" +#include "TrkEventPrimitives/ParticleHypothesis.h" +#include "TrkEventUtils/TrkParametersComparisonFunction.h" +#include "TrkTruthData/TrackTruthCollection.h" + +class AtlasDetectorID; +class PixelID; +class TRandom3; + +namespace Trk{ + +class ITrackFitter; +class ITrackSummaryTool; +class ITrackSelectorTool; +class IPRD_AssociationTool; + + /** @brief Algorithm using an instance of a ITrackFitter + to refit the tracks of a given pseudotrack collection + after changing the cluster position to the truth particle + position + + @author Gabriel.Facini@cern.ch, Andrea.Sciandra@cern.ch + */ + +class ReFitTrackWithTruth : public AthAlgorithm { + +public: + + typedef Trk::Track Track; + + //! standard Algorithm constructor + ReFitTrackWithTruth(const std::string &name,ISvcLocator *pSvcLocator); + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + +private: + + std::vector<SiHit> matchSiHitsToCluster( const int barcodeToMatch, + const InDet::PixelCluster* pixClus, + SG::ReadHandle<AtlasHitsVector<SiHit>> &siHitCollection) const; + + bool IsClusterFromTruth( const InDet::PixelCluster* pixClus, + const int barcodeToMatch, + const InDetSimDataCollection &sdoCollection) const; + + HepGeom::Point3D<double> smearTruthPosition( const HepGeom::Point3D<double> orig, + const int bec, + const int layer_disk, + const InDetDD::SiDetectorDesign* design) const; + + double getPhiPosResolution(int layer) const; + double getEtaPosResolution(int layer) const; + double getPhiPosErrorFactor(int layer) const; + double getEtaPosErrorFactor(int layer) const; + + // input/output track container + SG::ReadHandleKey<TrackCollection> m_inputTrackColName{this,"InputTrackColName","","collection name for tracks to be refitted"}; // Name of the input Trackcollection + SG::WriteHandleKey<TrackCollection> m_outputTrackCollectionName{this,"OutputTrackColName","ReFitted_TracksWithTruth","collection name for output tracks"}; + + // TRandom3 generator for hit-resolution smearing + boost::thread_specific_ptr<TRandom3> m_random; //!< smear away! + + // --- fitter steering + Trk::RunOutlierRemoval m_runOutlier = false; // switch whether to run outlier logics or not + int m_matEffects = 3; // type of material interaction in extrapolation + + Gaudi::Property<bool> m_saveWrongHits {this, "SaveWrongHits", false}; // If running on Reco Tracks, can have wrong hits + Gaudi::Property<bool> m_fixWrongHits {this, "FixWrongHits", false}; // If running on Reco Tracks, fix wrong hits + Gaudi::Property<bool> m_rejNoiseHits {this, "RejectNoiseHits", false}; // If running on Reco Tracks, can have noise hits + + Trk::ParticleHypothesis m_ParticleHypothesis = Trk::pion; // nomen est omen + + // --- job options + SG::ReadHandleKey<SiHitCollection> m_siHitCollectionName{this,"SiHitCollectionName","PixelHits",""}; // SiHitCollection storegate key + SG::ReadHandleKey<InDetSimDataCollection> m_SDOContainerName{this,"MC_SDOs","PixelSDO_Map"}; // SDO Container storegate key + SG::ReadHandleKey<TrackTruthCollection> m_truthMapName{this,"TruthMap","InDetTracksTruthCollection"}; // TruthMap name storegate key + + // smearing + Gaudi::Property<std::vector<float> > m_resolutionRPhi{this, "ResolutionRPhi", {}}; // per-layer resolution + Gaudi::Property<std::vector<float> > m_resolutionZ{this, "ResolutionZ", {}}; // per-layer resolution + Gaudi::Property<std::vector<float> > m_errorRPhi{this, "ErrorFactorRPhi", {}}; // per-layer error - multiplicative factor * res. + Gaudi::Property<std::vector<float> > m_errorZ{this, "ErrorFactorZ", {}}; // per-layer error - multiplicative factor * res. + + // -- algorithm members + ToolHandle<Trk::ITrackFitter> m_ITrackFitter + {this, "FitterTool", "Trk::GlobalChi2Fitter/InDetTrackFitter" }; //!< the refit tool + ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool + {this, "SummaryTool", "Trk::TrackSummaryTool/InDetTrackSummaryTool" }; //!< the track summary tool + ToolHandle<Trk::IPRDtoTrackMapTool> m_assoTool + {this, "AssociationTool", "Trk::PRDtoTrackMapTool" }; //!< Tool to create and populate PRD to track + const AtlasDetectorID* m_idHelper; //!< Detector ID helper + const PixelID* m_pixelID; //!< Pixel ID + +}; + +} + +#endif //TRKREFITALG_REFITTRACKWITHTRUTH_H + diff --git a/Tracking/TrkFitter/TrkRefitAlg/src/ReFitTrackWithTruth.cxx b/Tracking/TrkFitter/TrkRefitAlg/src/ReFitTrackWithTruth.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a7f3ce6523b3ff31136bed23303fb1636f4417bd --- /dev/null +++ b/Tracking/TrkFitter/TrkRefitAlg/src/ReFitTrackWithTruth.cxx @@ -0,0 +1,606 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// ReFitTrackWithTruth.cxx +// Implementation file for class ReFitTrackWithTruth +/////////////////////////////////////////////////////////////////// +// version 1.0 03/10/19 Gabriel Facini (Rel21) +// version 2.0 22/03/23 Andrea Sciandra (Rel22/Rel23) +/////////////////////////////////////////////////////////////////// + +//SiTBLineFitter includes +#include "TrkRefitAlg/ReFitTrackWithTruth.h" + +// Gaudi includes +#include "GaudiKernel/ListItem.h" + +#include "AtlasDetDescr/AtlasDetectorID.h" +#include "TrkRIO_OnTrack/RIO_OnTrack.h" +#include "TrkEventPrimitives/ParamDefs.h" +#include "TrkEventPrimitives/LocalParameters.h" +#include "TrkParameters/TrackParameters.h" +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkTrackSummary/TrackSummary.h" +#include "TrkFitterInterfaces/ITrackFitter.h" +#include "TrkToolInterfaces/ITrackSummaryTool.h" +#include "InDetRIO_OnTrack/PixelClusterOnTrack.h" +#include "TRandom3.h" + +#include <vector> + +// Constructor with parameters: +Trk::ReFitTrackWithTruth::ReFitTrackWithTruth(const std::string &name, ISvcLocator *pSvcLocator) : + AthAlgorithm(name,pSvcLocator) +{ + +} + +// Initialize method: +StatusCode Trk::ReFitTrackWithTruth::initialize() +{ + ATH_MSG_INFO ("ReFitTrackWithTruth::initialize()"); + + ATH_CHECK (m_siHitCollectionName.initialize()); + ATH_CHECK (m_SDOContainerName.initialize()); + ATH_CHECK (m_truthMapName.initialize()); + + // get tracks + ATH_CHECK( m_inputTrackColName.initialize() ); + + if (m_ITrackFitter.retrieve().isFailure()) { + ATH_MSG_FATAL ("Failed to retrieve tool "<<m_ITrackFitter.typeAndName()); + return StatusCode::FAILURE; + } else { + ATH_MSG_INFO ("Retrieved general fitter " << m_ITrackFitter.typeAndName()); + } + + if (m_trkSummaryTool.retrieve().isFailure()) { + ATH_MSG_FATAL ("Failed to retrieve tool " << m_trkSummaryTool); + return StatusCode::FAILURE; + } else { + ATH_MSG_INFO ("Retrieved tool " << m_trkSummaryTool.typeAndName()); + } + + // needed if want to check on shared clusters + if ( m_assoTool.retrieve().isFailure() ) { + ATH_MSG_FATAL ("Failed to retrieve tool " << m_assoTool); + return StatusCode::FAILURE; + } else ATH_MSG_INFO("Retrieved tool " << m_assoTool); + + + // Configuration of the material effects + m_ParticleHypothesis = Trk::ParticleSwitcher::particle[m_matEffects]; + + // Get ID Helper + ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID")); + + // Get Pixel Helper + if (detStore()->retrieve(m_pixelID, "PixelID").isFailure()) { + ATH_MSG_FATAL ("Could not get Pixel ID helper"); + return StatusCode::FAILURE; + } + + //set seed for random-number generator + m_random.get()->SetSeed(); + + // ensure the vector is the correct size in case the user does not want to smear + if( m_resolutionRPhi.size() < 4 ) { m_resolutionRPhi={0.,0.,0.,0.}; } + if( m_resolutionZ.size() < 4 ) { m_resolutionZ={0.,0.,0.,0.}; } + + if( m_errorRPhi.size() < 4 ) { m_errorRPhi={1.,1.,1.,1.}; } + if( m_errorZ.size() < 4 ) { m_errorZ={1.,1.,1.,1.}; } + + ATH_MSG_INFO (" Resolutions " << m_resolutionRPhi.size() << " " << m_resolutionZ.size()); + for( unsigned int i=0; i<m_resolutionRPhi.size(); i++) { + ATH_MSG_INFO (" " << i << " " << m_resolutionRPhi[i] << "\t" << m_resolutionZ[i]); + } + ATH_MSG_INFO (" Error SR " << m_errorRPhi.size() << " " << m_errorZ.size()); + for( unsigned int i=0; i<m_errorRPhi.size(); i++) { + ATH_MSG_INFO (" " << i << " " << m_errorRPhi[i] << "\t" << m_errorZ[i]); + } + + ATH_CHECK(m_outputTrackCollectionName.initialize()); + ATH_MSG_DEBUG("m_outputTrackCollectionName: " << m_outputTrackCollectionName); + + return StatusCode::SUCCESS; +} + +// Execute method: +StatusCode Trk::ReFitTrackWithTruth::execute() +{ + ATH_MSG_DEBUG ("ReFitTrackWithTruth::execute()"); + std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map(m_assoTool->createPRDtoTrackMap()); + const EventContext& ctx = Gaudi::Hive::currentContext(); + + SG::ReadHandle<TrackCollection> tracks(m_inputTrackColName, ctx); + if (!tracks.isValid()) { + ATH_MSG_ERROR(m_inputTrackColName.key() << " not found"); + return StatusCode::FAILURE; + } + + //retrieve truth information needed (SiHitCollection) + SG::ReadHandle<SiHitCollection> siHits(m_siHitCollectionName, ctx); + if (!siHits.isValid()) { + ATH_MSG_WARNING( "Error retrieving SiHitCollection " << m_siHitCollectionName); + return StatusCode::FAILURE; + } + + //retrieve truth information needed (SDOCollection) + SG::ReadHandle<InDetSimDataCollection> sdoCollection(m_SDOContainerName, ctx); + if (!sdoCollection.isValid()) { + ATH_MSG_WARNING( "Error retrieving SDOCollection " << m_SDOContainerName ); + return StatusCode::FAILURE; + } + + //retrieve truth map + SG::ReadHandle<TrackTruthCollection> truthMap(m_truthMapName, ctx); + if (!truthMap.isValid()) { + ATH_MSG_WARNING( "Error retrieving truth map " << m_truthMapName ); + return StatusCode::FAILURE; + } + + // create new collection of tracks to write in storegate + std::vector<std::unique_ptr<Trk::Track> > newtracks; + + // loop over tracks + for (TrackCollection::const_iterator itr = tracks->begin(); itr != tracks->end(); ++itr) { + ATH_MSG_DEBUG("input track"); + + // Get original parameters + const TrackParameters* origPerigee = (*itr)->perigeeParameters(); + double od0(0); + double oz0(0); + double ophi0(0); + double otheta(0); + double oqOverP(0); + if (!origPerigee){ + ATH_MSG_WARNING("Cannot get original parameters"); + } + else if (msgLvl(MSG::DEBUG)) { + od0 = origPerigee->parameters()[Trk::d0]; + oz0 = origPerigee->parameters()[Trk::z0]; + ophi0 = origPerigee->parameters()[Trk::phi0]; + otheta = origPerigee->parameters()[Trk::theta]; + oqOverP = origPerigee->parameters()[Trk::qOverP]; + ATH_MSG_DEBUG ("Original parameters " << od0 << " " << oz0 << " " << ophi0 << " " << otheta << " " << oqOverP); + } + + // get the barcode of truth particle matched to the track + float minProb(0); + + // copy from DenseEnvironmentsAmbiguityProcessorTool.cxx + ElementLink<TrackCollection> tracklink; + tracklink.setElement(const_cast<Trk::Track*>(*itr)); + tracklink.setStorableObject(*tracks); + const ElementLink<TrackCollection> tracklink2=tracklink; + + TrackTruthCollection::const_iterator found = truthMap->find(tracklink2); + if ( found == truthMap->end() ) { continue; } + if ( !found->second.particleLink().isValid() ) { continue; } + if ( found->second.probability() < minProb ) { continue; } + int barcodeToMatch = found->second.particleLink().barcode(); + ATH_MSG_DEBUG ("Barcode to match " << barcodeToMatch); + + // now that have the track, loop through and build a new set of measurements for a track fit + std::vector<const Trk::MeasurementBase*> measurementSet; + std::vector<const Trk::MeasurementBase*> trash; + + ATH_MSG_DEBUG ("Loop over measurementsOnTrack " << (*itr)->measurementsOnTrack()->size() ); + for (auto measurement : *((*itr)->measurementsOnTrack())) { + ATH_MSG_DEBUG ("Next Measurement: " << *measurement); + + // Get measurement as RIO_OnTrack + const Trk::RIO_OnTrack* rio = dynamic_cast <const Trk::RIO_OnTrack*>( measurement ); + if (rio == nullptr) { + ATH_MSG_WARNING("Cannot get RIO_OnTrack from measurement. Hit will NOT be included in track fit."); + continue; + } + + // if not a pixel cluster, keep the measurement as is and press on + const Identifier& surfaceID = (rio->identify()) ; + if( !m_idHelper->is_pixel(surfaceID) ) { + measurementSet.push_back( measurement ); + continue; + } + + // only PIXEL CLUSTERS from here on + const InDet::PixelCluster* pix = dynamic_cast<const InDet::PixelCluster*>(rio->prepRawData()); + if (pix == nullptr) { + ATH_MSG_WARNING("Cannot get PixelCluster from RIO_OnTrack"); + continue; + } + + const InDetDD::SiDetectorElement* element = pix->detectorElement(); + const InDetDD::SiDetectorDesign* design = static_cast<const InDetDD::SiDetectorDesign*>(&element->design()); + // To locate cluster module + Identifier clusterId = pix->identify(); + int bec = m_pixelID->barrel_ec(clusterId); + int layer_disk = m_pixelID->layer_disk(clusterId); + + // Do any SDOs in reconstructed cluster match barcodeToMatch + // Should always return true for pseudotracks. For reco tracks could differ + bool hasSDOMatch = IsClusterFromTruth( pix, barcodeToMatch, *sdoCollection ); + + // --- hit flags' logic + // m_saveWrongHits - only has impact on reco track, where hit might be from wrong particle + // m_fixWrongHits - fix will only work on hits that are not noise, noise hits behavior unchanged by this flag + // m_rejNoiseHits - if saving but don't want to save these + + // could be used already here to correct wrong hits + double maxEnergyDeposit(-1); + SiHit maxEDepSiHit; + + if ( !hasSDOMatch ) { + ATH_MSG_DEBUG ("No SDO matching cluster"); + // save wrong hits + if (not m_saveWrongHits) continue; + const std::vector<SiHit> matchedSiHits = matchSiHitsToCluster( -999 , pix, siHits ); + if( matchedSiHits.empty() ) { // then noise, and go to next hit + if( !m_rejNoiseHits ) { measurementSet.push_back( measurement ); } + continue; + } // is a real hit, just not from the particle in question -- will NOT go to next hit just yet + if( m_fixWrongHits ) { // if fix, use highest energy truth hit + for( auto& siHit : matchedSiHits ) { + if (siHit.energyLoss() > maxEnergyDeposit) { + maxEnergyDeposit = siHit.energyLoss(); + maxEDepSiHit = siHit; + } + } + } else { // save the wrong hit as is and go to next cluster + measurementSet.push_back( measurement ); + continue; + } + } else { // hasSDOMatch + // Get All SiHits truth matched to the reconstruction cluster for the particle associated with the track + const std::vector<SiHit> matchedSiHits = matchSiHitsToCluster( barcodeToMatch, pix, siHits ); + if( matchedSiHits.empty() ) { + ATH_MSG_WARNING ("No SiHit matching cluster"); + continue; // should NOT HAPPEN for pseudotracks + } + ATH_MSG_DEBUG ("N SiHit matching cluster: " << matchedSiHits.size()); + + // If multiple SiHits / cluster FOR THE SAME TRUTH PARTICLE, + // Take position of SiHit giving the most energy + for( auto& siHit : matchedSiHits ) { + if (siHit.energyLoss() > maxEnergyDeposit) { + maxEnergyDeposit = siHit.energyLoss(); + maxEDepSiHit = siHit; + } + } + } // if else hasSDOMatch + + // - Retrieve true position of cluster from entry/exit point of truth particle + //get average position of entry/exit point + HepGeom::Point3D<double> averagePosition = (maxEDepSiHit.localStartPosition() + maxEDepSiHit.localEndPosition()) * 0.5; + ATH_MSG_DEBUG (" Average position : " << averagePosition); + + // SiHit coordinate system i.e. localStartPosition + // z = eta -> this is y in ATLAS sensor local frame + // y = phi -> this is x in ATLAS sensor local frame + // USE hitLocalToLocal from SiDetectorElement + + HepGeom::Point3D<double> smearedPosition = smearTruthPosition( averagePosition, bec, layer_disk, design ); + ATH_MSG_DEBUG (" Smeared position : " << smearedPosition ); + + auto locparOrig = rio->localParameters(); + ATH_MSG_DEBUG(" Original locpar " << locparOrig); + + Trk::LocalParameters locpar = element->hitLocalToLocal(smearedPosition.z(), smearedPosition.y()); // eta, phi + ATH_MSG_DEBUG(" locpar " << locpar); + + InDetDD::SiLocalPosition centroid(locpar.get(Trk::loc2), locpar.get(Trk::loc1), 0); // eta, phi, depth + const Amg::Vector3D& globPos = element->globalPosition(centroid); + + InDet::SiWidth pixWidth = pix->width(); + Amg::MatrixX cov = pix->localCovariance(); + // Original code took width / nrows (or columns)* 1/sqrt(12) to check if > 0... + // only need to check width to test against 0... + // disk one is layer 0 + if(bec!=0) layer_disk++; + if(pixWidth.phiR()>0) { + float error(1.0); + error = getPhiPosResolution(layer_disk)*getPhiPosErrorFactor(layer_disk); + cov(0,0) = error*error; + } else { + ATH_MSG_WARNING("pixWidth.phiR not > 0"); + } + + if(pixWidth.z()>0) { + float error(1.0); + error = getEtaPosResolution(layer_disk)*getEtaPosErrorFactor(layer_disk); + cov(1,1) = error*error; + } else { + ATH_MSG_WARNING("pixWidth.z not > 0"); + } + + auto iH = element->identifyHash(); + + InDet::PixelClusterOnTrack* pcot = new InDet::PixelClusterOnTrack(pix,locpar,cov,iH,globPos, + pix->gangedPixel(), + false); + + if(pcot) { + measurementSet.push_back( pcot); + trash.push_back(pcot); + } else { + ATH_MSG_WARNING("Could not make new PixelClusterOnTrack"); + } + + } // loop over measurements on track + + + + ATH_MSG_DEBUG ("Fit new tracks with measurementSet : " << measurementSet.size()); + std::unique_ptr<Trk::Track> newtrack; + try { + newtrack = m_ITrackFitter->fit(ctx, + measurementSet, + *origPerigee, + m_runOutlier, + m_ParticleHypothesis); + } + catch(const std::exception& e) { + ATH_MSG_ERROR ("Refit Logic Error. No new track. Message: " << e.what()); + newtrack = 0; + } + + ATH_MSG_DEBUG ("Track fit is done!"); + + if (msgLvl(MSG::DEBUG)) { + if (!newtrack) { ATH_MSG_DEBUG ("Refit Failed"); } + else { + + ATH_MSG_VERBOSE ("re-fitted track:" << *newtrack); + const Trk::Perigee* aMeasPer = newtrack->perigeeParameters(); + if (aMeasPer==0){ + ATH_MSG_ERROR ("Could not get Trk::MeasuredPerigee"); + } else { + double d0 = aMeasPer->parameters()[Trk::d0]; + double z0 = aMeasPer->parameters()[Trk::z0]; + double phi0 = aMeasPer->parameters()[Trk::phi0]; + double theta = aMeasPer->parameters()[Trk::theta]; + double qOverP = aMeasPer->parameters()[Trk::qOverP]; + ATH_MSG_DEBUG ("Refitted parameters differences " + << (od0-d0)/od0 << " " + << (oz0-z0)/oz0 << " " + << (ophi0-phi0)/ophi0 << " " + << (otheta-theta)/otheta << " " + << (oqOverP-qOverP)/oqOverP ); + } // aMeasPer exists + } // newtrack exists + } // if debug + + if (newtrack) { newtracks.push_back(std::move(newtrack)); } + else { ATH_MSG_WARNING ("Refit Failed"); } + + } // loop over tracks + + ATH_MSG_VERBOSE ("Add PRDs to assoc tool."); + + // recreate the summaries on the final track collection with correct PRD tool + for(const std::unique_ptr<Trk::Track> &new_track : newtracks ) { + if((m_assoTool->addPRDs(*prd_to_track_map, *new_track)).isFailure()) {ATH_MSG_WARNING("Failed to add PRDs to map");} + } + + ATH_MSG_VERBOSE ("Recalculate the summary"); + // and copy tracks from vector of non-const tracks to collection of const tracks + std::unique_ptr<TrackCollection> new_track_collection = std::make_unique<TrackCollection>(); + new_track_collection->reserve(newtracks.size()); + for(std::unique_ptr<Trk::Track> &new_track : newtracks ) { + m_trkSummaryTool->computeAndReplaceTrackSummary(ctx, *new_track, false /* DO NOT suppress hole search*/); + new_track_collection->push_back(std::move(new_track)); + } + + ATH_MSG_VERBOSE ("Save tracks"); + ATH_CHECK(SG::WriteHandle<TrackCollection>(m_outputTrackCollectionName).record(std::move(new_track_collection))); + + ATH_MSG_INFO ("ReFitTrackWithTruth::execute() completed"); + return StatusCode::SUCCESS; +} + +std::vector<SiHit> Trk::ReFitTrackWithTruth::matchSiHitsToCluster( const int barcodeToMatch, + const InDet::PixelCluster* pixClus, + SG::ReadHandle<AtlasHitsVector<SiHit>> &siHitCollection) const { + + // passing a negative barcode value will not apply barcode - can get multiple SiHits upone return from different particles + + ATH_MSG_VERBOSE( " Have " << (*siHitCollection).size() << " SiHits to look through" ); + std::vector<SiHit> matchingHits; + + // Check if we have detector element -- needed to find the local position of the SiHits + const InDetDD::SiDetectorElement* de = pixClus->detectorElement(); + if(!de) { + ATH_MSG_WARNING("Do not have detector element to find the local position of SiHits!"); + return matchingHits; + } + + // To locate cluster module + Identifier clusterId = pixClus->identify(); + + std::vector<const SiHit* > multiMatchingHits; + + // match SiHits to barcode and make sure in same module as reco hit + for ( const auto& siHit : *siHitCollection) { + + if ( barcodeToMatch > 0 ) { // negative barcodeToMatch will keep all + if ( siHit.particleLink().barcode() != barcodeToMatch ) { continue; } + } + + // Check if it is a Pixel hit + if( !siHit.isPixel() ) { continue; } + + // Match to the cluster module + if( m_pixelID->barrel_ec(clusterId) != siHit.getBarrelEndcap() ) { continue; } + if( m_pixelID->layer_disk(clusterId)!= siHit.getLayerDisk() ) { continue; } + if( m_pixelID->phi_module(clusterId)!= siHit.getPhiModule() ) { continue; } + if( m_pixelID->eta_module(clusterId)!= siHit.getEtaModule() ) { continue; } + + // Have SiHits in the same module as the cluster at this point + ATH_MSG_DEBUG("Hit is on the same module"); + multiMatchingHits.push_back(&siHit); + + } // loop over SiHitCollection + + + //Now we will now make 1 SiHit for each true particle if the SiHits "touch" other + std::vector<const SiHit* >::iterator siHitIter = multiMatchingHits.begin(); + std::vector<const SiHit* >::iterator siHitIter2 = multiMatchingHits.begin(); + ATH_MSG_DEBUG( "Found " << multiMatchingHits.size() << " SiHit " ); + + // double loop - for each matching SiHit, consider all the SiHits _next_ in the collection + // to see if they overlap. + // if overlapping, combine and only consider new merged hits + for ( ; siHitIter != multiMatchingHits.end(); ++siHitIter) { + const SiHit* lowestXPos = *siHitIter; + const SiHit* highestXPos = *siHitIter; + + + // We will merge these hits + std::vector<const SiHit* > ajoiningHits; + ajoiningHits.push_back( *siHitIter ); + + siHitIter2 = siHitIter+1; + while ( siHitIter2 != multiMatchingHits.end() ) { + // Need to come from the same truth particle + + // wasn't the barcode match already done!? + if ( (*siHitIter)->particleLink().barcode() != (*siHitIter2)->particleLink().barcode() ) { + ++siHitIter2; + continue; + } + + // Check to see if the SiHits are compatible with each other. + if (std::abs((highestXPos->localEndPosition().x()-(*siHitIter2)->localStartPosition().x()))<0.00005 && + std::abs((highestXPos->localEndPosition().y()-(*siHitIter2)->localStartPosition().y()))<0.00005 && + std::abs((highestXPos->localEndPosition().z()-(*siHitIter2)->localStartPosition().z()))<0.00005 ) + { + highestXPos = *siHitIter2; + ajoiningHits.push_back( *siHitIter2 ); + // Dont use hit more than once + siHitIter2 = multiMatchingHits.erase( siHitIter2 ); + //--siHitIter2; // maybe + }else if (std::abs((lowestXPos->localStartPosition().x()-(*siHitIter2)->localEndPosition().x()))<0.00005 && + std::abs((lowestXPos->localStartPosition().y()-(*siHitIter2)->localEndPosition().y()))<0.00005 && + std::abs((lowestXPos->localStartPosition().z()-(*siHitIter2)->localEndPosition().z()))<0.00005) + { + lowestXPos = *siHitIter2; + ajoiningHits.push_back( *siHitIter2 ); + // Dont use hit more than once + siHitIter2 = multiMatchingHits.erase( siHitIter2 ); + // --siHitIter2; // maybe + } else { + ++siHitIter2; + } + } // loop over matching SiHits to see if any overlap + + if( ajoiningHits.size() == 0){ + ATH_MSG_WARNING("This should really never happen"); + continue; + } + if(ajoiningHits.size() == 1){ + // Copy Si Hit ready to return + matchingHits.push_back( *ajoiningHits[0] ); + continue; + } + // Build new SiHit and merge information together. + ATH_MSG_DEBUG("Merging " << ajoiningHits.size() << " SiHits together." ); + + + float energyDep(0); + float time(0); + for( auto& siHit : ajoiningHits){ + energyDep += siHit->energyLoss(); + time += siHit->meanTime(); + } + time /= (float)ajoiningHits.size(); + + matchingHits.push_back( SiHit(lowestXPos->localStartPosition(), + highestXPos->localEndPosition(), + energyDep, + time, + (*siHitIter)->particleLink().barcode(), + 0, // 0 for pixel 1 for Pixel + (*siHitIter)->getBarrelEndcap(), + (*siHitIter)->getLayerDisk(), + (*siHitIter)->getEtaModule(), + (*siHitIter)->getPhiModule(), + (*siHitIter)->getSide() ) ); + ATH_MSG_DEBUG("Finished Merging " << ajoiningHits.size() << " SiHits together." ); + } // loop over all matching SiHits + + return matchingHits; +} + +bool Trk::ReFitTrackWithTruth::IsClusterFromTruth( const InDet::PixelCluster* pixClus, + const int barcodeToMatch, + const InDetSimDataCollection &sdoCollection) const { + + // Should be true for all pseudotracks + // Can be false for reco tracks - misassigned hits + + bool match(false); + + // loop over reconstructed energy depoists in the cluster + for( const auto &hitIdentifier : pixClus->rdoList() ) { + + // find the rdo in the sdo collection + auto pos = sdoCollection.find(hitIdentifier); + if( pos == sdoCollection.end() ) { continue; } + + // get the barcode from each deposit + for( auto deposit : pos->second.getdeposits() ){ + if( !deposit.first ){ continue; } // if truthparticle(?) link doesn't exists? Energy deposit is still known + if( (deposit.first).barcode() != barcodeToMatch ) { continue; } + match = true; + break; + } + if(match) { break; } + } + + return match; +} + +HepGeom::Point3D<double> Trk::ReFitTrackWithTruth::smearTruthPosition( const HepGeom::Point3D<double> orig, + const int bec, + const int layer_disk, + const InDetDD::SiDetectorDesign* design) const { + + HepGeom::Point3D<double> smeared(0,0,0); + + smeared.setX(orig.x()); + + if (bec == 0) { + double smearLocY = m_random.get()->Gaus(0, getPhiPosResolution(layer_disk)); + double smearLocZ = m_random.get()->Gaus(0, getEtaPosResolution(layer_disk)); + smeared.setY(orig.y() + smearLocY); + smeared.setZ(orig.z() + smearLocZ); + + } else { + + smeared.setY(orig.y()); + smeared.setZ(orig.z()); + } + + //check for module boundaries + if (smeared.y()>design->width()/2) { + smeared.setY(design->width()/2-1e-6); + } else if (smeared.y()<-design->width()/2) { + smeared.setY(-design->width()/2+1e-6); + } + if (smeared.z()>design->length()/2) { + smeared.setZ(design->length()/2-1e-6); + } else if (smeared.z()<-design->length()/2) { + smeared.setZ(-design->width()/2+1e-6); + } + + + return smeared; +} + +double Trk::ReFitTrackWithTruth::getPhiPosResolution(int layer) const { return m_resolutionRPhi[layer]; } +double Trk::ReFitTrackWithTruth::getEtaPosResolution(int layer) const { return m_resolutionZ[layer]; } + +double Trk::ReFitTrackWithTruth::getPhiPosErrorFactor(int layer) const { return m_errorRPhi[layer]; } +double Trk::ReFitTrackWithTruth::getEtaPosErrorFactor(int layer) const { return m_errorZ[layer]; } diff --git a/Tracking/TrkFitter/TrkRefitAlg/src/components/TrkRefitAlg_entries.cxx b/Tracking/TrkFitter/TrkRefitAlg/src/components/TrkRefitAlg_entries.cxx index 1be0df3e88ed8113b7809d8e1b792d23ea673416..e768e8261d7b7ae44613930c1f5f760a954d3dba 100644 --- a/Tracking/TrkFitter/TrkRefitAlg/src/components/TrkRefitAlg_entries.cxx +++ b/Tracking/TrkFitter/TrkRefitAlg/src/components/TrkRefitAlg_entries.cxx @@ -1,5 +1,7 @@ #include "TrkRefitAlg/ReFitTrack.h" +#include "TrkRefitAlg/ReFitTrackWithTruth.h" using namespace Trk; DECLARE_COMPONENT( Trk::ReFitTrack ) +DECLARE_COMPONENT( Trk::ReFitTrackWithTruth ) diff --git a/Tracking/TrkG4Components/TrkG4UserActions/python/Geant4MSFollowing.py b/Tracking/TrkG4Components/TrkG4UserActions/python/Geant4MSFollowing.py new file mode 100644 index 0000000000000000000000000000000000000000..e1e58293689a06594e7294556b09e25fd456d40a --- /dev/null +++ b/Tracking/TrkG4Components/TrkG4UserActions/python/Geant4MSFollowing.py @@ -0,0 +1,258 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +#============================================================== +# +# +# This job option runs the G4 simulation +# of the ATLAS detector and the GeantFollower in ID (and MS) +# +#============================================================== + +from AthenaCommon.Constants import DEBUG, INFO + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + + +# Argument parsing +def setupArgParser(): + from argparse import ArgumentParser + parser = ArgumentParser() + parser.add_argument("--inputevntfile", + default="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root", + type=str, + help="The input EVNT file to use") + parser.add_argument("--outputhitsfile", + default="myHITS.pool.root", + type=str, + help="The output HITS filename") + parser.add_argument("--geometrytag", + default="ATLAS-R3S-2021-03-00-00", + type=str, + help="The geometry tag to use") + parser.add_argument("--globaltag", + default="OFLCOND-MC21-SDR-RUN3-09", + type=str, + help="The global tag to use") + parser.add_argument("--myPDG", + default=998, + type=int, + help="PDG for particle gun sim. 998 = Charged Geantino 999 = neutral Geantino, 13 = Muon") + parser.add_arument("--maxEvents", + default=100, + type = int, + help="Maximum number of events to run on.") + return parser + + +def MSCfg(flags): + # Setup main services + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + acc = MainServicesCfg(flags) + + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + acc.merge(PoolReadCfg(flags)) + + #from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg + #acc.merge(PoolWriteCfg(flags)) + + from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg + acc.merge(BeamSpotCondAlgCfg(flags)) + + from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg + acc.merge(BeamEffectsAlgCfg(flags)) + + from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg + acc.merge(BeamPipeGeometryCfg(flags)) + + from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig import TrackingGeometryCondAlgCfg + acc.merge(TrackingGeometryCondAlgCfg(flags)) + + from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg + acc.merge(TrackingGeometrySvcCfg(flags)) + + return acc + +def ExtrapolationToolCfg(flags, args): + + acc = ComponentAccumulator() + + # the layer material inspector + LayerMaterialInspector = CompFactory.Trk.LayerMaterialInspector("LayerMaterialInspector", + OutputLevel=INFO) + acc.addPublicTool(LayerMaterialInspector) + + # the tracking volume displayer + from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags + TrackingVolumeDisplayer = CompFactory.Trk.TrackingVolumeDisplayer("TrackingVolumeDisplayer", + TrackingVolumeOutputFile='TrackingVolumes-'+TrkDetFlags.MaterialMagicTag()+'.C', + LayerOutputFile='Layers-'+TrkDetFlags.MaterialMagicTag()+'.C', + SurfaceOutputFile='Surfaces-'+TrkDetFlags.MaterialMagicTag()+'.C') + acc.addPublicTool(TrackingVolumeDisplayer) + + # PROPAGATOR DEFAULTS + TestPropagators = [] + TestPropagator = CompFactory.Trk.RungeKuttaPropagator("TestPropagator") + acc.addPublicTool(TestPropagator) + TestPropagators += [TestPropagator] + + from TrkConfig.TrkExSTEP_PropagatorConfig import AtlasSTEP_PropagatorCfg + TestSTEP_Propagator = acc.popToolsAndMerge(AtlasSTEP_PropagatorCfg(flags, name="TestSTEP_Propagator", DetailedEloss=True)) + TestPropagators += [TestSTEP_Propagator] + + TestSTEP_Propagator.Straggling = False + + if args.myPDG == 998 : + TestSTEP_Propagator.MultipleScattering = False + TestSTEP_Propagator.EnergyLoss = False + + # UPDATOR DEFAULTS + TestUpdators = [] + + TestMaterialEffectsUpdator = CompFactory.Trk.MaterialEffectsUpdator("TestMaterialEffectsUpdator") + acc.addPublicTool(TestMaterialEffectsUpdator) + if args.myPDG == 998 : + TestMaterialEffectsUpdator.EnergyLoss = False + TestMaterialEffectsUpdator.MultipleScattering = False + + TestUpdators += [TestMaterialEffectsUpdator] + + TestMaterialEffectsUpdatorLandau = CompFactory.Trk.MaterialEffectsUpdator("TestMaterialEffectsUpdatorLandau", + LandauMode=True) + acc.addPublicTool(TestMaterialEffectsUpdatorLandau) + + if args.myPDG == 998 : + TestMaterialEffectsUpdatorLandau.EnergyLoss = False + TestMaterialEffectsUpdatorLandau.MultipleScattering = False + + ##testUpdators += [ testMaterialEffectsUpdatorLandau ] + + # the UNIQUE NAVIGATOR ( === UNIQUE GEOMETRY) + TestNavigator = CompFactory.Trk.Navigator("TestNavigator", + TrackingGeometrySvc="Trk::TrackingGeometrySvc/AtlasTrackingGeometrySvc") + acc.addPublicTool(TestNavigator) + + # CONFIGURE PROPAGATORS/UPDATORS ACCORDING TO GEOMETRY SIGNATURE + + TestSubPropagators = [] + TestSubUpdators = [] + + # -------------------- set it depending on the geometry ---------------------------------------------------- + # default for ID is (Rk,Mat) + TestSubPropagators += [ TestPropagator.name ] + TestSubUpdators += [ TestMaterialEffectsUpdator.name ] + + # default for Calo is (Rk,MatLandau) + TestSubPropagators += [ TestPropagator.name ] + TestSubUpdators += [ TestMaterialEffectsUpdator.name ] + + TestSubPropagators += [ TestPropagator.name ] + TestSubUpdators += [ TestMaterialEffectsUpdator.name ] + + # default for MS is (STEP,Mat) + TestSubPropagators += [ TestSTEP_Propagator.name ] + TestSubUpdators += [ TestMaterialEffectsUpdator.name ] + + TestSubPropagators += [ TestSTEP_Propagator.name ] + TestSubUpdators += [ TestMaterialEffectsUpdator.name ] + + TestSubPropagators += [ TestPropagator.name ] + TestSubUpdators += [ TestMaterialEffectsUpdator.name ] + # ---------------------------------------------------------------------------------------------------------- + + # AtlasELossUpdater = acc.popToolsAndMerge(TC.AtlasEnergyLossUpdatorCfg(flags)) + # AtlasEnergyLossUpdater = AtlasELossUpdater + + AtlasEnergyLossUpdator = CompFactory.Trk.EnergyLossUpdator("AtlasEnergyLossUpdator", + DetailedEloss=True) + acc.addPublicTool(AtlasEnergyLossUpdator) + # AtlasELossUpdater = acc.popToolsAndMerge(TC.AtlasEnergyLossUpdatorCfg(flags)) + # AtlasEnergyLossUpdater = AtlasELossUpdater + + # from TrkConfig.AtlasExtrapolatorToolsConfig as TC + # AtlasEnergyLossUpdator = acc.popToolsAndMerge(AtlasEnergyLossUpdatorCfg(flags, name="AtlasEnergyLossUpdator", DetailedEloss=True) ) + + # call the base class constructor + TestExtrapolator = CompFactory.Trk.Extrapolator("TestExtrapolator", + Navigator = TestNavigator, + MaterialEffectsUpdators = TestUpdators, + STEP_Propagator = TestSTEP_Propagator.name, + Propagators = TestPropagators, + SubPropagators = TestSubPropagators, + SubMEUpdators = TestSubUpdators, + EnergyLossUpdater = AtlasEnergyLossUpdator + ) + acc.addPublicTool(TestExtrapolator) + # acc.setPrivateTools(TestExtrapolator) + + return acc + + +def GeantFollowerMSCfg(flags, name="GeantFollowerMSSvc", **kwargs): + + result = ComponentAccumulator() + from TrkConfig.AtlasExtrapolatorConfig import MuonExtrapolatorCfg + extrapolator = result.getPrimaryAndMerge(MuonExtrapolatorCfg(flags)) + result.addPublicTool(extrapolator) + + #Setup Helper + followingHelper = CompFactory.Trk.GeantFollowerMSHelper("GeantFollowerMSHelper", + Extrapolator= extrapolator, + ExtrapolateDirectly=False, + ExtrapolateIncrementally=False, + SpeedUp=True, + OutputLevel=DEBUG) + result.addPublicTool(followingHelper, primary = True) + + #Setting up the CA for the GeantFollowerMS + from G4AtlasServices.G4AtlasUserActionConfig import getDefaultActions + kwargs.setdefault("UserActionTools", result.popToolsAndMerge(getDefaultActions(flags))) + result.addService(CompFactory.G4UA.UserActionSvc(name, **kwargs)) + return result + + +if __name__ =="__main__": + from AthenaConfiguration.AllConfigFlags import initConfigFlags + + args = setupArgParser().parse_args() + # Configure + flags = initConfigFlags() + flags.Input.Files = [args.inputevntfile] # default: ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root'] + flags.Output.HITSFileName = args.outputhitsfile # default: "myHITS.pool.root" + flags.GeoModel.AtlasVersion = args.geometrytag # default: "ATLAS-R3S-2021-03-00-00" + flags.IOVDb.GlobalTag = args.globaltag # default: "OFLCOND-MC21-SDR-RUN3-09" + flags.Input.isMC = True + flags.GeoModel.Align.Dynamic = False + flags.Concurrency.NumThreads =1 + flags.Concurrency.NumConcurrentEvents = 1 + # Setup detector + from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList + detectors = ["Muon","ID","Bpipe"] + setupDetectorsFromList(flags, detectors, toggle_geometry=True) + + flags.lock() + flags.dump() + + + # Construct component accumulator + acc = MSCfg(flags) + acc.printConfig(withDetails=True) + acc.merge(GeantFollowerMSCfg(flags)) + + #DEV# + #Setting up the CA for the GeantFollowerMS + from TrkG4UserActions.TrkG4UserActionsConfig import GeantFollowerMSToolCfg + GeantFollowerMSTool = acc.getPrimaryAndMerge(GeantFollowerMSToolCfg(flags)) + #DEV# + + from G4AtlasAlg.G4AtlasAlgConfig import G4AtlasAlgCfg + acc.merge(G4AtlasAlgCfg(flags,UserActionTools=[GeantFollowerMSTool], + ExtraInputs=[( 'Trk::TrackingGeometry' , 'ConditionStore+AtlasTrackingGeometry'), + ( 'AtlasFieldCacheCondObj' , 'ConditionStore+fieldCondObj' )])) + + #from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + #from SimuJobTransforms.SimOutputConfig import getStreamHITS_ItemList + #acc.merge(OutputStreamCfg(flags,"HITS", ItemList=getStreamHITS_ItemList(flags), disableEventTag=True, AcceptAlgs=['MSG4AtlasAlg'])) + + # Execute + import sys + sys.exit(not acc.run(maxEvents=args.maxEvents).isSuccess()) diff --git a/Tracking/TrkG4Components/TrkG4UserActions/python/TrkG4UserActionsConfig.py b/Tracking/TrkG4Components/TrkG4UserActions/python/TrkG4UserActionsConfig.py index 2dc156adb4dcdabe3e63771d47f92d79f23ac336..f9007e98aa041d62293c529b26329588d3f9a65b 100644 --- a/Tracking/TrkG4Components/TrkG4UserActions/python/TrkG4UserActionsConfig.py +++ b/Tracking/TrkG4Components/TrkG4UserActions/python/TrkG4UserActionsConfig.py @@ -82,3 +82,16 @@ def MaterialStepRecorder(configFlags, name="G4UA::ISFFullUserActionSvc", **kwarg result.addEventAlgo(outputStream) return result + +def GeantFollowerMSToolCfg(configFlags, name="G4UA::GeantFollowerMSTool", **kwargs): + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + from AthenaConfiguration.ComponentFactory import CompFactory + + THistSvc= CompFactory.THistSvc + result = ComponentAccumulator() + histsvc = THistSvc(name="THistSvc") + histsvc.Output = ["val DATAFILE='GeantFollowing.root' OPT='RECREATE'"] + result.addService(histsvc) + result.setPrivateTools(CompFactory.G4UA.GeantFollowerMSTool(name, **kwargs)) + + return result \ No newline at end of file diff --git a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h index c5b3ced2b664d7c3d767a0d19c638378018cdaef..8a70e480ff7d485c599dd0a5cf8527941db93a5d 100644 --- a/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h +++ b/Tracking/TrkTools/TrkParticleCreator/TrkParticleCreator/TrackParticleCreatorTool.h @@ -174,6 +174,10 @@ public: /** Add shared hit info not computed in Trk::TrkSummary anymore*/ void addSharedHitInformation(const Track *track, xAOD::TrackParticle& tp) const; + /** Add dummy endcap shared hit info as AuxDyn variable in case nominal shared hit info not computed (for ITk fast tracking) */ + void addDummyEndcapSharedHitInformation(xAOD::TrackParticle& tp) const; + + /** Method to set Defining parameters of a xAOD::TrackParticle */ void setDefiningParameters(xAOD::TrackParticle& tp, const Perigee& perigee) const; diff --git a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx index a246535cb186956f72fca1c5ed209ff3acdbafa6..3af63fdd0edebe6fb3bc619102a895f4cd243e6a 100644 --- a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx +++ b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx @@ -725,6 +725,7 @@ TrackParticleCreatorTool::createParticle(const EventContext& ctx, addExpectedHitInformation(track->perigeeParameters(), *trackparticle); addOutlierHitInformation(track->trackStateOnSurfaces(), *trackparticle); if(m_doSharedSiHits || m_doSharedTRTHits) addSharedHitInformation(track, *trackparticle); + else if(m_doITk) addDummyEndcapSharedHitInformation(*trackparticle); } const auto* beamspot = CacheBeamSpotData(ctx); @@ -1260,6 +1261,22 @@ TrackParticleCreatorTool::addSharedHitInformation(const Track *track, xAOD::Trac } + +void +TrackParticleCreatorTool::addDummyEndcapSharedHitInformation(xAOD::TrackParticle& tp) const +{ + + uint8_t nInPixSharedEndcapHits = 0, nNInPixSharedEndcapHits = 0; + uint8_t nInPixSplitEndcapHits = 0, nNInPixSplitEndcapHits = 0; + + tp.setSummaryValue(nInPixSplitEndcapHits, xAOD::numberOfInnermostPixelLayerSplitEndcapHits); + tp.setSummaryValue(nNInPixSplitEndcapHits, xAOD::numberOfNextToInnermostPixelLayerSplitEndcapHits); + tp.setSummaryValue(nInPixSharedEndcapHits, xAOD::numberOfInnermostPixelLayerSharedEndcapHits); + tp.setSummaryValue(nNInPixSharedEndcapHits, xAOD::numberOfNextToInnermostPixelLayerSharedEndcapHits); + +} + + const Trk::ClusterSplitProbabilityContainer::ProbabilityInfo& TrackParticleCreatorTool::getClusterSplittingProbability(const InDet::PixelCluster* pix) const { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCore.h b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCore.h index 4175700b91b86b6ffb31befed202deba2ec20094..d17cada623334fcedff0919da919911af664052e 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCore.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCore.h @@ -89,6 +89,7 @@ namespace Trk { CascadeEvent * m_cascadeEvent=nullptr; public: ForCFT vk_forcft; + bool m_frozenVersionForBTagging = false; }; } // end of namespace bracket diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx index 3e986e0d7e02eb6dbb3384e88981f27767b45e57..900a36593db64ab02f4d53599015c4fb8b8ce690 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx @@ -169,7 +169,7 @@ int fitVertex(VKVertex * vk) extern int cfInv5(double *cov, double *wgt ); extern void cfTrkCovarCorr(double *cov); extern void applyConstraints(VKVertex * vk); - extern void robtest(VKVertex * , long int ); + extern void robtest(VKVertex * , int ifl, int nIteration=10); // // New datastructure @@ -312,8 +312,8 @@ int fitVertex(VKVertex * vk) trk = vk->TrackList[tk].get(); protectCurvatureSign( trk->refPerig[4], trk->fitP[2] , trk->WgtM); } /*-------------------------------- Now the fit itself -----------------*/ - if (vrtForCFT.irob != 0) {robtest(vk, 0);} // ROBUSTIFICATION new data structure - if (vrtForCFT.irob != 0) {robtest(vk, 1);} // ROBUSTIFICATION new data structure + if (vrtForCFT.irob != 0) {robtest(vk, 0, it);} // ROBUSTIFICATION new data structure + if (vrtForCFT.irob != 0) {robtest(vk, 1, it);} // ROBUSTIFICATION new data structure for( tk=0; tk<NTRK; tk++){ trk = vk->TrackList[tk].get(); trk->iniP[0]=trk->cnstP[0]=trk->fitP[0]; //use fitted track parameters as initial guess @@ -339,7 +339,7 @@ int fitVertex(VKVertex * vk) chi22s = chi21s * 1.01 + 10.; //for safety if ( vShift < 10.*vkalShiftToTrigExtrapolation) { // REASONABLE DISPLACEMENT - RECALCULATE /* ROBUSTIFICATION */ - if (vrtForCFT.irob != 0) {robtest(vk, 1);} // ROBUSTIFICATION new data structure + if (vrtForCFT.irob != 0) {robtest(vk, 1, it+1);} // ROBUSTIFICATION new data structure //Reset mag.field for( i=0; i<3; i++) dparst[i]=vk->refIterV[i]+vk->fitV[i]; // fitted vertex at global frame vrtForCFT.localbmag=myMagFld.getMagFld(dparst,(vk->vk_fitterControl).get()); @@ -382,14 +382,17 @@ int fitVertex(VKVertex * vk) /*---------------------Normal convergence--------------------*/ double PrecLimit = std::min(chi22s*1.e-4, vrtForCFT.IterationPrecision); //std::cout<<"Convergence="<< chi2df <<"<"<<PrecLimit<<" cnst="<<cnstRemnants<<"<"<<ConstraintAccuracy<<'\n'; - if ((chi2df < PrecLimit) && (vShift < 0.001) && it>1 && (cnstRemnants<ConstraintAccuracy)){ - double dstFromExtrapPnt=sqrt(vk->fitV[0]*vk->fitV[0] + vk->fitV[1]*vk->fitV[1]+ vk->fitV[2]*vk->fitV[2]); - if( dstFromExtrapPnt>vkalShiftToTrigExtrapolation/2. && it < vrtForCFT.IterationNumber-15){ - forcedExtrapolation=true; - continue; // Make another extrapolation exactly to found vertex position - } - break; - } + if( ( vk->vk_fitterControl->m_frozenVersionForBTagging && it>1 ) + || (!vk->vk_fitterControl->m_frozenVersionForBTagging && (it>3||vrtForCFT.irob==0) ) ){ + if((chi2df < PrecLimit) && (vShift < 0.001) && (cnstRemnants<ConstraintAccuracy)){ + double dstFromExtrapPnt=sqrt(vk->fitV[0]*vk->fitV[0] + vk->fitV[1]*vk->fitV[1]+ vk->fitV[2]*vk->fitV[2]); + if( dstFromExtrapPnt>vkalShiftToTrigExtrapolation/2. && it < vrtForCFT.IterationNumber-15){ + forcedExtrapolation=true; + continue; // Make another extrapolation exactly to found vertex position + } + break; + } + } chi2min = std::min(chi2min,chi22s); if ((chi2min*100. < chi22s) && (chi22s>std::max( (2*NTRK-3)*10., 100.)) && (it>5)){ //std::cout<<" DIVERGENCE="<<chi22s<<" Ratio="<<chi22s/chi2min<<'\n'; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx index b80ecd1b39f8dcc0a7d96543e6aeba1026d0b557..151bc5540b08ec23e7dc9bea8d599f078ad65b2a 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx @@ -41,7 +41,7 @@ extern std::array<double, 4> getFitParticleMom( const VKTrack *, double); extern void setFittedMatrices(const double * , long int , std::vector<int> &, std::vector< std::vector<double> > &, CascadeEvent& ); extern std::vector<double> transformCovar(int , double **, const std::vector<double>& ); extern double cfVrtDstSig( VKVertex * , bool ); -extern void robtest(VKVertex * , long int ); +extern void robtest(VKVertex * , int ifl, int nIteration=10); extern int fixPseudoTrackPt(long int NPar, double * fullMtx, double * LSide, CascadeEvent&); extern void getNewCov(const double *OldCov, const double* Der, double* Cov, long int DIM) noexcept; @@ -368,8 +368,8 @@ int processCascade(CascadeEvent & cascadeEvent_ ) vpderiv(vk->passWithTrkCov, vk->FVC.Charge, dparst, vk->fitCovXYZMom, vk->FVC.vrt, vk->FVC.covvrt, vk->FVC.cvder, vk->FVC.ywgt, vk->FVC.rv0, (vk->vk_fitterControl).get()); } - if (vk->vk_fitterControl->vk_forcft.irob != 0) {robtest(vk, 0);} // ROBUSTIFICATION new data structure - if (vk->vk_fitterControl->vk_forcft.irob != 0) {robtest(vk, 1);} // ROBUSTIFICATION new data structure + if (vk->vk_fitterControl->vk_forcft.irob != 0) {robtest(vk, 0, Iter);} // ROBUSTIFICATION new data structure + if (vk->vk_fitterControl->vk_forcft.irob != 0) {robtest(vk, 1, Iter);} // ROBUSTIFICATION new data structure IERR = fitVertexCascade( vk, 1 ); if(IERR) break; //with passNear for last vertex in cascade if needed IERR = setVTrackMass(vk); if(IERR) break; //mass of combined particle // diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx index e7bb953310246a992a685fe97a83f740ba44b19e..44ee7e8fd821a7ea2fb3f13941842f64af554b51 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx @@ -9,12 +9,10 @@ namespace Trk { - -//extern void digx(double*, double*, double*, long int , long int ); extern void vkGetEigVect(const double ci[], double d[], double vect[], int n); -void robtest(VKVertex * vk, long int ifl) +void robtest(VKVertex * vk, int ifl, int nIteration=10) { long int i, j, k, kk, it; double rob, res, c[5], darg, absX, roba[5]; @@ -40,26 +38,15 @@ void robtest(VKVertex * vk, long int ifl) double Scl = vk->vk_fitterControl->vk_forcft.RobustScale; //Tuning constant double C; // Breakdown constant + if(!vk->vk_fitterControl->m_frozenVersionForBTagging)Scl *= (1.+exp(3.-nIteration)); //Annealing + if ( ifl == 0) { /* FILLING OF EIGENVALUES AND VECTORS */ - for (it = 0; it < NTRK ; ++it) { /* RESTORE MATRIX */ + for (it = 0; it < NTRK ; ++it) { /* RESTORE MATRIX */ VKTrack *trk=vk->TrackList[it].get(); if(trk->Id < 0) continue; // Not a real track - //k = 0; double dest[5][5]; - //for (i = 0; i < 5; ++i) { - //for (j = 0; j <= i; ++j) { - // dest[i][j] = trk->WgtM[k]; - // dest[j][i] = trk->WgtM[k]; - // ++k; - // } - //} - //digx(&dest[0][0], &(vk->TrackList[it]->e[0]), &(vk->TrackList[it]->v[0][0]), 5, 1); vkGetEigVect(trk->WgtM, trk->e ,&(trk->v[0][0]), 5); - } -//std::cout.precision(9); std::cout<<"Rob="<<irob<<'\n'; -//std::cout<<" Ini="<<vk->TrackList[0]->WgtM[0]<<", "<<vk->TrackList[0]->WgtM[1]<<", "<<vk->TrackList[0]->WgtM[2] -// <<", "<<vk->TrackList[0]->WgtM[3]<<", "<<vk->TrackList[0]->WgtM[4]<<", "<<vk->TrackList[0]->WgtM[5] -// <<", "<<vk->TrackList[0]->WgtM[6]<<", "<<vk->TrackList[0]->WgtM[7]<<", "<<vk->TrackList[0]->WgtM[8]<<'\n'; - return; + } + return; } /* -- */ double halfPi=M_PI/2.; @@ -74,9 +61,6 @@ void robtest(VKVertex * vk, long int ifl) c[3] += trk->rmnd[k] * trk->v[3][k]; c[4] += trk->rmnd[k] * trk->v[4][k]; } -//std::cout<<"rm="<<trk->rmnd[0]<<", "<<trk->rmnd[1]<<", "<<trk->rmnd[2]<< -// ", "<<trk->rmnd[3]<<", "<<trk->rmnd[4]<<", "<<'\n'; -//std::cout<<" c="<<c[0]<<", "<<c[1]<<", "<<c[2]<<", "<<c[3]<<", "<<c[4]<<", "<<'\n'; for (k = 0; k < 5; ++k) { darg = c[k]*c[k]*trk->e[k]; if(darg < 1.e-10) darg = 1.e-10; @@ -102,7 +86,6 @@ void robtest(VKVertex * vk, long int ifl) roba[k] = rob; if(rob>0.99)roba[k] = 1.; //To improve precision } -//std::cout<<"robn="<<roba[0]<<", "<<roba[1]<<", "<<roba[2]<<", "<<roba[3]<<", "<<roba[4]<<", "<<irob<<'\n'; for (i = 0; i < 5; ++i) if(roba[i]<1.e-3)roba[i]=1.e-3; kk = 0; for (i = 0; i < 5; ++i) { @@ -118,9 +101,6 @@ void robtest(VKVertex * vk, long int ifl) vk->vk_fitterControl->vk_forcft.robres[it] = roba[0] * roba[1] * roba[2] * roba[3] * roba[4]; if(vk->vk_fitterControl->vk_forcft.robres[it]>1.)vk->vk_fitterControl->vk_forcft.robres[it]=1.; } -//std::cout<<" Fin="<<vk->TrackList[0]->WgtM[0]<<", "<<vk->TrackList[0]->WgtM[1]<<", "<<vk->TrackList[0]->WgtM[2] -// <<", "<<vk->TrackList[0]->WgtM[3]<<", "<<vk->TrackList[0]->WgtM[4]<<", "<<vk->TrackList[0]->WgtM[5] -// <<", "<<vk->TrackList[0]->WgtM[6]<<", "<<vk->TrackList[0]->WgtM[7]<<", "<<vk->TrackList[0]->WgtM[8]<<'\n'; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx index d2562b6a246790436d166e54082e614b2b7dc4f7..408bb7f04d6aa08e15c9207b3b6549b95c749f0f 100644 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx @@ -30,7 +30,8 @@ namespace Trk { m_vrtMassTot(-1), m_vrtMassError(-1), m_cascadeEvent(nullptr), - vk_forcft() + vk_forcft(), + m_frozenVersionForBTagging(false) { } VKalVrtControl::VKalVrtControl(const VKalVrtControl & src) @@ -38,7 +39,8 @@ namespace Trk { m_vrtMassTot(src.m_vrtMassTot), m_vrtMassError(src.m_vrtMassError), m_cascadeEvent(src.m_cascadeEvent), - vk_forcft(src.vk_forcft) + vk_forcft(src.vk_forcft), + m_frozenVersionForBTagging(src.m_frozenVersionForBTagging) { } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h index 6f39d20a34f5ac785822f8384be2bf7745eea839..bc42604898d8c2f1ae4c96e6965a907116fe920a 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/TrkVKalVrtFitter/TrkVKalVrtFitter.h @@ -351,6 +351,7 @@ namespace Trk{ bool m_useZPointingCnst; bool m_usePassNear; bool m_usePassWithTrkErr; + bool m_frozenVersionForBTagging; void initCnstList(); // Track material effects control @@ -426,6 +427,7 @@ namespace Trk{ bool m_useZPointingCnst = false; bool m_usePassNear = false; bool m_usePassWithTrkErr = false; + bool m_frozenVersionForBTagging = false; std::vector<double> m_VertexForConstraint; std::vector<double> m_CovVrtForConstraint; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/SetFitOptions.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/SetFitOptions.cxx index 35a4dbd4a50904918da472d8aa0251b4346fc3f3..d1c4c391ee760a195135ecdd5766420f8dd0d597 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/SetFitOptions.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/SetFitOptions.cxx @@ -57,6 +57,8 @@ namespace Trk{ if(state.m_usePassNear) state.m_vkalFitControl.setUsePassNear(1); if(state.m_usePassWithTrkErr)state.m_vkalFitControl.setUsePassNear(2); + if(state.m_frozenVersionForBTagging)state.m_vkalFitControl.m_frozenVersionForBTagging=true; + if(m_IterationPrecision>0.) state.m_vkalFitControl.setIterationPrec(m_IterationPrecision); if(m_IterationNumber) state.m_vkalFitControl.setIterationNum(m_IterationNumber); } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx index 3f9a92c60f4946ec6928648f0fd7db559ae7416e..3d3fa1f91438c570019863aee13426b530cd0b8a 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkVKalVrtFitter.cxx @@ -54,7 +54,8 @@ TrkVKalVrtFitter:: TrkVKalVrtFitter(const std::string& type, m_usePointingCnst(false), m_useZPointingCnst(false), m_usePassNear(false), - m_usePassWithTrkErr(false) + m_usePassWithTrkErr(false), + m_frozenVersionForBTagging(false) { declareInterface<IVertexFitter>(this); declareInterface<ITrkVKalVrtFitter>(this); @@ -93,6 +94,7 @@ TrkVKalVrtFitter:: TrkVKalVrtFitter(const std::string& type, declareProperty("useZPointingCnst", m_useZPointingCnst); declareProperty("usePassNearCnst", m_usePassNear); declareProperty("usePassWithTrkErrCnst", m_usePassWithTrkErr); + declareProperty("FrozenVersionForBTagging", m_frozenVersionForBTagging); // /*--------------------------------------------------------------------------*/ @@ -177,6 +179,7 @@ StatusCode TrkVKalVrtFitter::initialize() if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "TrkVKalVrtFitter initialize() successful" << endmsg; if(msgLvl(MSG::DEBUG)){ msg(MSG::DEBUG)<< "TrkVKalVrtFitter configuration:" << endmsg; + msg(MSG::DEBUG)<< " Frozen version for BTagging: "<< m_frozenVersionForBTagging <<endmsg; msg(MSG::DEBUG)<< " A priori vertex constraint: "<< m_useAprioriVertex <<endmsg; msg(MSG::DEBUG)<< " Angle dTheta=0 constraint: "<< m_useThetaCnst <<endmsg; msg(MSG::DEBUG)<< " Angle dPhi=0 constraint: "<< m_usePhiCnst <<endmsg; @@ -254,6 +257,7 @@ void TrkVKalVrtFitter::initState (const EventContext& ctx, State& state) const state.m_Robustness = m_Robustness; state.m_RobustScale = m_RobustScale; state.m_MassInputParticles = m_c_MassInputParticles; + state.m_frozenVersionForBTagging = m_frozenVersionForBTagging; } /** Interface for MeasuredPerigee with starting point */ diff --git a/Trigger/EFTracking/EFTrackingEmulation/CMakeLists.txt b/Trigger/EFTracking/EFTrackingEmulation/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..027be34fa6506ad95750c5390c6ec8c2969d61b9 --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +atlas_subdir ( EFTrackingEmulation ) + +atlas_add_library (EFTrackingEmulationLib + EFTrackingEmulation/*.h src/*.cxx src/FitFunctions/L1TT/* + NO_PUBLIC_HEADERS + LINK_LIBRARIES AnaAlgorithmLib xAODTracking TrkEventTPCnv TrkEventPrimitives) + + +atlas_add_component (EFTrackingEmulation + src/components/*.cxx + LINK_LIBRARIES EFTrackingEmulationLib ) + + +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select=ATL900,ATL901 ) + +atlas_add_test( EFTrackingSmearingConfig + SCRIPT python -m EFTrackingEmulation.EFTrackingSmearingConfig + POST_EXEC_SCRIPT noerror.sh ) diff --git a/Trigger/EFTracking/EFTrackingEmulation/README b/Trigger/EFTracking/EFTrackingEmulation/README new file mode 100644 index 0000000000000000000000000000000000000000..291316ab79c26f897d0d0a0ebb0f804edccac0d3 --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/README @@ -0,0 +1,14 @@ +EFTrackingEmulation + +This package contains tools to emulate EFTracking performance + +FakeTrackSmearer: + - class to smear track parameters and eventually add fake tracks + + +EFTrackingSmearingAlg: + - Athena algorithm to retreive input TrackParticleContainer and produce a smeared TrackParticleContainer + + +EFTrackingSmearingConfig: + - contains the configuraiton of EFTrackingSmearingAlg and an example of how to implement in a job (as unit test) \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingEmulation/python/EFTrackingSmearingConfig.py b/Trigger/EFTracking/EFTrackingEmulation/python/EFTrackingSmearingConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..5518f859ae8594c581a9afae29e65118fbc245dc --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/python/EFTrackingSmearingConfig.py @@ -0,0 +1,65 @@ + +#Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaCommon.Constants import INFO +from AthenaCommon.Logging import logging +_log = logging.getLogger(__name__) + +def EFTrackingSmearingCfg(flags, name = "EFTrackingSmearingAlg", **kwargs): + # set common parameters + + histSvc = CompFactory.THistSvc(Output=["EFTrackingSmearingAlg DATAFILE='EFTrackingSmearingAlg.root' OPT='RECREATE'"]) + + result = ComponentAccumulator() + result.addService(histSvc) + + alg = CompFactory.EFTrackingSmearingAlg ( + OutputLevel = INFO, + OutputTrackParticleContainer = "InDetTrackParticles_smeared_SF"+str(kwargs['smearFactor']), + InputTrackParticleContainer = kwargs['InputTrackParticle'], + SmearingScaleFactor = kwargs['smearFactor'], + InputTracksPtCutGeV = kwargs['trkpTCut'], + EnableMonitoring = kwargs['EnableMonitoring'], + RootStreamName = "EFTrackingSmearingAlg", + RootDirName = "/EFTSmearing" + ) + + result.addEventAlgo(alg) + return result + + + + + +if __name__ == "__main__": + + from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + flags.Input.Files = defaultTestFiles.AOD_RUN3_MC + flags.Input.isMC=True + flags.Exec.MaxEvents = 5 + flags.lock() + + # create basic infrastructure + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + acc = MainServicesCfg(flags) + + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + acc.merge(PoolReadCfg(flags)) + + smearer = EFTrackingSmearingCfg("test", trkpTCut=1, smearFactor=1, InputTrackParticle="InDetTrackParticles", + EnableMonitoring=True) + acc.merge(smearer) + acc.wasMerged() + # debug printout + acc.printConfig(withDetails=True, summariseProps=True) + + # run the job + status = acc.run() + + # report the execution status (0 ok, else error) + import sys + sys.exit(not status.isSuccess()) + \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/EFTrackingSmearingAlg.cxx b/Trigger/EFTracking/EFTrackingEmulation/src/EFTrackingSmearingAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9d2837210f9119183d3d54ec0721199af0958c36 --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/EFTrackingSmearingAlg.cxx @@ -0,0 +1,392 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + + +#include "EFTrackingSmearingAlg.h" +#include "xAODTracking/VertexContainer.h" + +#include "TH1.h" + +#ifndef XAOD_ANALYSIS +#include "TrkEventTPCnv/helpers/EigenHelpers.h" +#include "TrkEventPrimitives/ParamDefs.h" +#else + +namespace Amg +{ + // expression template to evaluate the required size of the compressed matrix at compile time + template<int N> + struct CalculateCompressedSize { + static const int value = N + CalculateCompressedSize<N - 1>::value; + }; + + template<> + struct CalculateCompressedSize<1> { + static const int value = 1; + }; + + template<int N> + inline void compress(const AmgSymMatrix(N)& covMatrix, std::vector<float>& vec ) { + vec.reserve(CalculateCompressedSize<N>::value); + for (unsigned int i = 0; i < N ; ++i) + for (unsigned int j = 0; j <= i; ++j) + vec.push_back(covMatrix(i,j)); + } + inline void compress(const MatrixX& covMatrix, std::vector<float>& vec) { + int rows = covMatrix.rows(); + for (int i = 0; i < rows; ++i) { + for (int j = 0; j <= i; ++j) { + vec.push_back(covMatrix(i, j)); + } + } + } +} + +// from Tracking/TrkEventCnv/TrkEventTPCnv/TrkEventTPCnv/helpers/EigenHelpers.h +namespace EigenHelpers +{ + template <class VECTOR, class COVARIANCE> + inline static void eigenMatrixToVector(VECTOR& vec, COVARIANCE& cov, const char* ) { + Amg::compress(cov, vec); + } +} + +namespace Trk +{ + enum ParamDefs { + // Enums for LocalParameters - LocalPosition/ + loc1=0, loc2=1, //!< generic first and second local coordinate + locX=0, locY=1 , //!< local cartesian + locRPhi=0, locPhiR=0, locZ=1, //!< local cylindrical + locR=0, locPhi=1, //!< local polar + iPhi=0, iEta=1, //!< (old readout) will be skipped + distPhi=0, distEta=1, //!< readout for silicon + driftRadius=0, //!< trt, straws + // Enums for const Amg::Vector3D & GlobalMomentum / + x=0, y=1, z=2, //!< global position (cartesian) + px=0, py=1, pz=2, //!< global momentum (cartesian) + // Enums for Perigee // + d0=0, z0=1, phi0=2, theta=3, qOverP=4, //!< perigee + /* Enums for TrackState on Surfaces + The first two enums in the TrackParameters refer to the local Frame, i.e. + - LocalCartesian for AtanArbitraryPlane + - LocalCylindrical for AtaCylinder (includes line) + - LocalPolar for AtaDisc + The other three enums are standard \f$(\phi, \eta, \frac{q}{p_{T}})\f$ + */ + phi=2, + /**Enums for curvilinear frames*/ + u=0, v=1, + + /** Extended perigee: mass*/ + trkMass=5 + + }; //!< parameters on surface + +} +#endif + + +EFTrackingSmearingAlg::EFTrackingSmearingAlg( const std::string& name, ISvcLocator* pSvcLocator ) +: AthHistogramAlgorithm( name, pSvcLocator ){} + + +EFTrackingSmearingAlg::~EFTrackingSmearingAlg() {} + + +StatusCode EFTrackingSmearingAlg::initialize() { + ATH_MSG_INFO ("Initializing " << name() << "..."); + + ATH_MSG_INFO("########## EFTrackingSmearingAlg Configurations are ########## "); + ATH_MSG_INFO("------- InputTrackContainerName: "<<m_inputTrackContainerName); + ATH_MSG_INFO("------- OutputTrackContainerName: "<<m_outputTrackContainerName); + ATH_MSG_INFO("------- inputTracksPtCut [GeV]: "<<m_inputTracksPtCut); + ATH_MSG_INFO("------- outputTracksPtCut [GeV]: "<<m_outputTracksPtCut); + ATH_MSG_INFO("------- SmearingSigma: "<<m_SigmaScaleFactor); + ATH_MSG_INFO("------- UseResolutionPtCutOff: "<<m_UseResolutionPtCutOff); + ATH_MSG_INFO("------- SetResolutionPtCutOff: "<<m_SetResolutionPtCutOff); + ATH_MSG_INFO("------- EnableMonitoring:" <<m_enableMonitoring); + + ATH_MSG_INFO("------- IncludeDuplicatesAndFakes: "<<m_EnableFakes); + ATH_MSG_INFO("------- RandomSeed: "<<m_RandomSeed); + ATH_MSG_INFO("------- UseCoinToss: "<<m_UseCoinToss); + ATH_MSG_INFO("------- FakeKillerEnable: "<<m_FakeKillerEnable); + ATH_MSG_INFO("------- IncludeFakesInResolutionCalculation: "<<m_IncludeFakesInResolutionCalculation); + ATH_MSG_INFO("########## EFTrackingSmearingAlg Configurations: That's it. ########## "); + + ATH_MSG_INFO("Will output new track container with name "<<m_outputTrackContainerName); + + ATH_CHECK( m_inputTrackParticleKey.initialize() ); + ATH_CHECK( m_outputTrackParticleKey.initialize() ); + + // configure the Smearer + std::string smearerName = m_outputTrackContainerName+"_smearer"; + m_mySmearer = (void *) new FakeTrackSmearer(smearerName.c_str(), m_RandomSeed,msgLvl (MSG::DEBUG)); + ((FakeTrackSmearer *) m_mySmearer)->SetInputTracksPtCut(m_inputTracksPtCut); + ((FakeTrackSmearer *) m_mySmearer)->SetOutputTracksPtCut(m_outputTracksPtCut); + ((FakeTrackSmearer *) m_mySmearer)->SetSigmaScaleFactor(m_SigmaScaleFactor.value()); + ((FakeTrackSmearer *) m_mySmearer)->UseResolutionPtCutOff(m_UseResolutionPtCutOff.value()); + ((FakeTrackSmearer *) m_mySmearer)->SetResolutionPtCutOff(m_SetResolutionPtCutOff.value()); + + ((FakeTrackSmearer *) m_mySmearer)->EnableFakes(m_EnableFakes.value()); + ((FakeTrackSmearer *) m_mySmearer)->UseCoinToss(m_UseCoinToss.value()); + ((FakeTrackSmearer *) m_mySmearer)->FakeKillerEnable(m_FakeKillerEnable.value()); + ((FakeTrackSmearer *) m_mySmearer)->IncludeFakesInResolutionCalculation(m_IncludeFakesInResolutionCalculation.value()); + + + + + if (m_enableMonitoring) { + // store the smearing functions + TF1 *d0res_eta = ((FakeTrackSmearer *) m_mySmearer)->d0res_eta; + TF1 *z0res_eta = ((FakeTrackSmearer *) m_mySmearer)->z0res_eta; + TF1 *d0res_pt = ((FakeTrackSmearer *) m_mySmearer)->d0res_pt; + TF1 *z0res_pt = ((FakeTrackSmearer *) m_mySmearer)->z0res_pt; + CHECK(book(new TH1F("d0res_function_vs_eta","#eta of track",100, 0.0,4.0))); + CHECK(book(new TH1F("z0res_function_vs_eta","#eta of track",100, 0.0,4.0))); + CHECK(book(new TH1F("d0res_function_vs_pt","#pt of track",100, 4.0,200.0))); + CHECK(book(new TH1F("z0res_function_vs_pt","#pt of track",100, 4.0,200.0))); + hist("d0res_function_vs_eta")->Add(d0res_eta); + hist("z0res_function_vs_eta")->Add(z0res_eta); + hist("d0res_function_vs_pt")->Add(d0res_pt); + hist("z0res_function_vs_pt")->Add(z0res_pt); + // book historgams + CHECK(book_histograms()); + } + return StatusCode::SUCCESS; +} + +StatusCode EFTrackingSmearingAlg::finalize() { + ATH_MSG_INFO ("Finalizing " << name() << "..."); + delete((FakeTrackSmearer *)m_mySmearer); + return StatusCode::SUCCESS; +} + +StatusCode EFTrackingSmearingAlg::execute() { + ATH_MSG_DEBUG ("Executing " << name() << "..."); + + SG::ReadHandle<xAOD::TrackParticleContainer> inputTracks_handle( m_inputTrackParticleKey, getContext() ); + const xAOD::TrackParticleContainer* inputTracks = inputTracks_handle.cptr(); + if (not inputTracks) { + ATH_MSG_FATAL("Unable to retrieve input ID tacks"); + return StatusCode::FAILURE; + } + + SG::WriteHandle<xAOD::TrackParticleContainer> outputTracks_handle( m_outputTrackParticleKey, getContext() ); + auto outputTracks = std::make_unique<xAOD::TrackParticleContainer>(); + + // clear the smearear + FakeTrackSmearer *mySmearer=(FakeTrackSmearer *) m_mySmearer; + mySmearer->Clear(); + + int trackno=0; + int n_input_tracks=0; + int n_output_tracks=0; + int n_output_broad_tracks=0; + int n_output_narrow_tracks=0; + ATH_MSG_DEBUG ("Found "<<inputTracks->size()<< " input tracks"); + for ( const auto* trk : *inputTracks ) + { + xAOD::ParametersCovMatrix_t trkcov = trk->definingParametersCovMatrix(); + double theta=trk->theta(); + double pt = TMath::Sin(theta)/(1000.*trk->qOverP());// GeV + float qoverPt = trk->qOverP()*1000./TMath::Sin(theta); // GeV + ATH_MSG_DEBUG ("===> New Track: parameters: d0=" << trk->d0() + <<" z0=" << trk->z0() + <<" qoverP=" << trk->qOverP()<<" pt(GeV)="<<pt << " curvT="<<qoverPt + <<" eta=" << trk->eta() + <<" phi=" << trk->phi0() + <<" cov d0=" << trkcov(Trk::d0,Trk::d0) + <<" cov z0=" << trkcov(Trk::z0,Trk::z0) + <<" sigma d0=" << TMath::Sqrt(TMath::Abs(trkcov(Trk::d0,Trk::d0))) + <<" sigma z0=" << TMath::Sqrt(TMath::Abs(trkcov(Trk::z0,Trk::z0))) ); + + + if (TMath::Abs(pt) > m_inputTracksPtCut) + { + n_input_tracks++; + if (m_enableMonitoring) { + hist("track_input_eta")->Fill(trk->eta()); + hist("track_input_theta")->Fill(trk->theta()); + hist("track_input_pt" )->Fill(pt); + hist("track_input_phi")->Fill(trk->phi0()); + hist("track_input_z0" )->Fill(trk->z0()); + hist("track_input_d0" )->Fill(trk->d0()); + + hist("track_input_sigma_theta") ->Fill(TMath::Sqrt(trkcov(Trk::theta,Trk::theta))); + hist("track_input_sigma_qOverP")->Fill(TMath::Sqrt(trkcov(Trk::qOverP,Trk::qOverP))); + hist("track_input_sigma_phi") ->Fill(TMath::Sqrt(trkcov(Trk::phi0,Trk::phi0))); + hist("track_input_sigma_z0") ->Fill(TMath::Sqrt(trkcov(Trk::z0,Trk::z0))); + hist("track_input_sigma_d0") ->Fill(TMath::Sqrt(trkcov(Trk::d0,Trk::d0))); + } + + + mySmearer->AddTrack(trk->d0(),trk->z0(),qoverPt,trk->eta(),trk->phi0()); + n_output_tracks += mySmearer->GetNTracks(); + + ATH_MSG_DEBUG ("Looping on output track #"<< n_output_tracks); + for (int i=0;i<mySmearer->GetNTracks();i++) + { + xAOD::TrackParticle * newtrk = new xAOD::TrackParticle(*trk); + xAOD::ParametersCovMatrix_t trkcov = trk->definingParametersCovMatrix(); + + double sintheta=TMath::Sin(mySmearer->Tracks[i].theta()); + for (int ii=0;ii<5;ii++) for (int jj=0;jj<5;jj++) if (ii!=jj) trkcov(ii,jj)=0.0; + // not sure about the position of the elements below: need to cross check + trkcov(Trk::d0 ,Trk::d0 ) = mySmearer->Tracks[i].sigma_d0() * mySmearer->Tracks[i].sigma_d0() ; + trkcov(Trk::z0 ,Trk::z0 ) = mySmearer->Tracks[i].sigma_z0() * mySmearer->Tracks[i].sigma_z0() ; + trkcov(Trk::theta ,Trk::theta ) = mySmearer->Tracks[i].sigma_theta()* mySmearer->Tracks[i].sigma_theta(); + trkcov(Trk::phi0 ,Trk::phi0 ) = mySmearer->Tracks[i].sigma_phi() * mySmearer->Tracks[i].sigma_phi() ; + trkcov(Trk::qOverP,Trk::qOverP) = mySmearer->Tracks[i].sigma_curv() * mySmearer->Tracks[i].sigma_curv() *sintheta*sintheta; + if (m_enableMonitoring) { + hist("track_outputcoll_sigma_theta") ->Fill(TMath::Sqrt(trkcov(Trk::theta,Trk::theta))); + hist("track_outputcoll_sigma_qOverP")->Fill(TMath::Sqrt(trkcov(Trk::qOverP,Trk::qOverP))); + hist("track_outputcoll_sigma_phi") ->Fill(TMath::Sqrt(trkcov(Trk::phi0,Trk::phi0))); + hist("track_outputcoll_sigma_z0") ->Fill(TMath::Sqrt(trkcov(Trk::z0,Trk::z0))); + hist("track_outputcoll_sigma_d0") ->Fill(TMath::Sqrt(trkcov(Trk::d0,Trk::d0))); + } + + ATH_MSG_DEBUG ("Setting parameters covariance vector"); + auto trkcovvec = trk->definingParametersCovMatrixVec(); + trkcovvec.clear(); + EigenHelpers::eigenMatrixToVector(trkcovvec,trkcov,""); + newtrk->setDefiningParametersCovMatrixVec(trkcovvec); + + ATH_MSG_DEBUG ("Setting parameters covariance"); + newtrk->setDefiningParametersCovMatrix(trkcov); + + + ATH_MSG_DEBUG ("Smeared track: d0=" << mySmearer->Tracks[i].d0() + <<" z0=" << mySmearer->Tracks[i].z0() + <<" qoverPt (curv)=" << mySmearer->Tracks[i].curv() + <<" pT=" << mySmearer->Tracks[i].pt() + <<" pT (inverse curv)=" << 1./mySmearer->Tracks[i].curv() + <<" qoverP=" << mySmearer->Tracks[i].curv()*sintheta + <<" eta=" << mySmearer->Tracks[i].eta() + <<" phi=" << mySmearer->Tracks[i].phi() ); + + //(float d0, float z0, float phi0, float theta, float qOverP) + newtrk->setDefiningParameters( + mySmearer->Tracks[i].d0(), + mySmearer->Tracks[i].z0(), + mySmearer->Tracks[i].phi(), + mySmearer->Tracks[i].theta(), + (mySmearer->Tracks[i].curv()*sintheta) + ); + + if (m_enableMonitoring) { + hist("track_output_eta")->Fill(mySmearer->Tracks[i].eta()); + hist("track_output_theta")->Fill(mySmearer->Tracks[i].theta()); + hist("track_output_pt" )->Fill(mySmearer->Tracks[i].pt()/1000.0 ); + hist("track_output_phi")->Fill(mySmearer->Tracks[i].phi()); + hist("track_output_z0" )->Fill(mySmearer->Tracks[i].z0() ); + hist("track_output_d0" )->Fill(mySmearer->Tracks[i].d0() ); + + hist("track_outputcoll_eta")->Fill(newtrk->eta()); + hist("track_outputcoll_theta")->Fill(newtrk->theta()); + hist("track_outputcoll_pt" )->Fill(TMath::Sin(newtrk->theta())/(1000.0*newtrk->qOverP())); + hist("track_outputcoll_phi")->Fill(newtrk->phi0()); + hist("track_outputcoll_z0" )->Fill(newtrk->z0()); + hist("track_outputcoll_d0" )->Fill(newtrk->d0()); + + hist("track_delta_eta")->Fill(mySmearer->Tracks[i].eta() - trk->eta()); + hist("track_delta_crv")->Fill(1000.0*mySmearer->Tracks[i].curv()-((1000.0*trk->qOverP())/TMath::Sin(theta))); + hist("track_delta_phi")->Fill(mySmearer->Tracks[i].phi() - trk->phi0()); + hist("track_delta_z0" )->Fill(mySmearer->Tracks[i].z0() - trk->z0()); + hist("track_delta_d0" )->Fill(mySmearer->Tracks[i].d0() - trk->d0()); + + xAOD::ParametersCovMatrix_t trkcov_out = newtrk->definingParametersCovMatrix(); + hist("track_outputcoll_check_sigma_theta") ->Fill(TMath::Sqrt(trkcov_out(Trk::theta,Trk::theta))); + hist("track_outputcoll_check_sigma_qOverP")->Fill(TMath::Sqrt(trkcov_out(Trk::qOverP,Trk::qOverP))); + hist("track_outputcoll_check_sigma_phi") ->Fill(TMath::Sqrt(trkcov_out(Trk::phi0,Trk::phi0))); + hist("track_outputcoll_check_sigma_z0") ->Fill(TMath::Sqrt(trkcov_out(Trk::z0,Trk::z0))); + hist("track_outputcoll_check_sigma_d0") ->Fill(TMath::Sqrt(trkcov_out(Trk::d0,Trk::d0))); + } + // do we need this hack? + // hack!!! + // Chi2: 1 -> "Broad Fake" + // 0 -> "core tracks" + // + // NDF: index of parent track in input track collection + newtrk->setFitQuality(mySmearer->Tracks[i].FakeFlags(),trackno); + + outputTracks->push_back(newtrk); + } + + } + mySmearer->Clear(); // clear teh smearer after each input track + trackno++; + } + + CHECK( outputTracks_handle.record( std::move( outputTracks ) ) ); + ATH_MSG_DEBUG ("End of loop track #"<<n_input_tracks<<" ---> "<<" "<< n_output_tracks + <<" "<<n_output_narrow_tracks<<" "<<n_output_broad_tracks); + if (m_enableMonitoring) { + hist("n_input_tracks")->Fill(n_input_tracks); + hist("n_output_tracks")->Fill(n_output_tracks); + hist("n_output_narrow_tracks")->Fill(n_output_narrow_tracks); + hist("n_output_broad_tracks")->Fill(n_output_broad_tracks); + } + return StatusCode::SUCCESS; +} + + + + +StatusCode EFTrackingSmearingAlg::book_histograms() +{ + double b_eta[3]={50,-5,5}; + CHECK(book(new TH1F("track_input_eta","#eta of input tracks",b_eta[0],b_eta[1],b_eta[2]))); + CHECK(book(new TH1F("track_input_theta","#Theta of input tracks",50,0.0,4.0))); + CHECK(book(new TH1F("track_input_pt" ,"p_T of input tracks",50.0,-10.0,10.0))); + CHECK(book(new TH1F("track_input_phi","#phi of input tracks",50,-6.28,6.28))); + CHECK(book(new TH1F("track_input_z0" ,"z_0 of input tracks",100,-50,50))); + CHECK(book(new TH1F("track_input_d0" ,"d_0 of input tracks",50,-5,5))); + + CHECK(book(new TH1F("track_input_sigma_theta","#sigma_{#Theta} of input tracks" ,50,0.0,0.001))); + CHECK(book(new TH1F("track_input_sigma_qOverP" ,"#sigma_{q/P} of input tracks" ,50.0,0.0,0.0001))); + CHECK(book(new TH1F("track_input_sigma_phi" ,"#sigma_{#phi} of input tracks" ,50,0.0,0.002))); + CHECK(book(new TH1F("track_input_sigma_z0" ,"#sigma_{z_0} of input tracks" ,100,0.0,5 ))); + CHECK(book(new TH1F("track_input_sigma_d0" ,"#sigma_{d_0} of input tracks" ,50,0.0,5 ))); + + int maxtracks=500; + CHECK(book(new TH1F("n_input_tracks" ,"Number of input tracks" ,maxtracks,0,maxtracks))); + CHECK(book(new TH1F("n_output_tracks" ,"Number of output tracks" ,maxtracks,0,maxtracks))); + CHECK(book(new TH1F("n_output_narrow_tracks","Number of output tracks (narrow)" ,maxtracks,0,maxtracks))); + CHECK(book(new TH1F("n_output_broad_tracks" ,"Number of output tracks (broad)" ,maxtracks,0,maxtracks))); + + CHECK(book(new TH1F("track_output_eta","#eta of output tracks",50,-5,5))); + CHECK(book(new TH1F("track_output_theta","#Theta of output tracks",50,0.0,4.0))); + CHECK(book(new TH1F("track_output_pt" ,"p_T of output tracks",50,-10,10))); + CHECK(book(new TH1F("track_output_phi","#phi of output tracks",50,-6.28,6.28))); + CHECK(book(new TH1F("track_output_z0" ,"z_0 of output tracks",100,-50,50))); + CHECK(book(new TH1F("track_output_d0" ,"d_0 of output tracks",50,-5,5))); + + CHECK(book(new TH1F("track_outputcoll_eta","#eta of output tracks collection",50,-5,5))); + CHECK(book(new TH1F("track_outputcoll_theta","#Theta of output tracks collection",50,0.0,4.0))); + CHECK(book(new TH1F("track_outputcoll_pt" ,"p_T of output tracks collection",50,-10,10))); + CHECK(book(new TH1F("track_outputcoll_phi","#phi of output tracks collection",50,-6.28,6.28))); + CHECK(book(new TH1F("track_outputcoll_z0" ,"z_0 of output tracks collection",100,-50,50))); + CHECK(book(new TH1F("track_outputcoll_d0" ,"d_0 of output tracks collection",50,-5,5))); + + CHECK(book(new TH1F("track_outputcoll_sigma_theta","#sigma_{#Theta} of output tracks collection" ,50,0.0,0.001))); + CHECK(book(new TH1F("track_outputcoll_sigma_qOverP" ,"#sigma_{q/P} of output tracks collection",50.0,0.0,0.0001))); + CHECK(book(new TH1F("track_outputcoll_sigma_phi" ,"#sigma_{#phi} of output tracks collection" ,50,0.0,0.002))); + CHECK(book(new TH1F("track_outputcoll_sigma_z0" ,"#sigma_{z_0} of output tracks collection" ,100,0.0,5 ))); + CHECK(book(new TH1F("track_outputcoll_sigma_d0" ,"#sigma_{d_0} of output tracks collection" ,50,0.0,5 ))); + + CHECK(book(new TH1F("track_outputcoll_check_sigma_theta","#sigma_{#Theta} of output tracks collection" ,50,0.0,0.001))); + CHECK(book(new TH1F("track_outputcoll_check_sigma_qOverP" ,"#sigma_{q/P} of output tracks collection",50.0,0.0,0.0001))); + CHECK(book(new TH1F("track_outputcoll_check_sigma_phi" ,"#sigma_{#phi} of output tracks collection" ,50,0.0,0.002))); + CHECK(book(new TH1F("track_outputcoll_check_sigma_z0" ,"#sigma_{z_0} of output tracks collection" ,100,0.0,5 ))); + CHECK(book(new TH1F("track_outputcoll_check_sigma_d0" ,"#sigma_{d_0} of output tracks collection" ,50,0.0,5 ))); + + CHECK(book(new TH1F("track_delta_eta","tracks #Delta #eta",50,-1,1))); + CHECK(book(new TH1F("track_delta_crv" ,"tracks #Delta crv",50,-1,1))); + CHECK(book(new TH1F("track_delta_phi","tracks #Delta #phi",50,-0.5,0.5))); + CHECK(book(new TH1F("track_delta_z0" ,"tracks #Delta z_0 ",100,-50,50))); + CHECK(book(new TH1F("track_delta_d0" ,"tracks #Delta d_0 ",50,-10,10))); + return StatusCode::SUCCESS; +} + + + diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/EFTrackingSmearingAlg.h b/Trigger/EFTracking/EFTrackingEmulation/src/EFTrackingSmearingAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..45fbbc8dbdcb50b99a0870cecf09333f78d92dfe --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/EFTrackingSmearingAlg.h @@ -0,0 +1,55 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +#ifndef EFTRACKING_SMEARINGALG_H +#define EFTRACKING_SMEARINGALG_H + +#include "FakeTrackSmearer.h" +#include "AthenaBaseComps/AthHistogramAlgorithm.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/TrackParticleAuxContainer.h" +#include "xAODTracking/TrackParticle.h" + + + +class EFTrackingSmearingAlg: public ::AthHistogramAlgorithm { + public: + EFTrackingSmearingAlg( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~EFTrackingSmearingAlg(); + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + private: + + std::string m_inputTrackContainerName; + std::string m_outputTrackContainerName; + + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_inputTrackParticleKey { this, "InputTrackParticleContainer", "InDetTrackParticles_tosmear", + "key for retrieval of input TrackParticles" }; + + SG::WriteHandleKey<xAOD::TrackParticleContainer> m_outputTrackParticleKey { this, "OutputTrackParticleContainer", "InDetTrackParticles_smeared", + "key for retrieval of output TrackParticles" }; + + + IntegerProperty m_SigmaScaleFactor {this, "SmearingScaleFactor", 1, "Set the smearing SF value for the sigmas"}; + BooleanProperty m_UseResolutionPtCutOff {this, "UseResolutionPtCutOff", false, "Apply ptCutoff on smearing"}; + DoubleProperty m_SetResolutionPtCutOff {this, "SetResolutionPtCutOff", 0., "Set ptCutoff off for semaring"}; + DoubleProperty m_inputTracksPtCut {this, "InputTracksPtCutGeV", 4.0, "Set input track pT cut"}; + DoubleProperty m_outputTracksPtCut {this, "OutputTracksPtCutGeV", 4.0, "Set the output track pT cut"}; + BooleanProperty m_enableMonitoring {this, "EnableMonitoring", false, "Enable debugging monitoring of the algorithm"}; + // these are for fake emulations + BooleanProperty m_EnableFakes {this,"IncludeDuplicatesAndFakes",false,"Enable fake track production"}; + BooleanProperty m_FakeKillerEnable {this,"FakeKillerEnable",false, "disable inclusion of broad fakes"}; + BooleanProperty m_IncludeFakesInResolutionCalculation{this,"IncludeFakesInResolutionCalculation",false, + "modify calculation of covariance parameters to include weighted combination of core and broad RMS"}; + BooleanProperty m_UseCoinToss {this,"UseCoinToss",false, + "if True, fakes are generated with flat inefficiency, else use poissonian criteria"}; + + LongLongProperty m_RandomSeed{this,"RandomSeed",0}; + + + void *m_mySmearer; + StatusCode book_histograms(); +}; + +#endif //> !FTRACKING_SMEARINGALG_H diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/FTS_Track.h b/Trigger/EFTracking/EFTrackingEmulation/src/FTS_Track.h new file mode 100644 index 0000000000000000000000000000000000000000..1d2cd7ee7f97b8eee672a362f44260117c63fcbd --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/FTS_Track.h @@ -0,0 +1,64 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +#ifndef EFTRACKINGEMULATION_FTSTRACK_H +#define EFTRACKINGEMULATION_FTSTRACK_H + +// Easy representation of a smeared track, allows fast manipulation + +#include <iostream> +#include "TMath.h" + +namespace EFTrackingSmearing{ +class FTS_Track { + + public: + + + FTS_Track(double pt, double eta, double phi, double d0, double z0): + m_pt(pt), m_eta(eta), m_phi(phi), m_d0(d0), m_z0(z0) {}; + + FTS_Track(double pt, double eta, double phi, double d0, double z0,double sigma_pt, double sigma_eta, double sigma_phi, double sigma_d0, double sigma_z0,int FakeFlags): + m_pt(pt), m_eta(eta), m_phi(phi), m_d0(d0), m_z0(z0), + m_sigma_pt(sigma_pt), m_sigma_eta(sigma_eta), m_sigma_phi(sigma_phi), m_sigma_d0(sigma_d0), m_sigma_z0(sigma_z0), m_FakeFlags(FakeFlags) {}; + + double pt() const {return m_pt;}; + double curv() const {return 1.0/m_pt;}; // curv pT + double eta() const {return m_eta;}; + double theta() const {return 2.0*TMath::ATan(TMath::Exp(-m_eta));}; + double phi() const {return m_phi;}; + double d0() const {return m_d0;}; + double z0() const {return m_z0;}; + + double sigma_pt() const {return m_sigma_pt;}; + double sigma_curv() const {return m_sigma_pt/m_pt/m_pt;}; + double sigma_eta() const {return m_sigma_eta;}; + double sigma_theta() const {return m_sigma_eta/TMath::CosH(m_eta); }; + double sigma_phi() const {return m_sigma_phi;}; + double sigma_d0() const {return m_sigma_d0;}; + double sigma_z0() const {return m_sigma_z0;}; + int FakeFlags() const {return m_FakeFlags;}; + + protected: + double m_pt = 0.; + double m_eta = 0.; + double m_phi= 0.; + double m_d0 = 0.; + double m_z0 = 0.; + + double m_sigma_pt = 0. ; + double m_sigma_eta = 0.; + double m_sigma_phi = 0.; + double m_sigma_d0 = 0. ; + double m_sigma_z0 = 0. ; + int m_FakeFlags = 0; +}; +} + +inline std::ostream& operator<<(std::ostream& s, const EFTrackingSmearing::FTS_Track& t){ + s << "trackCandidate: pt=" << t.pt() << " eta="<< t.eta() <<" phi="<< t.phi() + << " d0="<<t.d0() << " z0="<< t.z0() + << "\n"; + return s; +} + + +#endif diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/FakeTrackSmearer.h b/Trigger/EFTracking/EFTrackingEmulation/src/FakeTrackSmearer.h new file mode 100644 index 0000000000000000000000000000000000000000..7ca6caaa36895a034932a9b1f803e7ee3050e54b --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/FakeTrackSmearer.h @@ -0,0 +1,349 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +// Stolen from A.Cerri + +#ifndef EFTRACKINGEMULATION_FAKETRACKSMEARER_H +#define EFTRACKINGEMULATION_FAKETRACKSMEARER_H + +#include "TRandom3.h" +#include "TCanvas.h" +#include "TGraphErrors.h" +#include "TF1.h" +#include "TF2.h" +#include "TH1F.h" +#include "TROOT.h" + + +#include "FTS_Track.h" +#include <cmath> +namespace FitFunctions { + #include "FitFunctions/L1TT/d0Fitparam_N.C" + #include "FitFunctions/L1TT/z0Fitparam_N.C" + #include "FitFunctions/L1TT/MoreFitParam_N.C" +} + + +class FakeTrackSmearer +{ + public: + FakeTrackSmearer(const std::string & InstanceName, long long randomseed=0, bool verbose=false) + { + m_baseName=InstanceName; + Prepare(); + m_myRandom=new TRandom3(randomseed); + Tracks.clear(); + m_verbose=verbose; + + // Set these in order to define the scenario: + //SetSigmaScaleFactor(1.0); + //SetResolutionPtCutOff(5.0); + //UseResolutionPtCutOff(true); + + } + // + FakeTrackSmearer(const FakeTrackSmearer & other) = delete; + FakeTrackSmearer & operator=(const FakeTrackSmearer & other) = delete; + +// prepare the functions to use + void Prepare() + { + printf("Entering Prepare\n"); + std::string name; + + name="d0res_eta"+m_baseName; + d0res_eta=new TF1(name.c_str(),[&](double*x,double*p){return d0ResFunc(x[0],p[0],0); },0.0,4.0,1); + name="z0res_eta"+m_baseName; + z0res_eta=new TF1(name.c_str(),[&](double*x,double*p){return z0ResFunc(x[0],p[0],0); },0.0,4.0,1); + name="d0ref_eta"+m_baseName; + d0ref_eta=new TF1(name.c_str(),[&](double*x,double*p){return d0RefFunc(x[0],p[0],0); },0.0,4.0,1); + name="z0ref_eta"+m_baseName; + z0ref_eta=new TF1(name.c_str(),[&](double*x,double*p){return z0RefFunc(x[0],p[0],0); },0.0,4.0,1); + + + name="d0res_pt"+m_baseName; + d0res_pt=new TF1(name.c_str(),[&](double*x,double*p){return d0ResFunc(p[0],x[0],0); },4.0,200.0,1); + name="z0res_pt"+m_baseName; + z0res_pt=new TF1(name.c_str(),[&](double*x,double*p){return z0ResFunc(p[0],x[0],0); },4.0,200.0,1); + name="d0ref_pt"+m_baseName; + d0ref_pt=new TF1(name.c_str(),[&](double*x,double*p){return d0RefFunc(p[0],x[0],0); },4.0,200.0,1); + name="z0ref_pt"+m_baseName; + z0ref_pt=new TF1(name.c_str(),[&](double*x,double*p){return z0RefFunc(p[0],x[0],0); },4.0,200.0,1); + } + + + double d0ResFunc(double eta,double pt,int verbose) + { + // add here other d0 res functions + return FitFunctions::getD0ResParam_N(eta,pt,verbose)/1000.0; + } + + double z0ResFunc(double eta,double pt,int verbose) + { + // add here other z0 res functions + return FitFunctions::getZ0ResParam_N(eta,pt,verbose)/1000.0; + } + + double etaResFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + // add here other eta res functions + return 0.; + } + + double phiResFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + // add here other phi res functions + return 0.; + } + + double curvResFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + // add here other curv res functions + return 0.; + } + +// Reference functions, in case needed //// + + double d0RefFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + return 1.; // no reference to scale + } + + double z0RefFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + return 1.; // no reference to scale + } + +double etaRefFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + return 1.;// no reference to scale + } + +double phiRefFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + return 1.;// no reference to scale + } + +double curvRefFunc(double eta __attribute__((unused)),double pt __attribute__((unused)),int verbose __attribute__((unused))) + { + return 1.;// no reference to scale + } + + + void InitArray(double *a,int n,const double in[]) + { + for (int i=0;i<n;i++) a[i]=in[i]; + } + + + + void SetInputTracksPtCut(double ptcut) {m_inPtCut=ptcut;}; + void SetOutputTracksPtCut(double ptcut) {m_outPtCut=ptcut;}; + void SetMatchRatio(double m) { m_FMatches=m;}; // NMatch/NOffline i.e. k + void SetFakeFraction(double f) {m_FakeFraction=f; }; // i.e. f + void SetSigmaScaleFactor(double s) {m_SigmaScaleFactor=s; }; + void SetResolutionPtCutOff(double cutoff) {m_resolutionPtCutOff=cutoff; }; + void UseResolutionPtCutOff(bool use ) {m_useResolutionPtCutOff=use ; }; + + void Clear() {m_ntracks=0; m_nfakes=0; Tracks.clear(); }; + + int GetNTrueTracks() {return m_ntracks; }; + int GetNFakes() {return m_nfakes; }; + int GetNTracks() {return m_ntracks+m_nfakes; }; + + void AddTrackAndTruth(double d0,double z0,double curv,double eta,double phi) + { + m_useTrackingTruth=true; m_useInputSigmas=false; + AddTrack(d0,z0,curv,eta,phi); + m_useTrackingTruth=true; m_useInputSigmas=false; + } + + + void AddTrack(double d0,double z0,double curv,double eta,double phi) + { + // Adding one or more tracks to this input + // input curv is in GeV + bool verbose=m_verbose; + + double abseta=std::abs(eta); + double abspt=std::abs(1.0/curv); //GeV + if (verbose) printf("Smearer::AddTrack : d0=%f, z0=%f, qOverPt=%f, eta=%f, phi=%f pt=%f\n", d0, z0, curv, eta,phi, abspt); + + bool condition = (abspt>m_inPtCut) && + (d0RefFunc(abseta,abspt,verbose)>0.0) && + (d0ResFunc(abseta,abspt,verbose)>0.0) && + (z0RefFunc(abseta,abspt,verbose)>0.0) && + (z0ResFunc(abseta,abspt,verbose)>0.0); + + if (!condition) + return; + + + //Call here SetFakeFraction() and SetMatchRatio(); + + double curvres = m_SigmaScaleFactor * curvResFunc(abseta,abspt,0); + double phires = m_SigmaScaleFactor * phiResFunc(abseta,abspt,0); + double etares = m_SigmaScaleFactor * etaResFunc(abseta,abspt,0); + double d0res = m_SigmaScaleFactor * d0ResFunc(abseta,abspt,0); + double z0res = m_SigmaScaleFactor * z0ResFunc(abseta,abspt,0); + if (verbose) printf("Smearing parameters: curv = %f, phi=%f, eta=%f, d0=%f, z0=%f\n",curvres, phires, etares, d0res, z0res); + + + #ifdef STANDALONE_FAKETRACKSMEARER + d0Narrow->Fill(d0res); + z0Narrow->Fill(z0res); + #endif + + + #ifdef STANDALONE_FAKETRACKSMEARER + d0Sim->Fill(s_narrow_d0_model->Eval(abseta)); + z0Sim->Fill(s_narrow_z0_model->Eval(abseta)); + #endif + + + + double avgntracks=(m_nominalEfficiency> m_FMatches)?m_nominalEfficiency: m_FMatches; + int ntracks=( m_myRandom->Rndm()<m_nominalEfficiency)?1:0; + + if (m_produceFakes) + { + if (m_useCoinToss) { + if (avgntracks>m_nominalEfficiency) ntracks+= m_myRandom->Poisson(avgntracks-m_nominalEfficiency); + else if (avgntracks<m_nominalEfficiency) ntracks=( m_myRandom->Rndm()<avgntracks)?1:0; + } + else + ntracks= m_myRandom->Poisson(avgntracks); + } + + if (verbose) printf("Now producing %d tracks\n", ntracks); + for (int i=0;i<ntracks;i++) + { + // Creating close track + double gend0,genz0, geneta, genphi, gencurv; + gend0= m_myRandom->Gaus(d0,d0res); + genz0= m_myRandom->Gaus(z0,z0res); + geneta= m_myRandom->Gaus(eta,etares); + genphi= m_myRandom->Gaus(phi,phires); + gencurv= m_myRandom->Gaus(curv,curvres); + + EFTrackingSmearing::FTS_Track Track( + 1000./ gencurv, // convert to MeV + geneta, + genphi, + gend0, + genz0, + curvres, + etares, + phires, + d0res, + z0res, + false + ); + if (verbose) printf("Producing this track: curv = %f, phi=%f, eta=%f, d0=%f, z0=%f pt=%f\n",gencurv, genphi, geneta, gend0, genz0, Track.pt()/1000.0); + if (std::abs(Track.pt())>=m_outPtCut) + { + Tracks.push_back(Track); + m_ntracks++; + if (verbose) printf("Adding track with pt=%f ==> track #%d\n",Track.pt(), m_ntracks); + } + } + + + // AddTrack Done + return; + }; + + void PlotD0Res(double eta) + { + TCanvas *d0rescanvas=(TCanvas *)gROOT->FindObjectAny("d0rescanvas"); + if (d0rescanvas==NULL) d0rescanvas=new TCanvas("d0rescanvas"); + d0res_pt->SetParameter(0,eta); + d0ref_pt->SetParameter(0,eta); + d0res_pt->Draw(); + d0ref_pt->SetLineColor(4); + d0ref_pt->Draw("same"); + } + + + void EnableFakes(bool enable=true) + { + m_produceFakes=enable; + if (not Tracks.empty()) + printf("Warning: you are reconfiguring fakes production but it seems you have already processed events with this instance of FakeTracksSmearer\n"); + } + + void FakeKillerEnable(bool enable=true) + { + m_fakeKillerEnable=enable; + if (not Tracks.empty()) + printf("Warning: you are reconfiguring fakes production but it seems you have already processed events with this instance of FakeTracksSmearer (FakeKillerEnable)\n"); + } + + void IncludeFakesInResolutionCalculation(bool enable=true) + { + m_includeFakesInResolutionCalculation=enable; + if (not Tracks.empty()) + printf("Warning: you are reconfiguring fakes production but it seems you have already processed events with this instance of FakeTracksSmearer (IncluldeFakesInResolutionCalculation)\n"); + } + + void UseCoinToss(bool enable=true) + { + m_useCoinToss=enable; + if (not Tracks.empty()) + printf("Warning: you are reconfiguring fakes production but it seems you have already processed events with this instance of FakeTracksSmearer (UseCoinToss)\n"); + } + + void SetTrackingEfficiency(double epsilon=0.95) + { + m_nominalEfficiency=epsilon; + } + + std::vector<EFTrackingSmearing::FTS_Track> Tracks; + double z0(int idx) {return Tracks[idx].z0();}; + double d0(int idx) {return Tracks[idx].d0();}; + double phi(int idx) {return Tracks[idx].phi();}; + double pt(int idx) {return Tracks[idx].pt();}; + double curv(int idx) {return 1000.0/Tracks[idx].pt();}; + double eta(int idx) {return Tracks[idx].eta();}; + + + TH1F *d0Narrow = nullptr; + TH1F *z0Narrow = nullptr; + TH1F *d0Sim = nullptr; + TH1F *z0Sim = nullptr; + + TF1 *d0res_eta = nullptr; + TF1 *d0ref_eta = nullptr; + TF1 *z0res_eta = nullptr; + TF1 *z0ref_eta = nullptr; + TF1 *d0res_pt = nullptr; + TF1 *d0ref_pt = nullptr; + TF1 *z0res_pt = nullptr; + TF1 *z0ref_pt = nullptr; + + + private: + std::string m_baseName; + int m_ntracks = 0; + int m_nfakes = 0; + bool m_verbose = false; + TRandom3 *m_myRandom = nullptr; + + double m_FMatches = 1.; // NMatch/NOffline i.e. k + double m_FakeFraction = 0.; + double m_SigmaScaleFactor = 1.0;//Note: This is an *integer property* in EFTrackingSmearingAlg.h + double m_nominalEfficiency = 0.95; + + bool m_includeFakesInResolutionCalculation = false; + bool m_fakeKillerEnable = false; + bool m_useCoinToss = false; + bool m_useInputSigmas = false; + bool m_produceFakes = true; + bool m_useResolutionPtCutOff = false; + bool m_useTrackingTruth = true; + double m_resolutionPtCutOff=0.0; + double m_inPtCut = 1.0; + double m_outPtCut = 2.0; + +}; + +#endif diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/MoreFitParam_N.C b/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/MoreFitParam_N.C new file mode 100644 index 0000000000000000000000000000000000000000..ed1ad6b2f7581aa2f854b0929283f34f2b41b874 --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/MoreFitParam_N.C @@ -0,0 +1,3 @@ +#include <cmath> +#include <stdio.h> +//double getEtaResParam_N(float abstrketa, float trkpt, bool debug=0) { return 1.;} \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/d0Fitparam_N.C b/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/d0Fitparam_N.C new file mode 100644 index 0000000000000000000000000000000000000000..0c51e28926605ba70ac8a44c8c4940a5821c9819 --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/d0Fitparam_N.C @@ -0,0 +1,86 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +/* +2D-function to describe the d0 resolution versus pT and eta, for Nominal geometry +obtained by fitting curves with a post processing of the indetphysvalmonitoring outputs +(original code from A.Cerri and P. Calfayan, used for the L1Track task-force, 2020) +https://twiki.cern.ch/twiki/bin/viewauth/Atlas/HTTPerfWithEmulation +*/ +#include <cmath> +#include <stdio.h> +double getD0ResParam_N(float abstrketa, float trkpt, bool debug=0) { + + double d0Res = -1; + if (trkpt>=1.0 && trkpt<1.5) { + if (abstrketa<4.0) { + d0Res += 62.28*pow(abstrketa, 0); + d0Res += 7.69*pow(abstrketa, 1); + d0Res += -0.38*pow(abstrketa, 2); + d0Res += 1.76*pow(abstrketa, 3); + d0Res += 24.13*exp(-0.5*pow((abstrketa-1.82)/0.49,2)); + d0Res += 31.98*exp(-0.5*pow((abstrketa-2.33)/0.26,2)); + } + } + + if (trkpt>=1.5 && trkpt<2.5) { + if (abstrketa<4.0) { + d0Res += 41.81*pow(abstrketa, 0); + d0Res += 2.80*pow(abstrketa, 1); + d0Res += 1.17*pow(abstrketa, 2); + d0Res += 0.97*pow(abstrketa, 3); + d0Res += 16.61*exp(-0.5*pow((abstrketa-1.93)/0.58,2)); + d0Res += 15.48*exp(-0.5*pow((abstrketa-2.35)/0.26,2)); + } + } + + if (trkpt>=2.5 && trkpt<5.0) { + if (abstrketa<4.0) { + d0Res += 25.53*pow(abstrketa, 0); + d0Res += 1.28*pow(abstrketa, 1); + d0Res += -2.25*pow(abstrketa, 2); + d0Res += 10.19*pow(abstrketa, 3); + d0Res += -4.72*pow(abstrketa, 4); + d0Res += 0.64*pow(abstrketa, 5); + d0Res += 5.26*exp(-0.5*pow((abstrketa-2.30)/0.26,2)); + } + } + + if (trkpt>=5.0 && trkpt<10.0) { + if (abstrketa<2.9) { + d0Res += 15.68*pow(abstrketa, 0); + d0Res += 5.02*exp(-0.5*pow((abstrketa-1.63)/0.50,2)); + d0Res += 15.63*exp(-0.5*pow((abstrketa-2.60)/0.49,2)); + } + if (abstrketa>=2.9 && abstrketa<4.0) { + d0Res += -129.25*pow(abstrketa, 0); + d0Res += 46.90*pow(abstrketa, 1); + d0Res += 20.96*exp(-0.5*pow((abstrketa-2.96)/0.28,2)); + } + } + + if (trkpt>=10.0 && trkpt<20.0) { + if (abstrketa<4.0) { + d0Res += 10.54*pow(abstrketa, 0); + d0Res += -3.03*pow(abstrketa, 1); + d0Res += 3.63*pow(abstrketa, 2); + d0Res += -5.05*pow(abstrketa, 3); + d0Res += 1.18*pow(abstrketa, 4); + d0Res += 27.84*exp(-0.5*pow((abstrketa-2.81)/0.95,2)); + } + } + + if (trkpt>=20.0 && trkpt<100.0) { + if (abstrketa<4.0) { + d0Res += 7.26*pow(abstrketa, 0); + d0Res += -0.72*pow(abstrketa, 1); + d0Res += -0.20*pow(abstrketa, 2); + d0Res += 1.36*pow(abstrketa, 3); + d0Res += -0.32*pow(abstrketa, 4); + d0Res += -0.16*pow(abstrketa, 5); + d0Res += 0.05*pow(abstrketa, 6); + d0Res += 1.72*exp(-0.5*pow((abstrketa-2.39)/0.15,2)); + } + } + + if (debug) printf("d0Res = %f\n", d0Res); + return d0Res; +} diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/z0Fitparam_N.C b/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/z0Fitparam_N.C new file mode 100644 index 0000000000000000000000000000000000000000..634b4b90a49e6db0e673747a43c645c332d63327 --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/FitFunctions/L1TT/z0Fitparam_N.C @@ -0,0 +1,106 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +/* +2D-function to describe the z0 resolution versus pT and eta, for Nominal geometry +obtained by fitting curves with a post processing of the indetphysvalmonitoring outputs +(original code from A.Cerri and P. Calfayan, used for the L1Track task-force, 2020) +https://twiki.cern.ch/twiki/bin/viewauth/Atlas/HTTPerfWithEmulation +*/ +#include <cmath> +#include <stdio.h> +double getZ0ResParam_N(float abstrketa, float trkpt, bool debug=0) { + + double z0Res = -1; + if (trkpt>=1.0 && trkpt<1.5) { + if (abstrketa<4.0) { + z0Res += 62.49*pow(abstrketa, 0); + z0Res += 11.15*pow(abstrketa, 1); + z0Res += -97.86*pow(abstrketa, 2); + z0Res += 340.16*pow(abstrketa, 3); + z0Res += -276.95*pow(abstrketa, 4); + z0Res += 85.68*pow(abstrketa, 5); + z0Res += -8.04*pow(abstrketa, 6); + z0Res += 414.60*exp(-0.5*pow((abstrketa-2.39)/0.46,2)); + } + } + + if (trkpt>=1.5 && trkpt<2.5) { + if (abstrketa<4.0) { + z0Res += 43.65*pow(abstrketa, 0); + z0Res += -9.94*pow(abstrketa, 1); + z0Res += -16.34*pow(abstrketa, 2); + z0Res += 148.41*pow(abstrketa, 3); + z0Res += -108.10*pow(abstrketa, 4); + z0Res += -3.09*pow(abstrketa, 5); + z0Res += 15.41*pow(abstrketa, 6); + z0Res += -2.37*pow(abstrketa, 7); + z0Res += 512.88*exp(-0.5*pow((abstrketa-2.55)/0.56,2)); + } + } + + if (trkpt>=2.5 && trkpt<5.0) { + if (abstrketa<4.0) { + z0Res += 28.44*pow(abstrketa, 0); + z0Res += -21.22*pow(abstrketa, 1); + z0Res += 17.80*pow(abstrketa, 2); + z0Res += 67.20*pow(abstrketa, 3); + z0Res += -67.35*pow(abstrketa, 4); + z0Res += -1.57*pow(abstrketa, 5); + z0Res += 10.43*pow(abstrketa, 6); + z0Res += -1.64*pow(abstrketa, 7); + z0Res += 427.85*exp(-0.5*pow((abstrketa-2.64)/0.63,2)); + } + } + + if (trkpt>=5.0 && trkpt<10.0) { + if (abstrketa<2.0) { + z0Res += 20.48*pow(abstrketa, 0); + z0Res += -48.16*pow(abstrketa, 1); + z0Res += 135.27*pow(abstrketa, 2); + z0Res += -141.57*pow(abstrketa, 3); + z0Res += 72.27*pow(abstrketa, 4); + z0Res += -12.49*pow(abstrketa, 5); + } + if (abstrketa>=2.0 && abstrketa<4.0) { + z0Res += 1159.63*pow(abstrketa, 0); + z0Res += -1036.00*pow(abstrketa, 1); + z0Res += 256.18*pow(abstrketa, 2); + z0Res += -4.22*pow(abstrketa, 3); + z0Res += 74.45*exp(-0.5*pow((abstrketa-2.46)/0.27,2)); + } + } + + if (trkpt>=10.0 && trkpt<20.0) { + if (abstrketa<2.0) { + z0Res += 15.61*pow(abstrketa, 0); + z0Res += -45.29*pow(abstrketa, 1); + z0Res += 119.31*pow(abstrketa, 2); + z0Res += -124.47*pow(abstrketa, 3); + z0Res += 61.85*pow(abstrketa, 4); + z0Res += -10.88*pow(abstrketa, 5); + } + if (abstrketa>=2.0 && abstrketa<4.0) { + z0Res += 211.71*pow(abstrketa, 0); + z0Res += -83.16*pow(abstrketa, 1); + z0Res += -37.82*pow(abstrketa, 2); + z0Res += 19.11*pow(abstrketa, 3); + z0Res += 30.03*exp(-0.5*pow((abstrketa-2.48)/0.25,2)); + } + } + + if (trkpt>=20.0 && trkpt<100.0) { + if (abstrketa<4.0) { + z0Res += 12.24*pow(abstrketa, 0); + z0Res += -45.41*pow(abstrketa, 1); + z0Res += 122.61*pow(abstrketa, 2); + z0Res += -150.45*pow(abstrketa, 3); + z0Res += 100.37*pow(abstrketa, 4); + z0Res += -36.24*pow(abstrketa, 5); + z0Res += 6.66*pow(abstrketa, 6); + z0Res += -0.48*pow(abstrketa, 7); + z0Res += 3.04*exp(-0.5*pow((abstrketa-2.46)/0.21,2)); + } + } + + if (debug) printf("z0Res = %f\n", z0Res); + return z0Res; +} diff --git a/Trigger/EFTracking/EFTrackingEmulation/src/components/EFTrackingEmulation_entries.cxx b/Trigger/EFTracking/EFTrackingEmulation/src/components/EFTrackingEmulation_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5e22af4152552b1cf88af228c9d5c97e51fd179c --- /dev/null +++ b/Trigger/EFTracking/EFTrackingEmulation/src/components/EFTrackingEmulation_entries.cxx @@ -0,0 +1,3 @@ +#include "../EFTrackingSmearingAlg.h" + +DECLARE_COMPONENT( EFTrackingSmearingAlg ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 28f52f16e886494ab5dd41ed80ba06d7a1d8c2d9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/HTTOverlapRemovalValidation_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/HTTOverlapRemovalValidation_jobOptions.py deleted file mode 100644 index 3b9205041061a38f8dd88fa09e0f913cb55e2bb4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/HTTOverlapRemovalValidation_jobOptions.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -############################################################### -# -# HTTOverlapRemovalValAlg job options file -# @file TrigHTTAlgorithms/share/HTTOverlapRemovalValidation_jobOptions.py -# @author Zhaoyuan.Cui@cern.ch -# @date Dec. 4, 2020 -# @brief jobOptions for overlap removal validation algorithm -#============================================================== - -import os -import glob - -from TrigHTTConfig.formatMessageSvc import formatMessageSvc -formatMessageSvc() - -import TrigHTTConfig.HTTTagConfig as HTTTagConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig -import TrigHTTBanks.HTTBankConfig as HTTBankConfig -import TrigHTTConfig.HTTConfigCompInit as HTTConfig - -tags = HTTTagConfig.getTags(stage='bank') -map_tag = tags['map'] -bank_tag = tags['bank'] -MapSvc = HTTMapConfig.addMapSvc(map_tag) -BankSvc = HTTBankConfig.addBankSvc(map_tag, bank_tag) - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - -from AthenaCommon.AppMgr import ToolSvc, ServiceMgr -from AthenaCommon.Constants import DEBUG - -from GaudiSvc.GaudiSvcConf import THistSvc -# THistSvc configuration -ServiceMgr += THistSvc() -ServiceMgr.THistSvc.Output += ["MONITOROUT DATAFILE='OR_monitor_out_${HTTORSampleType}_${HTTORAlgo}_grouping-${HTTORnhg}.root' OPT='RECREATE'"] - -# InputFile -HTTInputFile=[] -if 'HTTInputFile' in os.environ : - for ex in os.environ['HTTInputFile'].split(','): - files=glob.glob(ex) - HTTInputFile += files -else : - HTTInputFile = ["httsim_loghits_wra.OUT.root"] -print("Input file: ", HTTInputFile) - -ES = HTTConfig.addEvtSelSvc(map_tag) -ES.sampleType=os.environ["HTTORSampleType"] - -# Read in file -from TrigHTTInput.TrigHTTInputConf import HTTOutputHeaderTool -HTTReadInput = HTTOutputHeaderTool("HTTReadInput", OutputLevel = DEBUG) -HTTReadInput.InFileName=HTTInputFile -HTTReadInput.RWstatus="READ" -ToolSvc += HTTReadInput - -# OR tools -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTOverlapRemovalTool -ORtool = HTTOverlapRemovalTool(OutputLevel = DEBUG) -ORtool.ORAlgo = os.environ["HTTORAlgo"] -ORtool.NumOfHitPerGrouping = int(os.environ["HTTORnhg"]) -ToolSvc += ORtool - -from TrigHTTMonitor.TrigHTTMonitorConf import HTTOverlapRemovalMonitorTool -ORmonitor = HTTOverlapRemovalMonitorTool(OutputLevel = DEBUG) -ORmonitor.BarcodeFracCut = 0.5 -ToolSvc += ORmonitor - -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTOverlapRemovalValAlg -theAlg = HTTOverlapRemovalValAlg(OutputLevel = DEBUG); -theAlg.InputTool = HTTReadInput -theAlg.OverlapRemoval = ORtool -theAlg.OverlapRemovalMonitor = ORmonitor - -theJob +=theAlg -############################################################ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTLogicalHitsProcessAlg.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTLogicalHitsProcessAlg.h deleted file mode 100644 index 28722c6f6c046fda65e601fc0c8caf1631b147f9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTLogicalHitsProcessAlg.h +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTT_LOGICALHITSPROCESSALG_H -#define HTT_LOGICALHITSPROCESSALG_H - -/* - * Please put a description on what this class does - */ - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrigHTTInput/IHTTEventOutputHeaderTool.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" -#include "TrigHTTHough/IHTTRoadFilterTool.h" -#include "TrigHTTHough/IHTTRoadFinderTool.h" -#include "TrigHTTMaps/HTTSpacePointsToolI.h" -#include "TrigHTTMaps/IHTTHitFilteringTool.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTMaps/HTTClusteringToolI.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" -#include "TrigHTTInput/HTTReadRawRandomHitsTool.h" -#include "TrigHTTHough/HTTHoughRootOutputTool.h" -#include "TrigHTTLRT/HTTLLPRoadFilterTool.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" - -#include "AthenaMonitoringKernel/Monitored.h" - -#include <fstream> - -class HTTDataFlowTool; -class HTTHoughRootOutputTool; -class HTTLLPRoadFilterTool; -class HTTNNTrackTool; -class HTTOverlapRemovalTool; -class HTTTrackFitterTool; -class HTTEtaPatternFilterTool; - -class HTTCluster; -class HTTHit; -class HTTLogicalEventInputHeader; -class HTTLogicalEventOutputHeader; -class HTTRoad; -class HTTTrack; -class HTTDataFlowInfo; - - -class HTTLogicalHitsProcessAlg : public AthAlgorithm -{ - public: - HTTLogicalHitsProcessAlg(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTLogicalHitsProcessAlg() = default; - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - virtual StatusCode finalize() override; - - private: - - std::string m_description; - int m_ev = 0; - - // Handles - ToolHandle<IHTTEventInputHeaderTool> m_hitInputTool {this, "InputTool", "HTTSGToRawHitsTool/HTTSGToRawHitsTool", "Input Tool"}; - ToolHandle<HTTReadRawRandomHitsTool> m_hitInputTool2 {this, "InputTool2", "HTTReadRawRandomHitsTool/HTTReadRawRandomHitsTool", "Potential 2nd input Tool to load data from more than one source"}; - ToolHandle<HTTRawToLogicalHitsTool> m_hitMapTool {this, "RawToLogicalHitsTool", "HTT_RawToLogicalHitsTool/HTT_RawToLogicalHitsTool", "Raw To Logical Tool"}; - ToolHandle<IHTTHitFilteringTool> m_hitFilteringTool {this, "HitFilteringTool", "HTTHitFilteringTool/HTTHitFilteringTool", "Hit Filtering Tool"}; - ToolHandle<HTTClusteringToolI> m_clusteringTool {this, "ClusteringTool", "HTTClusteringTool/HTTClusteringTool", "Hit Clustering Tool"}; - ToolHandle<HTTSpacePointsToolI> m_spacepointsTool {this, "SpacePointTool", "HTTSpacePointsTool/HTTSpacePointsTool", "Space Points Tool"}; - ToolHandle<IHTTRoadFinderTool> m_roadFinderTool {this, "RoadFinder", "HTTPatternMatchTool", "Road Finder Tool"}; - ToolHandle<HTTLLPRoadFilterTool> m_LRTRoadFilterTool {this, "LRTRoadFilter", "HTTLLPRoadFilterTool/HTTLLPRoadFilterTool", "LRT Road Filter Tool"}; - ToolHandle<IHTTRoadFinderTool> m_LRTRoadFinderTool {this, "LRTRoadFinder", "HTTHoughTransform_d0phi0_Tool/HTTHoughTransform_d0phi0_Tool", "LRT Road Finder Tool"}; - ToolHandle<IHTTRoadFilterTool> m_roadFilterTool {this, "RoadFilter", "HTTEtaPatternFilterTool", "Road Filter Tool"}; - ToolHandle<IHTTRoadFilterTool> m_roadFilterTool2 {this, "RoadFilter2", "HTTPhiRoadFilterTool", "Road Filter2 Tool"}; - ToolHandle<HTTNNTrackTool> m_NNTrackTool {this, "NNTrackTool", "HTTNNTrackTool/HTTNNTrackTool", "NN Track Tool"}; - ToolHandle<HTTHoughRootOutputTool> m_houghRootOutputTool {this, "HoughRootOutputTool", "HTTHoughRootOutputTool/HTTHoughRootOutputTool", "Hough ROOT Output Tool"}; - ToolHandle<HTTTrackFitterTool> m_trackFitterTool_1st {this, "TrackFitter_1st", "HTTTrackFitterTool/HTTTrackFitterTool_1st", "1st stage track fit tool"}; - ToolHandle<HTTTrackFitterTool> m_trackFitterTool_2nd {this, "TrackFitter_2nd", "HTTTrackFitterTool/HTTTrackFitterTool_2nd", "2nd stage track fit tool"}; - ToolHandle<HTTOverlapRemovalTool> m_overlapRemovalTool_1st {this, "OverlapRemoval_1st", "HTTOverlapRemovalTool/HTTOverlapRemovalTool_1st", "1st stage overlap removal tool"}; - ToolHandle<HTTOverlapRemovalTool> m_overlapRemovalTool_2nd {this, "OverlapRemoval_2nd", "HTTOverlapRemovalTool/HTTOverlapRemovalTool_2nd", "2nd stage overlap removal tool"}; - ToolHandle<HTTDataFlowTool> m_dataFlowTool {this, "DataFlowTool", "HTTDataFlowTool/HTTDataFlowTool", "Data Flow Tool"}; - ToolHandle<IHTTEventOutputHeaderTool> m_writeOutputTool {this, "OutputTool", "HTTOutputHeaderTool/HTTOutputHeaderTool", "Output tool"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "HTTMapping", "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; - ServiceHandle<IHTTEventSelectionSvc> m_evtSel {this, "eventSelector", "HTTEventSelectionSvc", "Event selection Svc"}; - - // Flags - Gaudi::Property<int> m_firstInputToolN {this, "FirstInputToolN", 1, "number of times to use event from first input tool"}; - Gaudi::Property<int> m_secondInputToolN {this, "SecondInputToolN", 0, "number of times to use event from second input tool"}; - Gaudi::Property<bool> m_doHitFiltering {this, "HitFiltering", false, "flag to enable hit/cluster filtering"}; - Gaudi::Property<bool> m_clustering {this, "Clustering", false, "flag to enable the clustering"}; - Gaudi::Property<bool> m_doSpacepoints {this, "Spacepoints", false, "flag to enable the spacepoint formation"}; - Gaudi::Property<bool> m_doTracking {this, "tracking", false, "flag to enable the tracking"}; - Gaudi::Property<bool> m_doMissingHitsChecks {this, "DoMissingHitsChecks", false}; - Gaudi::Property<bool> m_filterRoads {this, "FilterRoads", false, "enable first road filter"}; - Gaudi::Property<bool> m_filterRoads2 {this, "FilterRoads2", false, "enable second road filter"}; - Gaudi::Property<bool> m_runSecondStage {this, "RunSecondStage", false, "flag to enable running the second stage fitting"}; - Gaudi::Property<bool> m_doHoughRootOutput {this, "DoHoughRootOutput", false, "Dump output from the Hough Transform to flat ntuples"}; - Gaudi::Property<bool> m_doNNTrack {this, "DoNNTrack", false, "Run NN track filtering"}; - Gaudi::Property<bool> m_doLRT {this, "doLRT", false, "Enable Large Radious Tracking"}; - Gaudi::Property<bool> m_doLRTHitFiltering {this, "LRTHitFiltering", false, "flag to enable hit/cluster filtering for LRT"}; - Gaudi::Property<bool> m_writeOutputData {this, "writeOutputData", true,"write the output TTree"}; - Gaudi::Property<bool> m_outputHitTxt {this, "outputHitTxt", false, "write out road hits to text file"}; - - std::string m_outputHitTxtName = "outputRoadHits.txt"; - std::ofstream m_outputHitTxtStream; - - // ROOT pointers - HTTEventInputHeader m_eventHeader; - HTTEventInputHeader m_firstInputHeader; - HTTLogicalEventInputHeader* m_logicEventHeader_1st = nullptr; - HTTLogicalEventInputHeader* m_logicEventHeader_2nd = nullptr; - HTTLogicalEventOutputHeader* m_logicEventOutputHeader = nullptr; - - // Event storage - std::vector<HTTCluster> m_clusters_1st, m_clusters_1st_original, m_clusters_2nd; - std::vector<HTTCluster> m_spacepoints_1st, m_spacepoints_2nd; - std::vector<HTTHit> m_hits_1st_miss, m_hits_2nd_miss; - std::vector<HTTTrack> m_tracks_1st_guessedcheck, m_tracks_1st_nomiss, m_tracks_2nd_guessedcheck, m_tracks_2nd_nomiss; - - - StatusCode readInputs(bool & done); - StatusCode processInputs(); - StatusCode secondStageProcessing(std::vector<HTTTrack> const & tracks_1st, - std::vector<HTTRoad*> & roads_2nd, std::vector<HTTTrack> & tracks_2nd); - - - StatusCode writeOutputData(std::vector<HTTRoad*> const & roads_1st, std::vector<HTTTrack> const & tracks_1st, - std::vector<HTTRoad*> const & roads_2nd, std::vector<HTTTrack> const & tracks_2nd, - HTTDataFlowInfo const * dataFlowInfo); - - void printHitSubregions(std::vector<HTTHit> const & hits); - - ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"}; -}; - -#endif // HTTLOGICALHITSTOALGORITHMS_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/components/TrigHTTAlgorithms_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/components/TrigHTTAlgorithms_entries.cxx deleted file mode 100644 index b00eca7607d294fec70d0898bab59068c3543761..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/components/TrigHTTAlgorithms_entries.cxx +++ /dev/null @@ -1,14 +0,0 @@ -#include "../HTTLogicalHitsProcessAlg.h" -#include "../HTTMapMakerAlg.h" -#include "../HTTNNTrackTool.h" -#include "../HTTOverlapRemovalTool.h" -#include "../HTTTrackFitterTool.h" -#include "../HTTDataFlowTool.h" - -DECLARE_COMPONENT( HTTLogicalHitsProcessAlg ) -DECLARE_COMPONENT( HTTMapMakerAlg ) -DECLARE_COMPONENT( HTTNNTrackTool ) -DECLARE_COMPONENT( HTTOverlapRemovalTool ) -DECLARE_COMPONENT( HTTTrackFitterTool ) -DECLARE_COMPONENT( HTTDataFlowTool ) - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 8805f6dfcd9340ce93793b5ebbf9c279bc1c9005..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/ \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTConstReduceConstGen_tf.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTConstReduceConstGen_tf.py deleted file mode 100755 index d4e0c75b514cf8b65bfb7a6f72ca23943067512f..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTConstReduceConstGen_tf.py +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#!/usr/bin/env python - -## HTT Simulation Transform -# @version $Id: HTTConstReduceConstGen_tf.py 718878 2016-01-20 17:27:51Z jwebster $ -import argparse -import sys -import time -import traceback - -import logging - -# Setup core logging here -from PyJobTransforms.trfLogger import msg -msg.info('logging set in %s' % sys.argv[0]) - -from PyJobTransforms.trfExitCodes import trfExit -from PyJobTransforms.transform import transform -from PyJobTransforms.trfExe import athenaExecutor -from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace - -import PyJobTransforms.trfExceptions as trfExceptions -import PyJobTransforms.trfArgClasses as trfArgClasses -from TrigHTTConfig.parseRunArgs import addHTTMapsArgs - -@stdTrfExceptionHandler -@sigUsrStackTrace -def main(): - - msg.info('This is %s' % sys.argv[0]) - - trf = getTransform() - trf.parseCmdLineArgs(sys.argv[1:]) - trf.execute() - trf.generateReport() - - msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode)) - sys.exit(trf.exitCode) - - -## Get the base transform with all arguments added -def getTransform(): - executorSet = set() - executorSet.add(athenaExecutor(name = 'HTTConstantGen2ndStage', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTConstantGen.py', - substep='HTTC2', - inData=['HTTMatrix'], outData=['HTTGoodMatrix'] - )) - executorSet.add(athenaExecutor(name = 'HTTMatrixReduction', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTMatrixReduction.py', - inData=['HTTGoodMatrix'], outData=['HTTMatrixReduced'], - substep='HTTM2m' - )) - executorSet.add(athenaExecutor(name = 'HTTConstantGen1stStageIgnore2ndStage', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTConstantGen.py', - runtimeRunargs={'CheckGood2ndStage':0}, - inData=['HTTMatrixReduced'], outData=['HTTGoodMatrixReducedIgnore'], - substep='HTTC1I' - )) - executorSet.add(athenaExecutor(name = 'HTTConstantGen1stStageCheck2ndStage', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTConstantGen.py', - runtimeRunargs={'CheckGood2ndStage':1}, - inData=['HTTMatrixReduced'], outData=['HTTGoodMatrixReducedCheck'], - substep='HTTC1C' - )) - - trf = transform(executor=executorSet, description = "HTT Make 2nd stage constants, reduce matrix file, make 1st stage constants") - - addHTTConstReduceGenArgs(trf.parser) - addHTTMapsArgs(trf.parser) - - return trf - - -def addHTTConstReduceGenArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTConstReduceConst', 'Fast tracker simulation options') - - parser.add_argument('--CheckGood2ndStage', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Check whether 2nd stage sector is good when producing things for 1st stage', group='HTTConstReduceConst') - - parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Bank region number', group='HTTConstReduceConst') - - parser.add_argument('--genconst', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Generate the sectors and constants', group='HTTConstReduceConst') - - parser.add_argument('--allregions', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Run all regions?', group='HTTConstReduceConst') - - parser.add_argument('--inputHTTMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input',type='htt_matrix'),help="input matrix file", group="HTTConstReduceConst") - - parser.add_argument('--inputHTTMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input',type='htt_matrix'),help="input matrix file", group="HTTConstReduceConst") - - - parser.add_argument('--outputHTTGoodMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix'), help="output good matrix file", group="HTTConstReduceConst") - - parser.add_argument('--inputHTTGoodMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input'), - help="input good matrix file", group="HTTConstReduceConst" ) - - parser.add_argument('--outputHTTMatrixReducedFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_reduced'), help="output reduced matrix file", group="HTTConstReduceConst") - - parser.add_argument('--outputHTTGoodMatrixReducedIgnoreFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_good_reduced_ignore'), help="output reduced good matrix file, ignoring whether 2nd stage is good or not", group="HTTConstReduceConst") - - parser.add_argument('--outputHTTGoodMatrixReducedCheckFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_good_reduced_check'), help="output reduced good matrix file, check whether 2nd stage is good or not", group="HTTConstReduceConst") - - parser.add_argument('--inputHTTMatrixReducedFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input',type='htt_matrix_reduced'), help="input reduced matrix file", group="HTTConstReduceConst") - - parser.add_argument('--extract1stStage', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Reduce 2nd stage matrix to 1st stage matrix', group='HTTConstReduceConst') - - -if __name__ == '__main__': - main() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTConstantGen_tf.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTConstantGen_tf.py deleted file mode 100755 index 49851812871f3111ee9ab56373a4a2d1dcd1e27d..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTConstantGen_tf.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#!/usr/bin/env python - -## HTT Simulation Transform -# @version $Id: HTTConstantGen_tf.py 718878 2016-01-20 17:27:51Z jwebster $ -import argparse -import sys -import time -import traceback - -import logging - -# Setup core logging here -from PyJobTransforms.trfLogger import msg -msg.info('logging set in %s' % sys.argv[0]) - -from PyJobTransforms.trfExitCodes import trfExit -from PyJobTransforms.transform import transform -from PyJobTransforms.trfExe import athenaExecutor -from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace - -import PyJobTransforms.trfExceptions as trfExceptions -import PyJobTransforms.trfArgClasses as trfArgClasses -from TrigHTTConfig.parseRunArgs import addHTTMapsArgs - -@stdTrfExceptionHandler -@sigUsrStackTrace -def main(): - - msg.info('This is %s' % sys.argv[0]) - - trf = getTransform() - trf.parseCmdLineArgs(sys.argv[1:]) - trf.execute() - trf.generateReport() - - msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode)) - sys.exit(trf.exitCode) - - -## Get the base transform with all arguments added -def getTransform(): - trf = transform(executor = athenaExecutor(name = 'HTTConstantGen', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTConstantGen.py')) - addHTTPattGenArgs(trf.parser) - addHTTMapsArgs(trf.parser) - return trf - - -def addHTTPattGenArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTConstantGen', 'Fast tracker simulation options') - - parser.add_argument('--NBanks', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Number of pattern banks', group='HTTConstantGen') - - parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Bank region number', group='HTTConstantGen') - - parser.add_argument('--genconst', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Generate the sectors and constants', group='HTTConstantGen') - - parser.add_argument('--skip_sectors', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True), - help='Sectors to skip', group='HTTConstantGen') - - parser.add_argument('--inputHTTMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True), - help="input matrix file", group="HTTConstantGen" ) - - parser.add_argument('--outputHTTGoodMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output'), help="output good matrix file", group="HTTConstantGen") - - - parser.add_argument('--outputHTTGoodMatrixReducedCheckFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_good_reduced_check'), help="output reduced good matrix file, check whether 2nd stage is good or not", group="HTTConstantGen") - - -if __name__ == '__main__': - main() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/components/TrigHTTBankGen_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/components/TrigHTTBankGen_entries.cxx deleted file mode 100644 index feafc0f750ff6fd2e99d375eda638182b7d7b36b..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/components/TrigHTTBankGen_entries.cxx +++ /dev/null @@ -1,9 +0,0 @@ -#include "../HTTMatrixGenAlgo.h" -#include "../HTTConstGenAlgo.h" -#include "../HTTMatrixReductionAlgo.h" -#include "../HTTMatrixMergeAlgo.h" - -DECLARE_COMPONENT( HTTConstGenAlgo ) -DECLARE_COMPONENT( HTTMatrixMergeAlgo ) -DECLARE_COMPONENT( HTTMatrixReductionAlgo ) -DECLARE_COMPONENT( HTTMatrixGenAlgo ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/README b/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/README deleted file mode 100644 index 684fe886fc1e22bf85d21223c9ae7c71d71bad79..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/README +++ /dev/null @@ -1,20 +0,0 @@ -## TrigHTTBanks package - -This package contains all files that manage constant banks. This includes fit constants and pattern banks. Algorithms for generating banks are located in TrigHTTBankGen. -All bank classes can be retrieved using ITrigHTTBankSvc, except for HTTIndexPatt, which are AthAlgTools. File and other configuration can be set using the bank tags. - -#### Bank Service: - -1. ITrigHTTBankSvc.h: Interface declaration for the bank service. -2. TrigHTTBankSvc.h: Implementation of the bank service. - -#### Sector Files: - -1. HTTFitConstantBank.h: This class stores the fit constants for all sectors, and exposes methods to perform linear fits and inverse fits. -2. HTTSectorSlice.h: This class manages bitvectors that describe what range of track parameters go through each sector (a slice). Primarily used by track inversion to reverse-lookup sectors given a set of track parameters. -3. HTTSectorBank.h: This class stores the sector definitions, the list of 8 or 13 modules that define a sector. It also provides methods to reverse-lookup a sector given a list of modules. - -#### Configuration: - -1. HTTBankConfig.py: Functions for creating the bank service and applying the bank tag to HTTBanks objects. -2. HTTBankTags.py: JSON-like file that lists tags for configuring the HTTBanks objects and algorithms. diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index d2d7f7768aa340bbea8a119b427ad7b93b254a1b..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/ITrigHTTBankSvc.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/ITrigHTTBankSvc.h deleted file mode 100644 index 72efc9b8d1d246341cc0b12afe9e5ff555d6ecc6..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/ITrigHTTBankSvc.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef ITRIGHTTBANKSVC_H -#define ITRIGHTTBANKSVC_H - -/** - * This file defines an interface for a bank service. The service is in charge - * of loading all constants, including the fit coefficients, etc - * Other classes can use this service to retrieve the banks. - */ - - -#include "GaudiKernel/IService.h" -#include "GaudiKernel/IInterface.h" - -class HTTFitConstantBank; -class HTTSectorSlice; -class HTTSectorBank; - -class ITrigHTTBankSvc : virtual public IService -{ - public: - DeclareInterfaceID(ITrigHTTBankSvc, 1, 0); - virtual ~ITrigHTTBankSvc() = default; - - virtual const HTTFitConstantBank* FitConstantBank_1st(int missedPlane = -1) = 0; - virtual const HTTFitConstantBank* FitConstantBank_2nd(int missedPlane = -1) = 0; - virtual const HTTSectorSlice* SectorSlice() = 0; - virtual const HTTSectorBank* SectorBank_1st() = 0; - virtual const HTTSectorBank* SectorBank_2nd() = 0; -}; - -#endif // ITRIGHTTBANKSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/python/__init__.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/python/__init__.py deleted file mode 100644 index 8d9b84098321914b0d2408526b8fbeaf555efdd9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/python/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -__author__ = "Jahred Adelman, HTT team" - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/components/TrigHTTBanks_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/components/TrigHTTBanks_entries.cxx deleted file mode 100644 index 88ccb899ac6869ab59c6392c2b2d8aaeef5a6c2e..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/components/TrigHTTBanks_entries.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include "../TrigHTTBankSvc.h" - -DECLARE_COMPONENT(TrigHTTBankSvc) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/CMakeLists.txt b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/CMakeLists.txt deleted file mode 100644 index 9d46fd5330a113684fb2d4f89aaef7c4d34ff205..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( TrigHTTConfTools ) - -# External dependencies: -find_package( ROOT COMPONENTS Core MathCore Physics ) - -# Component(s) in the package: -atlas_add_library( TrigHTTConfToolsLib - src/*.cxx TrigHTTConfTools/*.h - PUBLIC_HEADERS TrigHTTConfTools - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib - LINK_LIBRARIES AthenaBaseComps AtlasHepMCLib GaudiKernel TrigHTTObjectsLib ) - -atlas_add_component( TrigHTTConfTools - src/components/*.cxx - LINK_LIBRARIES TrigHTTConfToolsLib ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_scripts( test/HTTInputTestSetup.sh ) - -# Tests in the package: -atlas_add_test( HTTRegionSlices_test - SOURCES test/HTTRegionSlices_test.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} TrigHTTConfToolsLib ) - -atlas_add_test( HTTEventSelectionSvc_test - SCRIPT python -m TrigHTTConfTools.HTTConfigCompInit - POST_EXEC_SCRIPT noerror.sh ) - -atlas_add_test( HTTConfigFlags_test - SCRIPT python -m TrigHTTConfTools.HTTConfigFlags - POST_EXEC_SCRIPT noerror.sh ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/README.md b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/README.md deleted file mode 100644 index 0c3843f2282ec5b7e471c3a18c5afc6727661571..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# This package contains config of HTT simulation and various HTT utilities - - -# How to run HTTMapMaker jobs -See info on how to run this in rel 21: https://gitlab.cern.ch/atlas-tdaq-ph2upgrades/atlas-tdaq-htt/tdaq-htt-offline/athena/-/blob/21.9/Trigger/TrigHTT/TrigHTTAlgorithms/README.md - -and the info on the format of the map files: https://gitlab.cern.ch/atlas-tdaq-ph2upgrades/atlas-tdaq-htt/tdaq-htt-offline/athena/-/blob/21.9/Trigger/TrigHTT/TrigHTTMaps/README.md - -To run the HTTMapMaker in master: -``` -python3 -m TrigHTTConfTools.HTTMapMakerConfig --filesInput=../singlemu_invPtFlat1_1M_wrap.root --evtMax=5 OutFileName="NN_" region=0 Exec.DebugMessageComponents='["*/HTT*"]' -``` -There is more options exposed (look for the addFlags in the HTTMapMakerConfig.py) - - - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 77b6d4ce6f5c7a3eca8cf5c1245879c934322e70..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/HTTRegionSlices.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/HTTRegionSlices.h deleted file mode 100644 index 6ee25de33acdeae9793b88ca4daad28a2c8eb027..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/HTTRegionSlices.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -/** - * @file HTTRegionSlices.h - * @author Riley Xu - riley.xu@cern.ch - * @date Janurary 7th, 2021 - * @brief Stores slice definitions for HTT regions - * - * This class reads the slice description file to get the region definition in - * terms of track parameters. This is complementary to HTTRegionMap, which defines - * the modules that belong in each region. - */ - -#ifndef HTTCONFTOOLS_TTREGIONSLICES_H -#define HTTCONFTOOLS_TTREGIONSLICES_H - -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTObjects/HTTTruthTrack.h" - -#include <vector> -#include <utility> - - -class HTTRegionSlices -{ - public: - HTTRegionSlices(std::string const & filepath); - - unsigned nRegions() const { return m_regions.size(); } - - std::pair<HTTTrackPars, HTTTrackPars> const & getRegion(unsigned region) const { return m_regions.at(region); } - HTTTrackPars const & getMin(unsigned region) const { return m_regions.at(region).first; } - HTTTrackPars const & getMax(unsigned region) const { return m_regions.at(region).second; } - - bool inRegion(unsigned region, HTTTruthTrack const & t) const; - - private: - - std::vector<std::pair<HTTTrackPars, HTTTrackPars>> m_regions; // index by region, min/max - -}; - -#endif // HTTCONFTOOLS_TTREGIONSLICES_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/IHTTEventSelectionSvc.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/IHTTEventSelectionSvc.h deleted file mode 100644 index 34d0232b7da25b4317a2858049836c58da62ed5f..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/TrigHTTConfTools/IHTTEventSelectionSvc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTCONFTOOLS_IHTTEVENTSELECTIONSVC_H -#define HTTCONFTOOLS_IHTTEVENTSELECTIONSVC_H - -#include "GaudiKernel/IInterface.h" -#include "GaudiKernel/IService.h" - -class HTTHit; -class HTTTrack; -class HTTOfflineTrack; -class HTTTruthTrack; -class HTTTrackPars; -class HTTRegionSlices; -class HTTEventInputHeader; -class HTTLogicalEventInputHeader; -enum class SampleType; - -class IHTTEventSelectionSvc : public virtual IService -{ - public: - - static const InterfaceID& interfaceID(); - - virtual HTTTrackPars getMin() const = 0; - virtual HTTTrackPars getMax() const = 0; - virtual unsigned getRegionID() const = 0; - virtual SampleType getSampleType() const = 0; - virtual bool checkPU() const = 0; - virtual int getLRTpdgID() const = 0; - virtual const HTTRegionSlices* getRegions() = 0; - - virtual bool passCuts(const HTTHit&) const = 0; - virtual bool passCuts(const HTTTrack&) const = 0; - virtual bool passCuts(const HTTOfflineTrack&) const = 0; - virtual bool passCuts(const HTTTruthTrack&) const = 0; - - virtual bool passMatching(HTTTrack const &) const = 0; - virtual bool passMatching(HTTTruthTrack const &) const = 0; - - virtual bool selectEvent(HTTEventInputHeader*) const = 0; - virtual bool selectEvent(HTTLogicalEventInputHeader*) const = 0; - - virtual bool passQOverPt(const HTTTrack&) const = 0; - virtual bool passEta(const HTTTrack&) const = 0; - virtual bool passPhi(const HTTTrack&) const = 0; - virtual bool passD0(const HTTTrack&) const = 0; - virtual bool passZ0(const HTTTrack&) const = 0; - - virtual bool passQOverPt(const HTTOfflineTrack&) const = 0; - virtual bool passEta(const HTTOfflineTrack&) const = 0; - virtual bool passPhi(const HTTOfflineTrack&) const = 0; - virtual bool passD0(const HTTOfflineTrack&) const = 0; - virtual bool passZ0(const HTTOfflineTrack&) const = 0; -}; - -inline const InterfaceID& IHTTEventSelectionSvc::interfaceID() -{ - static const InterfaceID IID("IHTTEventSelectionSvc", 1, 0); - return IID; -} - -#endif //HTTCONFTOOLS_IHTTEVENTSELECTIONSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTAnalysisConfig.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTAnalysisConfig.py deleted file mode 100644 index bc53bd79b916c202928527330af47fd63ad6d851..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTAnalysisConfig.py +++ /dev/null @@ -1,390 +0,0 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from AthenaConfiguration.ComponentFactory import CompFactory - - -def HTTAnalysisConfig(): - print('HTTAnalysisConfig') - - -def getNSubregions(path): - import os - - from PyJobTransforms.trfUtils import findFile - path = findFile(os.environ['DATAPATH'], path) - - with open(path, 'r') as f: - fields = f.readline().split() - assert(fields[0] == 'towers') - return int(fields[1]) - - -def HTTEventSelectionCfg(): - result=ComponentAccumulator() - eventSelector = CompFactory.HTTEventSelectionSvc() - eventSelector.regions = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/slices_v01_Jan21.txt" - eventSelector.regionID = 0 - eventSelector.sampleType = 'singleMuons' - eventSelector.withPU = False - result.addService(eventSelector, create=True, primary=True) - return result - -def TrigHTTMappingCfg(): - result=ComponentAccumulator() - pathMapping = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/' - HTTMapping = CompFactory.TrigHTTMappingSvc() - HTTMapping.mappingType = "FILE" - HTTMapping.rmap = f'{pathMapping}map_file/rmaps/eta0103phi0305_ATLAS-P2-ITK-22-02-00.rmap' - HTTMapping.subrmap = f'{pathMapping}zslicemaps/ATLAS-P2-ITK-22-02-00/eta0103phi0305_KeyLayer-strip_barrel_2_extra03_trim_0_001_NSlices-6.rmap' - HTTMapping.pmap = f'{pathMapping}map_file/ATLAS-P2-ITK-22-02-00.pmap' - HTTMapping.modulemap = f'{pathMapping}map_file/ITk.global-to-local.moduleidmap' - HTTMapping.NNmap = f'{pathMapping}map_file/NN_DNN_Region_0p1_0p3_HTTFake_HTTTrueMu_SingleP_8L_Nom_v6.json' - HTTMapping.layerOverride = {} - result.addService(HTTMapping, create=True, primary=True) - return result - -def HTTBankSvcCfg(): - result=ComponentAccumulator() - HTTBankSvc = CompFactory.TrigHTTBankSvc() - pathBankSvc = '/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0103phi0305/SectorBanks/' - HTTBankSvc.constantsNoGuess_1st = [ - f'{pathBankSvc}corrgen_raw_8L_skipPlane0.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane1.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane2.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane3.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane4.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane5.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane6.gcon', - f'{pathBankSvc}corrgen_raw_8L_skipPlane7.gcon'] - HTTBankSvc.constantsNoGuess_2nd = [ - f'{pathBankSvc}corrgen_raw_13L_skipPlane0.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane1.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane2.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane3.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane4.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane5.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane6.gcon', - f'{pathBankSvc}corrgen_raw_13L_skipPlane7.gcon'] - HTTBankSvc.constants_1st = f'{pathBankSvc}corrgen_raw_8L.gcon' - HTTBankSvc.constants_2nd = f'{pathBankSvc}corrgen_raw_13L_reg0_checkGood1.gcon' - HTTBankSvc.sectorBank_1st = f'{pathBankSvc}sectorsHW_raw_8L.patt' - HTTBankSvc.sectorBank_2nd = f'{pathBankSvc}sectorsHW_raw_13L_reg0_checkGood1.patt' - HTTBankSvc.sectorSlices = f'{pathBankSvc}slices_8L.root' - result.addService(HTTBankSvc, create=True, primary=True) - return result - - -def HTTRoadUnionToolCfg(flags): - result=ComponentAccumulator() - RF = CompFactory.HTTRoadUnionTool() - - xBins = flags.Trigger.HTT.ActiveConfig.xBins - xBufferBins = flags.Trigger.HTT.ActiveConfig.xBufferBins - yBins = flags.Trigger.HTT.ActiveConfig.yBins - yBufferBins = flags.Trigger.HTT.ActiveConfig.yBufferBins - xMin = flags.Trigger.HTT.ActiveConfig.phiMin - xMax = flags.Trigger.HTT.ActiveConfig.phiMax - xBuffer = (xMax - xMin) / xBins * xBufferBins - xMin = xMin - xBuffer - xMax = xMax + xBuffer - yMin = flags.Trigger.HTT.ActiveConfig.qptMin - yMax = flags.Trigger.HTT.ActiveConfig.qptMax - yBuffer = (yMax - yMin) / yBins * yBufferBins - yMin -= yBuffer - yMax += yBuffer - tools = [] - HTTMapping = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - - for number in range(getNSubregions(HTTMapping.subrmap)): - HoughTransform = CompFactory.HTTHoughTransformTool("HoughTransform_0_" + str(number)) - HoughTransform.HTTEventSelectionSvc = HTTEventSelectionCfg().getService("HTTEventSelectionSvc") - HoughTransform.TrigHTTBankSvc = HTTBankSvcCfg().getService("TrigHTTBankSvc") - HoughTransform.TrigHTTMappingSvc = HTTMapping - HoughTransform.combine_layers = flags.Trigger.HTT.ActiveConfig.combineLayers - HoughTransform.convSize_x = flags.Trigger.HTT.ActiveConfig.convSizeX - HoughTransform.convSize_y = flags.Trigger.HTT.ActiveConfig.convSizeY - HoughTransform.convolution = flags.Trigger.HTT.ActiveConfig.convolution - HoughTransform.d0_max = 0 - HoughTransform.d0_min = 0 - HoughTransform.fieldCorrection = flags.Trigger.HTT.ActiveConfig.fieldCorrection - HoughTransform.hitExtend_x = flags.Trigger.HTT.ActiveConfig.hitExtendX - HoughTransform.localMaxWindowSize = flags.Trigger.HTT.ActiveConfig.localMaxWindowSize - HoughTransform.nBins_x = xBins + 2 * xBufferBins - HoughTransform.nBins_y = yBins + 2 * yBufferBins - HoughTransform.phi_max = xMax - HoughTransform.phi_min = xMin - HoughTransform.qpT_max = yMax - HoughTransform.qpT_min = yMin - HoughTransform.scale = flags.Trigger.HTT.ActiveConfig.scale - HoughTransform.subRegion = number - HoughTransform.threshold = flags.Trigger.HTT.ActiveConfig.threshold - HoughTransform.traceHits = False - tools.append(HoughTransform) - - RF.tools = tools - result.addPublicTool(RF, primary=True) - return result - - -def HTTRawLogicCfg(flags): - result=ComponentAccumulator() - HTTRawLogic = CompFactory.HTTRawToLogicalHitsTool() - HTTRawLogic.SaveOptional = 2 - if (flags.Trigger.HTT.ActiveConfig.sampleType == 'skipTruth'): - HTTRawLogic.SaveOptional = 1 - HTTRawLogic.TowersToMap = [0] # TODO TODO why is this hardcoded? - HTTRawLogic.HTTEventSelectionSvc = HTTEventSelectionCfg().getService("HTTEventSelectionSvc") - HTTRawLogic.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - result.addPublicTool(HTTRawLogic, primary=True) - return result - -def HTTDataFlowToolCfg(): - result=ComponentAccumulator() - DataFlowTool = CompFactory.HTTDataFlowTool() - DataFlowTool.HTTEventSelectionSvc = HTTEventSelectionCfg().getService("HTTEventSelectionSvc") - DataFlowTool.TrigHTTMappingSvc =TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - DataFlowTool.THistSvc = CompFactory.THistSvc() - result.setPrivateTools(DataFlowTool) - return result - -def HTTSpacePointsToolCfg(flags): - result=ComponentAccumulator() - SpacePointTool = CompFactory.HTTSpacePointsTool_v2() - SpacePointTool.Filtering = flags.Trigger.HTT.ActiveConfig.spacePointFiltering - SpacePointTool.FilteringClosePoints = False - SpacePointTool.PhiWindow = 0.008 - SpacePointTool.Duplication = True - result.addPublicTool(SpacePointTool, primary=True) - return result - - -def HTTHitFilteringToolCfg(): - result=ComponentAccumulator() - HitFilteringTool = CompFactory.HTTHitFilteringTool() - HitFilteringTool.barrelStubDphiCut = 3.0 - HitFilteringTool.doRandomRemoval = False - HitFilteringTool.doStubs = False - HitFilteringTool.endcapStubDphiCut = 1.5 - HitFilteringTool.pixelClusRmFrac = 0 - HitFilteringTool.pixelHitRmFrac = 0 - HitFilteringTool.stripClusRmFrac = 0 - HitFilteringTool.stripHitRmFrac = 0 - HitFilteringTool.useNstrips = False - result.addPublicTool(HitFilteringTool, primary=True) - return result - - -def HTTHoughRootOutputToolCfg(): - result=ComponentAccumulator() - HoughRootOutputTool = CompFactory.HTTHoughRootOutputTool() - HoughRootOutputTool.HTTEventSelectionSvc = HTTEventSelectionCfg().getService("HTTEventSelectionSvc") - HoughRootOutputTool.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - HoughRootOutputTool.THistSvc = CompFactory.THistSvc() - result.setPrivateTools(HoughRootOutputTool) - return result - -def LRTRoadFinderCfg(flags): - result=ComponentAccumulator() - LRTRoadFinder =CompFactory.HTTHoughTransform_d0phi0_Tool() - LRTRoadFinder.TrigHTTBankSvc = HTTBankSvcCfg().getService("TrigHTTBankSvc") - LRTRoadFinder.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - LRTRoadFinder.combine_layers = flags.Trigger.HTT.ActiveConfig.lrtStraighttrackCombineLayers - LRTRoadFinder.convolution = flags.Trigger.HTT.ActiveConfig.lrtStraighttrackConvolution - LRTRoadFinder.hitExtend_x = flags.Trigger.HTT.ActiveConfig.lrtStraighttrackHitExtendX - LRTRoadFinder.scale = flags.Trigger.HTT.ActiveConfig.scale - LRTRoadFinder.threshold = flags.Trigger.HTT.ActiveConfig.lrtStraighttrackThreshold - result.setPrivateTools(LRTRoadFinder) - return result - -def NNTrackToolCfg(): - result=ComponentAccumulator() - NNTrackTool = CompFactory.HTTNNTrackTool() - NNTrackTool.THistSvc = CompFactory.THistSvc() - NNTrackTool.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - result.setPrivateTools(NNTrackTool) - return result - -def HTTWriteOutputCfg(flags): - result=ComponentAccumulator() - HTTWriteOutput = CompFactory.HTTOutputHeaderTool("HTTWriteOutput") - HTTWriteOutput.InFileName = ["test"] - HTTWriteOutput.RWstatus = "HEADER" # do not open file, use THistSvc - HTTWriteOutput.RunSecondStage = flags.Trigger.HTT.ActiveConfig.secondStage - result.addPublicTool(HTTWriteOutput, primary=True) - return result - -def HTTTrackFitterToolCfg(flags): - result=ComponentAccumulator() - TF_1st = CompFactory.HTTTrackFitterTool("HTTTrackFitterTool_1st") - TF_1st.GuessHits = flags.Trigger.HTT.ActiveConfig.guessHits - TF_1st.IdealCoordFitType = flags.Trigger.HTT.ActiveConfig.idealCoordFitType - TF_1st.TrigHTTBankSvc = HTTBankSvcCfg().getService("TrigHTTBankSvc") - TF_1st.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - TF_1st.chi2DofRecoveryMax = flags.Trigger.HTT.ActiveConfig.chi2DoFRecoveryMax - TF_1st.chi2DofRecoveryMin = flags.Trigger.HTT.ActiveConfig.chi2DoFRecoveryMin - TF_1st.doMajority = flags.Trigger.HTT.ActiveConfig.doMajority - TF_1st.nHits_noRecovery = flags.Trigger.HTT.ActiveConfig.nHitsNoRecovery - TF_1st.DoDeltaGPhis = flags.Trigger.HTT.ActiveConfig.doDeltaGPhis - TF_1st.DoMissingHitsChecks = flags.Trigger.HTT.ActiveConfig.doMissingHitsChecks - result.addPublicTool(TF_1st, primary=True) - return result - -def HTTOverlapRemovalToolCfg(flags): - result=ComponentAccumulator() - OR_1st = CompFactory.HTTOverlapRemovalTool("HTTOverlapRemovalTool_1st") - OR_1st.ORAlgo = "Normal" - OR_1st.doFastOR =flags.Trigger.HTT.ActiveConfig.doFastOR - OR_1st.NumOfHitPerGrouping = 5 - OR_1st.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - if flags.Trigger.HTT.ActiveConfig.hough: - OR_1st.nBins_x = flags.Trigger.HTT.ActiveConfig.xBins + 2 * flags.Trigger.HTT.ActiveConfig.xBufferBins - OR_1st.nBins_y = flags.Trigger.HTT.ActiveConfig.yBins + 2 * flags.Trigger.HTT.ActiveConfig.yBufferBins - OR_1st.localMaxWindowSize = flags.Trigger.HTT.ActiveConfig.localMaxWindowSize - OR_1st.roadSliceOR = flags.Trigger.HTT.ActiveConfig.roadSliceOR - - result.addPublicTool(OR_1st, primary=True) - return result - - -def HTTOverlapRemovalTool_2ndCfg(flags): - result=ComponentAccumulator() - OR_2nd = CompFactory.HTTOverlapRemovalTool("HTTOverlapRemovalTool_2nd") - OR_2nd.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - if flags.Trigger.HTT.ActiveConfig.secondStage: - OR_2nd.DoSecondStage = True - OR_2nd.ORAlgo = "Normal" - OR_2nd.doFastOR = flags.Trigger.HTT.ActiveConfig.doFastOR - OR_2nd.NumOfHitPerGrouping = 5 - result.setPrivateTools(OR_2nd) - return result - - -def HTTTrackFitterTool_2ndCfg(flags): - result=ComponentAccumulator() - TF_2nd = CompFactory.HTTTrackFitterTool("HTTTrackFitterTool_2nd") - TF_2nd.TrigHTTBankSvc = HTTBankSvcCfg().getService("TrigHTTBankSvc") - TF_2nd.TrigHTTMappingSvc = TrigHTTMappingCfg().getService("TrigHTTMappingSvc") - if flags.Trigger.HTT.ActiveConfig.secondStage: - TF_2nd.Do2ndStageTrackFit = True - result.setPrivateTools(TF_2nd) - return result - - -def checkIfAlgoTagExist(flags, tag): - if not flags.hasFlag(tag) and not flags.hasFlagCategory(tag): - raise Exception(f'{tag} does not appear to be flag category') - -def HTTReadInputCfg(flags): - result=ComponentAccumulator() - InputTool = CompFactory.HTTInputHeaderTool("HTTReadInput", - InFileName = flags.Input.Files) - result.addPublicTool(InputTool, primary=True) - return result - - -def HTTLogicalHistProcessAlgCfg(flags): - - result=ComponentAccumulator() - - - theHTTLogicalHistProcessAlg=CompFactory.HTTLogicalHitsProcessAlg() - theHTTLogicalHistProcessAlg.HitFiltering = flags.Trigger.HTT.ActiveConfig.hitFiltering - theHTTLogicalHistProcessAlg.writeOutputData = flags.Trigger.HTT.ActiveConfig.writeOutputData - theHTTLogicalHistProcessAlg.Clustering = True - theHTTLogicalHistProcessAlg.tracking = flags.Trigger.HTT.ActiveConfig.doTracking - theHTTLogicalHistProcessAlg.outputHitTxt = flags.Trigger.HTT.ActiveConfig.outputHitTxt - theHTTLogicalHistProcessAlg.RunSecondStage = flags.Trigger.HTT.ActiveConfig.secondStage - theHTTLogicalHistProcessAlg.DoMissingHitsChecks = flags.Trigger.HTT.ActiveConfig.doMissingHitsChecks - theHTTLogicalHistProcessAlg.DoHoughRootOutput = False - theHTTLogicalHistProcessAlg.DoNNTrack = False - theHTTLogicalHistProcessAlg.eventSelector = result.getPrimaryAndMerge(HTTEventSelectionCfg()) - - HTTMaping = result.getPrimaryAndMerge(TrigHTTMappingCfg()) - theHTTLogicalHistProcessAlg.HTTMapping = HTTMaping - - result.getPrimaryAndMerge(HTTBankSvcCfg()) - - theHTTLogicalHistProcessAlg.RoadFinder = result.getPrimaryAndMerge(HTTRoadUnionToolCfg(flags)) - theHTTLogicalHistProcessAlg.RawToLogicalHitsTool = result.getPrimaryAndMerge(HTTRawLogicCfg(flags)) - - theHTTLogicalHistProcessAlg.InputTool = result.getPrimaryAndMerge(HTTReadInputCfg(flags)) - - InputTool2 = CompFactory.HTTReadRawRandomHitsTool("HTTReadRawRandomHitsTool") - InputTool2.InFileName = flags.Input.Files[0] - result.addPublicTool(InputTool2) - theHTTLogicalHistProcessAlg.InputTool2 = InputTool2 - - theHTTLogicalHistProcessAlg.DataFlowTool = result.getPrimaryAndMerge(HTTDataFlowToolCfg()) - theHTTLogicalHistProcessAlg.SpacePointTool = result.getPrimaryAndMerge(HTTSpacePointsToolCfg(flags)) - - RoadFilter = CompFactory.HTTEtaPatternFilterTool() - RoadFilter.TrigHTTMappingSvc = HTTMaping - theHTTLogicalHistProcessAlg.RoadFilter = RoadFilter - - theHTTLogicalHistProcessAlg.HitFilteringTool = result.getPrimaryAndMerge(HTTHitFilteringToolCfg()) - theHTTLogicalHistProcessAlg.HoughRootOutputTool = result.getPrimaryAndMerge(HTTHoughRootOutputToolCfg()) - - LRTRoadFilter = CompFactory.HTTLLPRoadFilterTool() - result.addPublicTool(LRTRoadFilter) - theHTTLogicalHistProcessAlg.LRTRoadFilter = LRTRoadFilter - - theHTTLogicalHistProcessAlg.LRTRoadFinder = result.getPrimaryAndMerge(LRTRoadFinderCfg(flags)) - theHTTLogicalHistProcessAlg.NNTrackTool = result.getPrimaryAndMerge(NNTrackToolCfg()) - - RoadFilter2 = CompFactory.HTTPhiRoadFilterTool() - RoadFilter2.TrigHTTMappingSvc = HTTMaping - RoadFilter2.window = [] - theHTTLogicalHistProcessAlg.RoadFilter2 = RoadFilter2 - - theHTTLogicalHistProcessAlg.ClusteringTool = CompFactory.HTTClusteringTool() - theHTTLogicalHistProcessAlg.OutputTool = result.getPrimaryAndMerge(HTTWriteOutputCfg(flags)) - theHTTLogicalHistProcessAlg.TrackFitter_1st = result.getPrimaryAndMerge(HTTTrackFitterToolCfg(flags)) - theHTTLogicalHistProcessAlg.OverlapRemoval_1st = result.getPrimaryAndMerge(HTTOverlapRemovalToolCfg(flags)) - theHTTLogicalHistProcessAlg.OverlapRemoval_2nd = result.getPrimaryAndMerge(HTTOverlapRemovalTool_2ndCfg(flags)) - theHTTLogicalHistProcessAlg.TrackFitter_2nd = result.getPrimaryAndMerge(HTTTrackFitterTool_2ndCfg(flags)) - - - if flags.Trigger.HTT.ActiveConfig.secondStage: - HTTExtrapolatorTool = CompFactory.HTTExtrapolator() - HTTExtrapolatorTool.Ncombinations = 16 - theHTTLogicalHistProcessAlg.Extrapolator = HTTExtrapolatorTool - - - if flags.Trigger.HTT.ActiveConfig.lrt: - assert flags.Trigger.HTT.ActiveConfig.lrtUseBasicHitFilter != flags.Trigger.HTT.ActiveConfig.lrtUseMlHitFilter, 'Inconsistent LRT hit filtering setup, need either ML of Basic filtering enabled' - assert flags.Trigger.HTT.ActiveConfig.lrtUseStraightTrackHT != flags.Trigger.HTT.ActiveConfig.lrtUseDoubletHT, 'Inconsistent LRT HT setup, need either double or strightTrack enabled' - theHTTLogicalHistProcessAlg.doLRT = True - theHTTLogicalHistProcessAlg.LRTHitFiltering = (not flags.Trigger.HTT.ActiveConfig.lrtSkipHitFiltering) - - from TrigHTTAlgorithms.HTTAlgorithmConfig import HTTLogicalHitsProcessAlgMonitoringCfg - theHTTLogicalHistProcessAlg.MonTool = result.getPrimaryAndMerge(HTTLogicalHitsProcessAlgMonitoringCfg(flags)) - - result.addEventAlgo(theHTTLogicalHistProcessAlg) - return result - - -def prepareFlagsForHTTLogicalHistProcessAlg(flags): - flags.Trigger.HTT.algoTag="Hough" - checkIfAlgoTagExist(flags.Trigger.HTT, flags.Trigger.HTT.algoTag) - newFlags = flags.cloneAndReplace("Trigger.HTT.ActiveConfig", "Trigger.HTT." + flags.Trigger.HTT.algoTag) - return newFlags - - -if __name__ == "__main__": - from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.MainServicesConfig import MainServicesCfg - flags = initConfigFlags() - flags.Input.Files = ['HTTWrapper.singlemu_Pt10.root'] - - newFlags = prepareFlagsForHTTLogicalHistProcessAlg(flags) - del flags - - acc=MainServicesCfg(newFlags) - acc.addService(CompFactory.THistSvc(Output = ["EXPERT DATAFILE='monitoring.root', OPT='RECREATE'"])) - acc.merge(HTTLogicalHistProcessAlgCfg(newFlags)) - acc.store(open('AnalysisConfig.pkl','wb')) - - statusCode = acc.run() - assert statusCode.isSuccess() is True, "Application execution did not succeed" - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/__init__.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/__init__.py deleted file mode 100644 index a4baa280c23437970434cb74cdf07ac5890ebca0..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -__version__ = "$Revision$" -__author__ = "Riley Xu, HTT team" - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTEventSelectionSvc.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTEventSelectionSvc.h deleted file mode 100644 index 90af45b5a164b1a3b069ea92fb5261b6e4f3e1d8..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTEventSelectionSvc.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTCONFTOOLS_HTTEVENTSELECTIONSVC_H -#define HTTCONFTOOLS_HTTEVENTSELECTIONSVC_H - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/ToolHandle.h" - -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTObjects/HTTTypes.h" - -class HTTHit; -class HTTTrack; -class HTTOfflineTrack; -class HTTTruthTrack; -class HTTRegionSlices; -class HTTEventInputHeader; -class HTTLogicalEventInputHeader; - - -class HTTEventSelectionSvc : public extends< AthService, IHTTEventSelectionSvc > -{ - public: - - HTTEventSelectionSvc(const std::string& name, ISvcLocator* svc); - virtual ~HTTEventSelectionSvc() = default; - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - //static const InterfaceID& interfaceID(); - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIf) override; - - virtual unsigned getRegionID() const override { return m_regionID; } - virtual SampleType getSampleType() const override { return m_st; } - virtual bool checkPU() const override { return m_withPU.value(); } - virtual const HTTRegionSlices* getRegions() override; - virtual int getLRTpdgID() const override { return m_LRT_pdgID; } - - virtual HTTTrackPars getMin() const override { return m_min; } - virtual HTTTrackPars getMax() const override { return m_max; } - - virtual bool passCuts(const HTTHit&) const override; - virtual bool passCuts(const HTTTrack&) const override; - virtual bool passCuts(const HTTOfflineTrack&) const override; - virtual bool passCuts(const HTTTruthTrack&) const override; - - virtual bool passQOverPt(const HTTTrack&) const override; - virtual bool passEta(const HTTTrack&) const override; - virtual bool passPhi(const HTTTrack&) const override; - virtual bool passD0(const HTTTrack&) const override; - virtual bool passZ0(const HTTTrack&) const override; - virtual bool passQOverPt(const HTTOfflineTrack&) const override; - virtual bool passEta(const HTTOfflineTrack&) const override; - virtual bool passPhi(const HTTOfflineTrack&) const override; - virtual bool passD0(const HTTOfflineTrack&) const override; - virtual bool passZ0(const HTTOfflineTrack&) const override; - - virtual bool passMatching(HTTTrack const &) const override; - virtual bool passMatching(HTTTruthTrack const &) const override; - - virtual bool selectEvent(HTTEventInputHeader*) const override; - virtual bool selectEvent(HTTLogicalEventInputHeader*) const override; - - private: - - // Gaudi parameters: - Gaudi::Property<unsigned int> m_regionID { this, "regionID", 0, "current region under processing"}; // Current region of interest - Gaudi::Property<std::string> m_regions_path { this, "regions", "", "path of the slices file"}; // path to slices file - Gaudi::Property<std::string> m_sampleType { this, "sampleType", "singleMuons", "type of sample under processing (skipTruth, singleElectrons, singleMuons, singlePions, or LLPs)"}; // type of sample ("skipTruth", "singleElectrons", "singleMuons", "singlePions") - Gaudi::Property<bool> m_withPU { this, "withPU", false, "flag to say if there is pile-up or not"}; // flag to say if there is pile-up or not - Gaudi::Property<bool> m_LRT { this, "doLRT", false, "Change track selection to LRT quantities; hit selection unchanged"}; // flag to require cancelling of selections on d0 and z0 in the case of large-radius tracking - Gaudi::Property<float> m_minLRTpT { this, "minLRTpT", 5., "Minimum pT to use in LRT selection, in GeV"}; // minimum pT, in GeV, to use in LRT selection - Gaudi::Property<int> m_LRT_pdgID { this, "lrt_truthMatchPDGID", 0, "If we are running an LLP sample but want only some PDGID of output in the truth selection, set this"}; // If we are running an LLP sample but want only some PDGID of output in the truth selection, set this - Gaudi::Property<bool> m_allowHighBarcode { this, "allowHighBarcode", false, "Whether or not to allow barcodes over 200000 in truth matching"}; // whether or not to allow barcodes over 200000 in truth matching - - - - SampleType m_st = SampleType::skipTruth; // internal value for faster comparisons in selectEvent() - HTTRegionSlices* m_regions = nullptr; // pointer to RegionSlices class - - HTTTrackPars m_min; // min limits of current region - HTTTrackPars m_max; // max limits of current region - HTTTrackPars m_trackmin; // min limits of tracks to be accepted in region - HTTTrackPars m_trackmax; // max limits of tracks to be accepted in region - - - void createRegions(); // helper function to create RegionSlices object - bool checkTruthTracks(const std::vector<HTTTruthTrack>&) const; // helper function to check the truth tracks for selectEvent() - bool checkTruthTracksLRT(const std::vector<HTTTruthTrack>&) const; // check the truth tracks for selectEvent() with LRT requirements -}; - -/*inline const InterfaceID& HTTEventSelectionSvc::interfaceID() -{ - static const InterfaceID IID_HTTEventSelectionSvc("HTTEventSelectionSvc", 1, 0); - return IID_HTTEventSelectionSvc; -}*/ - -#endif // HTTCONFTOOLS_HTTEVENTSELECTIONSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/components/TrigHTTConfig_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/components/TrigHTTConfig_entries.cxx deleted file mode 100644 index d469d234f6a67d68a1aa086759b959074d5026c2..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/components/TrigHTTConfig_entries.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include "../HTTEventSelectionSvc.h" - -DECLARE_COMPONENT( HTTEventSelectionSvc ) - - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/test/HTTInputTestSetup.sh b/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/test/HTTInputTestSetup.sh deleted file mode 100755 index 70be3247d3848eb30c7b4f496c6e61fc7037ac8a..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/test/HTTInputTestSetup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -#RDOs: -export HTTRDOFile22=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0103phi0305/RDOs/mc15_14TeV.900171.PG_singlemu_InvPtFlat1_etaFlat01_03_phiFlat03_05.recon.RDO.e8312_s3595_s3600_r12410/RDO.24440670._000016.pool.root.1 -export HTTRDOFile23=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-23-00-01/21.9.15/eta0103phi0305/RDOs/mc15_14TeV.900171.PG_singlemu_InvPtFlat1_etaFlat01_03_phiFlat03_05.recon.RDO.e8312_s3595_s3600_r12392/RDO.24279796._000051.pool.root.1 - -#wrappers: -export HTTRawHitFile=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-23-00-01/21.9.15/eta0103phi0305/Wrappers/single_muons_wrapper_wTruthUpdates.root -# input wrapper files for each region -export input_map=( \ - [0]="/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0103phi0305/Wrappers/singlemu_invPtFlat1_1M_wrap.root" \ - [1]="/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0709phi0305/Wrappers/singlemu_invPtFlat1_10k_wrap.root" \ -) - -export HTTLogHitFile=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0103phi0305/Outputs/singlemu_invPtFlat1_10k_loghits_N1000_P0_9-11-21.root - -#reference files -export REF_HTTRawHitFile=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTSim/wrapper_files/ATLAS-P2-ITK-22-00-00_RDO-21748447_bf1a13f_wrapper.root - -# PU200 -#RDOs -export PU200RDO_23=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-23-00-01/21.9.15/etaALLphiALL/RDO/mc15_14TeV.900036.PG_singlemu_Pt10_etaFlatnp0_43.recon.RDO.e8185_s3630_s3633_r12351_tid24030291_00/RDO.24030291._000127.pool.root.1 -export PU200RDO_22=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/etaALLphiALL/RDOs/mc15_14TeV.900036.PG_singlemu_Pt10_etaFlatnp0_43.recon.RDO.e8185_s3595_s3600_r12063/RDO.22568851._000140.pool.root.1 - -#Wrappers -export PU200DIR_23=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-23-00-01/21.9.15/etaALLphiALL/Wrappers/V2.mc15_14TeV.900036.PG_singlemu_Pt10_etaFlatnp0_43.recon.RDO.e8185_s3630_s3633_r12351_tid24030291_00/ -export PU200FILES_23=`ls -p -m $PU200DIR_23` -export PU200Wrapper_23=`echo $PU200FILES_23 |sed -e "s|httsim|"$PU200DIR_23"\httsim|g"|tr -d '\n'| tr -d ' '` -export PU200Wrapper_22=$EOS_MGM_URL_HTT/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/etaALLphiALL/Wrappers/user.martyniu.mar16.1muonpt10.mu200.21.9.16_v3_EXT0/user.martyniu.24590899.EXT0._000003.httsim_rawhits_wrap.root - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index bffc4be2bd3835176e441f75ba4d33f636dc88ff..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTHough/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/IHTTRoadFilterTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/IHTTRoadFilterTool.h deleted file mode 100644 index 7f98d301b51fd1d021ec33c3b91ac9bb18998dd7..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/IHTTRoadFilterTool.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTROADFILTERI_H -#define HTTROADFILTERI_H - -/** - * @file IHTTRoadFilterTool.h - * @author Elliot Lipeles lipeles@cern.ch - * @date 03/25/21 - * @brief Interface declaration for road filter tools - * - * This class is implemented by - * - HTTEtaPatternFilterTool - */ - -#include "GaudiKernel/IAlgTool.h" - -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTRoad.h" - -#include <vector> - - -/** - * A road filter returns a vector of roads given a vector of roads. - * - * Note that the postfilter_roads are owned by the tool, and are cleared at each successive - * call of filterRoads(). - */ - -class IHTTRoadFilterTool : virtual public IAlgTool -{ - public: - DeclareInterfaceID(IHTTRoadFilterTool, 1, 0); - virtual StatusCode filterRoads(const std::vector<HTTRoad*> & prefilter_roads, std::vector<HTTRoad*> & postfilter_roads) = 0; -}; - - -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/IHTTRoadFinderTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/IHTTRoadFinderTool.h deleted file mode 100644 index 35c83b7c420dfea8936ff4222b27ec6ba370f452..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/IHTTRoadFinderTool.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTROADFINDERI_H -#define HTTROADFINDERI_H - -/** - * @file IHTTRoadFinderTool.h - * @author Riley Xu - rixu@cern.ch - * @date 10/23/19 - * @brief Interface declaration for road finder tools - * - * This class is implemented by - * - HTTRoadUnionTool - * - HTTPatternMatchTool - * - HTTSectorMatchTool - * - HTTHoughTransformTool - * - HTTHough1DShiftTool - */ - -#include "GaudiKernel/IAlgTool.h" - -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTRoad.h" - -#include <vector> - -class HTTHit; - - -/** - * A road finder returns a vector of roads given a vector of hits. - * - * Note that the roads are owned by the tool, and are cleared at each successive - * call of getRoads(). - */ - - -class IHTTRoadFinderTool : virtual public IAlgTool -{ - public: - DeclareInterfaceID(IHTTRoadFinderTool, 1, 0); - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) = 0; -}; - - -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/python/__init__.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/python/__init__.py deleted file mode 100644 index fd4f0d3738f6e4c3ce9b94000e22c11a7c0c5af9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/python/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTRoadUnionTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTRoadUnionTool.h deleted file mode 100644 index b454c4412d7727814854aca60f0f73372b83e776..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTRoadUnionTool.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTROADUNIONTOOL_H -#define HTTROADUNIONTOOL_H - -/** - * @file HTTRoadUnionTool.h - * @author Riley Xu - riley.xu@cern.ch - * @date November 20th, 2020 - * @brief Wrapper class to combine multiple road-finding tools - * - * Declarations in this file: - * class HTTRoadUnionTool : public AthAlgTool, virtual public IHTTRoadFinderTool - */ - -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - -#include "TrigHTTHough/IHTTRoadFinderTool.h" - - -// This class is merely a lightweight wrapper around multiple road finder tools. -class HTTRoadUnionTool : public extends <AthAlgTool, IHTTRoadFinderTool> -{ - public: - - /////////////////////////////////////////////////////////////////////// - // AthAlgTool - - HTTRoadUnionTool(const std::string&, const std::string&, const IInterface*); - - virtual StatusCode initialize() override; - - /////////////////////////////////////////////////////////////////////// - // IHTTRoadFinderTool - - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) override; - - /////////////////////////////////////////////////////////////////////// - // HTTRoadUnionTool - - ToolHandleArray<IHTTRoadFinderTool> const & tools() const { return m_tools; } - - private: - - /////////////////////////////////////////////////////////////////////// - // Handles - - ToolHandleArray<IHTTRoadFinderTool> m_tools; -}; - -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/components/TrigHTTHough_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/components/TrigHTTHough_entries.cxx deleted file mode 100644 index 9221774caa64cbd48ae770bcdee527b33e253117..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/components/TrigHTTHough_entries.cxx +++ /dev/null @@ -1,14 +0,0 @@ -#include "../HTTEtaPatternFilterTool.h" -#include "../HTTHough1DShiftTool.h" -#include "TrigHTTHough/HTTHoughRootOutputTool.h" -#include "../HTTHoughTransformTool.h" -#include "../HTTPhiRoadFilterTool.h" -#include "../HTTRoadUnionTool.h" - -DECLARE_COMPONENT( HTTEtaPatternFilterTool ) -DECLARE_COMPONENT( HTTHough1DShiftTool ) -DECLARE_COMPONENT( HTTHoughRootOutputTool ) -DECLARE_COMPONENT( HTTHoughTransformTool ) -DECLARE_COMPONENT( HTTPhiRoadFilterTool ) -DECLARE_COMPONENT( HTTRoadUnionTool ) - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/CMakeLists.txt b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/CMakeLists.txt deleted file mode 100644 index 467cb7f9c5a93cd30f24c1d4033ef84285f5d082..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -atlas_subdir( TrigHTTInput ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -# Component(s) in the package: -atlas_add_library( TrigHTTInputLib - src/*.cxx - PUBLIC_HEADERS TrigHTTInput - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel InDetReadoutGeometry - TrigHTTConfToolsLib TrigHTTMapsLib TrigHTTObjectsLib - PRIVATE_LINK_LIBRARIES AthContainers InDetIdentifier StoreGateLib TrigHTTSGInputLib ) - -atlas_add_component( TrigHTTInput - src/components/*.cxx - LINK_LIBRARIES TrigHTTInputLib -) - -# Install files from the package: -atlas_install_joboptions( share/*.py test/*.py) -atlas_install_scripts( scripts/*) -atlas_install_python_modules( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select=ATL900,ATL901 ) - -# Test in the package: -atlas_add_test( testReadRawHit - SCRIPT test/test_TrigHTTReadRawHitsWrapperAlg.sh - LOG_SELECT_PATTERN "HTTRawHitsWrapp" - PRIVATE_WORKING_DIRECTORY -) - -atlas_add_test( testRawToLogical - SCRIPT test/test_TrigHTTRawToLogicalWrapperAlg.sh - LOG_SELECT_PATTERN "HTTReadLogical" - PRIVATE_WORKING_DIRECTORY -) - -atlas_add_test( testDumpOutputStat - SCRIPT test/test_TrigHTTDumpOutputStatAlg.sh - LOG_SELECT_PATTERN "HTTDumpOutputSt" - PRIVATE_WORKING_DIRECTORY -) - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/HTTRawToLogicalHitsTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/HTTRawToLogicalHitsTool.h deleted file mode 100644 index 8053de570ac97e7fa0dbbe5727a7abd76d216984..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/HTTRawToLogicalHitsTool.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTRAWTOLOGICALHITSTOOL_H -#define HTTRAWTOLOGICALHITSTOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" - - -// Forward declaration -class ITrigHTTMappingSvc; -class HTTEventInputHeader; -class HTTLogicalEventInputHeader; - - -class HTTRawToLogicalHitsTool : public AthAlgTool -{ - public: - - HTTRawToLogicalHitsTool(const std::string&, const std::string&, const IInterface*); - virtual ~HTTRawToLogicalHitsTool() = default; - virtual StatusCode initialize() override; - - StatusCode convert(unsigned stage, const HTTEventInputHeader& header, - HTTLogicalEventInputHeader& logicheader); - StatusCode getUnmapped(std::vector<HTTHit>& missing_hits); - - const HTTPlaneMap* getPlaneMap_1st(); - - -private: - - // JO configuration - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; - ServiceHandle<IHTTEventSelectionSvc> m_EvtSel {this, "HTTEventSelectionSvc", "HTTEventSelectionSvc"}; - IntegerProperty m_saveOptional {this, "SaveOptional", 2, "flag to enable the truth/offline tracking save =0 no optional saved, =1 saved in region, =2 save all "}; - IntegerArrayProperty m_towersToMap {this, "TowersToMap", {}, "Which Towers to map, goes from 0 to 96!"}; - - // internal members - std::vector<int> m_towers; - std::vector<HTTHit> m_missing_hits;// vector to save hits not mapped, debugging only - std::vector<int> m_missing_hit_codes; // for histograms used in debugging - -}; - -#endif // HTTRAWTOLOGICALHITSTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/HTTReadRawRandomHitsTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/HTTReadRawRandomHitsTool.h deleted file mode 100644 index 9d384187b1ce4b5209a6eb8273ec9692a20dfcd4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/HTTReadRawRandomHitsTool.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTREADRAWRANDOMHITSTOOL_H -#define HTTREADRAWRANDOMHITSTOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" - -#include "TFile.h" -#include "TTree.h" - - - -class HTTReadRawRandomHitsTool : public extends<AthAlgTool, IHTTEventInputHeaderTool> -{ - public: - - HTTReadRawRandomHitsTool(const std::string&, const std::string&, const IInterface*); - virtual ~HTTReadRawRandomHitsTool() = default; - virtual StatusCode initialize() override; - virtual StatusCode readData(HTTEventInputHeader* header, bool &last) override; - virtual StatusCode writeData(HTTEventInputHeader* header) override; - virtual StatusCode finalize() override; - - StatusCode readData(HTTEventInputHeader* header, bool &last, bool doReset); - - private: - // JO configuration - StringProperty m_inpath {this, "InFileName", "httsim_smartwrapper.root", "input path"}; - - // Internal pointers - unsigned int m_nEntries = 0U; - unsigned m_entry = 0; -}; - -#endif // HTTREADRAWRANDOMHINPUTTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/IHTTEventInputHeaderTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/IHTTEventInputHeaderTool.h deleted file mode 100644 index e7e743a5e43b202e7f7d1bb3ad8ef2f02d647b5b..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/IHTTEventInputHeaderTool.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ -/** - * @file IHTTEventInputHeaderTool.h - * - * This declares a basic interface for input tools which provide the HTTEventInputHeader data - * to all HTT processing. - */ - -#ifndef IHTTEventInputHeaderTool_H -#define IHTTEventInputHeaderTool_H - -#include "GaudiKernel/IAlgTool.h" -#include "TFile.h" -#include "TTree.h" - - -// to do: merge this with TrigHTTSGInput/ITrigHTTInputTool -// since they are both abstract interfaces - -class HTTEventInputHeader; -class IHTTEventInputHeaderTool : virtual public ::IAlgTool -{ - public: - virtual ~IHTTEventInputHeaderTool() = default; - DeclareInterfaceID( IHTTEventInputHeaderTool, 1, 0); - - - virtual StatusCode readData(HTTEventInputHeader* header, bool &last) = 0; - virtual StatusCode writeData(HTTEventInputHeader* header) = 0; - virtual HTTEventInputHeader* getEventInputHeader() {return m_eventHeader; }; - virtual TTree* getEventTree() {return m_EventTree;}; - - protected: - - HTTEventInputHeader * m_eventHeader; - TFile * m_infile = nullptr; - TTree * m_EventTree = nullptr; - -}; - - -#endif // IHTTEventInputHeaderTool_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/IHTTEventOutputHeaderTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/IHTTEventOutputHeaderTool.h deleted file mode 100644 index 3ab665dc5fabc8a18a90c90ee12682ca7ca0ebd9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/IHTTEventOutputHeaderTool.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef IHTTEventOutputHeaderTool_H -#define IHTTEventOutputHeaderTool_H - -#include "GaudiKernel/IAlgTool.h" -#include "TFile.h" -#include "TTree.h" - -class HTTLogicalEventOutputHeader; -class HTTLogicalEventInputHeader; - -class IHTTEventOutputHeaderTool : virtual public ::IAlgTool -{ - public: - - DeclareInterfaceID( IHTTEventOutputHeaderTool, 1, 0); - virtual ~IHTTEventOutputHeaderTool() = default; - - virtual StatusCode readData(HTTLogicalEventInputHeader* INheader_1st, HTTLogicalEventInputHeader* INheader_2nd, HTTLogicalEventOutputHeader* OUTheader, bool &last) = 0; - virtual StatusCode writeData(HTTLogicalEventInputHeader* INheader_1st, HTTLogicalEventInputHeader* INheader_2nd, HTTLogicalEventOutputHeader* OUTheader) = 0; - - virtual TTree* getEventTree() {return m_EventTree;}; - virtual HTTLogicalEventInputHeader* getLogicalEventInputHeader_1st() {return m_eventInputHeader_1st; }; - virtual HTTLogicalEventInputHeader* getLogicalEventInputHeader_2nd() {return m_eventInputHeader_2nd; }; - virtual HTTLogicalEventOutputHeader* getLogicalEventOutputHeader() {return m_eventOutputHeader;}; - - protected: - - HTTLogicalEventInputHeader *m_eventInputHeader_1st; - HTTLogicalEventInputHeader *m_eventInputHeader_2nd; - HTTLogicalEventOutputHeader *m_eventOutputHeader; - - - - TFile *m_infile = nullptr; - TTree *m_EventTree = nullptr; - -}; - - -#endif // IHTTEventOutputHeaderTool_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/HTTDumpCond_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/HTTDumpCond_jobOptions.py deleted file mode 100644 index f4ae87fbe83c5069263c1f9860172689f2486392..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/HTTDumpCond_jobOptions.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#----------------------------------------------------------------------------- -# Athena imports -#----------------------------------------------------------------------------- -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - -from AthenaCommon.AppMgr import ToolSvc - -import AthenaCommon.Configurable as Configurable -from AthenaCommon.Constants import INFO -Configurable.log.setLevel(INFO) - -#-------------------------------------------------------------- -# HTT Includes -#-------------------------------------------------------------- - - -from TrigHTTInput.TrigHTTInputConf import HTTDetectorTool, HTTDumpDetStatusAlgo - -import TrigHTTConfTools.HTTTagConfig as HTTTagConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig - -tags = HTTTagConfig.getTags(stage='map') -map_tag = tags['map'] -MapSvc = HTTMapConfig.addMapSvc(map_tag) - -HTTDet = HTTDetectorTool() -ToolSvc += HTTDet - -HTTDumpCond = HTTDumpDetStatusAlgo("HTTDumpDetStatusAlgo") -HTTDumpCond.DumpGlobalToLocalMap = True -theJob += HTTDumpCond diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testDumpOutputStat.ref b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testDumpOutputStat.ref deleted file mode 100644 index 01642e94ccb2f355851967111747a37baf44ac0c..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testDumpOutputStat.ref +++ /dev/null @@ -1,82 +0,0 @@ -Py:HTTDumpOutputStatAlg INFO Output file ['httsim_output.root'] -|-Members = ['HTTDumpOutputStatAlg/HTTDumpOutputStatAlg'] (default: []) -|=/***** Algorithm HTTDumpOutputStatAlg/HTTDumpOutputStatAlg ***************************************** -| \----- (End of Algorithm HTTDumpOutputStatAlg/HTTDumpOutputStatAlg) -------------------------------- -HTTDumpOutputSt... INFO HTTDumpOutputStatAlg::initialize() -HTTDumpOutputSt... DEBUG Initialized in READ MODE -HTTDumpOutputSt... DEBUG Opening file httsim_output.root in RECREATE mode. -HTTDumpOutputSt... INFO Creating empty branches in output file -HTTDumpOutputSt... DEBUG Adding private ToolHandle tool HTTDumpOutputStatAlg.HTTReadInput (HTTOutputHeaderTool) -HTTDumpOutputSt... DEBUG Adding private ToolHandle tool HTTDumpOutputStatAlg.HTTWriteOutput (HTTOutputHeaderTool) -HTTDumpOutputSt... DEBUG Running on event -HTTDumpOutputSt... DEBUG Asked Event 0 in this file; current total is 0 -HTTDumpOutputSt... DEBUG Asked in first stage header event: Event 100007001 Run 242000 -HTTDumpOutputSt... DEBUG n.roads_1st = 15 -HTTDumpOutputSt... DEBUG n.tracks_1st = 15 -HTTDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=511 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=495 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=383 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=508 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=255 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=5 SECTOR1=2658 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=503 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=6 SECTOR1=3258 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=495 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=7 SECTOR1=5158 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=508 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=8 SECTOR1=8519 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=507 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=9 SECTOR1=9470 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=511 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=10 SECTOR1=9470 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=495 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=11 SECTOR1=18557 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=507 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=12 SECTOR1=19816 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=511 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=13 SECTOR1=19816 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=383 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=14 SECTOR1=25190 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=255 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262143 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262095 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262140 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=260095 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262131 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG Writing data in TTree -HTTDumpOutputSt... DEBUG Wrote Event 0 in first stage header event Event 100007001 Run 242000 -HTTDumpOutputSt... DEBUG n.roads_1st = 15 -HTTDumpOutputSt... DEBUG n.roads_2nd = 5 -HTTDumpOutputSt... DEBUG n.tracks_1st = 15 -HTTDumpOutputSt... DEBUG n.tracks_2nd = 5 -HTTDumpOutputSt... DEBUG Running on event -HTTDumpOutputSt... DEBUG Asked Event 1 in this file; current total is 1 -HTTDumpOutputSt... DEBUG Asked in first stage header event: Event 100007018 Run 242000 -HTTDumpOutputSt... DEBUG n.roads_1st = 5 -HTTDumpOutputSt... DEBUG n.tracks_1st = 5 -HTTDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=16185 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=511 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=16185 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=507 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=33439 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=507 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=44304 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=511 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=48352 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=255 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=262140 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=262095 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG Writing data in TTree -HTTDumpOutputSt... DEBUG Wrote Event 1 in first stage header event Event 100007018 Run 242000 -HTTDumpOutputSt... DEBUG n.roads_1st = 5 -HTTDumpOutputSt... DEBUG n.roads_2nd = 2 -HTTDumpOutputSt... DEBUG n.tracks_1st = 5 -HTTDumpOutputSt... DEBUG n.tracks_2nd = 2 -HTTDumpOutputSt... DEBUG Running on event -HTTDumpOutputSt... DEBUG Asked Event 2 in this file; current total is 2 -HTTDumpOutputSt... DEBUG Asked in first stage header event: Event 100007024 Run 242000 -HTTDumpOutputSt... DEBUG n.roads_1st = 8 -HTTDumpOutputSt... DEBUG n.tracks_1st = 8 -HTTDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=1578 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=507 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=511 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=503 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=479 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=508 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=5 SECTOR1=2216 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=508 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=6 SECTOR1=14946 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=508 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=7 SECTOR1=17119 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=503 TYPE=0 NMISS=1 -HTTDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=262143 TYPE=0 NMISS=0 -HTTDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=262140 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=262131 TYPE=0 NMISS=2 -HTTDumpOutputSt... DEBUG Writing data in TTree -HTTDumpOutputSt... DEBUG Wrote Event 2 in first stage header event Event 100007024 Run 242000 -HTTDumpOutputSt... DEBUG n.roads_1st = 8 -HTTDumpOutputSt... DEBUG n.roads_2nd = 3 -HTTDumpOutputSt... DEBUG n.tracks_1st = 8 -HTTDumpOutputSt... DEBUG n.tracks_2nd = 3 -HTTDumpOutputSt... INFO Contains 3 entries, over 3 events run diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testRawToLogical.ref b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testRawToLogical.ref deleted file mode 100644 index 8bd72d53302ea82e7ead5826e1cf89cd56228764..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testRawToLogical.ref +++ /dev/null @@ -1,30 +0,0 @@ -Py:HTTReadLogicalHitsAlg INFO Input file ['httsim_loghits_wrap.OUT.root'] -HTTReadLogicalH... DEBUG Opening file httsim_loghits_wrap.OUT.root in READ mode. -HTTReadLogicalH... INFO Input file: httsim_loghits_wrap.OUT.root has 5 event entries. -HTTReadLogicalH... DEBUG Initialized in READ MODE -HTTReadLogicalH... DEBUG Adding private ToolHandle tool HTTReadLogicalHitsAlg.HTTReadInput (HTTOutputHeaderTool) -HTTReadLogicalH... DEBUG Asked Event 0 in this file; current total is 0 -HTTReadLogicalH... DEBUG Asked in first stage header event: Event 1 Run 242000 -HTTReadLogicalH... DEBUG n.roads_1st = 0 -HTTReadLogicalH... DEBUG n.tracks_1st = 0 -HTTReadLogicalH... DEBUG Event: Event 1 Run 242000 Optional: nOfflineClusters: 13, nOfflineTracks: 1, nTruthTracks: 1 -HTTReadLogicalH... DEBUG Asked Event 1 in this file; current total is 1 -HTTReadLogicalH... DEBUG Asked in first stage header event: Event 14 Run 242000 -HTTReadLogicalH... DEBUG n.roads_1st = 0 -HTTReadLogicalH... DEBUG n.tracks_1st = 0 -HTTReadLogicalH... DEBUG Event: Event 14 Run 242000 Optional: nOfflineClusters: 27, nOfflineTracks: 0, nTruthTracks: 1 -HTTReadLogicalH... DEBUG Asked Event 2 in this file; current total is 2 -HTTReadLogicalH... DEBUG Asked in first stage header event: Event 48 Run 242000 -HTTReadLogicalH... DEBUG n.roads_1st = 0 -HTTReadLogicalH... DEBUG n.tracks_1st = 0 -HTTReadLogicalH... DEBUG Event: Event 48 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 -HTTReadLogicalH... DEBUG Asked Event 3 in this file; current total is 3 -HTTReadLogicalH... DEBUG Asked in first stage header event: Event 55 Run 242000 -HTTReadLogicalH... DEBUG n.roads_1st = 0 -HTTReadLogicalH... DEBUG n.tracks_1st = 0 -HTTReadLogicalH... DEBUG Event: Event 55 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 -HTTReadLogicalH... DEBUG Asked Event 4 in this file; current total is 4 -HTTReadLogicalH... DEBUG Asked in first stage header event: Event 63 Run 242000 -HTTReadLogicalH... DEBUG n.roads_1st = 0 -HTTReadLogicalH... DEBUG n.tracks_1st = 0 -HTTReadLogicalH... DEBUG Event: Event 63 Run 242000 Optional: nOfflineClusters: 18, nOfflineTracks: 1, nTruthTracks: 1 diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testReadRawHit.ref b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testReadRawHit.ref deleted file mode 100644 index 839427b133386385f7d829ed40c6adc8a4b62dad..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/share/testReadRawHit.ref +++ /dev/null @@ -1,37 +0,0 @@ -HTTRawHitsWrapp... INFO HTTRawHitsWrapperAlg::initialize() -HTTRawHitsWrapp... INFO Getting branch and set EventHeader -HTTRawHitsWrapp... DEBUG Initialized in READ MODE -HTTRawHitsWrapp... DEBUG Opening file httsim_rawhits_wrap.OUT.root in RECREATE mode -HTTRawHitsWrapp... INFO Creating empty brnaches in output file -HTTRawHitsWrapp... DEBUG Adding private ToolHandle tool HTTRawHitsWrapperAlg.HTTReadInput (HTTInputHeaderTool) -HTTRawHitsWrapp... DEBUG Adding private ToolHandle tool HTTRawHitsWrapperAlg.HTTWriteInput (HTTInputHeaderTool) -HTTRawHitsWrapp... DEBUG Running on event -HTTRawHitsWrapp... DEBUG Asked Event 0 in this file; current total is 0 -HTTRawHitsWrapp... INFO 0 -HTTRawHitsWrapp... DEBUG Reading event Event 1 Run 242000 -HTTRawHitsWrapp... DEBUG Event: Event 1 Run 242000 Optional: nOfflineClusters: 13, nOfflineTracks: 1, nTruthTracks: 1 -HTTRawHitsWrapp... DEBUG Wrote Event 0 in header event Event 1 Run 242000 -HTTRawHitsWrapp... DEBUG Running on event -HTTRawHitsWrapp... DEBUG Asked Event 1 in this file; current total is 1 -HTTRawHitsWrapp... INFO 1 -HTTRawHitsWrapp... DEBUG Reading event Event 14 Run 242000 -HTTRawHitsWrapp... DEBUG Event: Event 14 Run 242000 Optional: nOfflineClusters: 27, nOfflineTracks: 0, nTruthTracks: 1 -HTTRawHitsWrapp... DEBUG Wrote Event 1 in header event Event 14 Run 242000 -HTTRawHitsWrapp... DEBUG Running on event -HTTRawHitsWrapp... DEBUG Asked Event 2 in this file; current total is 2 -HTTRawHitsWrapp... INFO 2 -HTTRawHitsWrapp... DEBUG Reading event Event 48 Run 242000 -HTTRawHitsWrapp... DEBUG Event: Event 48 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 -HTTRawHitsWrapp... DEBUG Wrote Event 2 in header event Event 48 Run 242000 -HTTRawHitsWrapp... DEBUG Running on event -HTTRawHitsWrapp... DEBUG Asked Event 3 in this file; current total is 3 -HTTRawHitsWrapp... INFO 3 -HTTRawHitsWrapp... DEBUG Reading event Event 55 Run 242000 -HTTRawHitsWrapp... DEBUG Event: Event 55 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 -HTTRawHitsWrapp... DEBUG Wrote Event 3 in header event Event 55 Run 242000 -HTTRawHitsWrapp... DEBUG Running on event -HTTRawHitsWrapp... DEBUG Asked Event 4 in this file; current total is 4 -HTTRawHitsWrapp... INFO 4 -HTTRawHitsWrapp... DEBUG Reading event Event 63 Run 242000 -HTTRawHitsWrapp... DEBUG Event: Event 63 Run 242000 Optional: nOfflineClusters: 18, nOfflineTracks: 1, nTruthTracks: 1 -HTTRawHitsWrapp... DEBUG Wrote Event 4 in header event Event 63 Run 242000 diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpOutputStatAlg.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpOutputStatAlg.h deleted file mode 100644 index 878f1988e89b9d76d22d2711f370e7bfbbdb9da0..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpOutputStatAlg.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef HTT_DUMPOUTPUTSTATALG_H -#define HTT_DUMPOUTPUTSTATALG_H - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrigHTTInput/IHTTEventOutputHeaderTool.h" - - -class TH2F; - -class HTTDumpOutputStatAlg : public AthAlgorithm { -public: - HTTDumpOutputStatAlg (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTDumpOutputStatAlg () {}; - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - StatusCode BookHistograms(); - - -private: - ToolHandle<IHTTEventOutputHeaderTool> m_readOutputTool { this, "InputTool", "HTTOutputHeaderTool/ReadOutputHeaderTool", "Input Tool" }; - ToolHandle<IHTTEventOutputHeaderTool> m_writeOutputTool { this, "OutputTool", "HTTOutputHeaderTool/WriteOutputHeaderTool", "Output Tool" }; - - // histograms - //TH2F* m_hits_r_vs_z = nullptr; -}; - -#endif // HTT_DUMPOUTPUTSTATALG_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTInputHeaderTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTInputHeaderTool.h deleted file mode 100644 index 340e972fc5a71b7c64c57c810e548f83546c5cd3..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTInputHeaderTool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTInputHeaderTool_H -#define HTTInputHeaderTool_H - -/** - * @file HTTInputHeaderTool.h - * - * This class reads HTT input data from a ROOT file (wrapper file) - * Designed to be not thread-safe - */ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" - -#include <atomic> - -class HTTEventInputHeader; - -class HTTInputHeaderTool : public extends<AthAlgTool, IHTTEventInputHeaderTool> { - public: - - HTTInputHeaderTool(const std::string&, const std::string&, const IInterface*); - virtual ~HTTInputHeaderTool() = default; - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - virtual StatusCode readData(HTTEventInputHeader* header, bool &last) override; - virtual StatusCode writeData(HTTEventInputHeader* header) override; - - - private: - StringArrayProperty m_inpath {this, "InFileName", {"."}, "input file paths"}; - StringProperty m_rwoption {this, "RWstatus", std::string("READ"), "define read or write file option: READ, RECREATE, HEADER"}; - - - //internal counters - std::atomic<unsigned> m_event = 0; - std::atomic<unsigned> m_totevent = 0; - std::atomic<unsigned> m_file = 0; - - static const std::string m_branchName; - StatusCode openFile(std::string const & path); - -}; - -#endif // HTTInputHeaderTool_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTLogicalHitsWrapperAlg.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTLogicalHitsWrapperAlg.cxx deleted file mode 100644 index 5812957496a2442ebc7b9d4281c42cc5f7601238..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTLogicalHitsWrapperAlg.cxx +++ /dev/null @@ -1,62 +0,0 @@ -#include "HTTLogicalHitsWrapperAlg.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" -#include "TrigHTTObjects/HTTTowerInputHeader.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" -#include "TrigHTTInput/IHTTEventOutputHeaderTool.h" - -HTTLogicalHitsWrapperAlg::HTTLogicalHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) -{} - - -StatusCode HTTLogicalHitsWrapperAlg::initialize() -{ - ATH_CHECK( m_hitInputTool.retrieve()); - ATH_CHECK( m_writeOutputTool.retrieve()); - ATH_CHECK( m_hitMapTool.retrieve()); - - if (m_Clustering ) { - ATH_CHECK( m_clusteringTool.retrieve()); - ATH_MSG_INFO ("Clustering is enabled"); - } - - return StatusCode::SUCCESS; -} - -StatusCode HTTLogicalHitsWrapperAlg::BookHistograms(){ - return StatusCode::SUCCESS; -} - - -StatusCode HTTLogicalHitsWrapperAlg::execute() -{ - HTTEventInputHeader eventHeader; - - bool last = false; - ATH_CHECK (m_hitInputTool->readData(&eventHeader, last)); - if (last) return StatusCode::SUCCESS; - - ATH_MSG_DEBUG (eventHeader); - - // Map hits: - HTTLogicalEventInputHeader logicEventHeader_1st; - ATH_CHECK(m_hitMapTool->convert(1, eventHeader, logicEventHeader_1st)); - ATH_MSG_DEBUG (logicEventHeader_1st); - - // clustering: - if (m_Clustering) { - std::vector<HTTCluster> clusters; - ATH_CHECK(m_clusteringTool->DoClustering(logicEventHeader_1st, clusters)); - ATH_MSG_INFO ("Ending with " << clusters.size() << " clusters"); - } - - HTTLogicalEventInputHeader logicEventHeader_2nd;//fake empty - HTTLogicalEventOutputHeader logicEventOutputHeader; - ATH_CHECK (m_writeOutputTool->writeData(&logicEventHeader_1st, &logicEventHeader_2nd, &logicEventOutputHeader)); - - return StatusCode::SUCCESS; -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTLogicalHitsWrapperAlg.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTLogicalHitsWrapperAlg.h deleted file mode 100644 index d64e0c6278b166ee333c4576e23aa00dee12bcae..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTLogicalHitsWrapperAlg.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef HTT_LOGICALHITSWRAPPERALG_H -#define HTT_LOGICALHITSWRAPPERALG_H - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "AthContainers/DataVector.h" - -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" -#include "TrigHTTInput/IHTTEventOutputHeaderTool.h" -#include "TrigHTTMaps/HTTClusteringToolI.h" -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" - -class HTTEventInputHeader; -class HTTLogicalEventInputHeader; - -class HTTLogicalHitsWrapperAlg : public AthAlgorithm { -public: - HTTLogicalHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTLogicalHitsWrapperAlg () = default; - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - StatusCode BookHistograms(); - - -private: - - ToolHandle<IHTTEventInputHeaderTool> m_hitInputTool { this, "InputTool", "HTTInputHeaderTool/HTTInputHeaderTool", "Input Tool" }; - ToolHandle<IHTTEventOutputHeaderTool> m_writeOutputTool { this, "OutputTool", "HTTOutputHeaderTool/HTTOutputHeaderTool", "Output Tool" }; - ToolHandle<HTTClusteringToolI> m_clusteringTool { this, "ClusteringTool", "HTTClusteringTool/HTTClusteringTool", "HTT Clustering Tool" }; - ToolHandle<HTTRawToLogicalHitsTool> m_hitMapTool { this, "RawToLogicalHitsTool", "HTTRawToLogicalHitsTool/HTTRawToLogicalHitsTool", "Map Raw to Logical hit Tool" }; - - Gaudi::Property<bool> m_Clustering {this, "Clustering", false, "flag to enable the clustering"}; - -}; - -#endif // HTTSGRORAWHITSWRAPPERALG_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTOutputHeaderTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTOutputHeaderTool.h deleted file mode 100644 index 4af9b8521062a60d046977a4945c825ae6662cc0..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTOutputHeaderTool.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTT_READOUTPUTHEADERTOOL_H -#define HTT_READOUTPUTHEADERTOOL_H - -/** - * @file HTTOutputHeaderTool.h - * - * This class reads/write HTT output data from/to a ROOT file - * Designed to be not thread-safe - */ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTInput/IHTTEventOutputHeaderTool.h" -#include <numeric> -#include <atomic> - -class HTTLogicalEventInputHeader; -class HTTLogicalEventOutputHeader; - -class HTTOutputHeaderTool : public extends<AthAlgTool, IHTTEventOutputHeaderTool> -{ - -public: - - HTTOutputHeaderTool(std::string const &, std::string const &, IInterface const *); - virtual ~HTTOutputHeaderTool() = default; - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - virtual StatusCode readData(HTTLogicalEventInputHeader* INheader_1st, HTTLogicalEventInputHeader* INheader_2nd, HTTLogicalEventOutputHeader* OUTheader, bool &last) override; - virtual StatusCode writeData(HTTLogicalEventInputHeader* INheader_1st, HTTLogicalEventInputHeader* INheader_2nd, HTTLogicalEventOutputHeader* OUTheader) override; - - std::string fileName() { return std::accumulate(m_inpath.value().begin(), m_inpath.value().end(), std::string{}); } - -private: - // JO configuration - StringArrayProperty m_inpath {this, "InFileName", {"."}, "input file paths"}; - StringProperty m_rwoption {this, "RWstatus", std::string("READ"), "define read or write file option: READ, RECREATE, HEADER"}; - BooleanProperty m_runSecondStage {this, "RunSecondStage",false, "flag to enable running the second stage fitting"}; - - // internal counters - std::atomic<unsigned> m_event = 0; - std::atomic<unsigned> m_totevent = 0; - std::atomic<unsigned> m_file = 0; - - // branches - static const std::string m_branchNameIn_1st; - static const std::string m_branchNameIn_2nd; - static const std::string m_branchNameOut; - - StatusCode openFile(std::string const & path); - -}; - -#endif // HTT_READOUTPUTHEADERTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawHitsWrapperAlg.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawHitsWrapperAlg.h deleted file mode 100644 index 3ace300ca314a74248f3a0a80cd8a0c361db5b96..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawHitsWrapperAlg.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef HTT_RAWHITSWRAPPERALG_H -#define HTT_RAWHITSWRAPPERALG_H - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" - -class HTTRawHitsWrapperAlg : public AthAlgorithm { -public: - HTTRawHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTRawHitsWrapperAlg () = default; - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - virtual StatusCode finalize() override; - StatusCode BookHistograms(); - - -private: - // configuration parameters - //TODO: use input from SG: HTTSGToRawHitsTool/IHTTInputTool - ToolHandle<IHTTEventInputHeaderTool> m_readOutputTool { this, "InputTool", "HTTInputHeaderTool/ReadInputHeaderTool", "Input Tool" }; - ToolHandle<IHTTEventInputHeaderTool> m_writeOutputTool { this, "OutputTool", "HTTInputHeaderTool/WriteInputHeaderTool", "Output Tool" }; - - // some debug counters - unsigned int m_tot_hits=0; - unsigned int m_tot_truth=0; - unsigned int m_tot_oftracks=0; -}; - -#endif // HTTRAWHITSWRAPPERALG_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadLogicalHitsAlg.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadLogicalHitsAlg.cxx deleted file mode 100644 index 1f153cc87739bc52069fa1c253bc50c65197a8e6..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadLogicalHitsAlg.cxx +++ /dev/null @@ -1,31 +0,0 @@ -#include "HTTReadLogicalHitsAlg.h" -#include "TrigHTTObjects/HTTTowerInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" - - -HTTReadLogicalHitsAlg::HTTReadLogicalHitsAlg (const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator){} - -StatusCode HTTReadLogicalHitsAlg::initialize() -{ - ATH_CHECK( m_readOutputTool.retrieve()); - m_event=0; - return StatusCode::SUCCESS; -} - - -StatusCode HTTReadLogicalHitsAlg::execute() -{ - HTTLogicalEventInputHeader eventInputHeader_1st; - HTTLogicalEventInputHeader eventInputHeader_2nd; - HTTLogicalEventOutputHeader eventOutputHeader; - bool last = false; - ATH_CHECK(m_readOutputTool->readData(&eventInputHeader_1st, &eventInputHeader_2nd, &eventOutputHeader, last) ); - if (last) return StatusCode::SUCCESS; - ATH_MSG_DEBUG (eventInputHeader_1st); - m_event++; - - return StatusCode::SUCCESS; -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadLogicalHitsAlg.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadLogicalHitsAlg.h deleted file mode 100644 index 58fe1f4cbf6c76fd2d67983d2e41ba9ca594a53b..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadLogicalHitsAlg.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef HTT_READLOGICALHITS_H -#define HTT_READLOGICALHITS_H - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "TrigHTTInput/IHTTEventOutputHeaderTool.h" -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" - - -class HTTReadLogicalHitsAlg : public AthAlgorithm { -public: - HTTReadLogicalHitsAlg (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTReadLogicalHitsAlg () = default; - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - - -private: - - ToolHandle<IHTTEventOutputHeaderTool> m_readOutputTool {this, "InputTool", "HTTOutputHeaderTool/HTTOutputHeaderTool"}; - - unsigned int m_event = 0U; - -}; - -#endif // HTTREADLOGICALHITS_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadRawRandomHitsTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadRawRandomHitsTool.h deleted file mode 100644 index 9d384187b1ce4b5209a6eb8273ec9692a20dfcd4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadRawRandomHitsTool.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTREADRAWRANDOMHITSTOOL_H -#define HTTREADRAWRANDOMHITSTOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" - -#include "TFile.h" -#include "TTree.h" - - - -class HTTReadRawRandomHitsTool : public extends<AthAlgTool, IHTTEventInputHeaderTool> -{ - public: - - HTTReadRawRandomHitsTool(const std::string&, const std::string&, const IInterface*); - virtual ~HTTReadRawRandomHitsTool() = default; - virtual StatusCode initialize() override; - virtual StatusCode readData(HTTEventInputHeader* header, bool &last) override; - virtual StatusCode writeData(HTTEventInputHeader* header) override; - virtual StatusCode finalize() override; - - StatusCode readData(HTTEventInputHeader* header, bool &last, bool doReset); - - private: - // JO configuration - StringProperty m_inpath {this, "InFileName", "httsim_smartwrapper.root", "input path"}; - - // Internal pointers - unsigned int m_nEntries = 0U; - unsigned m_entry = 0; -}; - -#endif // HTTREADRAWRANDOMHINPUTTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/components/TrigHTTInput_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/components/TrigHTTInput_entries.cxx deleted file mode 100644 index 2118c169474d98725d0b00d43c37aed1261d1b9e..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/components/TrigHTTInput_entries.cxx +++ /dev/null @@ -1,26 +0,0 @@ -#include "../HTTRawHitsWrapperAlg.h" -#include "../HTTRawNtupleWrapperAlg.h" -#include "../HTTReadLogicalHitsAlg.h" -#include "../HTTLogicalHitsWrapperAlg.h" -#include "../HTTReadRawRandomHitsTool.h" -#include "../HTTInputHeaderTool.h" -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" -#include "../HTTDetectorTool.h" -#include "../HTTDumpDetStatusAlgo.h" -#include "../HTTOutputHeaderTool.h" -#include "../HTTDumpOutputStatAlg.h" - - -DECLARE_COMPONENT( HTTDetectorTool ) -DECLARE_COMPONENT( HTTReadRawRandomHitsTool ) -DECLARE_COMPONENT( HTTInputHeaderTool ) -DECLARE_COMPONENT( HTTRawToLogicalHitsTool ) -DECLARE_COMPONENT( HTTOutputHeaderTool ) - -DECLARE_COMPONENT( HTTDumpDetStatusAlgo ) -DECLARE_COMPONENT( HTTRawHitsWrapperAlg ) -DECLARE_COMPONENT( HTTRawNtupleWrapperAlg ) -DECLARE_COMPONENT( HTTReadLogicalHitsAlg) -DECLARE_COMPONENT( HTTLogicalHitsWrapperAlg) -DECLARE_COMPONENT( HTTDumpOutputStatAlg ) - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTDumpOutputStatAlg_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTDumpOutputStatAlg_jobOptions.py deleted file mode 100644 index 169105af988a0c8a58fbbd0cc5db3946f54b946c..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTDumpOutputStatAlg_jobOptions.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -############################################################### -# -# HTTDumpOutputStatAlg job options file -# -#============================================================== -import os -import glob - -from AthenaCommon.Logging import logging -from AthenaCommon.Constants import DEBUG - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - -from AthenaCommon.AppMgr import ToolSvc - -#input -HTTInputFile = [] -if 'HTTInputFile' in os.environ: - for ex in os.environ['HTTInputFile'].split(','): - files = glob.glob(ex) - if files: - HTTInputFile += files - else: - HTTInputFile += [ex] -else: - HTTInputFile = ["httsim_input.root"] - -msg = logging.getLogger('HTTDumpOutputStatAlg') -msg.info("Input file: %r", HTTInputFile) - - #output -HTTOutputFile = [] -if 'HTTOutputFile' in os.environ : - for ex in os.environ['HTTOutputFile'].split(','): - files = glob.glob(ex) - if files: - HTTOutputFile += files - else: - HTTOutputFile += [ex] -else : - HTTOutputFile = ["httsim_output.root"] -msg.info("Output file %r", HTTOutputFile) - - -# input -from TrigHTTInput.TrigHTTInputConf import HTTOutputHeaderTool -HTTReadInput = HTTOutputHeaderTool("HTTReadInput", OutputLevel = DEBUG) -HTTReadInput.InFileName=HTTInputFile -HTTReadInput.RWstatus="READ" -ToolSvc += HTTReadInput - -# output -HTTWriteOutput = HTTOutputHeaderTool("HTTWriteOutput", OutputLevel = DEBUG) -HTTWriteOutput.InFileName=HTTOutputFile -HTTWriteOutput.RWstatus="RECREATE" -ToolSvc += HTTWriteOutput - - -from TrigHTTInput.TrigHTTInputConf import HTTDumpOutputStatAlg -theAlg = HTTDumpOutputStatAlg(OutputLevel = DEBUG) - -theAlg.InputTool = HTTReadInput -theAlg.OutputTool = HTTWriteOutput - - -theJob += theAlg -print (theJob) -############################################################### diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTRawToLogicalHitsWrapperAlg_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTRawToLogicalHitsWrapperAlg_jobOptions.py deleted file mode 100644 index 05c07d2588176555b4517085ba1524339055cd44..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTRawToLogicalHitsWrapperAlg_jobOptions.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -############################################################### -# -# TrigHTTWrapper job options file -# -#============================================================== - - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - -from PyJobTransformsCore.runargs import RunArguments -runArgs = RunArguments() - -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon.Logging import logging -from AthenaCommon.Constants import DEBUG - -import os -import glob - -#-------------------------------------------------------------- -# HTT Includes -#-------------------------------------------------------------- - -import TrigHTTConfTools.HTTTagConfig as HTTTagConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig - -tags = HTTTagConfig.getTags(stage='map') -map_tag = tags['map'] -MapSvc = HTTMapConfig.addMapSvc(map_tag) - -#-------------------------------------------------------------- -# Arguments -#-------------------------------------------------------------- - -InputHTTRawHitFile = [] -if 'InputHTTRawHitFile' in os.environ: - for ex in os.environ['InputHTTRawHitFile'].split(','): - files = glob.glob(ex) - if files: - InputHTTRawHitFile += files - else: - InputHTTRawHitFile += [ex] -else: - InputHTTRawHitFile = ["httsim_rawhits_wrap.root"] - - #output -OutputHTTRawHitFile = [] -if 'OutputHTTRawHitFile' in os.environ : - for ex in os.environ['OutputHTTRawHitFile'].split(','): - files = glob.glob(ex) - if files: - OutputHTTRawHitFile += files - else: - OutputHTTRawHitFile += [ex] -else : - OutputHTTRawHitFile = ["httsim_rawhits_wrap.OUT.root"] -msg = logging.getLogger('HTTRawToLogicalHitsWrapperAlg') -msg.info("OutHTTSim file %r ", OutputHTTRawHitFile) - - - -#-------------------------------------------------------------- -# Create the components -#-------------------------------------------------------------- - -from TrigHTTInput.TrigHTTInputConf import HTTInputHeaderTool, HTTOutputHeaderTool -HTTReadInput = HTTInputHeaderTool(OutputLevel = DEBUG) -HTTReadInput.InFileName=InputHTTRawHitFile -HTTReadInput.RWstatus="READ" -#HTTReadInput.ReadTruthTracks = True -ToolSvc += HTTReadInput - -HTTWriteOutput = HTTOutputHeaderTool("HTTWriteOutput", OutputLevel = DEBUG) -HTTWriteOutput.InFileName=OutputHTTRawHitFile -HTTWriteOutput.RWstatus="RECREATE" -ToolSvc += HTTWriteOutput - - - -from TrigHTTInput.TrigHTTInputConf import HTTRawToLogicalHitsTool -HTTRawLogic = HTTRawToLogicalHitsTool(OutputLevel = DEBUG) -HTTRawLogic.SaveOptional = 2 -ToolSvc += HTTRawLogic - - - -from TrigHTTInput.TrigHTTInputConf import HTTLogicalHitsWrapperAlg -wrapper = HTTLogicalHitsWrapperAlg(OutputLevel = DEBUG) - -wrapper.InputTool = HTTReadInput -wrapper.OutputTool = HTTWriteOutput -wrapper.RawToLogicalHitsTool = HTTRawLogic -wrapper.Clustering = True -theJob += wrapper - -############################################################### diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTReadLogicalHitsAlg_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTReadLogicalHitsAlg_jobOptions.py deleted file mode 100644 index 8c9c8adca22b3895ddd1842f8ad7d6b286c24b6c..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTReadLogicalHitsAlg_jobOptions.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -############################################################### -# -# TrigHTTWrapper job options file -# -#============================================================== - - -from AthenaCommon.AppMgr import ToolSvc -import TrigHTTConfTools.HTTTagConfig as HTTTagConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig - -tags = HTTTagConfig.getTags(stage='map') -map_tag = tags['map'] -MapSvc = HTTMapConfig.addMapSvc(map_tag) - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - - -import glob -import os -from AthenaCommon.Logging import logging -from AthenaCommon.Constants import DEBUG - -#input -InputHTTLogHitFile = [] -if 'InputHTTLogHitFile' in os.environ: - for ex in os.environ['InputHTTLogHitFile'].split(','): - files = glob.glob(ex) - if files: - InputHTTLogHitFile += files - else: - InputHTTLogHitFile += [ex] -else : - InputHTTLogHitFile = ["httsim_loghits_wrap.OUT.root"] - -msg = logging.getLogger('HTTReadLogicalHitsAlg') -msg.info("Input file %r", InputHTTLogHitFile) - - -from TrigHTTInput.TrigHTTInputConf import HTTOutputHeaderTool -HTTReadInput = HTTOutputHeaderTool("HTTReadInput", OutputLevel = DEBUG) -HTTReadInput.InFileName=InputHTTLogHitFile -HTTReadInput.RWstatus="READ" -ToolSvc += HTTReadInput - -from TrigHTTInput.TrigHTTInputConf import HTTReadLogicalHitsAlg -wrapper = HTTReadLogicalHitsAlg(OutputLevel = DEBUG) -wrapper.InputTool = HTTReadInput - -theJob += wrapper - -############################################################### diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTReadRawHitsWrapperAlg_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTReadRawHitsWrapperAlg_jobOptions.py deleted file mode 100644 index 5acba788ba44279ec679a872e324144fce7d5407..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/HTTReadRawHitsWrapperAlg_jobOptions.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -############################################################### -# -# TrigHTTWrapper job options file -# -#============================================================== -import os -import glob - -import TrigHTTConfTools.HTTTagConfig as HTTTagConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig - -tags = HTTTagConfig.getTags(stage='map') -map_tag = tags['map'] -MapSvc = HTTMapConfig.addMapSvc(map_tag) - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon.Logging import logging -from AthenaCommon.Constants import DEBUG - - -#input -InputHTTRawHitFile = [] -if 'InputHTTRawHitFile' in os.environ: - for ex in os.environ['InputHTTRawHitFile'].split(','): - files = glob.glob(ex) - if files: - InputHTTRawHitFile += files - else: - InputHTTRawHitFile += [ex] -else : - InputHTTRawHitFile = ["httsim_rawhits_wrap.root"] - -msg = logging.getLogger('HTTReadRawHitsWrapperAlg') -msg.info("Input file %r", InputHTTRawHitFile) - -#output -OutputHTTRawHitFile = [] -if 'OutputHTTRawHitFile' in os.environ : - for ex in os.environ['OutputHTTRawHitFile'].split(','): - files = glob.glob(ex) - if files: - OutputHTTRawHitFile += files - else: - OutputHTTRawHitFile += [ex] -else : - OutputHTTRawHitFile = ["httsim_rawhits_wrap.OUT.root"] -msg.info("OutHTTSim file %r", OutputHTTRawHitFile) - - - -from TrigHTTInput.TrigHTTInputConf import HTTInputHeaderTool -HTTReadInput = HTTInputHeaderTool("HTTReadInput", OutputLevel = DEBUG) -HTTReadInput.InFileName=InputHTTRawHitFile -HTTReadInput.RWstatus="READ" -#HTTReadInput.ReadTruthTracks = True -ToolSvc += HTTReadInput - -HTTWriteOutput = HTTInputHeaderTool("HTTWriteInput", OutputLevel = DEBUG) -HTTWriteOutput.InFileName=OutputHTTRawHitFile -HTTWriteOutput.RWstatus="RECREATE" -ToolSvc += HTTWriteOutput - -from TrigHTTInput.TrigHTTInputConf import HTTRawHitsWrapperAlg -wrapper = HTTRawHitsWrapperAlg(OutputLevel = DEBUG) - -wrapper.InputTool = HTTReadInput -wrapper.OutputTool = HTTWriteOutput - -theJob += wrapper - -############################################################### diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTDumpOutputStatAlg.sh b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTDumpOutputStatAlg.sh deleted file mode 100755 index 8bc22ef81ba074be5056c4339a890b3b2741fe5b..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTDumpOutputStatAlg.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -source `which HTTInputTestSetup.sh` - -export HTTInputFile=$HTTLogHitFile -echo "Running on Input file $HTTInputFile" -athena --evtMax=3 TrigHTTInput/HTTDumpOutputStatAlg_jobOptions.py diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTRawToLogicalWrapperAlg.sh b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTRawToLogicalWrapperAlg.sh deleted file mode 100755 index db342f062da3d8d9d6d19bdded1ccc79798555bd..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTRawToLogicalWrapperAlg.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -source `which HTTInputTestSetup.sh` - -export InputHTTRawHitFile=$HTTRawHitFile -export OutputHTTRawHitFile="httsim_loghits_wrap.OUT.root" - -athena --evtMax=5 TrigHTTInput/HTTRawToLogicalHitsWrapperAlg_jobOptions.py - -echo "Produced file $OutputHTTRawHitFile, now read it back" - -export InputHTTLogHitFile=$OutputHTTRawHitFile -athena --evtMax=5 TrigHTTInput/HTTReadLogicalHitsAlg_jobOptions.py - - - - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTReadRawHitsWrapperAlg.sh b/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTReadRawHitsWrapperAlg.sh deleted file mode 100755 index df5f1a4212e6c0f9ccb57329cb99ff7be9f02356..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/test/test_TrigHTTReadRawHitsWrapperAlg.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -source `which HTTInputTestSetup.sh` - -export InputHTTRawHitFile=$HTTRawHitFile -export OutputHTTRawHitFile="httsim_rawhits_wrap.OUT.root" -athena --evtMax=5 TrigHTTInput/HTTReadRawHitsWrapperAlg_jobOptions.py - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/CMakeLists.txt b/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/CMakeLists.txt deleted file mode 100644 index f4d83004f4fbe0d2006196d6171aa80685168757..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( TrigHTTLRT ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Hist RIO ) - -# Component(s) in the package: -atlas_add_library( TrigHTTLRTLib - src/*.cxx TrigHTTLRT/*.h - PUBLIC_HEADERS TrigHTTLRT - LINK_LIBRARIES AthenaBaseComps GaudiKernel TrigHTTBanksLib TrigHTTHoughLib TrigHTTObjectsLib - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} TrigHTTMapsLib -) - -atlas_add_component( TrigHTTLRT - src/components/*.cxx - LINK_LIBRARIES TrigHTTLRTLib -) - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 645bf1757c288a44d24375a99b0d179e7d2a3327..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/IHTTRoadFilterTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/IHTTRoadFilterTool.h deleted file mode 100644 index 7f98d301b51fd1d021ec33c3b91ac9bb18998dd7..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/IHTTRoadFilterTool.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTROADFILTERI_H -#define HTTROADFILTERI_H - -/** - * @file IHTTRoadFilterTool.h - * @author Elliot Lipeles lipeles@cern.ch - * @date 03/25/21 - * @brief Interface declaration for road filter tools - * - * This class is implemented by - * - HTTEtaPatternFilterTool - */ - -#include "GaudiKernel/IAlgTool.h" - -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTRoad.h" - -#include <vector> - - -/** - * A road filter returns a vector of roads given a vector of roads. - * - * Note that the postfilter_roads are owned by the tool, and are cleared at each successive - * call of filterRoads(). - */ - -class IHTTRoadFilterTool : virtual public IAlgTool -{ - public: - DeclareInterfaceID(IHTTRoadFilterTool, 1, 0); - virtual StatusCode filterRoads(const std::vector<HTTRoad*> & prefilter_roads, std::vector<HTTRoad*> & postfilter_roads) = 0; -}; - - -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/IHTTRoadFinderTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/IHTTRoadFinderTool.h deleted file mode 100644 index 35c83b7c420dfea8936ff4222b27ec6ba370f452..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/IHTTRoadFinderTool.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTROADFINDERI_H -#define HTTROADFINDERI_H - -/** - * @file IHTTRoadFinderTool.h - * @author Riley Xu - rixu@cern.ch - * @date 10/23/19 - * @brief Interface declaration for road finder tools - * - * This class is implemented by - * - HTTRoadUnionTool - * - HTTPatternMatchTool - * - HTTSectorMatchTool - * - HTTHoughTransformTool - * - HTTHough1DShiftTool - */ - -#include "GaudiKernel/IAlgTool.h" - -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTRoad.h" - -#include <vector> - -class HTTHit; - - -/** - * A road finder returns a vector of roads given a vector of hits. - * - * Note that the roads are owned by the tool, and are cleared at each successive - * call of getRoads(). - */ - - -class IHTTRoadFinderTool : virtual public IAlgTool -{ - public: - DeclareInterfaceID(IHTTRoadFinderTool, 1, 0); - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) = 0; -}; - - -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/components/TrigHTTLRT_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/components/TrigHTTLRT_entries.cxx deleted file mode 100644 index 86383181208f3b3489cd9293feb5bc612979a4fb..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/components/TrigHTTLRT_entries.cxx +++ /dev/null @@ -1,7 +0,0 @@ -#include "../HTTHoughTransform_d0phi0_Tool.h" -#include "../HTTLLPDoubletHoughTransformTool.h" -#include "TrigHTTLRT/HTTLLPRoadFilterTool.h" - -DECLARE_COMPONENT( HTTHoughTransform_d0phi0_Tool ) -DECLARE_COMPONENT( HTTLLPDoubletHoughTransformTool ) -DECLARE_COMPONENT( HTTLLPRoadFilterTool ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/CMakeLists.txt b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/CMakeLists.txt deleted file mode 100644 index 65d90af70f713471a3363ef5c175bafcad519f0c..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( TrigHTTMaps ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) -find_package( Boost ) -find_package( lwtnn ) - -# Component(s) in the package: -atlas_add_library( - TrigHTTMapsLib src/*.cxx TrigHTTMaps/*.h - PUBLIC_HEADERS TrigHTTMaps - INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} - LINK_LIBRARIES ${LWTNN_LIBRARIES} GaudiKernel TrigHTTConfToolsLib TrigHTTObjectsLib - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AsgMessagingLib AthenaBaseComps PathResolver -) - -atlas_add_component( - TrigHTTMaps src/components/*.cxx - LINK_LIBRARIES TrigHTTMapsLib TrigHTTConfToolsLib -) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) - -# Tests in the package: -atlas_add_test( HTTPlaneMap - SOURCES test/HTTPlaneMap_test.cxx - LINK_LIBRARIES AthenaKernel TrigHTTMapsLib TestTools - PROPERTIES - TIMEOUT 120 -) - -atlas_add_test( HTTRegionMap - SOURCES test/HTTRegionMap_test.cxx - LINK_LIBRARIES AthenaKernel TrigHTTMapsLib TestTools - PROPERTIES - TIMEOUT 120 -) - - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index fd004769e6a768665514db098952aededa4dcb93..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTClusteringToolI.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTClusteringToolI.h deleted file mode 100644 index 393d0336ad5c57655c28077488204b0691c0bf60..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTClusteringToolI.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTCLUSTERINGTOOLI_H -#define HTTCLUSTERINGTOOLI_H - -/** - * @file HTTClusteringToolI.h - * @author Alex Martyniuk - martyniu@cern.ch - * @date 04/12/19 - * @brief Declares an abstract class that implements an interface for pixel clustering. - * This class is implemented in - * HTTClusteringTool.h - * HTTClusteringFTKTool.h - * HTTClusteringOfflineTool.h - */ - -#include "GaudiKernel/IAlgTool.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" - -class HTTClusteringToolI : virtual public ::IAlgTool -{ - public: - DeclareInterfaceID( HTTClusteringToolI, 1, 0); - virtual ~HTTClusteringToolI() = default; - - virtual StatusCode DoClustering(HTTLogicalEventInputHeader &, std::vector<HTTCluster> &) const = 0; -}; - -#endif //HTTCLUSTERINGTOOLI_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTSpacePointsToolI.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTSpacePointsToolI.h deleted file mode 100644 index 44467eb6d16633645bc3f9054e7015f9b58d314c..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTSpacePointsToolI.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef HTTSPACEPOINTSTOOLI_H -#define HTTSPACEPOINTSTOOLI_H - -/** - * @file HTTSpacePointsToolI.h - * @author Julian Wollrath - wollrath@cern.ch - * @date 2021 - * @brief Declares an abstract class that implements an interface for spacepoint formation. - * This class is implemented in - * HTTSpacePointsTool.h - */ - -#include "GaudiKernel/IAlgTool.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" - -const InterfaceID IID_HTTSpacePointsToolI("HTTSpacePointsToolI", 1, 0); - -class HTTSpacePointsToolI : virtual public ::IAlgTool { - public: - DeclareInterfaceID(HTTSpacePointsToolI, 1, 0); - virtual ~HTTSpacePointsToolI() = default; - - virtual StatusCode DoSpacePoints(HTTLogicalEventInputHeader &, std::vector<HTTCluster> &) = 0; -}; - -#endif // HTTSPACEPOINTSTOOLI_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/IHTTHitFilteringTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/IHTTHitFilteringTool.h deleted file mode 100644 index e596f09d5de562f7ba1bc9dba493335649e60362..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/IHTTHitFilteringTool.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef IHTTHITFILTERINGTOOL_H -#define IHTTHITFILTERINGTOOL_H - -/** - * @file IHTTHitFilteringTool.h - * @author Will Kalderon - willam.kalderon@cern.ch, Julian Wollrath - wollrath@cern.ch - * @date 2021 - * @brief Declares an abstract class that implements an interface for hit/cluster filtering. - * This class is implemented in - * HTTHitFilteringTool.h - */ - -#include "GaudiKernel/IAlgTool.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "HTTPlaneMap.h" - -class IHTTHitFilteringTool : virtual public ::IAlgTool { - public: - DeclareInterfaceID(IHTTHitFilteringTool, 1, 0); - virtual ~IHTTHitFilteringTool() = default; - - virtual StatusCode DoRandomRemoval(HTTLogicalEventInputHeader &, bool) = 0; - virtual StatusCode GetPairedStripPhysLayers(const HTTPlaneMap*, std::vector<int> &) = 0; - virtual StatusCode DoHitFiltering(HTTLogicalEventInputHeader &, - std::vector<int>, std::vector<int>, - std::vector<HTTCluster> &) = 0; - -}; - -#endif // IHTTHITFILTERINGTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/ITrigHTTMappingSvc.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/ITrigHTTMappingSvc.h deleted file mode 100644 index ff9ccfd70e6951b769175fe74f0d4381ae4580a9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/ITrigHTTMappingSvc.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - - -#ifndef ITRIGHTTMAPPINGSVC_H -#define ITRIGHTTMAPPINGSVC_H - -#include "GaudiKernel/IService.h" -#include "GaudiKernel/IInterface.h" - -// Forward declarations -class HTTRegionMap; -class HTTPlaneMap; -class HTTNNMap; - - -class ITrigHTTMappingSvc: virtual public IService -{ - public: - DeclareInterfaceID(ITrigHTTMappingSvc, 1, 0); - - virtual const HTTPlaneMap* PlaneMap_1st() const = 0; - virtual const HTTPlaneMap* PlaneMap_2nd() const = 0; - virtual const HTTRegionMap* RegionMap_1st() const = 0; - virtual const HTTRegionMap* RegionMap_2nd() const = 0; - virtual const HTTRegionMap* SubRegionMap() const = 0; - virtual const HTTNNMap* NNMap() const = 0; -}; - - - -#endif // ITRIGHTTMAPPINGSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringOfflineTool.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringOfflineTool.cxx deleted file mode 100644 index d71d117cfdae81a83c001dec843b2caad2b2e29f..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringOfflineTool.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "HTTClusteringOfflineTool.h" - -HTTClusteringOfflineTool::HTTClusteringOfflineTool(const std::string& algname, const std::string &name, const IInterface *ifc) : - base_class(algname, name, ifc) -{ -} - - -StatusCode HTTClusteringOfflineTool::DoClustering(HTTLogicalEventInputHeader &header, std::vector<HTTCluster> &clusters) const -{ - - clusters = header.optional().getOfflineClusters(); - //fill the multitruth - for( auto& cluster:clusters){ - HTTHit clusterEquiv = cluster.getClusterEquiv(); - HTTMultiTruth mt; - HTTMultiTruth::Barcode uniquecode(clusterEquiv.getEventIndex(),clusterEquiv.getBarcode()); - mt.maximize(uniquecode,clusterEquiv.getBarcodePt()); - clusterEquiv.setTruth(mt); - cluster.setClusterEquiv(clusterEquiv); - } - return StatusCode::SUCCESS; -} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringOfflineTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringOfflineTool.h deleted file mode 100644 index 0a1b0845960fef44a59938647d2954b2ec3bcdf8..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringOfflineTool.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTCLUSTERINGOFFLINETOOL_H -#define HTTCLUSTERINGOFFLINETOOL_H - -/* - * httClustering - * --------------- - * - * Routines to perform clustering in the pixels, based on TrigHTTSim - * - */ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTMaps/HTTClusteringToolI.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTCluster.h" -#include <cmath> -#include <cassert> -#include <iostream> -#include <iomanip> -#include <stack> -#include <queue> - -class HTTClusteringOfflineTool : public extends <AthAlgTool,HTTClusteringToolI> { -public: - - HTTClusteringOfflineTool(const std::string&, const std::string&, const IInterface*); - - virtual ~HTTClusteringOfflineTool() = default; - - virtual StatusCode DoClustering(HTTLogicalEventInputHeader &, std::vector<HTTCluster> &) const override; - - private: - -}; - -#endif // HTTCLUSTERINGOFFLINETOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringTool.h deleted file mode 100644 index 96a74f9229c67c1bc9c55db60693f91acd358ed3..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringTool.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTCLUSTERINGTOOL_H -#define HTTCLUSTERINGTOOL_H - -/* - * httClustering - * --------------- - * - * Routines to perform clustering in the pixels, based on TrigHTTSim - * - */ - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTMaps/HTTClusteringToolI.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTCluster.h" - -namespace HTTCLUSTERING { - void attachTruth(std::vector<HTTHit> &); - bool updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incomingHit, bool newCluster); - bool updateStripCluster(HTTCluster ¤tCluster, HTTHit &incomingHit, bool newCluster); - void updateClusterContents(HTTCluster ¤tCluster, int &clusterRow, int &clusterRowWidth, int &clusterCol, int &clusterColWidth, HTTHit &incomingHit); - bool sortITkInputEta(const HTTHit& hitA, const HTTHit& hitB); - bool sortITkInputPhi(const HTTHit& hitA, const HTTHit& HitB); -} - -class HTTClusteringTool : public extends <AthAlgTool,HTTClusteringToolI> { -public: - - HTTClusteringTool(const std::string&, const std::string&, const IInterface*); - - virtual ~HTTClusteringTool() = default; - - virtual StatusCode DoClustering(HTTLogicalEventInputHeader &, std::vector<HTTCluster> &) const override; - - private: - - //HTT pixel clustering using the HTTSim objects - void SortedClustering(const std::vector<std::vector<HTTHit> >& sorted_hits, std::vector<HTTCluster> &) const; - void Clustering(std::vector<HTTHit>, std::vector<HTTCluster> &) const ; - - // Other helper functions - void splitAndSortHits(std::vector<HTTHit>& hits, std::vector<std::vector<HTTHit> >& hitsPerModule, int& eta_phi) const; - void splitAndSortHits(std::vector<HTTHit>& hits, std::vector<std::vector<HTTHit> >& hitsPerModule) const; - void splitHitsToModules(std::vector<HTTHit>& hits, std::vector<std::vector<HTTHit> >& hitsPerModule) const; - void normaliseClusters(std::vector<HTTCluster> &clusters) const; - void sortHitsOnModules(std::vector<std::vector<HTTHit> >& hitsPerModule, int& eta_phi) const; - void sortHitsOnModules(std::vector<std::vector<HTTHit> >& hitsPerModule) const; - bool etaOrPhi(const HTTHit& hit) const; - bool sortIBLInput(const std::unique_ptr<HTTHit>& i, const std::unique_ptr<HTTHit>& j) const; - bool sortPixelInput(const std::unique_ptr<HTTHit>& i, const std::unique_ptr<HTTHit>& j) const; - - - -}; - -#endif // HTTCLUSTERINGTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool.h deleted file mode 100644 index 2331d3f5d7ef89567fee82ab368e55394bf9bcb4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTSPACEPOINTSTOOL_H -#define HTTSPACEPOINTSTOOL_H - -#include <array> -#include <vector> - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTMaps/HTTSpacePointsToolI.h" - -class HTTSpacePointsTool : public extends<AthAlgTool, HTTSpacePointsToolI> { - public: - HTTSpacePointsTool(const std::string &, const std::string &, const IInterface *); - virtual ~HTTSpacePointsTool() = default; - - virtual StatusCode initialize() override; - - virtual StatusCode DoSpacePoints(HTTLogicalEventInputHeader &, std::vector<HTTCluster> &) override; - - private: - void SpacePointFinder(const std::vector<HTTHit> &, std::vector<std::array<int, 2>> &); - - - Gaudi::Property<bool> m_duplicate {this, "Duplication", false, "Duplicate spacepoint to layer on the other side of the stave"}; - Gaudi::Property<bool> m_filter {this, "Filtering", false, "Filter out incomplete spacepoints"}; - Gaudi::Property<bool> m_filterClose {this, "FilteringClosePoints", false, "Filter out single hits close to spacepoints"}; -}; - -#endif // HTTSPACEPOINTSTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool_v2.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool_v2.h deleted file mode 100644 index 552d9b5356c095aef32218e8c2e478865461ab24..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool_v2.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HTTSPACEPOINTSTOOLV2_H -#define HTTSPACEPOINTSTOOLV2_H - -#include <array> -#include <vector> -#include <map> - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTMaps/HTTSpacePointsToolI.h" - -class TH1I; - -class HTTSpacePointsTool_v2 : public extends<AthAlgTool, HTTSpacePointsToolI> { - public: - HTTSpacePointsTool_v2(const std::string &, const std::string &, const IInterface *); - virtual ~HTTSpacePointsTool_v2() = default; - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - virtual StatusCode DoSpacePoints(HTTLogicalEventInputHeader &, std::vector<HTTCluster> &) override; - - private: - StatusCode fillMaps(std::vector<HTTHit>& hits); - StatusCode makeSpacePoints(HTTTowerInputHeader &tower, std::vector<HTTCluster> &spacepoints); - void calcPosition(HTTHit &hit_in, HTTHit &hit_out, float &x, float &y, float &z); - bool searchForMatch(HTTHit& hit_in,std::vector<HTTHit>& hits_outer,HTTTowerInputHeader &tower, std::vector<HTTCluster> &spacepoints); - void addSpacePoints(HTTHit& hit_in, HTTHit& hit_out ,HTTTowerInputHeader &tower, std::vector<HTTCluster> &spacepoints); - - //---------------------- - // Working Memory - std::map<std::vector<int>,std::pair<std::vector<HTTHit>,std::vector<HTTHit>>> m_map; - std::vector<HTTHit> m_pixel; - - Gaudi::Property<float> m_phiwindow {this, "PhiWindow", 0.008, "Distance in phi (radians) to consider two hits for making a space-point"}; - Gaudi::Property<bool> m_duplicate {this, "Duplication", false, "Duplicate spacepoint to layer on the other side of the stave"}; - Gaudi::Property<bool> m_filter {this, "Filtering", false, "Filter out incomplete spacepoints"}; - Gaudi::Property<bool> m_filterClose {this, "FilteringClosePoints", false, "Filter out single hits close to spacepoints"}; - - // self monitoring - unsigned m_inputhits = 0; - unsigned m_spacepts = 0; - unsigned m_filteredhits = 0; - unsigned m_diffmodule = 0; - TH1I* m_spacepts_per_hit = nullptr; - -}; - -#endif // HTTSPACEPOINTSTOOLV2_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/TrigHTTMappingSvc.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/TrigHTTMappingSvc.h deleted file mode 100644 index 0a3f30bde6a574b897ad21d54108b70d1aa24d49..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/TrigHTTMappingSvc.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef TRIGHTTMAPPINGSVC_H -#define TRIGHTTMAPPINGSVC_H - -#include "AthenaBaseComps/AthService.h" - -#include "TrigHTTMaps/HTTRegionMap.h" -#include "TrigHTTMaps/HTTNNMap.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" - -class IHTTEventSelectionSvc; - -class TrigHTTMappingSvc : public AthService, virtual public ITrigHTTMappingSvc -{ - public: - - TrigHTTMappingSvc(const std::string& name, ISvcLocator* svc); - virtual ~TrigHTTMappingSvc() = default; - - virtual StatusCode initialize() override; - - virtual const HTTPlaneMap* PlaneMap_1st() const override { return m_pmap_1st.get(); } - virtual const HTTPlaneMap* PlaneMap_2nd() const override { return m_pmap_2nd.get(); } - virtual const HTTRegionMap* RegionMap_1st() const override { return m_rmap_1st.get(); } - virtual const HTTRegionMap* RegionMap_2nd() const override { return m_rmap_2nd.get(); } - virtual const HTTRegionMap* SubRegionMap() const override { return m_subrmap.get(); } - virtual const HTTNNMap* NNMap() const override { return m_NNmap.get(); } - - static const InterfaceID& interfaceID(); - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIf) override; - - private: - - // Handles - ServiceHandle<IHTTEventSelectionSvc> m_EvtSel; - - // Configuration - - Gaudi::Property<std::string> m_mappingType {this, "mappingType", "FILE", "for now should be FILE only, DB for the future"}; - Gaudi::Property<std::string> m_rmap_path {this, "rmap", "", "path of the region-map file"}; - Gaudi::Property<std::string> m_subrmap_path {this, "subrmap", "", "path of the region-map file for subregions"}; - Gaudi::Property<std::string> m_pmap_path {this, "pmap", "", "path of the PMAP file"}; - Gaudi::Property<std::string> m_modulelut_path {this, "modulemap", "", "path of the ModuleLUT file"}; - Gaudi::Property<std::string> m_NNmap_path {this, "NNmap", "", "path of the NN weighting file"}; - Gaudi::Property<std::vector <int> > m_layerOverrides {this, "layerOverride", {}, "Overrides the selection of the 1st stage logical layers in the plane map. Each entry declares a detector layer to use as a logical layer. Specify a detector layer with { SiliconTech * 1000 + DetectorZone * 100 + PhysicalLayer }"}; - - // Map unique pointers - std::unique_ptr<HTTPlaneMap> m_pmap_1st = nullptr; // pointer to the pmap object for 1st stage - std::unique_ptr<HTTPlaneMap> m_pmap_2nd = nullptr; // pointer to the pmap object for 2nd stage - std::unique_ptr<HTTRegionMap> m_rmap_1st = nullptr; // pointer to the RMAP object using 1st stage plane map - std::unique_ptr<HTTRegionMap> m_rmap_2nd = nullptr; // pointer to the RMAP object using 2nd stage plane map - std::unique_ptr<HTTRegionMap> m_subrmap = nullptr; - std::unique_ptr<HTTNNMap> m_NNmap = nullptr; - - // Helpers - StatusCode checkInputs(); - StatusCode checkAllocs(); -}; - -inline const InterfaceID& TrigHTTMappingSvc::interfaceID() -{ - static const InterfaceID IID_TrigHTTMappingSvc("TrigHTTMappingSvc", 1, 0); - return IID_TrigHTTMappingSvc; -} - -#endif // TRIGHTTMAPPINGSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/components/TrigHTTMaps_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/components/TrigHTTMaps_entries.cxx deleted file mode 100644 index 7c5df6ba7821af3ab6df7ba55f1b38edb7612810..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/components/TrigHTTMaps_entries.cxx +++ /dev/null @@ -1,14 +0,0 @@ -#include "../TrigHTTMappingSvc.h" -#include "../HTTSpacePointsTool.h" -#include "../HTTSpacePointsTool_v2.h" -#include "../HTTHitFilteringTool.h" -#include "../HTTClusteringTool.h" -#include "../HTTClusteringOfflineTool.h" - -DECLARE_COMPONENT(TrigHTTMappingSvc) -DECLARE_COMPONENT( HTTClusteringTool ) -DECLARE_COMPONENT( HTTClusteringOfflineTool ) -DECLARE_COMPONENT(HTTSpacePointsTool) -DECLARE_COMPONENT(HTTSpacePointsTool_v2) -DECLARE_COMPONENT(HTTHitFilteringTool) -DECLARE_COMPONENT(TrigHTTMappingSvc) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/CMakeLists.txt b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/CMakeLists.txt deleted file mode 100644 index 4a75c133734f1c19b2b13472ca2c1977b885019a..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( TrigHTTObjects ) - -# External dependencies: -find_package( ROOT COMPONENTS Core MathCore Hist ) - -# Component(s) in the package: -atlas_add_root_dictionary( TrigHTTObjectsLib - TrigHTTObjectsLibDictSource - ROOT_HEADERS TrigHTTObjects/*.h - EXTERNAL_PACKAGES ROOT -) - -atlas_add_library( TrigHTTObjectsLib - src/*.cxx TrigHTTObjects/*.h ${TrigHTTObjectsLibDictSource} - PUBLIC_HEADERS TrigHTTObjects - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} -) - -# Tests in the package: -atlas_add_test( TrigHTTRoad_test - SOURCES test/HTTRoad_test.cxx - LINK_LIBRARIES TrigHTTObjectsLib -) - -atlas_add_test( TrigHTTTrack_test - SOURCES test/HTTTrack_test.cxx - LINK_LIBRARIES TrigHTTObjectsLib -) - -atlas_add_test( TrigHTTLogicalEventInputHeader_test - SOURCES test/HTTLogicalEventInputHeader_test.cxx - LINK_LIBRARIES TrigHTTObjectsLib -) - -atlas_add_test( TrigHTTLogicalEventOutputHeader_test - SOURCES test/HTTLogicalEventOutputHeader_test.cxx - LINK_LIBRARIES TrigHTTObjectsLib -) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 0a698ce472a577110cd91a2e48041953b9949afe..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTCluster.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTCluster.h deleted file mode 100644 index 0567cfc31c282a9d0393608f349380332dab5219..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTCluster.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGHTTOBJECTS_HTTCLUSTER_H -#define TRIGHTTOBJECTS_HTTCLUSTER_H - -/* - * HTTCluster.h: This file declares the class used to represent clusters. - * Declarations in this file: - * class HTTCluster - * Author: Alex Martyniuk - * Email: martyniu@cern.ch - */ - -#include <TObject.h> -#include "TrigHTTObjects/HTTHit.h" - - /* - * Clusters resulting from HTT clustering algorithms as stored in m_clusterEquiv as a HTTHit - * The raw hits used to form this cluster are stored in the m_hitlist, the first entry is the seed that initiated this cluster. - */ -typedef std::vector<HTTHit> hitVector; -class HTTCluster : public TObject -{ -public: - virtual ~HTTCluster() = default; - - // get private members - hitVector const& getHitList() const { return m_hitlist; } - HTTHit const& getClusterEquiv() const { return m_clusterEquiv; } - - // set private members - void setHitList(const hitVector& input) { m_hitlist = input; } - void setClusterEquiv(const HTTHit& input) { m_clusterEquiv = input; } - - // filling functions - void push_backHitList(const HTTHit& input) { m_hitlist.push_back(input); } - -private: - hitVector m_hitlist; // list of hits that make the cluster, the seed of the cluster will be the first entry in this list. - HTTHit m_clusterEquiv; // This is the cluster - - ClassDef(HTTCluster, 3); -}; - -std::ostream& operator<<(std::ostream& o, const HTTCluster& cluster); - - -#endif // HTTCLUSTER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTEventInputHeader.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTEventInputHeader.h deleted file mode 100644 index 25290646b2830f1cb870693ee3c75a6fc1239417..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTEventInputHeader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGHTTOBJECTS_HTTEVENTINPUTHEADER_H -#define TRIGHTTOBJECTS_HTTEVENTINPUTHEADER_H - -#include <TObject.h> -#include <vector> -#include <iostream> -#include <sstream> - -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTEventInfo.h" -#include "TrigHTTObjects/HTTOptionalEventInfo.h" - - -class HTTEventInfo; -class HTTOptionalEventInfo; - -class HTTEventInputHeader : public TObject -{ -public: - - virtual ~HTTEventInputHeader(); - - void newEvent(HTTEventInfo const& event) { reset(); m_event = event; } - void setOptional(HTTOptionalEventInfo const& optional) { m_optional = optional; } - void reset();//reset per event variables - - - HTTEventInfo const& event() const { return m_event; } - HTTOptionalEventInfo const& optional() const { return m_optional; } - - // handling hits - const std::vector<HTTHit>& hits() const { return m_Hits; } - int nHits() const { return m_Hits.size(); } - void addHit(HTTHit const& s) { m_Hits.push_back(s); } - void clearHits() { m_Hits.clear(); } - void reserveHits(size_t size) { m_Hits.reserve(size); } - - -private: - HTTEventInfo m_event; - HTTOptionalEventInfo m_optional; - std::vector<HTTHit> m_Hits; - - - ClassDef(HTTEventInputHeader, 3); -}; - -std::ostream& operator<<(std::ostream&, const HTTEventInputHeader&); -#endif // TRIGHTTOBJECTS_HTTEVENTINPUTHEADER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTLogicalEventInputHeader.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTLogicalEventInputHeader.h deleted file mode 100644 index c42f604f2f2a7926917cd3fed62f549406aad325..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTLogicalEventInputHeader.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef TRIGHTTOBJECTS_HTTLOGICALEVENTINPUTHEADER_H -#define TRIGHTTOBJECTS_HTTLOGICALEVENTINPUTHEADER_H - -#include <TObject.h> - -#include <vector> -#include <iostream> -#include <sstream> - -#include "TrigHTTObjects/HTTTowerInputHeader.h" -#include "TrigHTTObjects/HTTEventInfo.h" -#include "TrigHTTObjects/HTTOptionalEventInfo.h" - - -class HTTEventInfo; -class HTTOptionalEventInfo; - -class HTTLogicalEventInputHeader : public TObject -{ -public: - - HTTLogicalEventInputHeader() = default; - virtual ~HTTLogicalEventInputHeader() = default; - - void reset(); //reset per event variables - - void newEvent(HTTEventInfo& event) { reset(); m_event = event; } - HTTEventInfo const& event() const { return m_event; } - - HTTOptionalEventInfo const& optional() const { return m_optional; } - void setOptional(HTTOptionalEventInfo o) { m_optional = o; } - - // handling towers - const std::vector<HTTTowerInputHeader>& towers() const { return m_towers; } - int nTowers() const { return m_towers.size(); } - void addTower(HTTTowerInputHeader s) { m_towers.push_back(s); } - HTTTowerInputHeader* getTower(size_t index) { return &m_towers[index]; } //get the pointer - void reserveTowers(size_t size) { m_towers.reserve(size); } - void addTowers(const std::vector<HTTTowerInputHeader>& towers) { m_towers = towers; } - -private: - HTTEventInfo m_event; - HTTOptionalEventInfo m_optional; // This is only available for 1st stage - std::vector<HTTTowerInputHeader> m_towers; - - ClassDef(HTTLogicalEventInputHeader, 1) -}; - - -std::ostream& operator<<(std::ostream&, const HTTLogicalEventInputHeader&); - - - -#endif // HTTEVENTINPUTHEADER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTLogicalEventOutputHeader.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTLogicalEventOutputHeader.h deleted file mode 100644 index 60c5ef5e5ab5e1495a71d7135961bcabbbb74914..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTLogicalEventOutputHeader.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -#ifndef TRIGHTTOBJECTS_HTTLOGICALEVENTOUTPUTHEADER_H -#define TRIGHTTOBJECTS_HTTLOGICALEVENTOUTPUTHEADER_H - -#include "TrigHTTObjects/HTTDataFlowInfo.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTTypes.h" -#include <TObject.h> - -class HTTLogicalEventOutputHeader : public TObject { -public: - - HTTLogicalEventOutputHeader() {}; - virtual ~HTTLogicalEventOutputHeader(); - - void reset(); //reset per event variables - - // First Stage HTT Roads - void getHTTRoads_1st(std::vector<HTTRoad*>& roads_1st) { roads_1st.reserve(m_HTTRoads_1st.size()); for ( auto& r : m_HTTRoads_1st) roads_1st.push_back(&r); } - size_t nHTTRoads_1st() const { return m_HTTRoads_1st.size(); } - void reserveHTTRoads_1st(size_t size) { m_HTTRoads_1st.reserve(size); } - void addHTTRoads_1st(std::vector<HTTRoad*> const& roads_1st) { for ( auto& r : roads_1st) m_HTTRoads_1st.push_back(*r); } - - // Second Stage HTT Roads - void getHTTRoads_2nd(std::vector<HTTRoad*>& roads_2nd) { roads_2nd.reserve(m_HTTRoads_2nd.size()); for ( auto& r : m_HTTRoads_2nd) roads_2nd.push_back(&r); } - size_t nHTTRoads_2nd() const { return m_HTTRoads_2nd.size(); } - void reserveHTTRoads_2nd(size_t size) { m_HTTRoads_2nd.reserve(size); } - void addHTTRoads_2nd(std::vector<HTTRoad*> const& roads_2nd) { for ( auto& r : roads_2nd) m_HTTRoads_2nd.push_back(*r); } - - // First Stage HTT Tracks - std::vector<HTTTrack> const& getHTTTracks_1st() const { return m_HTTTracks_1st; } - size_t nHTTTracks_1st() const { return m_HTTTracks_1st.size(); } - void reserveHTTTracks_1st(size_t size) { m_HTTTracks_1st.reserve(size); } - void addHTTTracks_1st(std::vector<HTTTrack> const& tracks_1st) { m_HTTTracks_1st = tracks_1st; } - - // Second Stage HTT Tracks - std::vector<HTTTrack> const& getHTTTracks_2nd() const { return m_HTTTracks_2nd; } - size_t nHTTTracks_2nd() const { return m_HTTTracks_2nd.size(); } - void reserveHTTTracks_2nd(size_t size) { m_HTTTracks_2nd.reserve(size); } - void addHTTTracks_2nd(std::vector<HTTTrack> const& tracks_2nd) { m_HTTTracks_2nd = tracks_2nd; } - - // Data Flow Information - HTTDataFlowInfo const& getDataFlowInfo() const { return m_dataflowInfo; } - void setDataFlowInfo(HTTDataFlowInfo const& info) { m_dataflowInfo = info; } - -private: - - std::vector<HTTRoad> m_HTTRoads_1st; - std::vector<HTTRoad> m_HTTRoads_2nd; - std::vector<HTTTrack> m_HTTTracks_1st; - std::vector<HTTTrack> m_HTTTracks_2nd; - - HTTDataFlowInfo m_dataflowInfo; - - ClassDef(HTTLogicalEventOutputHeader, 4) -}; - -std::ostream& operator<<(std::ostream& s, HTTLogicalEventOutputHeader const& h); - -#endif // HTTEVENTOUTPUTHEADER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTMatchInfo.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTMatchInfo.h deleted file mode 100644 index a7cd7aa6f723d67293bf63b535cb4416452efa85..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTMatchInfo.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGHTTOBJECTS_HTTMATCHINFO_H -#define TRIGHTTOBJECTS_HTTMATCHINFO_H - -#include <TObject.h> - -class HTTMatchInfo : public TObject { -public: - HTTMatchInfo() : m_barcode(0), m_evtindex(-1) { ; } - HTTMatchInfo(int v1, int v2) : m_barcode(v1), m_evtindex(v2) { ; } - - int barcode() const { return m_barcode; } - int evtindex() const { return m_evtindex; } - - bool operator==(const HTTMatchInfo& o) const { return (m_barcode == o.m_barcode) && (m_evtindex == o.m_evtindex); } - bool operator<(const HTTMatchInfo& o) const { if (m_evtindex != o.m_evtindex) return (m_evtindex < o.m_evtindex); else return m_barcode < o.m_barcode; } - - -private: - int m_barcode; - int m_evtindex; - - - ClassDef(HTTMatchInfo, 1) -}; - -std::ostream& operator<<(std::ostream&, const HTTMatchInfo&); -#endif // TRIGHTTOBJECTS_HTTMATCHINFO_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOptionalEventInfo.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOptionalEventInfo.h deleted file mode 100644 index 3443761c920499af58ca2d213a2ad73447b365aa..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOptionalEventInfo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGHTTOBJECTS_HTTOPTIONALEVENTINFO_H -#define TRIGHTTOBJECTS_HTTOPTIONALEVENTINFO_H - -#include <TObject.h> -#include <vector> -#include <iostream> -#include <sstream> - -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" -#include "TrigHTTObjects/HTTTruthTrack.h" - -class HTTOptionalEventInfo : public TObject { - -public: - - HTTOptionalEventInfo() {}; - virtual ~HTTOptionalEventInfo(); - - void reset(); - - // Offline Clusters - const std::vector<HTTCluster>& getOfflineClusters() const { return m_OfflineClusters; } - size_t nOfflineClusters() const { return m_OfflineClusters.size(); } - void addOfflineCluster(const HTTCluster& c) { m_OfflineClusters.push_back(c); } - - // Offline Tracks - const std::vector<HTTOfflineTrack>& getOfflineTracks() const { return m_OfflineTracks; } - size_t nOfflineTracks() const { return m_OfflineTracks.size(); } - void addOfflineTrack(const HTTOfflineTrack& t) { m_OfflineTracks.push_back(t); }; - - // Truth Tracks - const std::vector<HTTTruthTrack>& getTruthTracks() const { return m_TruthTracks; } - size_t nTruthTracks() const { return m_TruthTracks.size(); } - void addTruthTrack(const HTTTruthTrack& t) { m_TruthTracks.push_back(t); }; - - - //reserve sizes - void reserveOfflineClusters(size_t size) { m_OfflineClusters.reserve(size); } - void reserveOfflineTracks(size_t size) { m_OfflineTracks.reserve(size); } - void reserveTruthTracks(size_t size) { m_TruthTracks.reserve(size); } - - -private: - - std::vector<HTTCluster> m_OfflineClusters; - std::vector<HTTOfflineTrack> m_OfflineTracks; - std::vector<HTTTruthTrack> m_TruthTracks; - - - ClassDef(HTTOptionalEventInfo, 2) -}; - -std::ostream& operator<<(std::ostream&, const HTTOptionalEventInfo&); -#endif \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/TrigHTTObjectsLinkDef.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/TrigHTTObjectsLinkDef.h deleted file mode 100644 index 46c928ee563180a6c9a07175a154b84b5e42bbc9..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/TrigHTTObjectsLinkDef.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include <vector> -#include <map> -#include <utility> - - -#ifdef __CINT__ -#ifndef HTTOBJECTS_HTT_STANDALONE -#define HTTOBJECTS_HTT_STANDALONE -#endif -// unimplemented in rel 22 -// #pragma link off globals; -// #pragma link off classes; -// #pragma link off functions; - - -#pragma link C++ class HTTEventInfo+; -#pragma link C++ class HTTOptionalEventInfo+; -#pragma link C++ class HTTEventInputHeader+; -#pragma link C++ class HTTLogicalEventInputHeader+; -#pragma link C++ class HTTLogicalEventOutputHeader+; -#pragma link C++ class HTTTowerInputHeader+; -#pragma link C++ class std::vector<HTTTowerInputHeader>+; -#pragma link C++ class HTTDataFlowInfo+; - -#pragma link C++ class HTTOfflineTrack+; -#pragma link C++ class std::vector<HTTOfflineTrack>+; -#pragma link C++ class HTTOfflineHit+; -#pragma link C++ class std::vector<HTTOfflineHit>+; - -#pragma link C++ class HTTCluster+; -#pragma link C++ class std::vector<HTTCluster*>+; -#pragma link C++ class std::vector<HTTCluster>+; - -#pragma link C++ class HTTHit+; -#pragma link C++ class std::vector<HTTHit>+; -#pragma link C++ class std::vector<HTTHit*>+; -#pragma link C++ class std::vector<std::vector<const HTTHit*>>+; - -#pragma link C++ class HTTRoad+; -#pragma link C++ class HTTMultiTruth+; -#pragma link C++ class HTTMatchInfo+; - -#pragma link C++ class HTTTrack+; -#pragma link C++ class std::vector<HTTTrack>+; - -#pragma link C++ class HTTTruthTrack+; -#pragma link C++ class std::vector<HTTTruthTrack>+; - -#pragma link C++ class HTTTrackStream+; -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTCluster.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTCluster.cxx deleted file mode 100644 index dccf4eba859fc1e5985a6df4cc0fa3a9f6661126..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTCluster.cxx +++ /dev/null @@ -1,10 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ -#include <iostream> -#include "TrigHTTObjects/HTTCluster.h" - -std::ostream& operator<<(std::ostream& o, const HTTCluster& cluster) -{ - return o << "Cluster formed from " << cluster.getHitList().size() << " hits"; -} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTEventInfo.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTEventInfo.cxx deleted file mode 100644 index 2cac90dbf97c04424179fff8d24429d103bd5a66..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTEventInfo.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTEventInfo.h" -#include <iostream> - -ClassImp(HTTEventInfo) - - -HTTEventInfo::~HTTEventInfo() { - reset(); -} - - -void HTTEventInfo::reset() { - m_level1TriggerInfo.clear(); -} - -std::ostream& operator<<(std::ostream& s, const HTTEventInfo& h) { - s << "Event " << h.eventNumber() - << " \tRun " << h.runNumber(); - - return s; -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTEventInputHeader.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTEventInputHeader.cxx deleted file mode 100644 index d5d50e6885563e427c38ccbfb174d40b4c03eaf4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTEventInputHeader.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include <iostream> - -ClassImp(HTTEventInputHeader) - -HTTEventInputHeader::~HTTEventInputHeader() -{ - reset(); -} - -void HTTEventInputHeader::reset() -{ - m_event.reset(); - m_optional.reset(); - m_Hits.clear(); -} - - -std::ostream& operator<<(std::ostream& s, const HTTEventInputHeader& h) { - s << "Event: " << h.event() << "\t" - << "Optional: " << h.optional() << "\t" - << "Nhits=" << h.nHits(); - - s << "\n"; - - const std::vector<HTTHit>& hits = h.hits(); - for (int j = 0; j < h.nHits(); j++) { - s << " " << j << " " << hits[j] << "\n"; - // if ( (j+1)%5==0 ) s << "\n"; - } - //s <<"\n"; - - - return s; -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTLogicalEventInputHeader.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTLogicalEventInputHeader.cxx deleted file mode 100644 index 573f47de15cd07f054f968e6a5b6d05401ca29c5..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTLogicalEventInputHeader.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" - - -ClassImp(HTTLogicalEventInputHeader) - - -void HTTLogicalEventInputHeader::reset() -{ - m_event.reset(); - m_optional.reset(); - m_towers.clear(); -} - - -std::ostream& operator<<(std::ostream& s, const HTTLogicalEventInputHeader& h) -{ - s << "Event: " << h.event() << "\t" - << "Optional: " << h.optional() << "\t" - << "NTowers: " << h.nTowers() << "\n"; - - const std::vector<HTTTowerInputHeader>& towers = h.towers(); - for (int j = 0; j < h.nTowers(); j++) - { - s << " " << j << " " << towers[j] << "\n"; - } - s << std::endl; - - return s; -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTLogicalEventOutputHeader.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTLogicalEventOutputHeader.cxx deleted file mode 100644 index 336681755d6faedd0b47cd657bc27d4bfc4a03a2..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTLogicalEventOutputHeader.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" - -ClassImp(HTTLogicalEventOutputHeader) - -HTTLogicalEventOutputHeader::~HTTLogicalEventOutputHeader() { - reset(); -} - -void HTTLogicalEventOutputHeader::reset() { - m_HTTRoads_1st.clear(); - m_HTTRoads_2nd.clear(); - m_HTTTracks_1st.clear(); - m_HTTTracks_2nd.clear(); - m_dataflowInfo.reset(); -} - -std::ostream& operator<<(std::ostream& s, HTTLogicalEventOutputHeader const& h) { - - s << "NHTTRoads_1st = " << h.nHTTRoads_1st() << ", " - << "NHTTRoads_2nd = " << h.nHTTRoads_2nd() << ", " - << "NHTTTracks_1st = " << h.nHTTTracks_1st() << ", " - << "NHTTTracks_2nd = " << h.nHTTTracks_2nd() << std::endl; - - return s; -} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTMatchInfo.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTMatchInfo.cxx deleted file mode 100644 index cb979262d67e9f93ff0b1dabe146079f0a9731fc..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTMatchInfo.cxx +++ /dev/null @@ -1,16 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTMatchInfo.h" -#include <iostream> - -ClassImp(HTTMatchInfo) - -std::ostream& operator<<(std::ostream& s, const HTTMatchInfo& h) { - - s << "barcode: " << h.barcode() - << ", event index: " << h.evtindex() << std::endl; - - return s; -} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOptionalEventInfo.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOptionalEventInfo.cxx deleted file mode 100644 index 06bbe1c383bd9f4d015059a0ca7b6304ce907008..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOptionalEventInfo.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTOptionalEventInfo.h" -#include <iostream> - -ClassImp(HTTOptionalEventInfo) - -HTTOptionalEventInfo::~HTTOptionalEventInfo() { - reset(); -} - -void HTTOptionalEventInfo::reset() { - m_OfflineClusters.clear(); - m_OfflineTracks.clear(); - m_TruthTracks.clear(); -} - -std::ostream& operator<<(std::ostream& s, const HTTOptionalEventInfo& info) { - s << "nOfflineClusters: " << info.nOfflineClusters() << ", " - << "nOfflineTracks: " << info.nOfflineTracks() << ", " - << "nTruthTracks: " << info.nTruthTracks() << std::endl; - return s; -} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTowerInputHeader.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTowerInputHeader.cxx deleted file mode 100644 index cc89ced1f0d90076bd9d1d6decd431f3dd5086da..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTowerInputHeader.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigHTTObjects/HTTTowerInputHeader.h" -#include <iostream> - -ClassImp(HTTTowerInputHeader) - -HTTTowerInputHeader::HTTTowerInputHeader(int id, double e, double p, double de, double dp) : - m_id(id), - m_Eta(e), m_Phi(p), - m_DeltaEta(de), m_DeltaPhi(dp) -{ - m_Hits.clear(); -} - -void HTTTowerInputHeader::reset() -{ - m_id = 0; - m_Eta = 0.0; - m_Phi = 0.0; - m_DeltaEta = 0.0; - m_DeltaPhi = 0.0; - m_Hits.clear(); -} - - -std::ostream& operator<<(std::ostream& s, const HTTTowerInputHeader& r) -{ - - s << "Tower: id=" << r.id() << "\t eta=" << r.eta() << "\t phi=" << r.phi() - << "\t Nhits=" << r.nHits(); - - return s; -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTLogicalEventOutputHeader_test.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTLogicalEventOutputHeader_test.cxx deleted file mode 100644 index cf9f69ab28c67af3cd9ff804fc0d26c1cfbaab96..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTLogicalEventOutputHeader_test.cxx +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -/* - * HTTLogicalEventOutputHeader_test.cxx: Unit tests for HTTLogicalEventOutputHeader - */ - -#include <cstdio> -#include <iostream> -#include <cassert> -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" - -int main(int, char**) -{ - // some random values for checking things, just put them all up here - const int roadid(8675309); - const double qoverpt(-0.123456), chi2(3.41159); - - HTTLogicalEventOutputHeader header; - - HTTTrack track; - track.setQOverPt(qoverpt); - track.setChi2(chi2); - std::vector<HTTTrack> trackvec; - trackvec.push_back(track); - header.addHTTTracks_1st(trackvec); - - HTTRoad road; - road.setRoadID(roadid); - std::vector<HTTRoad*> roadvec; - roadvec.push_back(&road); - - header.addHTTTracks_1st(trackvec); - header.addHTTRoads_1st(roadvec); - std::cout << "q/pt = " << header.getHTTTracks_1st()[0].getQOverPt() << " and chi2 = " << - header.getHTTTracks_1st()[0].getChi2() << std::endl; - - std::vector<HTTRoad*> roads_1st; - header.getHTTRoads_1st(roads_1st); - std::cout << "Road ID = " << roads_1st[0]->getRoadID() << std::endl; - - return 0; - -} - diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/ATLAS_CHECK_THREAD_SAFETY deleted file mode 100644 index 36dea44ed517178832d0b8ebfcf70e3b1bc0c4cc..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/ATLAS_CHECK_THREAD_SAFETY +++ /dev/null @@ -1 +0,0 @@ -Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/ITrigHTTInputTool.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/ITrigHTTInputTool.h deleted file mode 100644 index 3a4416456723e7d17c7f4575401cffb9c91e9af4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/ITrigHTTInputTool.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TrigHTTSGInput_ITrigHTTInputTool_h -#define TrigHTTSGInput_ITrigHTTInputTool_h - -#include "GaudiKernel/IAlgTool.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" - -class HTTEventInputHeader; -/** - * @brief Interface of tools responsible for generation of the HTT sim wrapper files - * - */ -class ITrigHTTInputTool : virtual public ::IAlgTool -{ - public: - - DeclareInterfaceID( ITrigHTTInputTool, 1, 0); - virtual ~ITrigHTTInputTool(){} - /** - * @brief Reads the data from outer word (Athena StoreGate) and fills the output object called header - * - * @param header object to update - * @return StatusCode - */ - virtual StatusCode readData(HTTEventInputHeader* header, const EventContext& eventContext) = 0; - -}; - - -#endif // TrigHTTSGInput_ITrigHTTInputTool_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/share/HTTSGToRawHitsWrapperAlg_jobOptions.py b/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/share/HTTSGToRawHitsWrapperAlg_jobOptions.py deleted file mode 100644 index 664178e77808e68ee933d80ac7ee7af9fb7802a4..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/share/HTTSGToRawHitsWrapperAlg_jobOptions.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -############################################################### -# -# TrigHTTWrapper job options file -# -#============================================================== - -from AthenaCommon.AlgSequence import AlgSequence -theJob = AlgSequence() - - - -if hasattr(runArgs,"outputNTUP_HTTIPFile") : - OutputNTUP_HTTIPFile = runArgs.outputNTUP_HTTIPFile -else : - OutputNTUP_HTTIPFile = "httsim_rawhits_wrap.root" -print "Output file", OutputNTUP_HTTIPFile - -from AthenaCommon.AppMgr import ToolSvc -from TrigHTTSGInput.TrigHTTSGInputConf import TrigHTTSGToRawHitsTool -HTTSGInput = TrigHTTSGToRawHitsTool( maxEta= 3.2, minPt= 0.8*GeV) -HTTSGInput.OutputLevel = DEBUG -HTTSGInput.ReadTruthTracks = True -ToolSvc += HTTSGInput - -from TrigHTTSGInput.TrigHTTSGInputConf import TrigHTTRawHitsWrapperAlg -wrapper = TrigHTTRawHitsWrapperAlg(OutputLevel = DEBUG, - OutFileName = OutputNTUP_HTTIPFile) - -wrapper.InputTool = HTTSGInput -theJob += wrapper - -from AthenaCommon.AppMgr import ServiceMgr -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() - - -print theJob -############################################################### diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTRawHitsWrapperAlg.h b/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTRawHitsWrapperAlg.h deleted file mode 100644 index d75068996bec4bbe12c9a0a7e27ae7ffb8f7b5ff..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTRawHitsWrapperAlg.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TrigHTTSGInput_TrigHTTRawHistWrapperAlg_h -#define TrigHTTSGInput_TrigHTTRawHistWrapperAlg_h - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrigHTTSGInput/ITrigHTTInputTool.h" - -class TFile; -class TTree; -class TH2F; -class HTTEventInputHeader; -/** - * @brief Steering algorithm to run ITrigHTTInputTool and save the output in plain ROOT tree - * - */ -class TrigHTTRawHitsWrapperAlg : public AthAlgorithm { -public: - TrigHTTRawHitsWrapperAlg(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~TrigHTTRawHitsWrapperAlg() {}; - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - virtual StatusCode finalize() override; - - -private: - // configuration parameters - ToolHandle<ITrigHTTInputTool> m_hitInputTool { this, "InputTool", "TrigHTTSGToRawHitsTool/TrigHTTInputTool", "HitInput Tool" }; - Gaudi::Property<std::string> m_outpath { this, "OutFileName", "httsim_smartwrapper.root", "output path" }; - - // internal pointers - HTTEventInputHeader* m_eventHeader = nullptr; - TFile* m_outfile = nullptr; - TTree* m_EventTree = nullptr; -}; - -#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/components/TrigHTTSGInput_entries.cxx b/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/components/TrigHTTSGInput_entries.cxx deleted file mode 100644 index 526b059e8adf144efcc43fc7865b5d1c1abee9bd..0000000000000000000000000000000000000000 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/components/TrigHTTSGInput_entries.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include "../TrigHTTSGToRawHitsTool.h" -#include "../TrigHTTRawHitsWrapperAlg.h" - -DECLARE_COMPONENT( TrigHTTSGToRawHitsTool ) -DECLARE_COMPONENT( TrigHTTRawHitsWrapperAlg ) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..48d3cfd7c79e51bde9e83a0486a75ecd4913601c --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimAlgorithms diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/CMakeLists.txt similarity index 66% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/CMakeLists.txt rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/CMakeLists.txt index dc5dcf078369a4721ef4eed6a7bb1a63142821ff..8c5cfc7fde4e87ffcb73fc23eff0882b08350283 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/CMakeLists.txt +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/CMakeLists.txt @@ -1,18 +1,18 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( TrigHTTAlgorithms ) +atlas_subdir( FPGATrackSimAlgorithms ) # External dependencies: find_package( ROOT COMPONENTS Core Hist RIO ) find_package( lwtnn ) # Component(s) in the package: -atlas_add_component( TrigHTTAlgorithms +atlas_add_component( FPGATrackSimAlgorithms src/*.cxx src/components/*.cxx INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${LWTNN_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringKernelLib CxxUtils GaudiKernel TrigHTTBanksLib TrigHTTConfToolsLib TrigHTTHoughLib TrigHTTInputLib TrigHTTLRTLib TrigHTTMapsLib TrigHTTObjectsLib ) + LINK_LIBRARIES ${LWTNN_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringKernelLib CxxUtils GaudiKernel FPGATrackSimBanksLib FPGATrackSimConfToolsLib FPGATrackSimHoughLib FPGATrackSimInputLib FPGATrackSimLRTLib FPGATrackSimMapsLib FPGATrackSimObjectsLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/README.md b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/README.md similarity index 65% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/README.md rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/README.md index 45846a8d7adc372ebf054071a28d2940af0f3ab9..858f3b5513cef10b1660d231910819f11adfb592 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/README.md +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/README.md @@ -1,8 +1,8 @@ -## Running Output Monitor Algorithm (HTTOutputMonitorAlg) +## Running Output Monitor Algorithm (FPGATrackSimOutputMonitorAlg) -0. Clone and build the directory following `TrigHTT/README.md` +0. Clone and build the directory following `FPGATrackSim/README.md` -From the top-level working directory (`HTTSim/` if you followed the build instructions), +From the top-level working directory (`FPGATrackSim/` if you followed the build instructions), 1. Source the build ```sh @@ -23,26 +23,26 @@ From the top-level working directory (`HTTSim/` if you followed the build instru ```sh #!/bin/bash - HTTLogHitFile='/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-23-00-01/21.9.15/eta0103phi0305/References/loghits__21.9.15-ATLAS-P2-ITK-23-00-01__EF_TaskForce_dev23__EF_TaskForce_dev23__dev_21-02-15.root' + FPGATrackSimLogHitFile='/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-23-00-01/21.9.15/eta0103phi0305/References/loghits__21.9.15-ATLAS-P2-ITK-23-00-01__EF_TaskForce_dev23__EF_TaskForce_dev23__dev_21-02-15.root' cd rundir/ - HTTOutputMonitorAlg_tf.py \ + FPGATrackSimOutputMonitorAlg_tf.py \ --maxEvents 5 \ - --InFileName $HTTLogHitFile \ + --InFileName $FPGATrackSimLogHitFile \ ``` 5. Run the script. Note you must have eos mounted for this to work (i.e. lxplus) ```sh ./run ``` -## Running Map Maker Algorithm (HTTMapMakerAlg) +## Running Map Maker Algorithm (FPGATrackSimMapMakerAlg) The Map Maker algorithm will output a **plane map**, **region map**, and **subregion map**. It will also prodouce a **radii file** and **etapattern file**, which can be used with the bit shift implementation of the Hough Transform. Do the same as above, but run a different transform. If you haven't already set up your working environment then: -0. Clone and build the directory following `TrigHTT/README.md` +0. Clone and build the directory following `FPGATrackSim/README.md` -From the top-level working directory (`HTTSim/` if you followed the build instructions), +From the top-level working directory (`FPGATrackSim/` if you followed the build instructions), 1. Source the build ```sh @@ -63,16 +63,16 @@ From the top-level working directory (`HTTSim/` if you followed the build instru ```sh #!/bin/bash -HTTInputRawHits='/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0103phi0305/Wrappers/singlemu_invPtFlat1_1M_wrap.root' +FPGATrackSimInputRawHits='/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root' OutputName='MMtest_' cd rundir/ -HTTMapMakerAlg_tf.py \ +FPGATrackSimMapMakerAlg_tf.py \ --maxEvents 1000 \ --trim 0.1 \ --region 0 \ - --InFileName $HTTInputRawHits \ + --InFileName $FPGATrackSimInputRawHits \ --OutFileName $OutputName \ --KeyString "strip,barrel,2" \ --nSlices 10 \ @@ -86,4 +86,4 @@ In this example ```trim 0.1``` will result in ignoring modules that are hit by l To run with 2D slicing, use the ```KeyString2``` argument to define the second key layer. Layers can be given as a physical layer (```"strip,barrel,2"```) or a logical layer (```"plane 0"```). Endcap Layers must be specified as positive or negative: ```"strip,posEndcap,2"```. -Note that when using 2D slicing the MM will produce maps with a number of slices at the order of ```nSlices```<sup>2</sup>. And always ensure that the input HTTRawHit file is compatible with the region argument. +Note that when using 2D slicing the MM will produce maps with a number of slices at the order of ```nSlices```<sup>2</sup>. And always ensure that the input FPGATrackSimRawHit file is compatible with the region argument. diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/python/HTTAlgorithmConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/python/FPGATrackSimAlgorithmConfig.py similarity index 84% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/python/HTTAlgorithmConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/python/FPGATrackSimAlgorithmConfig.py index 0fb94bd7a61fc42bba084efef86fa329c85a3dee..3ba1722d694eb665226b2cbb85b8a6209c3599db 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/python/HTTAlgorithmConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/python/FPGATrackSimAlgorithmConfig.py @@ -2,13 +2,13 @@ ''' @author Riley Xu - rixu@cern.ch @date Feb 6th 2020 -@brief This file declares functions that configure the tools and algorithms in HTTAlgorithms. +@brief This file declares functions that configure the tools and algorithms in FPGATrackSimAlgorithms. ''' -from TrigHTTHough.TrigHTTHoughConf import HTTRoadUnionTool, HTTHoughTransformTool, HTTHough1DShiftTool -from TrigHTTLRT.TrigHTTLRTConf import HTTHoughTransform_d0phi0_Tool, HTTLLPDoubletHoughTransformTool +from FPGATrackSimHough.FPGATrackSimHoughConf import FPGATrackSimRoadUnionTool, FPGATrackSimHoughTransformTool, FPGATrackSimHough1DShiftTool +from FPGATrackSimLRT.FPGATrackSimLRTConf import FPGATrackSimHoughTransform_d0phi0_Tool, FPGATrackSimLLPDoubletHoughTransformTool -import TrigHTTMaps.HTTMapConfig as HTTMaps +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMaps def intList(string): return [ int(v) for v in string.split(',') if v != '' ] @@ -22,17 +22,17 @@ def floatList(floatStr): def applyTag(obj, tag): ''' - Applies the parameters in the supplied tag to the given HTTAlgorithm object. + Applies the parameters in the supplied tag to the given FPGATrackSimAlgorithm object. ''' params = { # List of configurable parameters for the given object type - 'HTTPatternMatchTool': [ + 'FPGATrackSimPatternMatchTool': [ 'max_misses', ], - 'HTTSectorMatchTool': [ + 'FPGATrackSimSectorMatchTool': [ 'max_misses', ], - 'HTTTrackFitterTool': [ + 'FPGATrackSimTrackFitterTool': [ 'chi2DofRecoveryMin', 'chi2DofRecoveryMax', 'doMajority', @@ -53,7 +53,7 @@ def addHoughTool(map_tag, algo_tag, doHitTracing): Creates and adds the Hough transform tools to the tool svc ''' - union = HTTRoadUnionTool() + union = FPGATrackSimRoadUnionTool() if algo_tag['xVar'] == 'phi': x_min = algo_tag['phi_min'] @@ -76,13 +76,13 @@ def addHoughTool(map_tag, algo_tag, doHitTracing): y_max += y_buffer tools = [] - nSlice = HTTMaps.getNSubregions(map_tag) if algo_tag['slicing'] else 1 + nSlice = FPGATrackSimMaps.getNSubregions(map_tag) if algo_tag['slicing'] else 1 d0_list = algo_tag['d0_slices'] or [0] for d0 in d0_list: for iSlice in range(nSlice): - t = HTTHoughTransformTool("HoughTransform_" + str(d0) + '_' + str(iSlice)) + t = FPGATrackSimHoughTransformTool("HoughTransform_" + str(d0) + '_' + str(iSlice)) t.subRegion = iSlice if nSlice > 1 else -1 t.phi_min = x_min @@ -127,7 +127,7 @@ def addHough_d0phi0_Tool(map_tag, algo_tag, doHitTracing): Creates and adds the Hough transform tools to the tool svc ''' - union = HTTRoadUnionTool("LRTRoadUnionTool") + union = FPGATrackSimRoadUnionTool("LRTRoadUnionTool") if algo_tag['lrt_straighttrack_xVar'] == 'phi': x_min = algo_tag['lrt_straighttrack_phi_min'] @@ -150,10 +150,10 @@ def addHough_d0phi0_Tool(map_tag, algo_tag, doHitTracing): y_max += y_buffer tools = [] - nSlice = HTTMaps.getNSubregions(map_tag) if algo_tag['lrt_straighttrack_slicing'] else 1 + nSlice = FPGATrackSimMaps.getNSubregions(map_tag) if algo_tag['lrt_straighttrack_slicing'] else 1 for iSlice in range(nSlice): - t = HTTHoughTransform_d0phi0_Tool("HoughTransform_d0phi0_" + str(iSlice)) + t = FPGATrackSimHoughTransform_d0phi0_Tool("HoughTransform_d0phi0_" + str(iSlice)) t.subRegion = iSlice if nSlice > 1 else -1 t.phi_min = x_min @@ -189,10 +189,10 @@ def addHough_d0phi0_Tool(map_tag, algo_tag, doHitTracing): def addHough1DShiftTool(map_tag, algo_tag): - union = HTTRoadUnionTool() + union = FPGATrackSimRoadUnionTool() tools = [] - nSlice = HTTMaps.getNSubregions(map_tag) if algo_tag['slicing'] else 1 + nSlice = FPGATrackSimMaps.getNSubregions(map_tag) if algo_tag['slicing'] else 1 splitpt=algo_tag['splitpt'] for ptstep in range(splitpt): @@ -202,7 +202,7 @@ def addHough1DShiftTool(map_tag, algo_tag): highpt = qpt_min + (qpt_max-qpt_min)/splitpt*(ptstep+1) for iSlice in range(nSlice): - tool = HTTHough1DShiftTool("Hough1DShift_" + str(iSlice)+(("_pt{}".format(ptstep)) if splitpt>1 else "")) + tool = FPGATrackSimHough1DShiftTool("Hough1DShift_" + str(iSlice)+(("_pt{}".format(ptstep)) if splitpt>1 else "")) tool.subRegion = iSlice if nSlice > 1 else -1 if algo_tag['radiiFile'] is not None: tool.radiiFile = algo_tag['radiiFile'] @@ -232,8 +232,8 @@ def addHough1DShiftTool(map_tag, algo_tag): ToolSvc += union return union -def addLRTDoubletHTTool(algo_tag): - tool = HTTLLPDoubletHoughTransformTool() +def addLRTDoubletFPGATrackSimool(algo_tag): + tool = FPGATrackSimLLPDoubletHoughTransformTool() tool.nBins_x = algo_tag['lrt_doublet_d0_bins'] tool.d0_range = algo_tag['lrt_doublet_d0_range'] tool.nBins_y = algo_tag['lrt_doublet_qpt_bins'] @@ -243,7 +243,7 @@ def addLRTDoubletHTTool(algo_tag): return tool -def HTTLogicalHitsProcessAlgMonitoringCfg(flags): +def FPGATrackSimLogicalHitsProcessAlgMonitoringCfg(flags): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator result = ComponentAccumulator() from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTLogicalHitsToAlg_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimLogicalHitsToAlg_tf.py similarity index 65% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTLogicalHitsToAlg_tf.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimLogicalHitsToAlg_tf.py index a46f2be6392fd4e0be61df4345cac5690f689ba0..afcbc61718202e8cf8628608c07405289ed3d9e4 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTLogicalHitsToAlg_tf.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimLogicalHitsToAlg_tf.py @@ -1,15 +1,15 @@ #!/usr/bin/env python -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' -@file HTTLogicalHitsToAlg_tf.py +@file FPGATrackSimLogicalHitsToAlg_tf.py @date July 14, 2020 @author Riley Xu - riley.xu@cern.ch -@brief This transform runs HTTLogicalHitsProcessAlgo. +@brief This transform runs FPGATrackSimLogicalHitsProcessAlgo. Usage: - HTTLogicalHitsToAlg_tf.py \ + FPGATrackSimLogicalHitsToAlg_tf.py \ --maxEvents 100 \ --InFileName "hits.raw.root" \ --OutFileName "hits.logical.root" \ @@ -31,7 +31,7 @@ from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTra import PyJobTransforms.trfExceptions as trfExceptions import PyJobTransforms.trfArgClasses as trfArgClasses -from TrigHTTConfTools.parseRunArgs import addHTTMapsArgs, addHTTBanksArgs, addHTTAlgorithmsArgs, addHTTHitFilteringArgs +from FPGATrackSimConfTools.parseRunArgs import addFPGATrackSimMapsArgs, addFPGATrackSimBanksArgs, addFPGATrackSimAlgorithmsArgs, addFPGATrackSimHitFilteringArgs @stdTrfExceptionHandler @sigUsrStackTrace @@ -51,29 +51,29 @@ def main(): # ___________________________________________________________________________ # def getTransform(): # Get the base transform with all arguments added - trf = transform(executor = athenaExecutor(name = 'HTTLogicalHitsToAlg', - skeletonFile = 'TrigHTTAlgorithms/skeleton.HTTLogicalHitsToAlg.py')) + trf = transform(executor = athenaExecutor(name = 'FPGATrackSimLogicalHitsToAlg', + skeletonFile = 'FPGATrackSimAlgorithms/skeleton.FPGATrackSimLogicalHitsToAlg.py')) addAthenaArguments(trf.parser) - addHTTMapsArgs(trf.parser) - addHTTBanksArgs(trf.parser) - addHTTAlgorithmsArgs(trf.parser) - addHTTLogicalHitsToAlgArgs(trf.parser) - addHTTHitFilteringArgs(trf.parser) + addFPGATrackSimMapsArgs(trf.parser) + addFPGATrackSimBanksArgs(trf.parser) + addFPGATrackSimAlgorithmsArgs(trf.parser) + addFPGATrackSimLogicalHitsToAlgArgs(trf.parser) + addFPGATrackSimHitFilteringArgs(trf.parser) return trf # ___________________________________________________________________________ # -def addHTTLogicalHitsToAlgArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTLogicalHitsToAlg', 'Options for HTTLogicalHitsToAlg') +def addFPGATrackSimLogicalHitsToAlgArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimLogicalHitsToAlg', 'Options for FPGATrackSimLogicalHitsToAlg') # Enable easy copy-paste from C++ argument initializers def declareProperty(argName, argType, helpText=""): parser.add_argument('--' + argName, type=trfArgClasses.argFactory(argType, runarg=True), help=helpText, - group='HTTLogicalHitsToAlg') + group='FPGATrackSimLogicalHitsToAlg') declareProperty("InFileName", trfArgClasses.argList, "input raw hit file path"); declareProperty("InFileName2", trfArgClasses.argString, "input raw hit file path for 2nd input tool"); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTMapMakerAlg_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimMapMakerAlg_tf.py similarity index 77% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTMapMakerAlg_tf.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimMapMakerAlg_tf.py index b1aa46dc75f2fe35847b71e4acd939e5a2d378ed..d228b017ad401e992b114280a053f6414fe4bf44 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTMapMakerAlg_tf.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimMapMakerAlg_tf.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python @@ -19,7 +19,7 @@ from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTra import PyJobTransforms.trfExceptions as trfExceptions import PyJobTransforms.trfArgClasses as trfArgClasses -from TrigHTTConfTools.parseRunArgs import addHTTAlgorithmsArgs +from FPGATrackSimConfTools.parseRunArgs import addFPGATrackSimAlgorithmsArgs @stdTrfExceptionHandler @sigUsrStackTrace @@ -39,27 +39,27 @@ def main(): # ___________________________________________________________________________ # def getTransform(): # Get the base transform with all arguments added - trf = transform(executor = athenaExecutor(name = 'HTTMapMakerAlg', - skeletonFile = 'TrigHTTAlgorithms/skeleton.HTTMapMakerAlg.py')) + trf = transform(executor = athenaExecutor(name = 'FPGATrackSimMapMakerAlg', + skeletonFile = 'FPGATrackSimAlgorithms/skeleton.FPGATrackSimMapMakerAlg.py')) addAthenaArguments(trf.parser) - addHTTAlgorithmsArgs(trf.parser) - addHTTMapMakerAlgArgs(trf.parser) + addFPGATrackSimAlgorithmsArgs(trf.parser) + addFPGATrackSimMapMakerAlgArgs(trf.parser) return trf # ___________________________________________________________________________ # -def addHTTMapMakerAlgArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTMapMakerAlg', 'Options for HTTMapMakerAlg') +def addFPGATrackSimMapMakerAlgArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimMapMakerAlg', 'Options for FPGATrackSimMapMakerAlg') # Enable easy copy-paste from C++ argument initializers def declareProperty(argName, argType, helpText=""): parser.add_argument('--' + argName, type=trfArgClasses.argFactory(argType, runarg=True), help=helpText, - group='HTTMapMakerAlg') + group='FPGATrackSimMapMakerAlg') declareProperty("InFileName", trfArgClasses.argList, "input raw hit file path") declareProperty("OutFileName", trfArgClasses.argString, "output map file path") diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTOutputMonitorAlg_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimOutputMonitorAlg_tf.py similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTOutputMonitorAlg_tf.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimOutputMonitorAlg_tf.py index f5cdd26c3ecabe77f255f8e33f8b74db6634d730..8cec109389bc7b8e86f7aadf339536c94f14a7c1 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/scripts/HTTOutputMonitorAlg_tf.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/scripts/FPGATrackSimOutputMonitorAlg_tf.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python @@ -18,7 +18,7 @@ from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTra import PyJobTransforms.trfExceptions as trfExceptions import PyJobTransforms.trfArgClasses as trfArgClasses -from TrigHTTConfTools.parseRunArgs import addHTTMapsArgs, addHTTBanksArgs, addHTTAlgorithmsArgs +from FPGATrackSimConfTools.parseRunArgs import addFPGATrackSimMapsArgs, addFPGATrackSimBanksArgs, addFPGATrackSimAlgorithmsArgs @stdTrfExceptionHandler @sigUsrStackTrace @@ -38,28 +38,28 @@ def main(): # ___________________________________________________________________________ # def getTransform(): # Get the base transform with all arguments added - trf = transform(executor = athenaExecutor(name = 'HTTOutputMonitorAlg', - skeletonFile = 'TrigHTTAlgorithms/skeleton.HTTOutputMonitorAlg.py')) + trf = transform(executor = athenaExecutor(name = 'FPGATrackSimOutputMonitorAlg', + skeletonFile = 'FPGATrackSimAlgorithms/skeleton.FPGATrackSimOutputMonitorAlg.py')) addAthenaArguments(trf.parser) - addHTTMapsArgs(trf.parser) - addHTTBanksArgs(trf.parser) - addHTTAlgorithmsArgs(trf.parser) - addHTTOutputMonitorAlgArgs(trf.parser) + addFPGATrackSimMapsArgs(trf.parser) + addFPGATrackSimBanksArgs(trf.parser) + addFPGATrackSimAlgorithmsArgs(trf.parser) + addFPGATrackSimOutputMonitorAlgArgs(trf.parser) return trf # ___________________________________________________________________________ # -def addHTTOutputMonitorAlgArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTOutputMonitorAlg', 'Options for HTTOutputMonitorAlg') +def addFPGATrackSimOutputMonitorAlgArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimOutputMonitorAlg', 'Options for FPGATrackSimOutputMonitorAlg') # Enable easy copy-paste from C++ argument initializers def declareProperty(argName, argType, helpText=""): parser.add_argument('--' + argName, type=trfArgClasses.argFactory(argType, runarg=True), help=helpText, - group='HTTOutputMonitorAlg') + group='FPGATrackSimOutputMonitorAlg') declareProperty("InFileName", trfArgClasses.argString, "output logical hit file path"); declareProperty("OutFileName", trfArgClasses.argString, "output monitoring histogram ROOT file path"); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/FPGATrackSimOverlapRemovalValidation_jobOptions.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/FPGATrackSimOverlapRemovalValidation_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..bd3f1c624c1f0cecd4cf83cba45e07d47bffe75c --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/FPGATrackSimOverlapRemovalValidation_jobOptions.py @@ -0,0 +1,79 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +############################################################### +# +# FPGATrackSimOverlapRemovalValAlg job options file +# @file FPGATrackSimAlgorithms/share/FPGATrackSimOverlapRemovalValidation_jobOptions.py +# @author Zhaoyuan.Cui@cern.ch +# @date Dec. 4, 2020 +# @brief jobOptions for overlap removal validation algorithm +#============================================================== + +import os +import glob + +from FPGATrackSimConfig.formatMessageSvc import formatMessageSvc +formatMessageSvc() + +import FPGATrackSimConfig.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig +import FPGATrackSimBanks.FPGATrackSimBankConfig as FPGATrackSimBankConfig +import FPGATrackSimConfig.FPGATrackSimConfigCompInit as FPGATrackSimConfig + +tags = FPGATrackSimTagConfig.getTags(stage='bank') +map_tag = tags['map'] +bank_tag = tags['bank'] +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) +BankSvc = FPGATrackSimBankConfig.addBankSvc(map_tag, bank_tag) + +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + +from AthenaCommon.AppMgr import ToolSvc, ServiceMgr +from AthenaCommon.Constants import DEBUG + +from GaudiSvc.GaudiSvcConf import THistSvc +# THistSvc configuration +ServiceMgr += THistSvc() +ServiceMgr.THistSvc.Output += ["MONITOROUT DATAFILE='OR_monitor_out_${FPGATrackSimORSampleType}_${FPGATrackSimORAlgo}_grouping-${FPGATrackSimORnhg}.root' OPT='RECREATE'"] + +# InputFile +FPGATrackSimInputFile=[] +if 'FPGATrackSimInputFile' in os.environ : + for ex in os.environ['FPGATrackSimInputFile'].split(','): + files=glob.glob(ex) + FPGATrackSimInputFile += files +else : + FPGATrackSimInputFile = ["httsim_loghits_wra.OUT.root"] +print("Input file: ", FPGATrackSimInputFile) + +ES = FPGATrackSimConfig.addEvtSelSvc(map_tag) +ES.sampleType=os.environ["FPGATrackSimORSampleType"] + +# Read in file +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimOutputHeaderTool +FPGATrackSimReadInput = FPGATrackSimOutputHeaderTool("FPGATrackSimReadInput", OutputLevel = DEBUG) +FPGATrackSimReadInput.InFileName=FPGATrackSimInputFile +FPGATrackSimReadInput.RWstatus="READ" +ToolSvc += FPGATrackSimReadInput + +# OR tools +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimOverlapRemovalTool +ORtool = FPGATrackSimOverlapRemovalTool(OutputLevel = DEBUG) +ORtool.ORAlgo = os.environ["FPGATrackSimORAlgo"] +ORtool.NumOfHitPerGrouping = int(os.environ["FPGATrackSimORnhg"]) +ToolSvc += ORtool + +from FPGATrackSimMonitor.FPGATrackSimMonitorConf import FPGATrackSimOverlapRemovalMonitorTool +ORmonitor = FPGATrackSimOverlapRemovalMonitorTool(OutputLevel = DEBUG) +ORmonitor.BarcodeFracCut = 0.5 +ToolSvc += ORmonitor + +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimOverlapRemovalValAlg +theAlg = FPGATrackSimOverlapRemovalValAlg(OutputLevel = DEBUG); +theAlg.InputTool = FPGATrackSimReadInput +theAlg.OverlapRemoval = ORtool +theAlg.OverlapRemovalMonitor = ORmonitor + +theJob +=theAlg +############################################################ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTLogicalHitsToAlg.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimLogicalHitsToAlg.py similarity index 56% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTLogicalHitsToAlg.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimLogicalHitsToAlg.py index 34aa4a8c61de3dda58d476085033dfaea34a4488..6a2123485da6f591e66a39fbe8c377ddfdcd3273 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTLogicalHitsToAlg.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimLogicalHitsToAlg.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #-------------------------------------------------------------- # Headers and setup @@ -16,23 +16,23 @@ from GaudiSvc.GaudiSvcConf import THistSvc from PerfMonComps.PerfMonFlags import jobproperties #-------------------------------------------------------------- -# HTT Setup +# FPGATrackSim Setup #-------------------------------------------------------------- -from TrigHTTConfTools.parseRunArgs import parseHTTArgs -import TrigHTTConfTools.HTTTagConfig as HTTTagConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig -import TrigHTTBanks.HTTBankConfig as HTTBankConfig -import TrigHTTAlgorithms.HTTAlgorithmConfig as HTTAlgorithmConfig +from FPGATrackSimConfTools.parseRunArgs import parseFPGATrackSimArgs +import FPGATrackSimConfTools.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig +import FPGATrackSimBanks.FPGATrackSimBankConfig as FPGATrackSimBankConfig +import FPGATrackSimAlgorithms.FPGATrackSimAlgorithmConfig as FPGATrackSimAlgorithmConfig print("Input file: ", runArgs.InFileName) -tags = HTTTagConfig.getTags(stage='algo', options=parseHTTArgs(runArgs)) +tags = FPGATrackSimTagConfig.getTags(stage='algo', options=parseFPGATrackSimArgs(runArgs)) map_tag = tags['map'] bank_tag = tags['bank'] algo_tag = tags['algo'] def defaultFilename(): - f = HTTTagConfig.getDescription(map_tag, bank_tag, algo_tag, filename=True) # deliberately omitting hit filtering tag for now + f = FPGATrackSimTagConfig.getDescription(map_tag, bank_tag, algo_tag, filename=True) # deliberately omitting hit filtering tag for now f = 'loghits__' + map_tag['release'] + '-' + map_tag['geoTag'] + '__' + f + '.root' return f @@ -40,11 +40,11 @@ OutFileName=getattr(runArgs, 'OutFileName', defaultFilename()) ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += ["MONITOROUT DATAFILE='"+OutFileName+"' OPT='RECREATE'"] -MapSvc = HTTMapConfig.addMapSvc(map_tag) +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) -HitFilteringTool = HTTMapConfig.addHitFilteringTool(map_tag) +HitFilteringTool = FPGATrackSimMapConfig.addHitFilteringTool(map_tag) -BankSvc = HTTBankConfig.addBankSvc(map_tag, bank_tag) +BankSvc = FPGATrackSimBankConfig.addBankSvc(map_tag, bank_tag) # Important to do hit tracing if we have physics samples or events with pileup. @@ -54,10 +54,10 @@ doHitTracing = (map_tag['withPU'] or map_tag['sampleType']=='LLPs') # Make the algorithm #-------------------------------------------------------------- -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTLogicalHitsProcessAlg -from TrigHTTHough.TrigHTTHoughConf import HTTEtaPatternFilterTool, HTTPhiRoadFilterTool +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimLogicalHitsProcessAlg +from FPGATrackSimHough.FPGATrackSimHoughConf import FPGATrackSimEtaPatternFilterTool, FPGATrackSimPhiRoadFilterTool -alg = HTTLogicalHitsProcessAlg() +alg = FPGATrackSimLogicalHitsProcessAlg() alg.HitFiltering = algo_tag['HitFiltering'] alg.writeOutputData = algo_tag['writeOutputData'] alg.Clustering = True @@ -72,23 +72,23 @@ theJob += alg # Make hit tools #-------------------------------------------------------------- -from TrigHTTInput.TrigHTTInputConf import HTTRawToLogicalHitsTool -HTTRawLogic = HTTRawToLogicalHitsTool() -HTTRawLogic.SaveOptional = 2 +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimRawToLogicalHitsTool +FPGATrackSimRawLogic = FPGATrackSimRawToLogicalHitsTool() +FPGATrackSimRawLogic.SaveOptional = 2 if (map_tag['sampleType'] == 'skipTruth'): - HTTRawLogic.SaveOptional = 1 -HTTRawLogic.TowersToMap = [0] # TODO TODO why is this hardcoded? -ToolSvc += HTTRawLogic -alg.RawToLogicalHitsTool = HTTRawLogic + FPGATrackSimRawLogic.SaveOptional = 1 +FPGATrackSimRawLogic.TowersToMap = [0] # TODO TODO why is this hardcoded? +ToolSvc += FPGATrackSimRawLogic +alg.RawToLogicalHitsTool = FPGATrackSimRawLogic -from TrigHTTInput.TrigHTTInputConf import HTTInputHeaderTool -InputTool = HTTInputHeaderTool("HTTReadInput") +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimInputHeaderTool +InputTool = FPGATrackSimInputHeaderTool("FPGATrackSimReadInput") InputTool.InFileName = runArgs.InFileName ToolSvc += InputTool alg.InputTool = InputTool -from TrigHTTInput.TrigHTTInputConf import HTTReadRawRandomHitsTool -InputTool2 = HTTReadRawRandomHitsTool("HTTReadRawRandomHitsTool") +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimReadRawRandomHitsTool +InputTool2 = FPGATrackSimReadRawRandomHitsTool("FPGATrackSimReadRawRandomHitsTool") InputTool2.InFileName = runArgs.InFileName[0] ToolSvc += InputTool2 alg.InputTool2 = InputTool2 @@ -96,7 +96,7 @@ alg.InputTool2 = InputTool2 if algo_tag['EtaPatternRoadFilter']: print("Setting Up EtaPatternFilter") - RoadFilter = HTTEtaPatternFilterTool() + RoadFilter = FPGATrackSimEtaPatternFilterTool() alg.FilterRoads=True if len(algo_tag['threshold']) != 1: raise NotImplementedError("EtaPatternRoadFilter does not support multi-value/neighboring bin treshold") @@ -106,35 +106,35 @@ if algo_tag['EtaPatternRoadFilter']: if algo_tag['PhiRoadFilter']!=None: print("Setting Up PhiRoadFilter") - PhiRoadFilter = HTTPhiRoadFilterTool() + PhiRoadFilter = FPGATrackSimPhiRoadFilterTool() alg.FilterRoads2=True if len(algo_tag['threshold'])!=1: raise NotImplementedError("PhiRoadFilter does not support multi-value/neighboring bin treshold") PhiRoadFilter.threshold=algo_tag['threshold'][0] - PhiRoadFilter.window=HTTAlgorithmConfig.floatList(algo_tag['PhiRoadFilter']) + PhiRoadFilter.window=FPGATrackSimAlgorithmConfig.floatList(algo_tag['PhiRoadFilter']) ToolSvc += PhiRoadFilter # writing down the output file -from TrigHTTInput.TrigHTTInputConf import HTTOutputHeaderTool -HTTWriteOutput = HTTOutputHeaderTool("HTTWriteOutput") -HTTWriteOutput.InFileName = ["test"] -HTTWriteOutput.RWstatus = "HEADER" # do not open file, use THistSvc -HTTWriteOutput.RunSecondStage = alg.RunSecondStage -ToolSvc += HTTWriteOutput -alg.OutputTool= HTTWriteOutput +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimOutputHeaderTool +FPGATrackSimWriteOutput = FPGATrackSimOutputHeaderTool("FPGATrackSimWriteOutput") +FPGATrackSimWriteOutput.InFileName = ["test"] +FPGATrackSimWriteOutput.RWstatus = "HEADER" # do not open file, use THistSvc +FPGATrackSimWriteOutput.RunSecondStage = alg.RunSecondStage +ToolSvc += FPGATrackSimWriteOutput +alg.OutputTool= FPGATrackSimWriteOutput #-------------------------------------------------------------- # Spacepoint tool #-------------------------------------------------------------- -from TrigHTTMaps.TrigHTTMapsConf import HTTSpacePointsTool, HTTSpacePointsTool_v2 +from FPGATrackSimMaps.FPGATrackSimMapsConf import FPGATrackSimSpacePointsTool, FPGATrackSimSpacePointsTool_v2 spacepoints_version = 2 if spacepoints_version == 1: - SPT = HTTSpacePointsTool() + SPT = FPGATrackSimSpacePointsTool() SPT.FilteringClosePoints = True else: - SPT = HTTSpacePointsTool_v2() + SPT = FPGATrackSimSpacePointsTool_v2() SPT.FilteringClosePoints = False SPT.PhiWindow=0.008 @@ -147,32 +147,32 @@ alg.SpacePointTool = SPT # Make RF/TF tools #-------------------------------------------------------------- -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTNNTrackTool, HTTOverlapRemovalTool, HTTTrackFitterTool -from TrigHTTHough.TrigHTTHoughConf import HTTHoughRootOutputTool +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimNNTrackTool, FPGATrackSimOverlapRemovalTool, FPGATrackSimTrackFitterTool +from FPGATrackSimHough.FPGATrackSimHoughConf import FPGATrackSimHoughRootOutputTool if algo_tag['hough']: - RF = HTTAlgorithmConfig.addHoughTool(map_tag, algo_tag,doHitTracing) + RF = FPGATrackSimAlgorithmConfig.addHoughTool(map_tag, algo_tag,doHitTracing) alg.DoNNTrack = algo_tag['TrackNNAnalysis'] if algo_tag['TrackNNAnalysis']: - NNTrackTool = HTTNNTrackTool() + NNTrackTool = FPGATrackSimNNTrackTool() ToolSvc += NNTrackTool alg.DoHoughRootOutput = algo_tag['hough_rootoutput'] if algo_tag['hough_rootoutput']: - rootOutTool = HTTHoughRootOutputTool() + rootOutTool = FPGATrackSimHoughRootOutputTool() ToolSvc += rootOutTool - HoughRootOutputName="HTTHoughOutput.root" - ServiceMgr.THistSvc.Output += ["TRIGHTTHOUGHOUTPUT DATAFILE='"+HoughRootOutputName+"' OPT='RECREATE'"] + HoughRootOutputName="FPGATrackSimHoughOutput.root" + ServiceMgr.THistSvc.Output += ["TRIGFPGATrackSimHOUGHOUTPUT DATAFILE='"+HoughRootOutputName+"' OPT='RECREATE'"] elif algo_tag['hough_1d']: - RF = HTTHoughConfig.addHough1DShiftTool(map_tag, algo_tag) + RF = FPGATrackSimHoughConfig.addHough1DShiftTool(map_tag, algo_tag) -TF_1st= HTTTrackFitterTool("HTTTrackFitterTool_1st") -HTTAlgorithmConfig.applyTag(TF_1st, algo_tag) +TF_1st= FPGATrackSimTrackFitterTool("FPGATrackSimTrackFitterTool_1st") +FPGATrackSimAlgorithmConfig.applyTag(TF_1st, algo_tag) ToolSvc += TF_1st alg.RoadFinder = RF alg.TrackFitter_1st = TF_1st -OR_1st = HTTOverlapRemovalTool("HTTOverlapRemovalTool_1st") +OR_1st = FPGATrackSimOverlapRemovalTool("FPGATrackSimOverlapRemovalTool_1st") OR_1st.ORAlgo = "Normal" OR_1st.doFastOR = algo_tag['doFastOR'] OR_1st.NumOfHitPerGrouping = 5 @@ -191,13 +191,13 @@ if algo_tag['hough']: if algo_tag['secondStage']: - TF_2nd = HTTTrackFitterTool("HTTTrackFitterTool_2nd") - HTTAlgorithmConfig.applyTag(TF_2nd, algo_tag) + TF_2nd = FPGATrackSimTrackFitterTool("FPGATrackSimTrackFitterTool_2nd") + FPGATrackSimAlgorithmConfig.applyTag(TF_2nd, algo_tag) TF_2nd.Do2ndStageTrackFit = True ToolSvc += TF_2nd alg.TrackFitter_2nd = TF_2nd - OR_2nd = HTTOverlapRemovalTool("HTTOverlapRemovalTool_2nd") + OR_2nd = FPGATrackSimOverlapRemovalTool("FPGATrackSimOverlapRemovalTool_2nd") OR_2nd.DoSecondStage = True OR_2nd.ORAlgo = "Normal" OR_2nd.doFastOR = algo_tag['doFastOR'] @@ -208,22 +208,22 @@ if algo_tag['secondStage']: ToolSvc += OR_2nd alg.OverlapRemoval_2nd = OR_2nd - from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTExtrapolator - HTTExtrapolatorTool = HTTExtrapolator() - HTTExtrapolatorTool.Ncombinations = 16 - ToolSvc += HTTExtrapolatorTool - alg.Extrapolator = HTTExtrapolatorTool + from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimExtrapolator + FPGATrackSimExtrapolatorTool = FPGATrackSimExtrapolator() + FPGATrackSimExtrapolatorTool.Ncombinations = 16 + ToolSvc += FPGATrackSimExtrapolatorTool + alg.Extrapolator = FPGATrackSimExtrapolatorTool #-------------------------------------------------------------- # Configure LRT #-------------------------------------------------------------- # We'll use this in other tools if LRT is requested -from TrigHTTConfTools import HTTConfigCompInit -evtSelLRT = HTTConfigCompInit.addEvtSelSvc(map_tag,"EvtSelLRTSvc") +from FPGATrackSimConfTools import FPGATrackSimConfigCompInit +evtSelLRT = FPGATrackSimConfigCompInit.addEvtSelSvc(map_tag,"EvtSelLRTSvc") -from TrigHTTLRT.TrigHTTLRTConf import HTTLLPRoadFilterTool -thellpfilter = HTTLLPRoadFilterTool() +from FPGATrackSimLRT.FPGATrackSimLRTConf import FPGATrackSimLLPRoadFilterTool +thellpfilter = FPGATrackSimLLPRoadFilterTool() ToolSvc += thellpfilter if algo_tag['lrt']: @@ -240,15 +240,15 @@ if algo_tag['lrt']: alg.LRTHitFiltering = (not algo_tag['lrt_skip_hit_filtering']) # now set up the rest - from TrigHTTLRT.TrigHTTLRTConf import HTTLLPRoadFilterTool + from FPGATrackSimLRT.FPGATrackSimLRTConf import FPGATrackSimLLPRoadFilterTool if algo_tag['lrt_use_basicHitFilter']: alg.LRTRoadFilter = thellpfilter if algo_tag['lrt_use_doubletHT']: - from TrigHTTLRT.TrigHTTLRTConf import addLRTDoubletHTTool - doubletTool = addLRTDoubletHTTool(algo_tag) + from FPGATrackSimLRT.FPGATrackSimLRTConf import addLRTDoubletFPGATrackSimool + doubletTool = addLRTDoubletFPGATrackSimool(algo_tag) alg.LRTRoadFinder = doubletTool elif algo_tag['lrt_use_straightTrackHT'] : - alg.LRTRoadFinder = HTTAlgorithmConfig.addHough_d0phi0_Tool(map_tag, algo_tag, doHitTracing) + alg.LRTRoadFinder = FPGATrackSimAlgorithmConfig.addHough_d0phi0_Tool(map_tag, algo_tag, doHitTracing) # Use our event selector in the algorithm alg.eventSelector = evtSelLRT diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTMapMakerAlg.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimMapMakerAlg.py similarity index 55% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTMapMakerAlg.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimMapMakerAlg.py index 77243d2ab7e547717feb55d92a9e2c7eb8a90569..8c4851863c4d4f4900a9a941021044dee53415fe 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTMapMakerAlg.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimMapMakerAlg.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #-------------------------------------------------------------- # Headers and setup @@ -16,24 +16,24 @@ theApp.EvtMax = runArgs.maxEvents from GaudiSvc.GaudiSvcConf import THistSvc #-------------------------------------------------------------- -# HTT Setup +# FPGATrackSim Setup #-------------------------------------------------------------- -from TrigHTTConfig.parseRunArgs import parseHTTArgs -from TrigHTTConfig.formatMessageSvc import HTT_OutputLevel, formatMessageSvc -import TrigHTTConfig.HTTTagConfig as HTTTagConfig -import TrigHTTConfig.HTTConfigCompInit as HTTConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig +from FPGATrackSimConfig.parseRunArgs import parseFPGATrackSimArgs +from FPGATrackSimConfig.formatMessageSvc import FPGATrackSim_OutputLevel, formatMessageSvc +import FPGATrackSimConfig.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimConfig.FPGATrackSimConfigCompInit as FPGATrackSimConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig formatMessageSvc() -HTT_OutputLevel=getattr(runArgs, 'OutputLevel', HTT_OutputLevel) -#HTT_OutputLevel = DEBUG +FPGATrackSim_OutputLevel=getattr(runArgs, 'OutputLevel', FPGATrackSim_OutputLevel) +#FPGATrackSim_OutputLevel = DEBUG -HTTInputFile = runArgs.InFileName -print "Input file: ", HTTInputFile +FPGATrackSimInputFile = runArgs.InFileName +print "Input file: ", FPGATrackSimInputFile -tags = HTTTagConfig.getTags(stage='algo', options=parseHTTArgs(runArgs)) +tags = FPGATrackSimTagConfig.getTags(stage='algo', options=parseFPGATrackSimArgs(runArgs)) map_tag = tags['map'] def defaultFilename(): @@ -43,19 +43,19 @@ OutFileName = getattr(runArgs, 'OutFileName', defaultFilename()) ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += ["MONITOROUT DATAFILE='"+OutFileName+"' OPT='RECREATE'"] -ES = HTTConfig.addEvtSelSvc(map_tag) -ES.OutputLevel = HTT_OutputLevel -MapSvc = HTTMapConfig.addMapSvc(map_tag) -MapSvc.OutputLevel = HTT_OutputLevel +ES = FPGATrackSimConfig.addEvtSelSvc(map_tag) +ES.OutputLevel = FPGATrackSim_OutputLevel +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) +MapSvc.OutputLevel = FPGATrackSim_OutputLevel #-------------------------------------------------------------- # Make the algorithm #-------------------------------------------------------------- -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTMapMakerAlg +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimMapMakerAlg -alg = HTTMapMakerAlg() -alg.OutputLevel = HTT_OutputLevel +alg = FPGATrackSimMapMakerAlg() +alg.OutputLevel = FPGATrackSim_OutputLevel alg.OutFileName = OutFileName alg.region = getattr(runArgs, 'region', 0) alg.KeyString = getattr(runArgs, 'KeyString', "strip,barrel,2") @@ -70,10 +70,10 @@ theJob += alg # Make hit tools #-------------------------------------------------------------- -from TrigHTTInput.TrigHTTInputConf import HTTInputHeaderTool +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimInputHeaderTool -InputTool = HTTInputHeaderTool("HTTReadInput") -InputTool.OutputLevel = HTT_OutputLevel +InputTool = FPGATrackSimInputHeaderTool("FPGATrackSimReadInput") +InputTool.OutputLevel = FPGATrackSim_OutputLevel InputTool.InFileName = runArgs.InFileName ToolSvc += InputTool diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTOutputMonitorAlg.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimOutputMonitorAlg.py similarity index 55% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTOutputMonitorAlg.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimOutputMonitorAlg.py index a7b093f644d793fe2dce5404600719399d1df040..4d8f46c8ebca6baa4490340ee68171710b84cc34 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/share/skeleton.HTTOutputMonitorAlg.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/share/skeleton.FPGATrackSimOutputMonitorAlg.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #-------------------------------------------------------------- # Headers and setup @@ -16,40 +16,40 @@ theApp.EvtMax = runArgs.maxEvents from GaudiSvc.GaudiSvcConf import THistSvc #-------------------------------------------------------------- -# HTT Setup +# FPGATrackSim Setup #-------------------------------------------------------------- -from TrigHTTConfig.parseRunArgs import parseHTTArgs -from TrigHTTConfig.formatMessageSvc import HTT_OutputLevel, formatMessageSvc -import TrigHTTConfig.HTTTagConfig as HTTTagConfig -import TrigHTTConfig.HTTConfigCompInit as HTTConfig -import TrigHTTMaps.HTTMapConfig as HTTMapConfig +from FPGATrackSimConfig.parseRunArgs import parseFPGATrackSimArgs +from FPGATrackSimConfig.formatMessageSvc import FPGATrackSim_OutputLevel, formatMessageSvc +import FPGATrackSimConfig.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimConfig.FPGATrackSimConfigCompInit as FPGATrackSimConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig formatMessageSvc() -HTT_OutputLevel=getattr(runArgs, 'OutputLevel', HTT_OutputLevel) -#HTT_OutputLevel = DEBUG +FPGATrackSim_OutputLevel=getattr(runArgs, 'OutputLevel', FPGATrackSim_OutputLevel) +#FPGATrackSim_OutputLevel = DEBUG # Input -HTTInputFile = [] +FPGATrackSimInputFile = [] if runArgs.InFileName: for ex in runArgs.InFileName.split(','): files = glob.glob(ex) if files: - HTTInputFile += files + FPGATrackSimInputFile += files else: - HTTInputFile += [ex] + FPGATrackSimInputFile += [ex] else: - HTTInputFile = ["httsim_input.root"] -print "Input file: ", HTTInputFile + FPGATrackSimInputFile = ["httsim_input.root"] +print "Input file: ", FPGATrackSimInputFile -tags = HTTTagConfig.getTags(stage='algo', options=parseHTTArgs(runArgs)) +tags = FPGATrackSimTagConfig.getTags(stage='algo', options=parseFPGATrackSimArgs(runArgs)) map_tag = tags['map'] bank_tag = tags['bank'] algo_tag = tags['algo'] def defaultFilename(): - f = HTTTagConfig.getDescription(map_tag, bank_tag, algo_tag, filename=True) + f = FPGATrackSimTagConfig.getDescription(map_tag, bank_tag, algo_tag, filename=True) f = 'output__' + map_tag['release'] + '-' + map_tag['geoTag'] + '__' + f + '.root' return f @@ -57,20 +57,20 @@ OutFileName=getattr(runArgs, 'OutFileName', defaultFilename()) ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += ["MONITOROUT DATAFILE='"+OutFileName+"' OPT='RECREATE'"] -ES = HTTConfig.addEvtSelSvc(map_tag) -ES.OutputLevel = HTT_OutputLevel +ES = FPGATrackSimConfig.addEvtSelSvc(map_tag) +ES.OutputLevel = FPGATrackSim_OutputLevel -MapSvc = HTTMapConfig.addMapSvc(map_tag) -MapSvc.OutputLevel = HTT_OutputLevel +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) +MapSvc.OutputLevel = FPGATrackSim_OutputLevel #-------------------------------------------------------------- # Make the algorithm #-------------------------------------------------------------- -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTOutputMonitorAlg +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimOutputMonitorAlg -alg = HTTOutputMonitorAlg() -alg.OutputLevel = HTT_OutputLevel +alg = FPGATrackSimOutputMonitorAlg() +alg.OutputLevel = FPGATrackSim_OutputLevel alg.RunSecondStage = algo_tag['secondStage'] alg.histoPrintDetail = 2 @@ -80,11 +80,11 @@ theJob += alg # Make Read Output Tool #-------------------------------------------------------------- -from TrigHTTInput.TrigHTTInputConf import HTTOutputHeaderTool +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimOutputHeaderTool -OutputReader = HTTOutputHeaderTool() -OutputReader.OutputLevel = HTT_OutputLevel -OutputReader.InFileName = HTTInputFile +OutputReader = FPGATrackSimOutputHeaderTool() +OutputReader.OutputLevel = FPGATrackSim_OutputLevel +OutputReader.InFileName = FPGATrackSimInputFile OutputReader.RWstatus="READ" OutputReader.RunSecondStage = alg.RunSecondStage @@ -95,45 +95,45 @@ alg.ReadOutputTool = OutputReader # Make Monitor Tools and Data Flow Tool #-------------------------------------------------------------- -from TrigHTTMonitor.TrigHTTMonitorConf import HTTHitMonitorTool, HTTClusterMonitorTool, HTTRoadMonitorTool, HTTTrackMonitorTool, HTTPerformanceMonitorTool, HTTEventMonitorTool, HTTSecondStageMonitorTool, HTTMonitorUnionTool -from TrigHTTAlgorithms.TrigHTTAlgorithmsConf import HTTDataFlowTool +from FPGATrackSimMonitor.FPGATrackSimMonitorConf import FPGATrackSimHitMonitorTool, FPGATrackSimClusterMonitorTool, FPGATrackSimRoadMonitorTool, FPGATrackSimTrackMonitorTool, FPGATrackSimPerformanceMonitorTool, FPGATrackSimEventMonitorTool, FPGATrackSimSecondStageMonitorTool, FPGATrackSimMonitorUnionTool +from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmsConf import FPGATrackSimDataFlowTool -HitMonitor = HTTHitMonitorTool() -HitMonitor.OutputLevel = HTT_OutputLevel +HitMonitor = FPGATrackSimHitMonitorTool() +HitMonitor.OutputLevel = FPGATrackSim_OutputLevel HitMonitor.fastMon = algo_tag['fastMon'] HitMonitor.OutputMon = True HitMonitor.RunSecondStage = alg.RunSecondStage HitMonitor.canExtendHistRanges = algo_tag['canExtendHistRanges'] -ClusterMonitor = HTTClusterMonitorTool() -ClusterMonitor.OutputLevel = HTT_OutputLevel +ClusterMonitor = FPGATrackSimClusterMonitorTool() +ClusterMonitor.OutputLevel = FPGATrackSim_OutputLevel ClusterMonitor.Clustering = False ClusterMonitor.Spacepoints = False ClusterMonitor.RunSecondStage = alg.RunSecondStage ClusterMonitor.canExtendHistRanges = algo_tag['canExtendHistRanges'] -RoadMonitor = HTTRoadMonitorTool() -RoadMonitor.OutputLevel = HTT_OutputLevel +RoadMonitor = FPGATrackSimRoadMonitorTool() +RoadMonitor.OutputLevel = FPGATrackSim_OutputLevel RoadMonitor.fastMon = algo_tag['fastMon'] RoadMonitor.RunSecondStage = alg.RunSecondStage RoadMonitor.canExtendHistRanges = algo_tag['canExtendHistRanges'] RoadMonitor.BarcodeFracCut = algo_tag['barcodeFracMatch'] -TrackMonitor = HTTTrackMonitorTool() -TrackMonitor.OutputLevel = HTT_OutputLevel +TrackMonitor = FPGATrackSimTrackMonitorTool() +TrackMonitor.OutputLevel = FPGATrackSim_OutputLevel TrackMonitor.fastMon = algo_tag['fastMon'] TrackMonitor.OutputMon = True TrackMonitor.DoMissingHitsChecks = False TrackMonitor.RunSecondStage = alg.RunSecondStage -PerfMonitor = HTTPerformanceMonitorTool() -PerfMonitor.OutputLevel = HTT_OutputLevel +PerfMonitor = FPGATrackSimPerformanceMonitorTool() +PerfMonitor.OutputLevel = FPGATrackSim_OutputLevel PerfMonitor.fastMon = algo_tag['fastMon'] PerfMonitor.RunSecondStage = alg.RunSecondStage PerfMonitor.BarcodeFracCut = algo_tag['barcodeFracMatch'] -EventMonitor = HTTEventMonitorTool() -EventMonitor.OutputLevel = HTT_OutputLevel +EventMonitor = FPGATrackSimEventMonitorTool() +EventMonitor.OutputLevel = FPGATrackSim_OutputLevel EventMonitor.fastMon = algo_tag['fastMon'] EventMonitor.OutputMon = True EventMonitor.Clustering = False @@ -141,14 +141,14 @@ EventMonitor.Spacepoints = False EventMonitor.RunSecondStage = alg.RunSecondStage EventMonitor.BarcodeFracCut = algo_tag['barcodeFracMatch'] -SecondMonitor = HTTSecondStageMonitorTool() -SecondMonitor.OutputLevel = HTT_OutputLevel +SecondMonitor = FPGATrackSimSecondStageMonitorTool() +SecondMonitor.OutputLevel = FPGATrackSim_OutputLevel SecondMonitor.fastMon = algo_tag['fastMon'] SecondMonitor.BarcodeFracCut = algo_tag['barcodeFracMatch'] SecondMonitor.Chi2ndofCut = 40. -MonitorUnion = HTTMonitorUnionTool() -MonitorUnion.OutputLevel = HTT_OutputLevel +MonitorUnion = FPGATrackSimMonitorUnionTool() +MonitorUnion.OutputLevel = FPGATrackSim_OutputLevel MonitorTools = [] MonitorTools.append(HitMonitor) MonitorTools.append(ClusterMonitor) @@ -160,8 +160,8 @@ if alg.RunSecondStage: MonitorTools.append(SecondMonitor) MonitorUnion.MonitorTools = MonitorTools -DataFlowTool = HTTDataFlowTool() -DataFlowTool.OutputLevel = HTT_OutputLevel +DataFlowTool = FPGATrackSimDataFlowTool() +DataFlowTool.OutputLevel = FPGATrackSim_OutputLevel DataFlowTool.RunSecondStage = alg.RunSecondStage ToolSvc += MonitorUnion diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTDataFlowTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimDataFlowTool.cxx similarity index 86% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTDataFlowTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimDataFlowTool.cxx index 501e5fb9333f184fcc3f4b163ea2622f8c51891b..6049fa1eed9d6f583a4cb04a82a93a3895729a3c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTDataFlowTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimDataFlowTool.cxx @@ -1,36 +1,36 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "HTTDataFlowTool.h" +#include "FPGATrackSimDataFlowTool.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTDataFlowInfo.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTFunctions.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimFunctions.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" #include "CxxUtils/bitscan.h" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -HTTDataFlowTool::HTTDataFlowTool(std::string const & algname, std::string const & name, IInterface const * ifc) : +FPGATrackSimDataFlowTool::FPGATrackSimDataFlowTool(std::string const & algname, std::string const & name, IInterface const * ifc) : AthAlgTool(algname, name, ifc) { } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::initialize() +StatusCode FPGATrackSimDataFlowTool::initialize() { - ATH_MSG_INFO("HTTDataFlowTool::initialize()"); + ATH_MSG_INFO("FPGATrackSimDataFlowTool::initialize()"); ATH_CHECK(m_tHistSvc.retrieve()); - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_evtSel.retrieve()); - m_nLayers_1st = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); + m_nLayers_1st = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); m_dataFlowTxt.open(m_dataFlowTxtName); m_dataFlowTeX.open(m_dataFlowTeXName); @@ -40,25 +40,25 @@ StatusCode HTTDataFlowTool::initialize() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::calculateDataFlow(HTTDataFlowInfo* info, HTTLogicalEventInputHeader const * header_1st, - std::vector<HTTCluster> const & clusters_1st, - std::vector<HTTRoad*> const & roads_1st, std::vector<HTTTrack> const & tracks_1st, - std::vector<HTTRoad*> const & roads_2nd, std::vector<HTTTrack> const & tracks_2nd) +StatusCode FPGATrackSimDataFlowTool::calculateDataFlow(FPGATrackSimDataFlowInfo* info, FPGATrackSimLogicalEventInputHeader const * header_1st, + std::vector<FPGATrackSimCluster> const & clusters_1st, + std::vector<FPGATrackSimRoad*> const & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st, + std::vector<FPGATrackSimRoad*> const & roads_2nd, std::vector<FPGATrackSimTrack> const & tracks_2nd) { info->nMappedHits_1st_layer.resize(m_nLayers_1st); - for (HTTHit const & hit : header_1st->towers().at(0).hits()) { + for (FPGATrackSimHit const & hit : header_1st->towers().at(0).hits()) { info->nMappedHits_1st_layer[hit.getLayer()]++; info->nMappedHits_1st_total++; } info->nClusters_1st_layer.resize(m_nLayers_1st); - for (HTTCluster const & cluster : clusters_1st) { + for (FPGATrackSimCluster const & cluster : clusters_1st) { info->nClusters_1st_layer[cluster.getClusterEquiv().getLayer()]++; info->nClusters_1st_total = clusters_1st.size(); } info->nRoads_1st_total = roads_1st.size(); - for (HTTRoad const * r : roads_1st) { + for (FPGATrackSimRoad const * r : roads_1st) { if (CxxUtils::count_ones(r->getHitLayers()) == m_nLayers_1st - 1) info->nRoads_1st_7hits++; if (CxxUtils::count_ones(r->getHitLayers()) == m_nLayers_1st) info->nRoads_1st_8hits++; } @@ -72,7 +72,7 @@ StatusCode HTTDataFlowTool::calculateDataFlow(HTTDataFlowInfo* info, HTTLogicalE std::unordered_map<int, size_t> sectID_nTracks_1st_afterOR; info->nTracks_1st_total = tracks_1st.size(); - for (HTTTrack const & t : tracks_1st) { + for (FPGATrackSimTrack const & t : tracks_1st) { if (t.getChi2ndof() <= m_cut_chi2ndof) { info->nTracks_1st_passChi2++; pattID_nTracks_1st_passChi2[t.getPatternID()]++; @@ -108,7 +108,7 @@ StatusCode HTTDataFlowTool::calculateDataFlow(HTTDataFlowInfo* info, HTTLogicalE std::unordered_map<int, size_t> sectID_nTracks_2nd_afterOR; info->nTracks_2nd_total = tracks_2nd.size(); - for (HTTTrack const & t : tracks_2nd) { + for (FPGATrackSimTrack const & t : tracks_2nd) { if (t.getChi2ndof() <= m_cut_chi2ndof) { info->nTracks_2nd_passChi2++; sectID_nTracks_2nd_passChi2[t.getSecondSectorID()]++; @@ -125,11 +125,11 @@ StatusCode HTTDataFlowTool::calculateDataFlow(HTTDataFlowInfo* info, HTTLogicalE info->nConstants_2nd_afterOR = sectID_nTracks_2nd_afterOR.size(); } - for (HTTTruthTrack const & truth_t : header_1st->optional().getTruthTracks()) { + for (FPGATrackSimTruthTrack const & truth_t : header_1st->optional().getTruthTracks()) { if (m_evtSel->passCuts(truth_t)) info->nTruthTracks++; } - for (HTTOfflineTrack const & offline_t : header_1st->optional().getOfflineTracks()) { + for (FPGATrackSimOfflineTrack const & offline_t : header_1st->optional().getOfflineTracks()) { if (m_evtSel->passCuts(offline_t)) info->nOfflineTracks++; } @@ -145,7 +145,7 @@ StatusCode HTTDataFlowTool::calculateDataFlow(HTTDataFlowInfo* info, HTTLogicalE // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::getDataFlowInfo(HTTDataFlowInfo const & info) +StatusCode FPGATrackSimDataFlowTool::getDataFlowInfo(FPGATrackSimDataFlowInfo const & info) { m_nEvents++; @@ -209,7 +209,7 @@ StatusCode HTTDataFlowTool::getDataFlowInfo(HTTDataFlowInfo const & info) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::makeDataFlowTable() +StatusCode FPGATrackSimDataFlowTool::makeDataFlowTable() { m_dataFlowTxt << std::left << std::setw(m_tableTypeWidth) << "Type" << std::setw(m_tableDataWidth) << "Stage" @@ -322,16 +322,16 @@ StatusCode HTTDataFlowTool::makeDataFlowTable() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::finalize() +StatusCode FPGATrackSimDataFlowTool::finalize() { - ATH_MSG_INFO("HTTDataFlowTool::finalize()"); + ATH_MSG_INFO("FPGATrackSimDataFlowTool::finalize()"); ATH_CHECK(makeDataFlowTable()); return StatusCode::SUCCESS; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::addDataFlow(float const n, std::string const & key, bool const isInt) +StatusCode FPGATrackSimDataFlowTool::addDataFlow(float const n, std::string const & key, bool const isInt) { if (isInt) { if (m_dataFlowDataI_min.find(key) == m_dataFlowDataI_min.end()) { @@ -406,7 +406,7 @@ StatusCode HTTDataFlowTool::addDataFlow(float const n, std::string const & key, // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDataFlowTool::printDataFlow(std::string const & key, int const div) +StatusCode FPGATrackSimDataFlowTool::printDataFlow(std::string const & key, int const div) { bool isInt = false; if (m_dataFlowHistsI.find(key) != m_dataFlowHistsI.end()) @@ -469,7 +469,7 @@ StatusCode HTTDataFlowTool::printDataFlow(std::string const & key, int const div // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void HTTDataFlowTool::addTableBreak(unsigned const n) +void FPGATrackSimDataFlowTool::addTableBreak(unsigned const n) { for (unsigned i = 0; i < n; i++) { m_dataFlowTxt << "--------------" << std::endl; @@ -479,7 +479,7 @@ void HTTDataFlowTool::addTableBreak(unsigned const n) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void HTTDataFlowTool::findAndReplaceAll(std::string & data, std::string const & toFind, std::string const & replaceStr) const +void FPGATrackSimDataFlowTool::findAndReplaceAll(std::string & data, std::string const & toFind, std::string const & replaceStr) const { size_t pos = data.find(toFind); while (pos != std::string::npos) { @@ -490,7 +490,7 @@ void HTTDataFlowTool::findAndReplaceAll(std::string & data, std::string const & // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -void HTTDataFlowTool::setMaxAcceptance(TH1* h, double const max_frac, double& max_value) const +void FPGATrackSimDataFlowTool::setMaxAcceptance(TH1* h, double const max_frac, double& max_value) const { double total = h->Integral(); for (int i = 1; i <= h->GetNbinsX(); i++) { @@ -505,7 +505,7 @@ void HTTDataFlowTool::setMaxAcceptance(TH1* h, double const max_frac, double& ma // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -double HTTDataFlowTool::roundTo(double const v, int const nSigDigits) const +double FPGATrackSimDataFlowTool::roundTo(double const v, int const nSigDigits) const { int sigDigit = v != 0 ? trunc(log10(fabs(v))) : 0; if (nSigDigits >= 1) { diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTDataFlowTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimDataFlowTool.h similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTDataFlowTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimDataFlowTool.h index c11dd85a6eac64900cf052c3c6b728ceba53201c..060e2cf0d974cef3b1edc1fa145217c50903189c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTDataFlowTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimDataFlowTool.h @@ -1,43 +1,43 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTDATAFLOWTOOL_H -#define HTTDATAFLOWTOOL_H +#ifndef FPGATrackSimDATAFLOWTOOL_H +#define FPGATrackSimDATAFLOWTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ITHistSvc.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include "TH1.h" #include <fstream> -class HTTDataFlowInfo; -class HTTHit; -class HTTCluster; -class HTTLogicalEventInputHeader; -class HTTRoad; -class HTTTrack; +class FPGATrackSimDataFlowInfo; +class FPGATrackSimHit; +class FPGATrackSimCluster; +class FPGATrackSimLogicalEventInputHeader; +class FPGATrackSimRoad; +class FPGATrackSimTrack; -class IHTTEventSelectionSvc; -class ITrigHTTMappingSvc; +class IFPGATrackSimEventSelectionSvc; +class IFPGATrackSimMappingSvc; ///////////////////////////////////////////////////////////////////////////// -class HTTDataFlowTool: public AthAlgTool +class FPGATrackSimDataFlowTool: public AthAlgTool { public: - HTTDataFlowTool(std::string const &, std::string const &, IInterface const *); - virtual ~HTTDataFlowTool() = default; + FPGATrackSimDataFlowTool(std::string const &, std::string const &, IInterface const *); + virtual ~FPGATrackSimDataFlowTool() = default; virtual StatusCode initialize() override; - StatusCode calculateDataFlow(HTTDataFlowInfo* info, HTTLogicalEventInputHeader const * header_1st, - std::vector<HTTCluster> const & clusters_1st, - std::vector<HTTRoad*> const & roads_1st, std::vector<HTTTrack> const & tracks_1st, - std::vector<HTTRoad*> const & roads_2nd, std::vector<HTTTrack> const & tracks_2nd); + StatusCode calculateDataFlow(FPGATrackSimDataFlowInfo* info, FPGATrackSimLogicalEventInputHeader const * header_1st, + std::vector<FPGATrackSimCluster> const & clusters_1st, + std::vector<FPGATrackSimRoad*> const & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st, + std::vector<FPGATrackSimRoad*> const & roads_2nd, std::vector<FPGATrackSimTrack> const & tracks_2nd); - StatusCode getDataFlowInfo(HTTDataFlowInfo const & info); + StatusCode getDataFlowInfo(FPGATrackSimDataFlowInfo const & info); virtual StatusCode finalize() override; @@ -59,13 +59,13 @@ class HTTDataFlowTool: public AthAlgTool StatusCode regHist (std::string const & dir, TH1* h) { return m_tHistSvc->regHist (dir + h->GetName(), h); } ServiceHandle<ITHistSvc> m_tHistSvc{this,"THistSvc","THistSvc"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping{this,"TrigHTTMappingSvc","TrigHTTMappingSvc"}; - ServiceHandle<IHTTEventSelectionSvc> m_evtSel{this,"HTTEventSelectionSvc","HTTEventSelectionSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_evtSel{this,"FPGATrackSimEventSelectionSvc","FPGATrackSimEventSelectionSvc"}; Gaudi::Property<bool> m_runSecondStage {this, "RunSecondStage", false, "flag to enable running the second stage fitting"}; Gaudi::Property<std::string> m_outputtag {this, "outputTag", "", "Extra string to use in output folder names - default none"}; - Gaudi::Property<float> m_cut_chi2ndof {this, "Chi2ndofCut", 40., "cut on Chi2 of HTTTrack"}; + Gaudi::Property<float> m_cut_chi2ndof {this, "Chi2ndofCut", 40., "cut on Chi2 of FPGATrackSimTrack"}; // data flow output std::string const m_dataFlowTxtName = "./dataflow.txt"; @@ -77,7 +77,7 @@ class HTTDataFlowTool: public AthAlgTool std::string m_dir; size_t m_nEvents = 0; - unsigned m_nLayers_1st = 0U; // alias to m_HTTMapping->PlaneMap1stStage()->getNLogiLayers(); + unsigned m_nLayers_1st = 0U; // alias to m_FPGATrackSimMapping->PlaneMap1stStage()->getNLogiLayers(); // constants used for data flow table unsigned const m_nSigDigits = 2; @@ -94,4 +94,4 @@ class HTTDataFlowTool: public AthAlgTool std::unordered_map<std::string, TH1F*> m_dataFlowHistsF; }; -#endif // HTTDataFlowTool_h +#endif // FPGATrackSimDataFlowTool_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTLogicalHitsProcessAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx similarity index 74% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTLogicalHitsProcessAlg.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx index 9d176b5de8a2f2b6d3d982110b20945a1b2dd42e..1e435cc4d1651cd062e5075463c8170f538eb416 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTLogicalHitsProcessAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx @@ -1,26 +1,26 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "HTTLogicalHitsProcessAlg.h" +#include "FPGATrackSimLogicalHitsProcessAlg.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTDataFlowInfo.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" -#include "HTTDataFlowTool.h" -#include "HTTNNTrackTool.h" -#include "HTTOverlapRemovalTool.h" -#include "HTTTrackFitterTool.h" +#include "FPGATrackSimDataFlowTool.h" +#include "FPGATrackSimNNTrackTool.h" +#include "FPGATrackSimOverlapRemovalTool.h" +#include "FPGATrackSimTrackFitterTool.h" -#include "TrigHTTConfTools/HTTRegionSlices.h" +#include "FPGATrackSimConfTools/FPGATrackSimRegionSlices.h" -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" -#include "TrigHTTInput/HTTReadRawRandomHitsTool.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" +#include "FPGATrackSimInput/FPGATrackSimReadRawRandomHitsTool.h" -#include "TrigHTTMaps/HTTRegionMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" #include "GaudiKernel/IEventProcessor.h" @@ -40,13 +40,13 @@ size_t m_tread = 0, m_tprocess = 0, m_troads = 0, m_troad_filter = 0, m_tlrt = 0 /////////////////////////////////////////////////////////////////////////////// // Initialize -HTTLogicalHitsProcessAlg::HTTLogicalHitsProcessAlg (const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimLogicalHitsProcessAlg::FPGATrackSimLogicalHitsProcessAlg (const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { } -StatusCode HTTLogicalHitsProcessAlg::initialize() +StatusCode FPGATrackSimLogicalHitsProcessAlg::initialize() { std::stringstream ss(m_description); std::string line; @@ -82,7 +82,7 @@ StatusCode HTTLogicalHitsProcessAlg::initialize() ATH_CHECK(m_dataFlowTool.retrieve()); ATH_CHECK(m_writeOutputTool.retrieve()); - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_evtSel.retrieve()); ATH_MSG_DEBUG("initialize() Instantiating root objects"); @@ -111,7 +111,7 @@ StatusCode HTTLogicalHitsProcessAlg::initialize() // MAIN EXECUTE ROUTINE // /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTLogicalHitsProcessAlg::execute() +StatusCode FPGATrackSimLogicalHitsProcessAlg::execute() { #ifdef BENCHMARK_LOGICALHITSALG std::chrono::time_point<std::chrono::steady_clock> t_0, t_1; @@ -135,7 +135,7 @@ StatusCode HTTLogicalHitsProcessAlg::execute() // Apply truth track cuts if (!m_evtSel->selectEvent(&m_eventHeader)) { - ATH_MSG_DEBUG("Event skipped by HTTEventSelectionSvc"); + ATH_MSG_DEBUG("Event skipped by FPGATrackSimEventSelectionSvc"); return StatusCode::SUCCESS; } @@ -152,21 +152,21 @@ StatusCode HTTLogicalHitsProcessAlg::execute() auto mon_regionID = Monitored::Scalar<unsigned>("regionID", regionID); Monitored::Group(m_monTool, mon_regionID); - std::vector<HTTHit> const & hits_1st = m_logicEventHeader_1st->towers().at(regionID).hits(); + std::vector<FPGATrackSimHit> const & hits_1st = m_logicEventHeader_1st->towers().at(regionID).hits(); TIME(m_tprocess); // Get roads - std::vector<HTTRoad*> prefilter_roads; - std::vector<HTTRoad*>& roads_1st = prefilter_roads; - std::vector<const HTTHit*> phits_1st; - for (HTTHit const & h : hits_1st) phits_1st.push_back(&h); + std::vector<FPGATrackSimRoad*> prefilter_roads; + std::vector<FPGATrackSimRoad*>& roads_1st = prefilter_roads; + std::vector<const FPGATrackSimHit*> phits_1st; + for (FPGATrackSimHit const & h : hits_1st) phits_1st.push_back(&h); ATH_CHECK(m_roadFinderTool->getRoads(phits_1st, roads_1st)); TIME(m_troads); // Standard road Filter - std::vector<HTTRoad*> postfilter_roads; + std::vector<FPGATrackSimRoad*> postfilter_roads; if (m_filterRoads) { ATH_MSG_DEBUG("Filtering roads"); @@ -176,7 +176,7 @@ StatusCode HTTLogicalHitsProcessAlg::execute() ATH_CHECK(m_overlapRemovalTool_1st->runOverlapRemoval(roads_1st)); // Road Filter2 - std::vector<HTTRoad*> postfilter2_roads; + std::vector<FPGATrackSimRoad*> postfilter2_roads; if (m_filterRoads2) { ATH_CHECK(m_roadFilterTool2->filterRoads(roads_1st, postfilter2_roads)); roads_1st = postfilter2_roads; @@ -185,11 +185,11 @@ StatusCode HTTLogicalHitsProcessAlg::execute() TIME(m_troad_filter); // Get tracks - std::vector<HTTTrack> tracks_1st; + std::vector<FPGATrackSimTrack> tracks_1st; if (m_doTracking) { if (m_doNNTrack) { ATH_MSG_DEBUG("Performing NN tracking"); - const HTTNNMap* nnMap = m_HTTMapping->NNMap(); + const FPGATrackSimNNMap* nnMap = m_FPGATrackSimMapping->NNMap(); ATH_CHECK(m_NNTrackTool->getTracks(roads_1st, tracks_1st, nnMap)); } else { @@ -206,11 +206,11 @@ StatusCode HTTLogicalHitsProcessAlg::execute() // Now, we may want to do large-radius tracking on the hits not used by the first stage tracking. // This follows overlap removal. - std::vector<HTTRoad*> roadsLRT; - std::vector<HTTTrack> tracksLRT; // currently empty + std::vector<FPGATrackSimRoad*> roadsLRT; + std::vector<FPGATrackSimTrack> tracksLRT; // currently empty if (m_doLRT) { // Filter out hits that are on successful first-stage tracks - std::vector<const HTTHit*> remainingHits; + std::vector<const FPGATrackSimHit*> remainingHits; if (m_doLRTHitFiltering) { ATH_MSG_DEBUG("Doing hit filtering based on prompt tracks."); @@ -227,21 +227,21 @@ StatusCode HTTLogicalHitsProcessAlg::execute() TIME(m_tlrt); - HTTDataFlowInfo* dataFlowInfo = new HTTDataFlowInfo(); + auto dataFlowInfo = std::make_unique<FPGATrackSimDataFlowInfo>(); // Second stage fitting - std::vector<HTTRoad*> roads_2nd; - std::vector<HTTTrack> tracks_2nd; + std::vector<FPGATrackSimRoad*> roads_2nd; + std::vector<FPGATrackSimTrack> tracks_2nd; if (m_runSecondStage) { ATH_CHECK(secondStageProcessing(tracks_1st, roads_2nd, tracks_2nd)); TIME(m_t2ndStage); } // Calculate data flow quantities - ATH_CHECK(m_dataFlowTool->calculateDataFlow(dataFlowInfo, m_logicEventHeader_1st, m_clusters_1st, roads_1st, tracks_1st, roads_2nd, tracks_2nd)); + ATH_CHECK(m_dataFlowTool->calculateDataFlow(dataFlowInfo.get(), m_logicEventHeader_1st, m_clusters_1st, roads_1st, tracks_1st, roads_2nd, tracks_2nd)); // Write the output and reset - ATH_CHECK(writeOutputData(roads_1st, tracks_1st, roads_2nd, tracks_2nd, dataFlowInfo)); + ATH_CHECK(writeOutputData(roads_1st, tracks_1st, roads_2nd, tracks_2nd, dataFlowInfo.get())); if (m_doHoughRootOutput) { ATH_CHECK(m_houghRootOutputTool->fillTree(roads_1st, m_logicEventHeader_1st->optional().getTruthTracks(), m_logicEventHeader_1st->optional().getOfflineTracks())); @@ -256,18 +256,18 @@ StatusCode HTTLogicalHitsProcessAlg::execute() << roads_1st.size() << " roads"; // endl moved below to deal with trailing comma // m_clusters_original exists, we just need to know which ones to access - // HTTRoad::getHits returns a vector of HTTHit, but each of them is actually a cluster + // FPGATrackSimRoad::getHits returns a vector of FPGATrackSimHit, but each of them is actually a cluster // m_parentageMask has been co-opted to store the cluster index (set in clustering tool) - // this lets us get hold of the actual HTTCluster via m_clusters_original[index] + // this lets us get hold of the actual FPGATrackSimCluster via m_clusters_original[index] int roadCount = 0; for(auto &road : roads_1st) { // to avoid empty entries if a layer has no hits in a road, save the hits to vector first - std::vector< std::vector<HTTHit> > clusters_in_road; + std::vector< std::vector<FPGATrackSimHit> > clusters_in_road; for(int layer = 0; layer < int(road->getNLayers()); layer ++) { for(auto &cluster_as_hit : road->getHits(layer)) { unsigned clusterIndex = (unsigned)cluster_as_hit->getParentageMask(); - HTTCluster thisCluster = m_clusters_1st_original.at(clusterIndex); + FPGATrackSimCluster thisCluster = m_clusters_1st_original.at(clusterIndex); // check that they match (might slow things down unnecessarily - remove later perhaps) if( (cluster_as_hit->getR() != thisCluster.getClusterEquiv().getR()) || (cluster_as_hit->getZ() != thisCluster.getClusterEquiv().getZ()) || @@ -297,11 +297,11 @@ StatusCode HTTLogicalHitsProcessAlg::execute() else m_outputHitTxtStream << ", "; // In the absence of hit.getIdentifier hash, need to get it back from - // HTTIdentifierHash = (m_identifierHash << 2) + m_etaIndex; // see HTTHit.cxx - // unsigned identifierHash = hit.getHTTIdentifierHash(); + // FPGATrackSimIdentifierHash = (m_identifierHash << 2) + m_etaIndex; // see FPGATrackSimHit.cxx + // unsigned identifierHash = hit.getFPGATrackSimIdentifierHash(); // if(hit.isStrip()) - // identifierHash = (hit.getHTTIdentifierHash() - hit.getEtaIndex()) >> 2; - // But instead can just use hit.getIdentifierHash() having uncommented it from HTTHit.h + // identifierHash = (hit.getFPGATrackSimIdentifierHash() - hit.getEtaIndex()) >> 2; + // But instead can just use hit.getIdentifierHash() having uncommented it from FPGATrackSimHit.h m_outputHitTxtStream << "[" << hit.isStrip() << ", " << hit.getIdentifierHash() << ", " << hit.getEtaIndex() << ", " << hit.getPhiIndex() << "]"; } @@ -320,7 +320,7 @@ StatusCode HTTLogicalHitsProcessAlg::execute() if (m_runSecondStage) m_logicEventHeader_2nd->reset(); TIME(m_tfin); - + return StatusCode::SUCCESS; } @@ -329,7 +329,7 @@ StatusCode HTTLogicalHitsProcessAlg::execute() // INPUT PASSING, READING AND PROCESSING // /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTLogicalHitsProcessAlg::readInputs(bool & done) +StatusCode FPGATrackSimLogicalHitsProcessAlg::readInputs(bool & done) { if (m_ev % m_firstInputToolN == 0) { @@ -362,7 +362,7 @@ StatusCode HTTLogicalHitsProcessAlg::readInputs(bool & done) // Applies clustering, mapping, hit filtering, and space points -StatusCode HTTLogicalHitsProcessAlg::processInputs() +StatusCode FPGATrackSimLogicalHitsProcessAlg::processInputs() { m_clusters_1st.clear(); m_spacepoints_1st.clear(); @@ -392,7 +392,7 @@ StatusCode HTTLogicalHitsProcessAlg::processInputs() { // get the sets of layers that we want to filter hits from std::vector<int> filter_pixel_physLayers, filter_strip_physLayers; - const HTTPlaneMap *planeMap_1st = m_HTTMapping->PlaneMap_1st(); + const FPGATrackSimPlaneMap *planeMap_1st = m_FPGATrackSimMapping->PlaneMap_1st(); ATH_CHECK(m_hitFilteringTool->GetPairedStripPhysLayers(planeMap_1st, filter_strip_physLayers)); m_clusters_1st.clear(); ATH_CHECK(m_hitFilteringTool->DoHitFiltering(*m_logicEventHeader_1st, filter_pixel_physLayers, filter_strip_physLayers, m_clusters_1st)); @@ -405,8 +405,8 @@ StatusCode HTTLogicalHitsProcessAlg::processInputs() } -StatusCode HTTLogicalHitsProcessAlg::secondStageProcessing(std::vector<HTTTrack> const & tracks_1st, - std::vector<HTTRoad*> & roads_2nd, std::vector<HTTTrack> & tracks_2nd) +StatusCode FPGATrackSimLogicalHitsProcessAlg::secondStageProcessing(std::vector<FPGATrackSimTrack> const & tracks_1st, + std::vector<FPGATrackSimRoad*> & roads_2nd, std::vector<FPGATrackSimTrack> & tracks_2nd) { m_clusters_2nd.clear(); m_spacepoints_2nd.clear(); @@ -422,15 +422,15 @@ StatusCode HTTLogicalHitsProcessAlg::secondStageProcessing(std::vector<HTTTrack> // Space points if (m_doSpacepoints) ATH_CHECK(m_spacepointsTool->DoSpacePoints(*m_logicEventHeader_2nd, m_spacepoints_2nd)); - std::vector<HTTHit> const & hits_2nd = m_logicEventHeader_2nd->towers().at(0).hits(); + std::vector<FPGATrackSimHit> const & hits_2nd = m_logicEventHeader_2nd->towers().at(0).hits(); ATH_MSG_DEBUG("Number of second stage hits = " << hits_2nd.size()); - std::vector<const HTTHit*> phits_2nd; - for (HTTHit const & h : hits_2nd) phits_2nd.push_back(&h); + std::vector<const FPGATrackSimHit*> phits_2nd; + for (FPGATrackSimHit const & h : hits_2nd) phits_2nd.push_back(&h); // Get the first stage tracks after OR - std::vector<HTTTrack> tracks_1st_OR; + std::vector<FPGATrackSimTrack> tracks_1st_OR; for (auto track : tracks_1st) { if (track.passedOR() == 1) tracks_1st_OR.push_back(track); } @@ -448,28 +448,28 @@ StatusCode HTTLogicalHitsProcessAlg::secondStageProcessing(std::vector<HTTTrack> return StatusCode::SUCCESS; } -StatusCode HTTLogicalHitsProcessAlg::writeOutputData(std::vector<HTTRoad*> const & roads_1st, std::vector<HTTTrack> const & tracks_1st, - std::vector<HTTRoad*> const & roads_2nd, std::vector<HTTTrack> const & tracks_2nd, - HTTDataFlowInfo const * dataFlowInfo) +StatusCode FPGATrackSimLogicalHitsProcessAlg::writeOutputData(std::vector<FPGATrackSimRoad*> const & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st, + std::vector<FPGATrackSimRoad*> const & roads_2nd, std::vector<FPGATrackSimTrack> const & tracks_2nd, + FPGATrackSimDataFlowInfo const * dataFlowInfo) { m_logicEventOutputHeader->reset(); - ATH_MSG_DEBUG("NHTTRoads_1st = " << roads_1st.size() << ", NHTTTracks_1st = " << tracks_1st.size() << ", NHTTRoads_2nd = " << roads_2nd.size() << ", NHTTTracks_2nd = " << tracks_2nd.size()); + ATH_MSG_DEBUG("NFPGATrackSimRoads_1st = " << roads_1st.size() << ", NFPGATrackSimTracks_1st = " << tracks_1st.size() << ", NFPGATrackSimRoads_2nd = " << roads_2nd.size() << ", NFPGATrackSimTracks_2nd = " << tracks_2nd.size()); if (!m_writeOutputData) return StatusCode::SUCCESS; - m_logicEventOutputHeader->reserveHTTRoads_1st(roads_1st.size()); - m_logicEventOutputHeader->reserveHTTTracks_1st(tracks_1st.size()); + m_logicEventOutputHeader->reserveFPGATrackSimRoads_1st(roads_1st.size()); + m_logicEventOutputHeader->reserveFPGATrackSimTracks_1st(tracks_1st.size()); - m_logicEventOutputHeader->addHTTRoads_1st(roads_1st); - m_logicEventOutputHeader->addHTTTracks_1st(tracks_1st); + m_logicEventOutputHeader->addFPGATrackSimRoads_1st(roads_1st); + m_logicEventOutputHeader->addFPGATrackSimTracks_1st(tracks_1st); if (m_runSecondStage) { - m_logicEventOutputHeader->reserveHTTRoads_2nd(roads_2nd.size()); - m_logicEventOutputHeader->reserveHTTTracks_2nd(tracks_2nd.size()); + m_logicEventOutputHeader->reserveFPGATrackSimRoads_2nd(roads_2nd.size()); + m_logicEventOutputHeader->reserveFPGATrackSimTracks_2nd(tracks_2nd.size()); - m_logicEventOutputHeader->addHTTRoads_2nd(roads_2nd); - m_logicEventOutputHeader->addHTTTracks_2nd(tracks_2nd); + m_logicEventOutputHeader->addFPGATrackSimRoads_2nd(roads_2nd); + m_logicEventOutputHeader->addFPGATrackSimTracks_2nd(tracks_2nd); } m_logicEventOutputHeader->setDataFlowInfo(*dataFlowInfo); @@ -486,7 +486,7 @@ StatusCode HTTLogicalHitsProcessAlg::writeOutputData(std::vector<HTTRoad*> const /////////////////////////////////////////////////////////////////////////////// // Finalize -StatusCode HTTLogicalHitsProcessAlg::finalize() +StatusCode FPGATrackSimLogicalHitsProcessAlg::finalize() { #ifdef BENCHMARK_LOGICALHITSALG ATH_MSG_INFO("Timings:" << @@ -512,12 +512,12 @@ StatusCode HTTLogicalHitsProcessAlg::finalize() /////////////////////////////////////////////////////////////////////////////// // Helpers -void HTTLogicalHitsProcessAlg::printHitSubregions(std::vector<HTTHit> const & hits) +void FPGATrackSimLogicalHitsProcessAlg::printHitSubregions(std::vector<FPGATrackSimHit> const & hits) { ATH_MSG_WARNING("Hit regions:"); for (auto hit : hits) { - std::vector<uint32_t> regions = m_HTTMapping->SubRegionMap()->getRegions(hit); + std::vector<uint32_t> regions = m_FPGATrackSimMapping->SubRegionMap()->getRegions(hit); std::stringstream ss; for (auto r : regions) ss << r << ","; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..8dc69c7e5a7b27e3322084449e992b390dea9d2d --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.h @@ -0,0 +1,137 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSim_LOGICALHITSPROCESSALG_H +#define FPGATrackSim_LOGICALHITSPROCESSALG_H + +/* + * Please put a description on what this class does + */ + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" +#include "FPGATrackSimMaps/FPGATrackSimSpacePointsToolI.h" +#include "FPGATrackSimMaps/IFPGATrackSimHitFilteringTool.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimClusteringToolI.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" +#include "FPGATrackSimInput/FPGATrackSimReadRawRandomHitsTool.h" +#include "FPGATrackSimHough/FPGATrackSimHoughRootOutputTool.h" +#include "FPGATrackSimLRT/FPGATrackSimLLPRoadFilterTool.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" + +#include "AthenaMonitoringKernel/Monitored.h" + +#include <fstream> + +class FPGATrackSimDataFlowTool; +class FPGATrackSimHoughRootOutputTool; +class FPGATrackSimLLPRoadFilterTool; +class FPGATrackSimNNTrackTool; +class FPGATrackSimOverlapRemovalTool; +class FPGATrackSimTrackFitterTool; +class FPGATrackSimEtaPatternFilterTool; + +class FPGATrackSimCluster; +class FPGATrackSimHit; +class FPGATrackSimLogicalEventInputHeader; +class FPGATrackSimLogicalEventOutputHeader; +class FPGATrackSimRoad; +class FPGATrackSimTrack; +class FPGATrackSimDataFlowInfo; + + +class FPGATrackSimLogicalHitsProcessAlg : public AthAlgorithm +{ + public: + FPGATrackSimLogicalHitsProcessAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimLogicalHitsProcessAlg() = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + private: + + std::string m_description; + int m_ev = 0; + + // Handles + ToolHandle<IFPGATrackSimEventInputHeaderTool> m_hitInputTool {this, "InputTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimSGToRawHitsTool", "Input Tool"}; + ToolHandle<FPGATrackSimReadRawRandomHitsTool> m_hitInputTool2 {this, "InputTool2", "FPGATrackSimReadRawRandomHitsTool/FPGATrackSimReadRawRandomHitsTool", "Potential 2nd input Tool to load data from more than one source"}; + ToolHandle<FPGATrackSimRawToLogicalHitsTool> m_hitMapTool {this, "RawToLogicalHitsTool", "FPGATrackSim_RawToLogicalHitsTool/FPGATrackSim_RawToLogicalHitsTool", "Raw To Logical Tool"}; + ToolHandle<IFPGATrackSimHitFilteringTool> m_hitFilteringTool {this, "HitFilteringTool", "FPGATrackSimHitFilteringTool/FPGATrackSimHitFilteringTool", "Hit Filtering Tool"}; + ToolHandle<FPGATrackSimClusteringToolI> m_clusteringTool {this, "ClusteringTool", "FPGATrackSimClusteringTool/FPGATrackSimClusteringTool", "Hit Clustering Tool"}; + ToolHandle<FPGATrackSimSpacePointsToolI> m_spacepointsTool {this, "SpacePointTool", "FPGATrackSimSpacePointsTool/FPGATrackSimSpacePointsTool", "Space Points Tool"}; + ToolHandle<IFPGATrackSimRoadFinderTool> m_roadFinderTool {this, "RoadFinder", "FPGATrackSimPatternMatchTool", "Road Finder Tool"}; + ToolHandle<FPGATrackSimLLPRoadFilterTool> m_LRTRoadFilterTool {this, "LRTRoadFilter", "FPGATrackSimLLPRoadFilterTool/FPGATrackSimLLPRoadFilterTool", "LRT Road Filter Tool"}; + ToolHandle<IFPGATrackSimRoadFinderTool> m_LRTRoadFinderTool {this, "LRTRoadFinder", "FPGATrackSimHoughTransform_d0phi0_Tool/FPGATrackSimHoughTransform_d0phi0_Tool", "LRT Road Finder Tool"}; + ToolHandle<IFPGATrackSimRoadFilterTool> m_roadFilterTool {this, "RoadFilter", "FPGATrackSimEtaPatternFilterTool", "Road Filter Tool"}; + ToolHandle<IFPGATrackSimRoadFilterTool> m_roadFilterTool2 {this, "RoadFilter2", "FPGATrackSimPhiRoadFilterTool", "Road Filter2 Tool"}; + ToolHandle<FPGATrackSimNNTrackTool> m_NNTrackTool {this, "NNTrackTool", "FPGATrackSimNNTrackTool/FPGATrackSimNNTrackTool", "NN Track Tool"}; + ToolHandle<FPGATrackSimHoughRootOutputTool> m_houghRootOutputTool {this, "HoughRootOutputTool", "FPGATrackSimHoughRootOutputTool/FPGATrackSimHoughRootOutputTool", "Hough ROOT Output Tool"}; + ToolHandle<FPGATrackSimTrackFitterTool> m_trackFitterTool_1st {this, "TrackFitter_1st", "FPGATrackSimTrackFitterTool/FPGATrackSimTrackFitterTool_1st", "1st stage track fit tool"}; + ToolHandle<FPGATrackSimTrackFitterTool> m_trackFitterTool_2nd {this, "TrackFitter_2nd", "FPGATrackSimTrackFitterTool/FPGATrackSimTrackFitterTool_2nd", "2nd stage track fit tool"}; + ToolHandle<FPGATrackSimOverlapRemovalTool> m_overlapRemovalTool_1st {this, "OverlapRemoval_1st", "FPGATrackSimOverlapRemovalTool/FPGATrackSimOverlapRemovalTool_1st", "1st stage overlap removal tool"}; + ToolHandle<FPGATrackSimOverlapRemovalTool> m_overlapRemovalTool_2nd {this, "OverlapRemoval_2nd", "FPGATrackSimOverlapRemovalTool/FPGATrackSimOverlapRemovalTool_2nd", "2nd stage overlap removal tool"}; + ToolHandle<FPGATrackSimDataFlowTool> m_dataFlowTool {this, "DataFlowTool", "FPGATrackSimDataFlowTool/FPGATrackSimDataFlowTool", "Data Flow Tool"}; + ToolHandle<IFPGATrackSimEventOutputHeaderTool> m_writeOutputTool {this, "OutputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool", "Output tool"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMapping", "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_evtSel {this, "eventSelector", "FPGATrackSimEventSelectionSvc", "Event selection Svc"}; + + // Flags + Gaudi::Property<int> m_firstInputToolN {this, "FirstInputToolN", 1, "number of times to use event from first input tool"}; + Gaudi::Property<int> m_secondInputToolN {this, "SecondInputToolN", 0, "number of times to use event from second input tool"}; + Gaudi::Property<bool> m_doHitFiltering {this, "HitFiltering", false, "flag to enable hit/cluster filtering"}; + Gaudi::Property<bool> m_clustering {this, "Clustering", false, "flag to enable the clustering"}; + Gaudi::Property<bool> m_doSpacepoints {this, "Spacepoints", false, "flag to enable the spacepoint formation"}; + Gaudi::Property<bool> m_doTracking {this, "tracking", false, "flag to enable the tracking"}; + Gaudi::Property<bool> m_doMissingHitsChecks {this, "DoMissingHitsChecks", false}; + Gaudi::Property<bool> m_filterRoads {this, "FilterRoads", false, "enable first road filter"}; + Gaudi::Property<bool> m_filterRoads2 {this, "FilterRoads2", false, "enable second road filter"}; + Gaudi::Property<bool> m_runSecondStage {this, "RunSecondStage", false, "flag to enable running the second stage fitting"}; + Gaudi::Property<bool> m_doHoughRootOutput {this, "DoHoughRootOutput", false, "Dump output from the Hough Transform to flat ntuples"}; + Gaudi::Property<bool> m_doNNTrack {this, "DoNNTrack", false, "Run NN track filtering"}; + Gaudi::Property<bool> m_doLRT {this, "doLRT", false, "Enable Large Radious Tracking"}; + Gaudi::Property<bool> m_doLRTHitFiltering {this, "LRTHitFiltering", false, "flag to enable hit/cluster filtering for LRT"}; + Gaudi::Property<bool> m_writeOutputData {this, "writeOutputData", true,"write the output TTree"}; + Gaudi::Property<bool> m_outputHitTxt {this, "outputHitTxt", false, "write out road hits to text file"}; + + std::string m_outputHitTxtName = "outputRoadHits.txt"; + std::ofstream m_outputHitTxtStream; + + // ROOT pointers + FPGATrackSimEventInputHeader m_eventHeader; + FPGATrackSimEventInputHeader m_firstInputHeader; + FPGATrackSimLogicalEventInputHeader* m_logicEventHeader_1st = nullptr; + FPGATrackSimLogicalEventInputHeader* m_logicEventHeader_2nd = nullptr; + FPGATrackSimLogicalEventOutputHeader* m_logicEventOutputHeader = nullptr; + + // Event storage + std::vector<FPGATrackSimCluster> m_clusters_1st, m_clusters_1st_original, m_clusters_2nd; + std::vector<FPGATrackSimCluster> m_spacepoints_1st, m_spacepoints_2nd; + std::vector<FPGATrackSimHit> m_hits_1st_miss, m_hits_2nd_miss; + std::vector<FPGATrackSimTrack> m_tracks_1st_guessedcheck, m_tracks_1st_nomiss, m_tracks_2nd_guessedcheck, m_tracks_2nd_nomiss; + + + StatusCode readInputs(bool & done); + StatusCode processInputs(); + StatusCode secondStageProcessing(std::vector<FPGATrackSimTrack> const & tracks_1st, + std::vector<FPGATrackSimRoad*> & roads_2nd, std::vector<FPGATrackSimTrack> & tracks_2nd); + + + StatusCode writeOutputData(std::vector<FPGATrackSimRoad*> const & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st, + std::vector<FPGATrackSimRoad*> const & roads_2nd, std::vector<FPGATrackSimTrack> const & tracks_2nd, + FPGATrackSimDataFlowInfo const * dataFlowInfo); + + void printHitSubregions(std::vector<FPGATrackSimHit> const & hits); + + ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"}; +}; + +#endif // FPGATrackSimLOGICALHITSTOALGORITHMS_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTMapMakerAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimMapMakerAlg.cxx similarity index 94% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTMapMakerAlg.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimMapMakerAlg.cxx index c394033e86c5c49ebe001c126975d95483d8f465..0b38e2052a1c14a6ff5d3745e532f27a646123a1 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTMapMakerAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimMapMakerAlg.cxx @@ -1,8 +1,8 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "HTTMapMakerAlg.h" +#include "FPGATrackSimMapMakerAlg.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" #include "TH2.h" #include "GaudiKernel/IEventProcessor.h" @@ -11,14 +11,14 @@ /////////////////////////////////////////////////////////////////////////////// // Initialize -HTTMapMakerAlg::HTTMapMakerAlg (const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimMapMakerAlg::FPGATrackSimMapMakerAlg (const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_monitorFile((m_outFileName.value() + ".root").c_str(), "RECREATE") { } -StatusCode HTTMapMakerAlg::initialize() +StatusCode FPGATrackSimMapMakerAlg::initialize() { std::stringstream ss(m_description); std::string line; @@ -46,7 +46,7 @@ StatusCode HTTMapMakerAlg::initialize() // MAIN EXECUTE ROUTINE // /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMapMakerAlg::execute() +StatusCode FPGATrackSimMapMakerAlg::execute() { // Read inputs bool done = false; @@ -74,7 +74,7 @@ StatusCode HTTMapMakerAlg::execute() /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMapMakerAlg::readInputs(bool & done) +StatusCode FPGATrackSimMapMakerAlg::readInputs(bool & done) { // Read primary input ATH_CHECK(m_hitInputTool->readData(&m_eventHeader, done)); @@ -84,7 +84,7 @@ StatusCode HTTMapMakerAlg::readInputs(bool & done) return StatusCode::SUCCESS; // end of loop over events } - HTTEventInfo eventinfo = m_eventHeader.event(); + FPGATrackSimEventInfo eventinfo = m_eventHeader.event(); ATH_MSG_DEBUG ("Getting Event " << eventinfo); for (auto hit: m_eventHeader.hits()) // fill track to modules map and hit vectors @@ -95,7 +95,7 @@ StatusCode HTTMapMakerAlg::readInputs(bool & done) SiliconTech det = hit.getDetType(); DetectorZone bec = hit.getDetectorZone(); int lyr = hit.getPhysLayer(); - int eta = hit.getHTTEtaModule(); + int eta = hit.getFPGATrackSimEtaModule(); int phi = hit.getPhiModule(); if (hit.isPixel() && hit.isBarrel()) { @@ -103,8 +103,8 @@ StatusCode HTTMapMakerAlg::readInputs(bool & done) if (lyr > m_pbmax) m_pbmax = lyr; } else if (hit.isPixel() && !hit.isBarrel()) { - int HTTlayer = eta + m_diskIndex[lyr]; - hit.setPhysLayer(HTTlayer); + int FPGATrackSimlayer = eta + m_diskIndex[lyr]; + hit.setPhysLayer(FPGATrackSimlayer); lyr = hit.getPhysLayer(); m_peHits.push_back(hit); if (bec == DetectorZone::posEndcap && lyr > m_pemax[0]) m_pemax[0] = lyr; @@ -141,7 +141,7 @@ StatusCode HTTMapMakerAlg::readInputs(bool & done) /////////////////////////////////////////////////////////////////////////////// // OUTPUT WRITING AND MONITORING // /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMapMakerAlg::writePmapAndRmap(std::vector<HTTHit> const & pbHits, std::vector<HTTHit> const & peHits, std::vector<HTTHit> const & sbHits, std::vector<HTTHit> const & seHits, int reg) +StatusCode FPGATrackSimMapMakerAlg::writePmapAndRmap(std::vector<FPGATrackSimHit> const & pbHits, std::vector<FPGATrackSimHit> const & peHits, std::vector<FPGATrackSimHit> const & sbHits, std::vector<FPGATrackSimHit> const & seHits, int reg) { // Plane Map @@ -215,7 +215,7 @@ StatusCode HTTMapMakerAlg::writePmapAndRmap(std::vector<HTTHit> const & pbHits, return StatusCode::SUCCESS; } -StatusCode HTTMapMakerAlg::writeSubrmap(std::vector<HTTHit> const & allHits) +StatusCode FPGATrackSimMapMakerAlg::writeSubrmap(std::vector<FPGATrackSimHit> const & allHits) { /* ---------- Create z-slices ---------- */ @@ -321,7 +321,7 @@ StatusCode HTTMapMakerAlg::writeSubrmap(std::vector<HTTHit> const & allHits) if (m_usedTracks.find(hit.getEventIndex()) != m_usedTracks.end()) continue; // skip if already done a hit from this track if (isOnKeyLayer(1,hit.getDetType(),hit.getDetectorZone(), hit.getPhysLayer())) { // if hit is in key layer, add it's barcode to the map - int s = keymod2slice[hit.getHTTEtaModule()]; + int s = keymod2slice[hit.getFPGATrackSimEtaModule()]; m_track2slice[hit.getEventIndex()] = s; m_usedTracks.insert(hit.getEventIndex()); } @@ -402,7 +402,7 @@ StatusCode HTTMapMakerAlg::writeSubrmap(std::vector<HTTHit> const & allHits) return StatusCode::SUCCESS; } -StatusCode HTTMapMakerAlg::writeEtaPatterns() +StatusCode FPGATrackSimMapMakerAlg::writeEtaPatterns() { std::stringstream trim; trim << std::fixed << std::setprecision(3) << m_trim; @@ -453,7 +453,7 @@ StatusCode HTTMapMakerAlg::writeEtaPatterns() return StatusCode::SUCCESS; } -StatusCode HTTMapMakerAlg::writeRadiiFile(std::vector<HTTHit> const & allHits) +StatusCode FPGATrackSimMapMakerAlg::writeRadiiFile(std::vector<FPGATrackSimHit> const & allHits) { // calculate mean radii m_radii.resize(m_nSlices, std::vector<std::vector<float>>(m_planes[m_region].size(),std::vector<float>(0))); @@ -496,7 +496,7 @@ StatusCode HTTMapMakerAlg::writeRadiiFile(std::vector<HTTHit> const & allHits) return StatusCode::SUCCESS; } -StatusCode HTTMapMakerAlg::writeMedianZFile(std::vector<HTTHit> const & allHits) +StatusCode FPGATrackSimMapMakerAlg::writeMedianZFile(std::vector<FPGATrackSimHit> const & allHits) { // calculate median z m_z.resize(m_nSlices, std::vector<std::vector<float>>(m_planes[m_region].size(),std::vector<float>(0))); @@ -542,7 +542,7 @@ StatusCode HTTMapMakerAlg::writeMedianZFile(std::vector<HTTHit> const & allHits) } /////////////////////////////////////////////////////////////////////////////// // Finalize -StatusCode HTTMapMakerAlg::finalize() +StatusCode FPGATrackSimMapMakerAlg::finalize() { // Write the output ATH_CHECK(writePmapAndRmap(m_pbHits, m_peHits, m_sbHits, m_seHits, m_region)); @@ -557,7 +557,7 @@ StatusCode HTTMapMakerAlg::finalize() /////////////////////////////////////////////////////////////////////////////// // Helpers -void HTTMapMakerAlg::drawSlices(std::vector<HTTHit> const & allHits) +void FPGATrackSimMapMakerAlg::drawSlices(std::vector<FPGATrackSimHit> const & allHits) { m_monitorFile.cd(); @@ -584,7 +584,7 @@ void HTTMapMakerAlg::drawSlices(std::vector<HTTHit> const & allHits) delete [] hname; } -bool HTTMapMakerAlg::isOnKeyLayer(int keynum, SiliconTech t_det, DetectorZone t_bec, int lyr) +bool FPGATrackSimMapMakerAlg::isOnKeyLayer(int keynum, SiliconTech t_det, DetectorZone t_bec, int lyr) { int det = static_cast<int>(t_det); int bec = static_cast<int>(t_bec); @@ -599,7 +599,7 @@ bool HTTMapMakerAlg::isOnKeyLayer(int keynum, SiliconTech t_det, DetectorZone t_ return false; } -int HTTMapMakerAlg::findPlane(const std::vector<std::vector<std::string>>& planes, const std::string& test) // find what plane a layer is assigned to. +int FPGATrackSimMapMakerAlg::findPlane(const std::vector<std::vector<std::string>>& planes, const std::string& test) // find what plane a layer is assigned to. { int pcounter = 0; for (auto& plane : planes) { @@ -611,7 +611,7 @@ int HTTMapMakerAlg::findPlane(const std::vector<std::vector<std::string>>& plane return -1; } -std::string HTTMapMakerAlg::makeRmapLines(std::vector<HTTHit> const & hits, SiliconTech det, DetectorZone bec, int max) +std::string FPGATrackSimMapMakerAlg::makeRmapLines(std::vector<FPGATrackSimHit> const & hits, SiliconTech det, DetectorZone bec, int max) { std::stringstream rmap_line; std::set<int> etas, phis; @@ -624,7 +624,7 @@ std::string HTTMapMakerAlg::makeRmapLines(std::vector<HTTHit> const & hits, Sili { if(static_cast<int>(hit.getPhysLayer()) == lyr && hit.getDetectorZone() == bec) // cast from uint to int just to remove Wsign-compare warnings { - etas.insert(hit.getHTTEtaModule()); + etas.insert(hit.getFPGATrackSimEtaModule()); phis.insert(hit.getPhiModule()); } } @@ -636,7 +636,7 @@ std::string HTTMapMakerAlg::makeRmapLines(std::vector<HTTHit> const & hits, Sili return rmap_line.str(); } -void HTTMapMakerAlg::parseKeyString() +void FPGATrackSimMapMakerAlg::parseKeyString() { // Parse keystring and define the Key Layer std::string delimiter = ","; @@ -730,7 +730,7 @@ void HTTMapMakerAlg::parseKeyString() } } -std::string HTTMapMakerAlg::makeSubrmapLines(std::vector<Module> const & allmods, SiliconTech det, DetectorZone bec, int max) +std::string FPGATrackSimMapMakerAlg::makeSubrmapLines(std::vector<Module> const & allmods, SiliconTech det, DetectorZone bec, int max) { std::stringstream subrmap_line; std::set<int> etas, phis; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTMapMakerAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimMapMakerAlg.h similarity index 84% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTMapMakerAlg.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimMapMakerAlg.h index 3f852fbbaf17e795d8b07c0b40a28f4d1d4504ca..2ddb74e573e4b5d9a6dd899e4725d5d633b81311 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTMapMakerAlg.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimMapMakerAlg.h @@ -1,7 +1,7 @@ // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTT_MAPMAKERALG_H -#define HTT_MAPMAKERALG_H +#ifndef FPGATrackSim_MAPMAKERALG_H +#define FPGATrackSim_MAPMAKERALG_H /* * Produce Map files from wrappers. @@ -11,16 +11,16 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "TFile.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" -class IHTTEventInputHeaderTool; -class HTTHit; +class IFPGATrackSimEventInputHeaderTool; +class FPGATrackSimHit; -class HTTMapMakerAlg : public AthAlgorithm { +class FPGATrackSimMapMakerAlg : public AthAlgorithm { public: - HTTMapMakerAlg(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTMapMakerAlg() = default; + FPGATrackSimMapMakerAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimMapMakerAlg() = default; virtual StatusCode initialize() override; virtual StatusCode execute() override; @@ -28,10 +28,10 @@ class HTTMapMakerAlg : public AthAlgorithm { private: // Handles - ToolHandle<IHTTEventInputHeaderTool> m_hitInputTool{ - this, "InputTool", "HTTSGToRawHitsTool/HTTSGToRawHitsTool"}; + ToolHandle<IFPGATrackSimEventInputHeaderTool> m_hitInputTool{ + this, "InputTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimSGToRawHitsTool"}; - HTTEventInputHeader m_eventHeader; + FPGATrackSimEventInputHeader m_eventHeader; Gaudi::Property<std::string> m_description{this, "description", "", "tag description"}; Gaudi::Property<std::string> m_outFileName{ @@ -75,7 +75,7 @@ class HTTMapMakerAlg : public AthAlgorithm { std::map<int, int> m_track2slice; // Event storage - std::vector<HTTHit> m_pbHits, m_peHits, m_sbHits, m_seHits, m_allHits; + std::vector<FPGATrackSimHit> m_pbHits, m_peHits, m_sbHits, m_seHits, m_allHits; int m_pbmax = -1; // pixel barrel largest layer index int m_sbmax = -1; @@ -246,25 +246,25 @@ class HTTMapMakerAlg : public AthAlgorithm { // 8, 9] --> [0,17,47,58,66] StatusCode readInputs(bool& done); - StatusCode writePmapAndRmap(std::vector<HTTHit> const& pbHits, - std::vector<HTTHit> const& peHits, - std::vector<HTTHit> const& sbHits, - std::vector<HTTHit> const& seHits, int region); - StatusCode writeSubrmap(std::vector<HTTHit> const& allHits); + StatusCode writePmapAndRmap(std::vector<FPGATrackSimHit> const& pbHits, + std::vector<FPGATrackSimHit> const& peHits, + std::vector<FPGATrackSimHit> const& sbHits, + std::vector<FPGATrackSimHit> const& seHits, int region); + StatusCode writeSubrmap(std::vector<FPGATrackSimHit> const& allHits); StatusCode - writeEtaPatterns(); // writes txt file used in the HTTEtaPatternFilterTool to + writeEtaPatterns(); // writes txt file used in the FPGATrackSimEtaPatternFilterTool to // filter roads based on eta module StatusCode writeRadiiFile( - std::vector<HTTHit> const& + std::vector<FPGATrackSimHit> const& allHits); // writes txt file with mean radii per layer for each // slice, used in 1D Hough Transform StatusCode writeMedianZFile( - std::vector<HTTHit> const& + std::vector<FPGATrackSimHit> const& allHits); // writes txt file with median z per layer for each slice, // used in 1D Hough Transform // Helpers - void drawSlices(std::vector<HTTHit> const& allHits); + void drawSlices(std::vector<FPGATrackSimHit> const& allHits); std::map<std::string, SiliconTech> m_det2tech = { {"pixel", SiliconTech::pixel}, {"strip", SiliconTech::strip}}; // for parsing KeyString @@ -278,7 +278,7 @@ class HTTMapMakerAlg : public AthAlgorithm { // or 2 for the first or second keylayer (if using 2D slicing) int findPlane(const std::vector<std::vector<std::string>>& planes, const std::string& test); - std::string makeRmapLines(std::vector<HTTHit> const& hits, SiliconTech det, + std::string makeRmapLines(std::vector<FPGATrackSimHit> const& hits, SiliconTech det, DetectorZone bec, int max); std::string makeSubrmapLines(std::vector<Module> const& allmods, SiliconTech det, DetectorZone bec, int max); @@ -286,4 +286,4 @@ class HTTMapMakerAlg : public AthAlgorithm { // Keystring and Keystring2 run args }; -#endif // HTTMAPMAKERALG_h +#endif // FPGATrackSimMAPMAKERALG_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTNNTrackTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimNNTrackTool.cxx similarity index 75% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTNNTrackTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimNNTrackTool.cxx index 06bb5bac1531fd638609fe04913ebb61ffbe9992..7d2955bda5fc99196c933f1e1daf5e7e6524a0bb 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTNNTrackTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimNNTrackTool.cxx @@ -1,45 +1,45 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** - * @file HTTNNTrackTool.cxx + * @file FPGATrackSimNNTrackTool.cxx * @author Elliott Cheu * @date April 28, 2021 * @brief Does NN tracking * * Uses lwtnn to calculate an NN score for a set of hits from a track. This is - * then stored in an HTTTrack object + * then stored in an FPGATrackSimTrack object */ -#include "HTTNNTrackTool.h" -#include "TrigHTTMaps/HTTNNMap.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTObjects/HTTFunctions.h" -#include "TrigHTTObjects/HTTMultiTruth.h" +#include "FPGATrackSimNNTrackTool.h" +#include "FPGATrackSimMaps/FPGATrackSimNNMap.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimFunctions.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" ///////////////////////////////////////////////////////////////////////////// -HTTNNTrackTool::HTTNNTrackTool(const std::string &algname, +FPGATrackSimNNTrackTool::FPGATrackSimNNTrackTool(const std::string &algname, const std::string &name, const IInterface *ifc) : AthAlgTool(algname, name, ifc) {} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTNNTrackTool::initialize() { - ATH_CHECK(m_HTTMapping.retrieve()); +StatusCode FPGATrackSimNNTrackTool::initialize() { + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_tHistSvc.retrieve()); return StatusCode::SUCCESS; } -StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, - std::vector<HTTTrack> &tracks, - const HTTNNMap *nnMap) { +StatusCode FPGATrackSimNNTrackTool::getTracks(std::vector<FPGATrackSimRoad *> &roads, + std::vector<FPGATrackSimTrack> &tracks, + const FPGATrackSimNNMap *nnMap) { int n_track = 0; // Loop over roads for (auto iroad : roads) { - HTTRoad_Hough *hough_road = dynamic_cast<HTTRoad_Hough *>(iroad); + FPGATrackSimRoad_Hough *hough_road = dynamic_cast<FPGATrackSimRoad_Hough *>(iroad); double y = 0; if (hough_road != nullptr) { y = hough_road->getY(); @@ -57,11 +57,11 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, layer_bitmask_t missing_mask = 0; // Just used to get number of layers considered - const HTTPlaneMap *planeMap = m_HTTMapping->PlaneMap_1st(); + const FPGATrackSimPlaneMap *planeMap = m_FPGATrackSimMapping->PlaneMap_1st(); // Create a template track with common parameters filled already for // initializing below - HTTTrack temp; + FPGATrackSimTrack temp; temp.setTrackStage(TrackStage::FIRST); temp.setNLayers(planeMap->getNLogiLayers()); temp.setBankID(-1); @@ -82,7 +82,7 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, // list of indices for this particular combination std::vector<int> const &hit_indices = combs[icomb]; - std::vector<const HTTHit *> hit_list; + std::vector<const FPGATrackSimHit *> hit_list; // Loop over all layers for (unsigned layer = 0; layer < planeMap->getNLogiLayers(); layer++) { @@ -90,7 +90,7 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, // Check to see if this is a valid hit if (hit_indices[layer] >= 0) { - const HTTHit *hit = iroad->getHits(layer)[hit_indices[layer]]; + const FPGATrackSimHit *hit = iroad->getHits(layer)[hit_indices[layer]]; // Add this hit to the road hit_list.push_back(hit); } @@ -98,7 +98,7 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, // Sort the list by radial distance std::sort(hit_list.begin(), hit_list.end(), - [](const HTTHit *hit1, const HTTHit *hit2) { + [](const FPGATrackSimHit *hit1, const FPGATrackSimHit *hit2) { double rho1 = std::hypot(hit1->getX(), hit1->getY()); double rho2 = std::hypot(hit2->getX(), hit2->getY()); return rho1 < rho2; @@ -160,12 +160,12 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, // This is a track. Fill class and add to track list n_track++; - HTTTrack track_cand; + FPGATrackSimTrack track_cand; track_cand.setTrackID(n_track); track_cand.setNLayers(planeMap->getNLogiLayers()); for (const auto &ihit : hit_list) { unsigned int layer = ihit->getLayer(); - track_cand.setHTTHit(layer, *ihit); + track_cand.setFPGATrackSimHit(layer, *ihit); } // Nominal chi2ndof cut is 40 and we want to use NN>0.0075 (or // NN<(1-0.0075) Nominal chi2ndof cut is 40 and we want to use NN>0.001 @@ -182,7 +182,7 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, } // loop over roads // Add truth info - for (HTTTrack &t : tracks) + for (FPGATrackSimTrack &t : tracks) compute_truth(t); // match the track to a geant particle using the // channel-level geant info in the hit data. @@ -190,29 +190,29 @@ StatusCode HTTNNTrackTool::getTracks(std::vector<HTTRoad *> &roads, } // Borrowed same code from TrackFitter - probably a nicer way to inherit instead -void HTTNNTrackTool::compute_truth(HTTTrack &t) const { - std::vector<HTTMultiTruth> mtv; - const HTTPlaneMap *planeMap = m_HTTMapping->PlaneMap_1st(); +void FPGATrackSimNNTrackTool::compute_truth(FPGATrackSimTrack &t) const { + std::vector<FPGATrackSimMultiTruth> mtv; + const FPGATrackSimPlaneMap *planeMap = m_FPGATrackSimMapping->PlaneMap_1st(); for (unsigned layer = 0; layer < planeMap->getNLogiLayers(); layer++) { if (t.getHitMap() & (1 << planeMap->getCoordOffset(layer))) continue; // no hit in this plane // Sanity check that we have enough hits. - if (layer < t.getHTTHits().size()) - mtv.push_back(t.getHTTHits().at(layer).getTruth()); + if (layer < t.getFPGATrackSimHits().size()) + mtv.push_back(t.getFPGATrackSimHits().at(layer).getTruth()); // adjust weight for hits without (and also with) a truth match, so that // each is counted with the same weight. mtv.back().assign_equal_normalization(); } - HTTMultiTruth mt(std::accumulate(mtv.begin(), mtv.end(), HTTMultiTruth(), - HTTMultiTruth::AddAccumulator())); + FPGATrackSimMultiTruth mt(std::accumulate(mtv.begin(), mtv.end(), FPGATrackSimMultiTruth(), + FPGATrackSimMultiTruth::AddAccumulator())); // frac is then the fraction of the total number of hits on the track // attributed to the barcode. - HTTMultiTruth::Barcode tbarcode; - HTTMultiTruth::Weight tfrac; + FPGATrackSimMultiTruth::Barcode tbarcode; + FPGATrackSimMultiTruth::Weight tfrac; const bool ok = mt.best(tbarcode, tfrac); if (ok) { t.setEventIndex(tbarcode.first); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTNNTrackTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimNNTrackTool.h similarity index 66% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTNNTrackTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimNNTrackTool.h index eb2f95c26b72ab26aa12eb3f406c4fb41002568d..bc48f805f416eae0ed089b96ca0918e99ce9918d 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTNNTrackTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimNNTrackTool.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTNNTRACKTOOL_H -#define HTTNNTRACKTOOL_H +#ifndef FPGATrackSimNNTRACKTOOL_H +#define FPGATrackSimNNTRACKTOOL_H /** - * @file HTTNNTrackTool.h + * @file FPGATrackSimNNTrackTool.h * @author Elliott Cheu * @date April 27 2021 * @brief Utilize NN score to build track candidates @@ -14,37 +14,37 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTMultiTruth.h" -#include "TrigHTTObjects/HTTTruthTrack.h" -#include "TrigHTTBanks/HTTSectorBank.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorBank.h" #include "GaudiKernel/ITHistSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include "lwtnn/LightweightGraph.hh" #include "lwtnn/parse_json.hh" -class ITrigHTTMappingSvc; +class IFPGATrackSimMappingSvc; -class HTTNNTrackTool : public AthAlgTool +class FPGATrackSimNNTrackTool : public AthAlgTool { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTNNTrackTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimNNTrackTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; - StatusCode getTracks(std::vector<HTTRoad*> &roads, std::vector<HTTTrack> &tracks, - const HTTNNMap *nnMap); + StatusCode getTracks(std::vector<FPGATrackSimRoad*> &roads, std::vector<FPGATrackSimTrack> &tracks, + const FPGATrackSimNNMap *nnMap); static float getXScale() { return 1015;}; static float getYScale() { return 1015;}; @@ -58,7 +58,7 @@ class HTTNNTrackTool : public AthAlgTool private: - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping{this, "TrigHTTMappingSvc","TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this, "FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; ServiceHandle<ITHistSvc> m_tHistSvc{this, "THistSvc","THistSvc"}; std::vector<float> m_x; // x position of hit in road @@ -92,9 +92,9 @@ class HTTNNTrackTool : public AthAlgTool std::vector<int64_t> m_input_node_dims; std::vector<const char*> m_output_node_names; - void compute_truth(HTTTrack & newtrk) const; + void compute_truth(FPGATrackSimTrack & newtrk) const; }; -#endif // HTTNNTRACKTOOL_H +#endif // FPGATrackSimNNTRACKTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTOverlapRemovalTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimOverlapRemovalTool.cxx similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTOverlapRemovalTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimOverlapRemovalTool.cxx index c59809b0fba26b0ab2fdbc2b0d45a6888fcf4000..8f7464ac0aa1df1dbb77c0c949922e100ec5775f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTOverlapRemovalTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimOverlapRemovalTool.cxx @@ -1,8 +1,8 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "HTTOverlapRemovalTool.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTObjects/HTTVectors.h" +#include "FPGATrackSimOverlapRemovalTool.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" #include "GaudiKernel/MsgStream.h" @@ -11,22 +11,22 @@ #include <fstream> ///////////////////////////////////////////////////////////////////////////// -HTTOverlapRemovalTool::HTTOverlapRemovalTool(const std::string& algname, const std::string& name, const IInterface *ifc) : +FPGATrackSimOverlapRemovalTool::FPGATrackSimOverlapRemovalTool(const std::string& algname, const std::string& name, const IInterface *ifc) : AthAlgTool(algname, name, ifc) { } -StatusCode HTTOverlapRemovalTool::initialize() +StatusCode FPGATrackSimOverlapRemovalTool::initialize() { - ATH_MSG_INFO( "HTTOverlapRemovalTool::initialize()" ); + ATH_MSG_INFO( "FPGATrackSimOverlapRemovalTool::initialize()" ); // Check if this is 2nd stage if(m_do2ndStage) { - m_totLayers = m_HTTMapping->PlaneMap_2nd()->getNLogiLayers();; + m_totLayers = m_FPGATrackSimMapping->PlaneMap_2nd()->getNLogiLayers();; } else { - m_totLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers();; + m_totLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers();; } ATH_MSG_DEBUG("Total number of layer: " << m_totLayers); @@ -48,7 +48,7 @@ StatusCode HTTOverlapRemovalTool::initialize() return StatusCode::SUCCESS; } -bool isLocalMax(vector2D<HTTRoad*> const & acc, unsigned x, unsigned y, int localMaxWindowSize) +bool isLocalMax(vector2D<FPGATrackSimRoad*> const & acc, unsigned x, unsigned y, int localMaxWindowSize) { if (!acc(y, x)) return false; @@ -71,23 +71,23 @@ bool isLocalMax(vector2D<HTTRoad*> const & acc, unsigned x, unsigned y, int loca return true; } -StatusCode HTTOverlapRemovalTool::runOverlapRemoval(std::vector<HTTRoad*>& roads) +StatusCode FPGATrackSimOverlapRemovalTool::runOverlapRemoval(std::vector<FPGATrackSimRoad*>& roads) { if (roads.empty()) return StatusCode::SUCCESS; - if (!dynamic_cast<HTTRoad_Hough*>(roads.front())) return StatusCode::SUCCESS; + if (!dynamic_cast<FPGATrackSimRoad_Hough*>(roads.front())) return StatusCode::SUCCESS; if (!m_roadSliceOR) return StatusCode::SUCCESS; size_t in = roads.size(); // Hough image - vector2D<HTTRoad*> acc(m_imageSize_y, m_imageSize_x); + vector2D<FPGATrackSimRoad*> acc(m_imageSize_y, m_imageSize_x); // Slice-wise duplicate removal: accept only one road (with most hits) per bin - for (HTTRoad* r: roads) + for (FPGATrackSimRoad* r: roads) { - HTTRoad_Hough* hough = dynamic_cast<HTTRoad_Hough*>(r); + FPGATrackSimRoad_Hough* hough = dynamic_cast<FPGATrackSimRoad_Hough*>(r); if (!hough) return StatusCode::FAILURE; // mixed hough non-hough roads not allowed! - HTTRoad* & old = acc(hough->getYBin(), hough->getXBin()); + FPGATrackSimRoad* & old = acc(hough->getYBin(), hough->getXBin()); if (!old) old = r; else if (r->getNHitLayers() > old->getNHitLayers()) old = r; else if (r->getNHitLayers() == old->getNHitLayers() && r->getNHits() > old->getNHits()) old = r; @@ -111,7 +111,7 @@ StatusCode HTTOverlapRemovalTool::runOverlapRemoval(std::vector<HTTRoad*>& roads return StatusCode::SUCCESS; } -StatusCode HTTOverlapRemovalTool::runOverlapRemoval(std::vector<HTTTrack>& tracks) +StatusCode FPGATrackSimOverlapRemovalTool::runOverlapRemoval(std::vector<FPGATrackSimTrack>& tracks) { // Do fast OR instead of requested @@ -121,7 +121,7 @@ StatusCode HTTOverlapRemovalTool::runOverlapRemoval(std::vector<HTTTrack>& track ATH_MSG_DEBUG("Beginning runOverlapRemoval()"); // Create tracks to hold and compare - HTTTrack fit1, fit2; + FPGATrackSimTrack fit1, fit2; for(unsigned int i=0; i<tracks.size();i++) { fit1=tracks.at(i); @@ -183,7 +183,7 @@ StatusCode HTTOverlapRemovalTool::runOverlapRemoval(std::vector<HTTTrack>& track return StatusCode::SUCCESS; } -void HTTOverlapRemovalTool::findMinChi2MaxHit(const std::vector<int>& duplicates, std::vector<HTTTrack>& RMtracks) +void FPGATrackSimOverlapRemovalTool::findMinChi2MaxHit(const std::vector<int>& duplicates, std::vector<FPGATrackSimTrack>& RMtracks) { // Hardcode the CHI2MAX for now, should change it later float minChi2=100000.; @@ -192,8 +192,8 @@ void HTTOverlapRemovalTool::findMinChi2MaxHit(const std::vector<int>& duplicates for(auto dup: duplicates) { float t_chi2 = RMtracks.at(dup).getChi2ndof(); - int t_nhitlayers = RMtracks.at(dup).getHTTHits().size(); - for(auto& hit : RMtracks.at(dup).getHTTHits()) + int t_nhitlayers = RMtracks.at(dup).getFPGATrackSimHits().size(); + for(auto& hit : RMtracks.at(dup).getFPGATrackSimHits()) { if(!hit.isReal()) { @@ -234,11 +234,11 @@ void HTTOverlapRemovalTool::findMinChi2MaxHit(const std::vector<int>& duplicates } } -int HTTOverlapRemovalTool::findNCommonHits(const HTTTrack& Track1, const HTTTrack& Track2) +int FPGATrackSimOverlapRemovalTool::findNCommonHits(const FPGATrackSimTrack& Track1, const FPGATrackSimTrack& Track2) { int nCommHits=0; - const std::vector <HTTHit> hits1 = Track1.getHTTHits(); - const std::vector <HTTHit> hits2 = Track2.getHTTHits(); + const std::vector <FPGATrackSimHit> hits1 = Track1.getFPGATrackSimHits(); + const std::vector <FPGATrackSimHit> hits2 = Track2.getFPGATrackSimHits(); // Loop through all layers for(unsigned int i = 0; i < hits1.size(); ++i) @@ -254,7 +254,7 @@ int HTTOverlapRemovalTool::findNCommonHits(const HTTTrack& Track1, const HTTTrac continue; } // Check if two hits have the same hashID - else if(hits1.at(i).getHTTIdentifierHash() != hits2.at(i).getHTTIdentifierHash()) + else if(hits1.at(i).getFPGATrackSimIdentifierHash() != hits2.at(i).getFPGATrackSimIdentifierHash()) { continue; } @@ -272,11 +272,11 @@ int HTTOverlapRemovalTool::findNCommonHits(const HTTTrack& Track1, const HTTTrac return nCommHits; } -int HTTOverlapRemovalTool::findNonOverlapHits(const HTTTrack& Track1, const HTTTrack& Track2) +int FPGATrackSimOverlapRemovalTool::findNonOverlapHits(const FPGATrackSimTrack& Track1, const FPGATrackSimTrack& Track2) { int nonOverlapHits=0; - const std::vector <HTTHit> hits1 = Track1.getHTTHits(); - const std::vector <HTTHit> hits2 = Track2.getHTTHits(); + const std::vector <FPGATrackSimHit> hits1 = Track1.getFPGATrackSimHits(); + const std::vector <FPGATrackSimHit> hits2 = Track2.getFPGATrackSimHits(); // Loop through all layers for(unsigned int i=0; i<hits1.size(); i++) @@ -292,7 +292,7 @@ int HTTOverlapRemovalTool::findNonOverlapHits(const HTTTrack& Track1, const HTTT nonOverlapHits++; } // Check if two hits have the same hashID - else if(hits1.at(i).getHTTIdentifierHash() != hits2.at(i).getHTTIdentifierHash()) + else if(hits1.at(i).getFPGATrackSimIdentifierHash() != hits2.at(i).getFPGATrackSimIdentifierHash()) { nonOverlapHits++; } @@ -310,11 +310,11 @@ int HTTOverlapRemovalTool::findNonOverlapHits(const HTTTrack& Track1, const HTTT } -StatusCode HTTOverlapRemovalTool::removeOverlapping(HTTTrack & track1, HTTTrack & track2) { +StatusCode FPGATrackSimOverlapRemovalTool::removeOverlapping(FPGATrackSimTrack & track1, FPGATrackSimTrack & track2) { // Hit comparison struct HitCompare { - bool operator()(const HTTHit* a, const HTTHit* b) const { + bool operator()(const FPGATrackSimHit* a, const FPGATrackSimHit* b) const { auto hash_a = a->getIdentifierHash(); auto hash_b = b->getIdentifierHash(); if ( hash_a == hash_b ) { @@ -336,17 +336,17 @@ StatusCode HTTOverlapRemovalTool::removeOverlapping(HTTTrack & track1, HTTTrack } }; - std::set<const HTTHit*, HitCompare > hitsInTrack1; - for ( auto& hit : track1.getHTTHits()) { + std::set<const FPGATrackSimHit*, HitCompare > hitsInTrack1; + for ( auto& hit : track1.getFPGATrackSimHits()) { if (hit.isReal()) hitsInTrack1.insert(&hit); } - std::set<const HTTHit*, HitCompare> hitsInTrack2; - for ( auto& hit: track2.getHTTHits()){ + std::set<const FPGATrackSimHit*, HitCompare> hitsInTrack2; + for ( auto& hit: track2.getFPGATrackSimHits()){ if (hit.isReal()) hitsInTrack2.insert(&hit); } - std::vector<const HTTHit*> sharedHits; + std::vector<const FPGATrackSimHit*> sharedHits; std::set_intersection( hitsInTrack1.begin(), hitsInTrack1.end(), hitsInTrack2.begin(), hitsInTrack2.end(), std::back_inserter(sharedHits), @@ -383,15 +383,15 @@ StatusCode HTTOverlapRemovalTool::removeOverlapping(HTTTrack & track1, HTTTrack return StatusCode::SUCCESS; } -bool HTTOverlapRemovalTool::compareTrackQuality(const HTTTrack & track1, const HTTTrack & track2) +bool FPGATrackSimOverlapRemovalTool::compareTrackQuality(const FPGATrackSimTrack & track1, const FPGATrackSimTrack & track2) { - std::vector<const HTTHit*> hitsInTrack1; - for ( auto& hit : track1.getHTTHits()) { + std::vector<const FPGATrackSimHit*> hitsInTrack1; + for ( auto& hit : track1.getFPGATrackSimHits()) { if (hit.isReal()) hitsInTrack1.push_back(&hit); } - std::vector<const HTTHit*> hitsInTrack2; - for ( auto& hit: track2.getHTTHits()){ + std::vector<const FPGATrackSimHit*> hitsInTrack2; + for ( auto& hit: track2.getFPGATrackSimHits()){ if (hit.isReal()) hitsInTrack2.push_back(&hit); } @@ -414,7 +414,7 @@ bool HTTOverlapRemovalTool::compareTrackQuality(const HTTTrack & track1, const H } -StatusCode HTTOverlapRemovalTool::runOverlapRemoval_fast(std::vector<HTTTrack>& tracks) +StatusCode FPGATrackSimOverlapRemovalTool::runOverlapRemoval_fast(std::vector<FPGATrackSimTrack>& tracks) { ATH_MSG_DEBUG("Beginning fast overlap removal"); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTOverlapRemovalTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimOverlapRemovalTool.h similarity index 57% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTOverlapRemovalTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimOverlapRemovalTool.h index 36b7a00f9e27e4ac7457389d0115164b06cf7346..c5ca9575ea8e622f85cb3809e4611030a485f12c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTOverlapRemovalTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimOverlapRemovalTool.h @@ -1,23 +1,23 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** -* @file HTTOverlapRemovalTool.h +* @file FPGATrackSimOverlapRemovalTool.h * @author Zhaoyuan.Cui@cern.ch * @date Dec.4, 2020 -* @brief Overlap removal tool for HTTTrack. +* @brief Overlap removal tool for FPGATrackSimTrack. */ -#ifndef HTTOVERLAPREMOVALTOOL_H -#define HTTOVERLAPREMOVALTOOL_H +#ifndef FPGATrackSimOVERLAPREMOVALTOOL_H +#define FPGATrackSimOVERLAPREMOVALTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" #include <string> #include <vector> @@ -25,35 +25,35 @@ enum class ORAlgo {Normal, InvertGrouping}; /** -* @class HTTOverlapRemovalTool +* @class FPGATrackSimOverlapRemovalTool * @brief Remove (mark) duplicate tracks -* This tool takes HTTTrack as input and mark their status of passing/failing the overlap removal criteria. +* This tool takes FPGATrackSimTrack as input and mark their status of passing/failing the overlap removal criteria. */ -class HTTOverlapRemovalTool: public AthAlgTool { +class FPGATrackSimOverlapRemovalTool: public AthAlgTool { public: - HTTOverlapRemovalTool (const std::string&, const std::string&, const IInterface*); - HTTOverlapRemovalTool() = delete; + FPGATrackSimOverlapRemovalTool (const std::string&, const std::string&, const IInterface*); + FPGATrackSimOverlapRemovalTool() = delete; StatusCode initialize() override; - StatusCode runOverlapRemoval(std::vector<HTTRoad*>& roads); + StatusCode runOverlapRemoval(std::vector<FPGATrackSimRoad*>& roads); // Original Overlap Removal function // Compare chi2 and common number of hits - StatusCode runOverlapRemoval(std::vector<HTTTrack>& tracks); + StatusCode runOverlapRemoval(std::vector<FPGATrackSimTrack>& tracks); void setDoSecondStage(bool v) { m_do2ndStage = v; } bool getDoSecondStage() const { return m_do2ndStage; } ORAlgo getAlgorithm() const {return m_algo;} // Find the one track from the duplicate group with the minium Chi2 and maximum # of hits - void findMinChi2MaxHit(const std::vector<int>& duplicates, std::vector<HTTTrack>& tracks); + void findMinChi2MaxHit(const std::vector<int>& duplicates, std::vector<FPGATrackSimTrack>& tracks); // Find number of common hits between two tracks - int findNCommonHits(const HTTTrack&, const HTTTrack&); - int findNonOverlapHits(const HTTTrack&, const HTTTrack&); + int findNCommonHits(const FPGATrackSimTrack&, const FPGATrackSimTrack&); + int findNonOverlapHits(const FPGATrackSimTrack&, const FPGATrackSimTrack&); - StatusCode removeOverlapping(HTTTrack & track1, HTTTrack & track2); - static bool compareTrackQuality(const HTTTrack & track1, const HTTTrack & track2); + StatusCode removeOverlapping(FPGATrackSimTrack & track1, FPGATrackSimTrack & track2); + static bool compareTrackQuality(const FPGATrackSimTrack & track1, const FPGATrackSimTrack & track2); private: @@ -72,11 +72,11 @@ private: ORAlgo m_algo{ORAlgo::Normal}; // Internal ORAlgo enum for faster compare - StatusCode runOverlapRemoval_fast(std::vector<HTTTrack>& tracks); + StatusCode runOverlapRemoval_fast(std::vector<FPGATrackSimTrack>& tracks); // ServiceHandle - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping{this,"TrigHTTMappingSvc","TrigHTTMappingSvc"}; // Get the number of layer through map + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; // Get the number of layer through map }; -#endif // HTTOverlapRemovalTool_h +#endif // FPGATrackSimOverlapRemovalTool_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTTrackFitterTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimTrackFitterTool.cxx similarity index 58% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTTrackFitterTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimTrackFitterTool.cxx index 0a37f13304e0056aba985b46f2f25fad802320fb..3d3707c8a294e27db71feb4e286e1950f8f513bd 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTTrackFitterTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimTrackFitterTool.cxx @@ -1,8 +1,8 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "HTTTrackFitterTool.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTMaps/HTTRegionMap.h" +#include "FPGATrackSimTrackFitterTool.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" #include "GaudiKernel/MsgStream.h" @@ -11,37 +11,37 @@ #include <fstream> ///////////////////////////////////////////////////////////////////////////// -HTTTrackFitterTool::HTTTrackFitterTool(const std::string& algname, const std::string& name, const IInterface *ifc) : +FPGATrackSimTrackFitterTool::FPGATrackSimTrackFitterTool(const std::string& algname, const std::string& name, const IInterface *ifc) : AthAlgTool(algname,name,ifc) { } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTTrackFitterTool::initialize() +StatusCode FPGATrackSimTrackFitterTool::initialize() { - ATH_MSG_DEBUG("HTTTrackFitterTool::initialize()"); + ATH_MSG_DEBUG("FPGATrackSimTrackFitterTool::initialize()"); - ATH_CHECK(m_HTTMapping.retrieve()); - ATH_CHECK(m_HTTBank.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimBank.retrieve()); - const HTTFitConstantBank* nominalbank; - std::vector<const HTTFitConstantBank*> bankvec; + const FPGATrackSimFitConstantBank* nominalbank; + std::vector<const FPGATrackSimFitConstantBank*> bankvec; if(!m_do2ndStage){ - nominalbank = m_HTTBank->FitConstantBank_1st(); + nominalbank = m_FPGATrackSimBank->FitConstantBank_1st(); if (!m_guessHits) { - for (unsigned int iplane = 0; iplane < m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); iplane++) { - const HTTFitConstantBank* bank = m_HTTBank->FitConstantBank_1st(iplane); + for (unsigned int iplane = 0; iplane < m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); iplane++) { + const FPGATrackSimFitConstantBank* bank = m_FPGATrackSimBank->FitConstantBank_1st(iplane); bankvec.push_back(bank); } } } else { - nominalbank = m_HTTBank->FitConstantBank_2nd(); + nominalbank = m_FPGATrackSimBank->FitConstantBank_2nd(); if (!m_guessHits) { - for (unsigned int iplane = 0; iplane < m_HTTMapping->PlaneMap_2nd()->getNLogiLayers(); iplane++) { - const HTTFitConstantBank* bank = m_HTTBank->FitConstantBank_2nd(iplane); + for (unsigned int iplane = 0; iplane < m_FPGATrackSimMapping->PlaneMap_2nd()->getNLogiLayers(); iplane++) { + const FPGATrackSimFitConstantBank* bank = m_FPGATrackSimBank->FitConstantBank_2nd(iplane); bankvec.push_back(bank); } } @@ -52,9 +52,9 @@ StatusCode HTTTrackFitterTool::initialize() m_tfpobj = std::unique_ptr<TrackFitter>(new TrackFitter(nominalbank, bankvec, m_guessHits)); if(!m_do2ndStage) - m_tfpobj->setPlaneMap(m_HTTMapping->PlaneMap_1st()); + m_tfpobj->setPlaneMap(m_FPGATrackSimMapping->PlaneMap_1st()); else - m_tfpobj->setPlaneMap(m_HTTMapping->PlaneMap_2nd()); + m_tfpobj->setPlaneMap(m_FPGATrackSimMapping->PlaneMap_2nd()); // set parameter object to TrackFitter m_tfpobj->setChi2DofRecoveryMin(m_chi2dof_recovery_min); @@ -77,7 +77,7 @@ StatusCode HTTTrackFitterTool::initialize() } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTTrackFitterTool::getTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTrack>& tracks) { +StatusCode FPGATrackSimTrackFitterTool::getTracks(const std::vector<FPGATrackSimRoad*>& roads, std::vector<FPGATrackSimTrack>& tracks) { // elaborate the next event int status = m_tfpobj->fitTracks(roads,tracks); @@ -96,7 +96,7 @@ StatusCode HTTTrackFitterTool::getTracks(const std::vector<HTTRoad*>& roads, std } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTTrackFitterTool::getMissingHitsCheckTracks(std::vector<HTTTrack>& tracks_guessed) +StatusCode FPGATrackSimTrackFitterTool::getMissingHitsCheckTracks(std::vector<FPGATrackSimTrack>& tracks_guessed) { // only call this after we first fit the tracks! tracks_guessed = m_tfpobj->getMissingHitsCheckTracks(); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTTrackFitterTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimTrackFitterTool.h similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTTrackFitterTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimTrackFitterTool.h index 36d59726c4043dea42e5958c2f3fd06a2ed2b95f..2f0d4cedd70769c0234bc461295e5c66c07e92de 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/HTTTrackFitterTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimTrackFitterTool.h @@ -1,40 +1,40 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTTRACKFITTERTOOL_H -#define HTTTRACKFITTERTOOL_H +#ifndef FPGATrackSimTRACKFITTERTOOL_H +#define FPGATrackSimTRACKFITTERTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" #include "TrackFitter.h" -#include "TrigHTTBanks/HTTSectorBank.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorBank.h" #include <string> #include <vector> #include <ostream> -class ITrigHTTMappingSvc; -class ITrigHTTBankSvc; -class HTTSectorBank; +class IFPGATrackSimMappingSvc; +class IFPGATrackSimBankSvc; +class FPGATrackSimSectorBank; class TrackFitter; ///////////////////////////////////////////////////////////////////////////// -class HTTTrackFitterTool: public AthAlgTool { +class FPGATrackSimTrackFitterTool: public AthAlgTool { public: - HTTTrackFitterTool (const std::string&, const std::string&, const IInterface*); - ~HTTTrackFitterTool() = default; + FPGATrackSimTrackFitterTool (const std::string&, const std::string&, const IInterface*); + ~FPGATrackSimTrackFitterTool() = default; StatusCode initialize() override; - StatusCode getTracks(std::vector<HTTRoad*> const & roads, std::vector<HTTTrack> & tracks); - StatusCode getMissingHitsCheckTracks(std::vector<HTTTrack> & tracks_guessed); + StatusCode getTracks(std::vector<FPGATrackSimRoad*> const & roads, std::vector<FPGATrackSimTrack> & tracks); + StatusCode getMissingHitsCheckTracks(std::vector<FPGATrackSimTrack> & tracks_guessed); StatusCode getNFits(int & n) { n = m_tfpobj->getNFits(); return StatusCode::SUCCESS; } StatusCode getNFitsMajority(int & n) { n = m_tfpobj->getNFitsMajority(); return StatusCode::SUCCESS; } @@ -45,8 +45,8 @@ public: private: std::unique_ptr<TrackFitter> m_tfpobj; // instance of the TrackFitter object - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping{this,"TrigHTTMappingSvc","TrigHTTMappingSvc"}; - ServiceHandle<ITrigHTTBankSvc> m_HTTBank{this,"TrigHTTBankSvc","TrigHTTBankSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; + ServiceHandle<IFPGATrackSimBankSvc> m_FPGATrackSimBank{this,"FPGATrackSimBankSvc","FPGATrackSimBankSvc"}; Gaudi::Property <int> m_chi2dof_recovery_min {this, "chi2DofRecoveryMin", 40, "min chi^2 cut for attempting recovery fits"}; Gaudi::Property <int> m_chi2dof_recovery_max {this, "chi2DofRecoveryMax", 1e30, "max chi^2 cut for attempting recovery fits"}; @@ -60,4 +60,4 @@ private: Gaudi::Property <int> m_idealCoordFitType {this, "IdealCoordFitType", 0, "Fit type for idealized coordinates, 0 if off"}; }; -#endif // HTTTrackFitterTool_h +#endif // FPGATrackSimTrackFitterTool_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/TrackFitter.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/TrackFitter.cxx similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/TrackFitter.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/TrackFitter.cxx index 58ea40586e3a0b015b8adcfc333bc346bcaaf287..04f4469248ebf7fa2d98181261327897ea633e8c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/TrackFitter.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/TrackFitter.cxx @@ -1,11 +1,11 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #include <algorithm> #include <iostream> #include <fstream> #include <cmath> -#include "TrigHTTObjects/HTTMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" #include "GaudiKernel/MsgStream.h" #include "AthenaKernel/getMessageSvc.h" @@ -13,17 +13,17 @@ #include "TrackFitter.h" -std::vector<HTTTrack>::const_iterator getBestChi2(std::vector<HTTTrack> const & tracks); -bool hasGoodFit(std::vector<HTTTrack> const & track_cands, float minchi2); +std::vector<FPGATrackSimTrack>::const_iterator getBestChi2(std::vector<FPGATrackSimTrack> const & tracks); +bool hasGoodFit(std::vector<FPGATrackSimTrack> const & track_cands, float minchi2); /////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////// -TrackFitter::TrackFitter(const HTTFitConstantBank *nominalbank, - const std::vector<const HTTFitConstantBank*>& droppedLayerbanks, bool guessingHits) : - AthMessaging (Athena::getMessageSvc(), "HTTTrackFitter") +TrackFitter::TrackFitter(const FPGATrackSimFitConstantBank *nominalbank, + const std::vector<const FPGATrackSimFitConstantBank*>& droppedLayerbanks, bool guessingHits) : + AthMessaging (Athena::getMessageSvc(), "FPGATrackSimTrackFitter") { m_guessinghits = guessingHits; m_nominalBank = nominalbank; @@ -52,10 +52,10 @@ void TrackFitter::resetCounters() /////////////////////////////////////////////////////////////////////////////// -int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTrack>& tracks) { +int TrackFitter::fitTracks(const std::vector<FPGATrackSimRoad*>& roads, std::vector<FPGATrackSimTrack>& tracks) { resetCounters(); for (auto cur_road : roads) { - std::vector<HTTTrack> t; + std::vector<FPGATrackSimTrack> t; int isOK = fitTracks(cur_road, t); if (isOK != FITTRACKS_OK) return isOK; else tracks.insert(tracks.end(), t.begin(), t.end()); @@ -70,11 +70,11 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr * Takes all combinations of hits in the road to create track candidates, * fits them using the constant bank, and filters them based on the chi2 of the fit. */ - int TrackFitter::fitTracks(HTTRoad *road, std::vector<HTTTrack>& tracks) + int TrackFitter::fitTracks(FPGATrackSimRoad *road, std::vector<FPGATrackSimTrack>& tracks) { m_tracks_missinghits_track.clear(); - HTTRoad_Hough *hough_road = dynamic_cast<HTTRoad_Hough*>(road); + FPGATrackSimRoad_Hough *hough_road = dynamic_cast<FPGATrackSimRoad_Hough*>(road); double y = 0.0; double x = 0.0; if (hough_road != nullptr && m_IdealCoordFitType != TrackCorrType::None ) { @@ -105,7 +105,7 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr layer_bitmask_t norecovery_mask; // mask to prevent majority in planes with multiple hits getMissingInfo(*road, nMissing, missPixel, missStrip, missing_mask, norecovery_mask); // Create a template track with common parameters filled already for initializing below - HTTTrack temp; + FPGATrackSimTrack temp; if(!m_do2ndStage){ temp.setTrackStage(TrackStage::FIRST); temp.setFirstSectorID(road->getSector()); @@ -126,7 +126,7 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr temp.setDoDeltaGPhis(m_doDeltaGPhis); // Create a list of track candidates by taking all possible combinations of hits in road. - std::vector<HTTTrack> track_cands; + std::vector<FPGATrackSimTrack> track_cands; makeTrackCandidates(*road, temp, track_cands); // Fit the track candidates @@ -156,7 +156,7 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr if (track_cands[icomb].getNMissing() == 0) { // missing 0 hits, drop hits one at a time and refit! for (unsigned icoord = 0; icoord < m_pmap->getNCoords(); icoord++) { // 9 coordinates to refit, nominally - HTTTrack newtrack = track_cands[icomb]; + FPGATrackSimTrack newtrack = track_cands[icomb]; newtrack.setNMissing(1); unsigned int bitmask = ( 1 << m_pmap->getNCoords() ) - 1; // all bits set to 1 bitmask &= ~(1 << icoord); // remove this coordinate @@ -190,10 +190,10 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr // In the case of m_do_majority > 1, we only do majority fits if ALL full fits fail the chi2 cut if (m_do_majority == 1 || (m_do_majority > 1 && !hasGoodFit(tracks, m_Chi2Dof_recovery_min))) { - for (HTTTrack & t : tracks) + for (FPGATrackSimTrack & t : tracks) if (t.getChi2ndof() > m_Chi2Dof_recovery_min && t.getChi2ndof() < m_Chi2Dof_recovery_max){ double y(0); - HTTRoad_Hough *hough_road = dynamic_cast<HTTRoad_Hough*>(road); + FPGATrackSimRoad_Hough *hough_road = dynamic_cast<FPGATrackSimRoad_Hough*>(road); if (hough_road != nullptr && m_IdealCoordFitType != TrackCorrType::None) y = hough_road->getY(); @@ -204,7 +204,7 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr } // Add truth info - for (HTTTrack & t : tracks) { + for (FPGATrackSimTrack & t : tracks) { compute_truth(t); // match the track to a geant particle using the channel-level geant info in the hit data. } @@ -218,7 +218,7 @@ int TrackFitter::fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTr // Given road, populates the supplied variables with info on which layers missed hits -void TrackFitter::getMissingInfo(const HTTRoad & road, int & nMissing, bool & missPixel, bool & missStrip, +void TrackFitter::getMissingInfo(const FPGATrackSimRoad & road, int & nMissing, bool & missPixel, bool & missStrip, layer_bitmask_t & missing_mask, layer_bitmask_t & norecovery_mask) { nMissing = m_pmap->getNCoords(); // init with nCoords and decrement as we find misses @@ -284,7 +284,7 @@ void TrackFitter::getMissingInfo(const HTTRoad & road, int & nMissing, bool & mi * it may be worth turning this function into a sort of iterator * over `combs`, return a single track each call. */ -void TrackFitter::makeTrackCandidates(const HTTRoad & road, const HTTTrack & temp, std::vector<HTTTrack>& track_cands) +void TrackFitter::makeTrackCandidates(const FPGATrackSimRoad & road, const FPGATrackSimTrack & temp, std::vector<FPGATrackSimTrack>& track_cands) { std::vector<std::vector<int>> combs = getComboIndices(road.getNHits_layer()); track_cands.resize(combs.size(), temp); @@ -303,7 +303,7 @@ void TrackFitter::makeTrackCandidates(const HTTRoad & road, const HTTTrack & tem { if (hit_indices[layer] < 0) // Set a dummy hit if road has no hits in this layer { - HTTHit newhit=HTTHit(); + FPGATrackSimHit newhit=FPGATrackSimHit(); newhit.setLayer(layer); newhit.setSection(0); if (m_pmap->getDim(layer) == 2) newhit.setDetType(SiliconTech::pixel); @@ -314,12 +314,12 @@ void TrackFitter::makeTrackCandidates(const HTTRoad & road, const HTTTrack & tem newhit.setLayer(layer); } - track_cands[icomb].setHTTHit(layer, newhit); + track_cands[icomb].setFPGATrackSimHit(layer, newhit); } else { - const HTTHit* hit = road.getHits(layer)[hit_indices[layer]]; - track_cands[icomb].setHTTHit(layer, *hit); + const FPGATrackSimHit* hit = road.getHits(layer)[hit_indices[layer]]; + track_cands[icomb].setFPGATrackSimHit(layer, *hit); } } } @@ -336,11 +336,11 @@ void TrackFitter::makeTrackCandidates(const HTTRoad & road, const HTTTrack & tem * * @param norecovery_mask - will skip removing hits from layers with bit set in this mask */ -HTTTrack TrackFitter::recoverTrack(HTTTrack const & t, sector_t sector, layer_bitmask_t norecovery_mask, double qoverpt) +FPGATrackSimTrack TrackFitter::recoverTrack(FPGATrackSimTrack const & t, sector_t sector, layer_bitmask_t norecovery_mask, double qoverpt) { m_nfits_rec += 1; - std::vector<HTTTrack> recovered_tracks(m_pmap->getNLogiLayers(),t); // start with the complete track in all layers + std::vector<FPGATrackSimTrack> recovered_tracks(m_pmap->getNLogiLayers(),t); // start with the complete track in all layers float best_chi2ndof = t.getChi2ndof(); int best_i = -1; @@ -353,11 +353,11 @@ HTTTrack TrackFitter::recoverTrack(HTTTrack const & t, sector_t sector, layer_bi m_nfits_addrec += 1; // Zero the cluster for the missing layer, make sure to set the number of dimensions for it - HTTHit newhit=HTTHit(); + FPGATrackSimHit newhit=FPGATrackSimHit(); newhit.setLayer(layer); newhit.setSection(0); newhit.setHitType(HitType::guessed); - recovered_tracks[layer].setHTTHit(layer,newhit); + recovered_tracks[layer].setFPGATrackSimHit(layer,newhit); // Set the number of missing points and the related bitmask int ix = m_pmap->getCoordOffset(layer); @@ -398,25 +398,25 @@ HTTTrack TrackFitter::recoverTrack(HTTTrack const & t, sector_t sector, layer_bi // compute the best geant match, the barcode with the largest number of hits contributing to the track, // and store in the track. -void TrackFitter::compute_truth(HTTTrack & t) const +void TrackFitter::compute_truth(FPGATrackSimTrack & t) const { - std::vector<HTTMultiTruth> mtv; + std::vector<FPGATrackSimMultiTruth> mtv; for (unsigned layer = 0; layer < m_pmap->getNLogiLayers(); layer++) { if (t.getHitMap() & (1 << m_pmap->getCoordOffset(layer))) continue; // no hit in this plane //Sanity check that we have enough hits. - if (layer < t.getHTTHits().size()) mtv.push_back(t.getHTTHits().at(layer).getTruth()); + if (layer < t.getFPGATrackSimHits().size()) mtv.push_back(t.getFPGATrackSimHits().at(layer).getTruth()); // adjust weight for hits without (and also with) a truth match, so that each is counted with the same weight. mtv.back().assign_equal_normalization(); } - HTTMultiTruth mt( std::accumulate(mtv.begin(), mtv.end(), HTTMultiTruth(), HTTMultiTruth::AddAccumulator()) ); + FPGATrackSimMultiTruth mt( std::accumulate(mtv.begin(), mtv.end(), FPGATrackSimMultiTruth(), FPGATrackSimMultiTruth::AddAccumulator()) ); // frac is then the fraction of the total number of hits on the track attributed to the barcode. - HTTMultiTruth::Barcode tbarcode; - HTTMultiTruth::Weight tfrac; + FPGATrackSimMultiTruth::Barcode tbarcode; + FPGATrackSimMultiTruth::Weight tfrac; const bool ok = mt.best(tbarcode, tfrac); if (ok) { @@ -432,9 +432,9 @@ void TrackFitter::compute_truth(HTTTrack & t) const /////////////////////////////////////////////////////////////////////////////// // Returns true if there is a fit in track_cands with chi2ndof < minchi2ndof -bool hasGoodFit(std::vector<HTTTrack> const & track_cands, float minchi2ndof) +bool hasGoodFit(std::vector<FPGATrackSimTrack> const & track_cands, float minchi2ndof) { - for (HTTTrack const & t: track_cands) + for (FPGATrackSimTrack const & t: track_cands) { if (t.getChi2ndof() > 0 && t.getChi2ndof() < minchi2ndof) return true; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/TrackFitter.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/TrackFitter.h similarity index 75% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/TrackFitter.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/TrackFitter.h index ec2c0d3aab46e791c1f8a5e9661ab36b7d1ebe0d..5384f6869b0d1883c6ead36719a4745561afeee7 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTAlgorithms/src/TrackFitter.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/TrackFitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #ifndef TRACKFITTER_H #define TRACKFITTER_H @@ -13,11 +13,11 @@ */ #include "AthenaBaseComps/AthMessaging.h" -#include "TrigHTTBanks/HTTFitConstantBank.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTFunctions.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimBanks/FPGATrackSimFitConstantBank.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimFunctions.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include <list> #include <vector> @@ -30,14 +30,14 @@ class TrackFitter /////////////////////////////////////////////////////////////////////// // Main interface functions - int fitTracks(const std::vector<HTTRoad*>& roads, std::vector<HTTTrack>& tracks); + int fitTracks(const std::vector<FPGATrackSimRoad*>& roads, std::vector<FPGATrackSimTrack>& tracks); - std::vector<HTTTrack> getMissingHitsCheckTracks() {return m_tracks_missinghits_track;} + std::vector<FPGATrackSimTrack> getMissingHitsCheckTracks() {return m_tracks_missinghits_track;} /////////////////////////////////////////////////////////////////////// // Constructor and Initialization - TrackFitter(const HTTFitConstantBank *nominalbank, const std::vector<const HTTFitConstantBank*>& droppedLayerbanks, bool guessingHits); + TrackFitter(const FPGATrackSimFitConstantBank *nominalbank, const std::vector<const FPGATrackSimFitConstantBank*>& droppedLayerbanks, bool guessingHits); /////////////////////////////////////////////////////////////////////// // Simple getters and setters @@ -45,8 +45,8 @@ class TrackFitter void setIdentifyBadHit(bool flag) { m_identify_badhit = flag; } bool getIdentifyBadHit() const { return m_identify_badhit; } - void setPlaneMap(HTTPlaneMap const * map) { m_pmap = map; } - HTTPlaneMap const * getPlaneMap() const { return m_pmap; } + void setPlaneMap(FPGATrackSimPlaneMap const * map) { m_pmap = map; } + FPGATrackSimPlaneMap const * getPlaneMap() const { return m_pmap; } void setNorecoveryNhits(int v) { m_norecovery_nhits = v; } int getNorecoveryNhits() const { return m_norecovery_nhits; } @@ -112,19 +112,19 @@ class TrackFitter /////////////////////////////////////////////////////////////////////// // Storage - HTTPlaneMap const *m_pmap = nullptr; // Convenience pointer + FPGATrackSimPlaneMap const *m_pmap = nullptr; // Convenience pointer // This bank should always exist. If we are guessing hits there is only one bank and it is this one // and if we are not guessing hits it is for 8/8 // It is just a pointer from BankSvc->FitConstantBank1stStage() but we copy it; - const HTTFitConstantBank *m_nominalBank; + const FPGATrackSimFitConstantBank *m_nominalBank; // These are only used if we are not guessing hits, one for each plane missing // Also just a set of pointers, but we copied them - std::vector<const HTTFitConstantBank*> m_droppedLayerBanks; + std::vector<const FPGATrackSimFitConstantBank*> m_droppedLayerBanks; // These are the tracks we store if we are doing the missing hits cross-check - std::vector<HTTTrack> m_tracks_missinghits_track; + std::vector<FPGATrackSimTrack> m_tracks_missinghits_track; // Counters int m_idbase = 0; // offset for new track ids @@ -140,12 +140,12 @@ class TrackFitter // Helper Functions void resetCounters(); - int fitTracks(HTTRoad *road, std::vector<HTTTrack> &tracks); - void getMissingInfo(const HTTRoad & road, int & nMissing, bool & missPixel, bool & missStrip, + int fitTracks(FPGATrackSimRoad *road, std::vector<FPGATrackSimTrack> &tracks); + void getMissingInfo(const FPGATrackSimRoad & road, int & nMissing, bool & missPixel, bool & missStrip, layer_bitmask_t & missing_mask, layer_bitmask_t & norecovery_mask); - void makeTrackCandidates(const HTTRoad & road, const HTTTrack & temp, std::vector<HTTTrack> &track_cands); - HTTTrack recoverTrack(HTTTrack const & t, sector_t sector, layer_bitmask_t norecovery_mask, double qoverpt); - void compute_truth(HTTTrack & newtrk) const; + void makeTrackCandidates(const FPGATrackSimRoad & road, const FPGATrackSimTrack & temp, std::vector<FPGATrackSimTrack> &track_cands); + FPGATrackSimTrack recoverTrack(FPGATrackSimTrack const & t, sector_t sector, layer_bitmask_t norecovery_mask, double qoverpt); + void compute_truth(FPGATrackSimTrack & newtrk) const; }; #endif // TRACKFITTER_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/components/FPGATrackSimAlgorithms_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/components/FPGATrackSimAlgorithms_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..11b329f7fdc1a51b9cd70b6234cf55e4c69263d2 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/components/FPGATrackSimAlgorithms_entries.cxx @@ -0,0 +1,14 @@ +#include "../FPGATrackSimLogicalHitsProcessAlg.h" +#include "../FPGATrackSimMapMakerAlg.h" +#include "../FPGATrackSimNNTrackTool.h" +#include "../FPGATrackSimOverlapRemovalTool.h" +#include "../FPGATrackSimTrackFitterTool.h" +#include "../FPGATrackSimDataFlowTool.h" + +DECLARE_COMPONENT( FPGATrackSimLogicalHitsProcessAlg ) +DECLARE_COMPONENT( FPGATrackSimMapMakerAlg ) +DECLARE_COMPONENT( FPGATrackSimNNTrackTool ) +DECLARE_COMPONENT( FPGATrackSimOverlapRemovalTool ) +DECLARE_COMPONENT( FPGATrackSimTrackFitterTool ) +DECLARE_COMPONENT( FPGATrackSimDataFlowTool ) + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..2d9099ca48a1aac14c3fcdda8879526cc2364b6b --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimBankGen/ \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/CMakeLists.txt similarity index 59% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/CMakeLists.txt rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/CMakeLists.txt index 97aa89b7b40a8b8645afb244fcf01dbbbd501ce6..c3f0a3a4a5acc9353f891c309fca74d72ed25520 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/CMakeLists.txt +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/CMakeLists.txt @@ -1,18 +1,18 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( TrigHTTBankGen ) +atlas_subdir( FPGATrackSimBankGen ) # External dependencies: find_package( Boost ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO Matrix ) # Declare Gaudi component(s) in the package -atlas_add_component( TrigHTTBankGen +atlas_add_component( FPGATrackSimBankGen src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps TruthUtils GaudiKernel TrigHTTBanksLib TrigHTTConfToolsLib TrigHTTHoughLib TrigHTTInputLib TrigHTTMapsLib TrigHTTObjectsLib TrigHTTSGInputLib ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps TruthUtils GaudiKernel FPGATrackSimBanksLib FPGATrackSimConfToolsLib FPGATrackSimHoughLib FPGATrackSimInputLib FPGATrackSimMapsLib FPGATrackSimObjectsLib FPGATrackSimSGInputLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/README.md b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/README.md similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/README.md rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/README.md index d151a4bb7ffbd3ebbff22e804667cfb9e8e5556e..09e5fd453cfad4c147ed657e78f5f667e612387a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/README.md +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/README.md @@ -1,8 +1,8 @@ -## TrigHTTBankGen +## FPGATrackSimBankGen -Last update: June 17,2022 +Last update: June 17,2023 -This package is used to make banks (fit constants, sectors) for the EF Tracking system (a la HTT). The instructions are for 21.9 and will need to be updated when we have files for Rel 22 +This package is used to make banks (fit constants, sectors) for the EF Tracking system (a la FPGATrackSim). The instructions are for 21.9 and will need to be updated when we have files for Rel 22 ### Files @@ -10,15 +10,15 @@ This package is used to make banks (fit constants, sectors) for the EF Tracking Matrix files accumulate track information from training muons, for generating sectors and constants. Matrix files condense information from HITS files to only what we need, but can still be merged with other matrix files to increase statistics (whereas the actual constants files can't be merged). -* HTTMatrixGenAlgo: Core matrix file generation code. -* HTTMatrixMergeAlgo: Algorithm to merge matrix files. -* HTTMatrixReductionAlgo: Reduces second-stage matrices to first-stage ones. -* HTTMatrixAccumulator: The actual "matrix" object, which is stored in the matrix files. -* HTTMatrixIO: Utility functions to read and write matrix files. +* FPGATrackSimMatrixGenAlgo: Core matrix file generation code. +* FPGATrackSimMatrixMergeAlgo: Algorithm to merge matrix files. +* FPGATrackSimMatrixReductionAlgo: Reduces second-stage matrices to first-stage ones. +* FPGATrackSimMatrixAccumulator: The actual "matrix" object, which is stored in the matrix files. +* FPGATrackSimMatrixIO: Utility functions to read and write matrix files. #### Fit constants generation -* HTTConstGenAlgo: Main algo to generate fit constants from matrix files. Also dumps sector definitions and slices. +* FPGATrackSimConstGenAlgo: Main algo to generate fit constants from matrix files. Also dumps sector definitions and slices. @@ -56,7 +56,7 @@ pathena \ --digiSteeringConf=StandardInTimeOnlyTruth --autoConfiguration=everything --postInclude 'all:InDetSLHC_Example/postInclude.SLHC_Setup_InclBrl_4.py' 'HITtoRDO:InDetSLHC_Example/postInclude.SLHC_Digitization_lowthresh.py' 'RAWtoESD:InDetSLHC_Example/postInclude.DigitalClustering.py' - --preExec 'all:from AthenaCommon.GlobalFlags import globalflags; globalflags.DataSource.set_Value_and_Lock(\"geant4\");from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags;SLHC_Flags.doGMX.set_Value_and_Lock(True);SLHC_Flags.LayoutOption=\"InclinedDuals\"; from RecExConfig.RecFlags import rec; rec.doCalo.set_Value_and_Lock(False); rec.doMuon.set_Value_and_Lock(False);rec.doJetMissingETTag.set_Value_and_Lock(False);rec.doEgamma.set_Value_and_Lock(False);rec.doMuonCombined.set_Value_and_Lock(False); rec.doTau.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); rec.doTagRawSummary.set_Value_and_Lock(False)' 'HITtoRDO:from Digitization.DigitizationFlags import digitizationFlags; digitizationFlags.doInDetNoise.set_Value_and_Lock(False); digitizationFlags.overrideMetadata+=[\"SimLayout\",\"PhysicsList\"];' 'RAWtoESD:rec.UserAlgs=[\"TrigHTTBankGen/r2e_HTTBankGenITk_joboptions.py\"]' + --preExec 'all:from AthenaCommon.GlobalFlags import globalflags; globalflags.DataSource.set_Value_and_Lock(\"geant4\");from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags;SLHC_Flags.doGMX.set_Value_and_Lock(True);SLHC_Flags.LayoutOption=\"InclinedDuals\"; from RecExConfig.RecFlags import rec; rec.doCalo.set_Value_and_Lock(False); rec.doMuon.set_Value_and_Lock(False);rec.doJetMissingETTag.set_Value_and_Lock(False);rec.doEgamma.set_Value_and_Lock(False);rec.doMuonCombined.set_Value_and_Lock(False); rec.doTau.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); rec.doTagRawSummary.set_Value_and_Lock(False)' 'HITtoRDO:from Digitization.DigitizationFlags import digitizationFlags; digitizationFlags.doInDetNoise.set_Value_and_Lock(False); digitizationFlags.overrideMetadata+=[\"SimLayout\",\"PhysicsList\"];' 'RAWtoESD:rec.UserAlgs=[\"FPGATrackSimBankGen/r2e_FPGATrackSimBankGenITk_joboptions.py\"]' --preInclude 'all:from AthenaCommon.DetFlags import DetFlags;DetFlags.ID_setOn();DetFlags.TRT_setOff();DetFlags.detdescr.TRT_setOff();DetFlags.makeRIO.TRT_setOff();DetFlags.BCM_setOff();DetFlags.detdescr.BCM_setOff();DetFlags.makeRIO.BCM_setOff();DetFlags.DBM_setOff();DetFlags.detdescr.DBM_setOff();DetFlags.makeRIO.DBM_setOff();DetFlags.Calo_setOff();DetFlags.Muon_setOff();DetFlags.Truth_setOn();DetFlags.simulate.TRT_setOff();DetFlags.simulate.BCM_setOff();DetFlags.simulate.DBM_setOff(),InDetSLHC_Example/preInclude.SLHC_Setup_InclBrl_4.py,InDetSLHC_Example/preInclude.SLHC_Setup_Strip_GMX.py' 'HITtoRDO:InDetSLHC_Example/preInclude.SLHC.py' 'default:InDetSLHC_Example/preInclude.SLHC.py,from AthenaCommon.DetFlags import DetFlags;DetFlags.ID_setOn();DetFlags.TRT_setOff();DetFlags.detdescr.TRT_setOff();DetFlags.makeRIO.TRT_setOff();DetFlags.BCM_setOff();DetFlags.detdescr.BCM_setOff();DetFlags.makeRIO.BCM_setOff();DetFlags.DBM_setOff();DetFlags.detdescr.DBM_setOff();DetFlags.makeRIO.DBM_setOff();DetFlags.Calo_setOff();DetFlags.Muon_setOff();DetFlags.Truth_setOn();DetFlags.simulate.TRT_setOff();DetFlags.simulate.BCM_setOff();DetFlags.simulate.DBM_setOff(),InDetSLHC_Example/preInclude.SLHC.Reco.py,InDetSLHC_Example/SLHC_Setup_Reco_TrackingGeometry_GMX.py' --postExec 'HITtoRDO:pixeldigi.EnableSpecialPixels=False; CfgMgr.MessageSvc().setError+=[\"HepMcParticleLink\"];' 'RAWtoESD:ToolSvc.InDetSCT_ClusteringTool.useRowInformation=True;' --DataRunNumber '240000'" \ @@ -71,13 +71,13 @@ You could run this step on the grid and then merge a smaller number of jobs loca ```sh PATHTOFILES='/home/jahreda/xdata/httsim_bankgen_check/merge/user*roo*' -HTTMatrixMerge_tf.py \ +FPGATrackSimMatrixMerge_tf.py \ --NBanks 96 \ --genconst False \ - --HTTMatrixFileRegEx $PATHTOFILES \ + --FPGATrackSimMatrixFileRegEx $PATHTOFILES \ --MaxInputFiles 5000 \ --bankregion 0 \ - --outputMergedHTTMatrixFile combined_matrix_13L_18Dim.root + --outputMergedFPGATrackSimMatrixFile combined_matrix_13L_18Dim.root ``` #### Step 3 Produce constants (1nd and 2nd stage) including reduced matrix file @@ -85,12 +85,12 @@ Note that you will want to change the path to the merged matrix file from above. ```sh PATHTOMERGEDMATRIX='/xdata/jahreda/httsim_bankgen/merge/combined_matrix_13L_18Dim.root' -HTTConstReduceConstGen_tf.py \ +FPGATrackSimConstReduceConstGen_tf.py \ --NBanks 96 \ --bankregion 0 \ --pmap_12L raw_FTKppExample.pmap \ --pmap_8L L1TrackExample.pmap \ --allregions False \ - --inputHTTMatrixFile $PATHTOMERGEDMATRIX \ - --outputHTTGoodMatrixReducedFile good_matrix_myreduced.root + --inputFPGATrackSimMatrixFile $PATHTOMERGEDMATRIX \ + --outputFPGATrackSimGoodMatrixReducedFile good_matrix_myreduced.root ``` diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/python/HTTBankGenConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/python/FPGATrackSimBankGenConfig.py similarity index 66% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/python/HTTBankGenConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/python/FPGATrackSimBankGenConfig.py index e36fc32fedda506147c26cc83b42dd889285c66a..db4c057d56772854ca1b20fde197f84e811adcc8 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/python/HTTBankGenConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/python/FPGATrackSimBankGenConfig.py @@ -1,14 +1,14 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' -@file HTTBankGenConfig.py +@file FPGATrackSimBankGenConfig.py @author Riley Xu - rixu@cern.ch @date Sept 22, 2020 -@brief This file declares functions to configure components in HTTBankGen +@brief This file declares functions to configure components in FPGATrackSimBankGen ''' def applyTag(obj, bank_tag): ''' - Applies the parameters in the supplied tags to the given HTTBankGen object. + Applies the parameters in the supplied tags to the given FPGATrackSimBankGen object. ''' # List of configurable parameters for the given object type @@ -16,7 +16,7 @@ def applyTag(obj, bank_tag): 'AtRanluxGenSvc': [ # pass ], - 'HTTMatrixGenAlgo': [ + 'FPGATrackSimMatrixGenAlgo': [ 'WCmax', ], } @@ -28,7 +28,7 @@ def applyTag(obj, bank_tag): obj.Seeds = [ bank_tag['rndStreamName'] + " %d %d" % (bank_tag['seed'], bank_tag['seed2']) ] obj.EventReseeding = False - elif obj.getType() == 'HTTMatrixGenAlgo': + elif obj.getType() == 'FPGATrackSimMatrixGenAlgo': obj.par_c_slices = 250 obj.par_phi_slices = 10 diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimConstReduceConstGen_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimConstReduceConstGen_tf.py new file mode 100755 index 0000000000000000000000000000000000000000..3b0f4d2dec0f095fddf534540c5ad09337baa2db --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimConstReduceConstGen_tf.py @@ -0,0 +1,115 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#!/usr/bin/env python + +## FPGATrackSim Simulation Transform +# @version $Id: FPGATrackSimConstReduceConstGen_tf.py 718878 2016-01-20 17:27:51Z jwebster $ +import argparse +import sys +import time +import traceback + +import logging + +# Setup core logging here +from PyJobTransforms.trfLogger import msg +msg.info('logging set in %s' % sys.argv[0]) + +from PyJobTransforms.trfExitCodes import trfExit +from PyJobTransforms.transform import transform +from PyJobTransforms.trfExe import athenaExecutor +from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace + +import PyJobTransforms.trfExceptions as trfExceptions +import PyJobTransforms.trfArgClasses as trfArgClasses +from FPGATrackSimConfig.parseRunArgs import addFPGATrackSimMapsArgs + +@stdTrfExceptionHandler +@sigUsrStackTrace +def main(): + + msg.info('This is %s' % sys.argv[0]) + + trf = getTransform() + trf.parseCmdLineArgs(sys.argv[1:]) + trf.execute() + trf.generateReport() + + msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode)) + sys.exit(trf.exitCode) + + +## Get the base transform with all arguments added +def getTransform(): + executorSet = set() + executorSet.add(athenaExecutor(name = 'FPGATrackSimConstantGen2ndStage', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimConstantGen.py', + substep='FPGATrackSimC2', + inData=['FPGATrackSimMatrix'], outData=['FPGATrackSimGoodMatrix'] + )) + executorSet.add(athenaExecutor(name = 'FPGATrackSimMatrixReduction', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimMatrixReduction.py', + inData=['FPGATrackSimGoodMatrix'], outData=['FPGATrackSimMatrixReduced'], + substep='FPGATrackSimM2m' + )) + executorSet.add(athenaExecutor(name = 'FPGATrackSimConstantGen1stStageIgnore2ndStage', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimConstantGen.py', + runtimeRunargs={'CheckGood2ndStage':0}, + inData=['FPGATrackSimMatrixReduced'], outData=['FPGATrackSimGoodMatrixReducedIgnore'], + substep='FPGATrackSimC1I' + )) + executorSet.add(athenaExecutor(name = 'FPGATrackSimConstantGen1stStageCheck2ndStage', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimConstantGen.py', + runtimeRunargs={'CheckGood2ndStage':1}, + inData=['FPGATrackSimMatrixReduced'], outData=['FPGATrackSimGoodMatrixReducedCheck'], + substep='FPGATrackSimC1C' + )) + + trf = transform(executor=executorSet, description = "FPGATrackSim Make 2nd stage constants, reduce matrix file, make 1st stage constants") + + addFPGATrackSimConstReduceGenArgs(trf.parser) + addFPGATrackSimMapsArgs(trf.parser) + + return trf + + +def addFPGATrackSimConstReduceGenArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimConstReduceConst', 'Fast tracker simulation options') + + parser.add_argument('--CheckGood2ndStage', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), + help='Check whether 2nd stage sector is good when producing things for 1st stage', group='FPGATrackSimConstReduceConst') + + parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), + help='Bank region number', group='FPGATrackSimConstReduceConst') + + parser.add_argument('--genconst', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), + help='Generate the sectors and constants', group='FPGATrackSimConstReduceConst') + + parser.add_argument('--allregions', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), + help='Run all regions?', group='FPGATrackSimConstReduceConst') + + parser.add_argument('--inputFPGATrackSimMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input',type='htt_matrix'),help="input matrix file", group="FPGATrackSimConstReduceConst") + + parser.add_argument('--inputFPGATrackSimMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input',type='htt_matrix'),help="input matrix file", group="FPGATrackSimConstReduceConst") + + + parser.add_argument('--outputFPGATrackSimGoodMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix'), help="output good matrix file", group="FPGATrackSimConstReduceConst") + + parser.add_argument('--inputFPGATrackSimGoodMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input'), + help="input good matrix file", group="FPGATrackSimConstReduceConst" ) + + parser.add_argument('--outputFPGATrackSimMatrixReducedFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_reduced'), help="output reduced matrix file", group="FPGATrackSimConstReduceConst") + + parser.add_argument('--outputFPGATrackSimGoodMatrixReducedIgnoreFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_good_reduced_ignore'), help="output reduced good matrix file, ignoring whether 2nd stage is good or not", group="FPGATrackSimConstReduceConst") + + parser.add_argument('--outputFPGATrackSimGoodMatrixReducedCheckFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_good_reduced_check'), help="output reduced good matrix file, check whether 2nd stage is good or not", group="FPGATrackSimConstReduceConst") + + parser.add_argument('--inputFPGATrackSimMatrixReducedFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='input',type='htt_matrix_reduced'), help="input reduced matrix file", group="FPGATrackSimConstReduceConst") + + parser.add_argument('--extract1stStage', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), + help='Reduce 2nd stage matrix to 1st stage matrix', group='FPGATrackSimConstReduceConst') + + +if __name__ == '__main__': + main() diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimConstantGen_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimConstantGen_tf.py new file mode 100755 index 0000000000000000000000000000000000000000..3de3e8d7171d300fee4b3efa45336fabce2f7000 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimConstantGen_tf.py @@ -0,0 +1,77 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#!/usr/bin/env python + +## FPGATrackSim Simulation Transform +# @version $Id: FPGATrackSimConstantGen_tf.py 718878 2016-01-20 17:27:51Z jwebster $ +import argparse +import sys +import time +import traceback + +import logging + +# Setup core logging here +from PyJobTransforms.trfLogger import msg +msg.info('logging set in %s' % sys.argv[0]) + +from PyJobTransforms.trfExitCodes import trfExit +from PyJobTransforms.transform import transform +from PyJobTransforms.trfExe import athenaExecutor +from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace + +import PyJobTransforms.trfExceptions as trfExceptions +import PyJobTransforms.trfArgClasses as trfArgClasses +from FPGATrackSimConfig.parseRunArgs import addFPGATrackSimMapsArgs + +@stdTrfExceptionHandler +@sigUsrStackTrace +def main(): + + msg.info('This is %s' % sys.argv[0]) + + trf = getTransform() + trf.parseCmdLineArgs(sys.argv[1:]) + trf.execute() + trf.generateReport() + + msg.info("%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode)) + sys.exit(trf.exitCode) + + +## Get the base transform with all arguments added +def getTransform(): + trf = transform(executor = athenaExecutor(name = 'FPGATrackSimConstantGen', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimConstantGen.py')) + addFPGATrackSimPattGenArgs(trf.parser) + addFPGATrackSimMapsArgs(trf.parser) + return trf + + +def addFPGATrackSimPattGenArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimConstantGen', 'Fast tracker simulation options') + + parser.add_argument('--NBanks', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), + help='Number of pattern banks', group='FPGATrackSimConstantGen') + + parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), + help='Bank region number', group='FPGATrackSimConstantGen') + + parser.add_argument('--genconst', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), + help='Generate the sectors and constants', group='FPGATrackSimConstantGen') + + parser.add_argument('--skip_sectors', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True), + help='Sectors to skip', group='FPGATrackSimConstantGen') + + parser.add_argument('--inputFPGATrackSimMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True), + help="input matrix file", group="FPGATrackSimConstantGen" ) + + parser.add_argument('--outputFPGATrackSimGoodMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output'), help="output good matrix file", group="FPGATrackSimConstantGen") + + + parser.add_argument('--outputFPGATrackSimGoodMatrixReducedCheckFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True,io='output',type='htt_matrix_good_reduced_check'), help="output reduced good matrix file, check whether 2nd stage is good or not", group="FPGATrackSimConstantGen") + + +if __name__ == '__main__': + main() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTMatrixMerge_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimMatrixMerge_tf.py similarity index 54% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTMatrixMerge_tf.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimMatrixMerge_tf.py index 28565caa1f366774c25f90e6cbe1d3b021699487..be462c71853ae36c7fbe890abb3083c322c16587 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTMatrixMerge_tf.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimMatrixMerge_tf.py @@ -1,9 +1,9 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python -## HTT Simulation Transform -# @version $Id: HTTMatrixMerge_tf.py 574395 2013-12-07 10:13:16Z gvolpi $ +## FPGATrackSim Simulation Transform +# @version $Id: FPGATrackSimMatrixMerge_tf.py 574395 2013-12-07 10:13:16Z gvolpi $ import argparse import sys import time @@ -20,7 +20,7 @@ from PyJobTransforms.transform import transform from PyJobTransforms.trfExe import athenaExecutor from PyJobTransforms.trfDecorators import stdTrfExceptionHandler, sigUsrStackTrace -from TrigHTTConfig.parseRunArgs import addHTTBanksArgs +from FPGATrackSimConfig.parseRunArgs import addFPGATrackSimBanksArgs import PyJobTransforms.trfExceptions as trfExceptions import PyJobTransforms.trfArgClasses as trfArgClasses @@ -41,42 +41,42 @@ def main(): ## Get the base transform with all arguments added def getTransform(): - trf = transform(executor = athenaExecutor(name = 'HTTMatrixMerge', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTMatrixMerge.py')) - addHTTBanksArgs(trf.parser) - addHTTPattGenArgs(trf.parser) + trf = transform(executor = athenaExecutor(name = 'FPGATrackSimMatrixMerge', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimMatrixMerge.py')) + addFPGATrackSimBanksArgs(trf.parser) + addFPGATrackSimPattGenArgs(trf.parser) return trf -def addHTTPattGenArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTMatrixMerge', 'Fast tracker simulation options') +def addFPGATrackSimPattGenArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimMatrixMerge', 'Fast tracker simulation options') parser.add_argument('--NBanks', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Number of pattern banks', group='HTTMatrixMerge') + help='Number of pattern banks', group='FPGATrackSimMatrixMerge') parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Bank region number', group='HTTMatrixMerge') + help='Bank region number', group='FPGATrackSimMatrixMerge') parser.add_argument('--allregions', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Merge all regions', group='HTTMatrixMerge') + help='Merge all regions', group='FPGATrackSimMatrixMerge') parser.add_argument('--genconst', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Generate the sectors and constants', group='HTTMatrixMerge') + help='Generate the sectors and constants', group='FPGATrackSimMatrixMerge') - parser.add_argument('--inputHTTMatrixFile', + parser.add_argument('--inputFPGATrackSimMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True), - help='List of matrix files',group='HTTMatrixMerge',nargs='+') + help='List of matrix files',group='FPGATrackSimMatrixMerge',nargs='+') - parser.add_argument('--HTTMatrixFileRegEx', group="HTTMatrixMerge", + parser.add_argument('--FPGATrackSimMatrixFileRegEx', group="FPGATrackSimMatrixMerge", type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True), help="Regular expression to select the input files from the working dir") - parser.add_argument('--MaxInputFiles', group="HTTMatrixMerge", + parser.add_argument('--MaxInputFiles', group="FPGATrackSimMatrixMerge", type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help="Max number of input files to include, only interpretted when used in combination with HTTMatrixFileRegEx") + help="Max number of input files to include, only interpretted when used in combination with FPGATrackSimMatrixFileRegEx") - parser.add_argument('--outputMergedHTTMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True), - help="Output file", group="HTTMatrixMerge" ) + parser.add_argument('--outputMergedFPGATrackSimMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True), + help="Output file", group="FPGATrackSimMatrixMerge" ) if __name__ == '__main__': main() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTMatrixReduction_tf.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimMatrixReduction_tf.py similarity index 54% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTMatrixReduction_tf.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimMatrixReduction_tf.py index 2a415d1c98f139df5a892e2d4305355f570021d1..c90e2646a0994b2b2333d2f36a3a3b30f5673e0d 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/scripts/HTTMatrixReduction_tf.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/scripts/FPGATrackSimMatrixReduction_tf.py @@ -1,9 +1,9 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python -## HTT Simulation Transform -# @version $Id: HTTMatrixReduction_tf.py 686533 2015-07-30 15:33:01Z tomoya $ +## FPGATrackSim Simulation Transform +# @version $Id: FPGATrackSimMatrixReduction_tf.py 686533 2015-07-30 15:33:01Z tomoya $ import argparse import sys import time @@ -40,27 +40,27 @@ def main(): ## Get the base transform with all arguments added def getTransform(): - trf = transform(executor = athenaExecutor(name = 'HTTMatrixReduction', - skeletonFile = 'TrigHTTBankGen/skeleton.HTTMatrixReduction.py')) - addHTTPattGenArgs(trf.parser) + trf = transform(executor = athenaExecutor(name = 'FPGATrackSimMatrixReduction', + skeletonFile = 'FPGATrackSimBankGen/skeleton.FPGATrackSimMatrixReduction.py')) + addFPGATrackSimPattGenArgs(trf.parser) return trf -def addHTTPattGenArgs(parser): - # Add a specific HTT argument group - parser.defineArgGroup('HTTMatrixReduction', 'Fast tracker simulation options') +def addFPGATrackSimPattGenArgs(parser): + # Add a specific FPGATrackSim argument group + parser.defineArgGroup('FPGATrackSimMatrixReduction', 'Fast tracker simulation options') parser.add_argument('--NBanks', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Number of pattern banks', group='HTTMatrixReduction') + help='Number of pattern banks', group='FPGATrackSimMatrixReduction') parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True), - help='Bank region number', group='HTTMatrixReduction') + help='Bank region number', group='FPGATrackSimMatrixReduction') parser.add_argument('--allregions', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True), - help='Merge all regions', group='HTTMatrixReduction') + help='Merge all regions', group='FPGATrackSimMatrixReduction') - parser.add_argument('--inputHTTMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True), - help="input matrix file", group="HTTMatrixReduction" ) + parser.add_argument('--inputFPGATrackSimMatrixFile', type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile,runarg=True), + help="input matrix file", group="FPGATrackSimMatrixReduction" ) if __name__ == '__main__': main() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTConstGenAlgo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimConstGenAlgo.cxx similarity index 82% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTConstGenAlgo.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimConstGenAlgo.cxx index ac60d4092290d9102e29b72bd11f8537eddd00c2..f09aed336f4896ded57fc29baffe76fa4d171c0a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTConstGenAlgo.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimConstGenAlgo.cxx @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTConstGenAlgo.cxx + * @file FPGATrackSimConstGenAlgo.cxx * @author Unknown; major rewrite Riley Xu - riley.xu@cern.ch * @date May 28th, 2020 * @brief Algorithm to generate fit constants. @@ -11,11 +11,11 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ITHistSvc.h" -#include "TrigHTTBanks/HTTSectorSlice.h" -#include "TrigHTTObjects/HTTConstants.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorSlice.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" -#include "HTTConstGenAlgo.h" -#include "HTTMatrixIO.h" +#include "FPGATrackSimConstGenAlgo.h" +#include "FPGATrackSimMatrixIO.h" #include "TTree.h" #include "TFile.h" @@ -44,21 +44,21 @@ using namespace std; // Initialize /////////////////////////////////////////////////////////////////////////////// -HTTConstGenAlgo::HTTConstGenAlgo(const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimConstGenAlgo::FPGATrackSimConstGenAlgo(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { } -StatusCode HTTConstGenAlgo::initialize() +StatusCode FPGATrackSimConstGenAlgo::initialize() { ATH_MSG_DEBUG("initialize()"); ATH_MSG_DEBUG("Are we going to dump missing hist constants? " << m_dumpMissingHitsConstants); - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); - m_pmap = (m_isSecondStage ? m_HTTMapping->PlaneMap_2nd() : m_HTTMapping->PlaneMap_1st() ); + m_pmap = (m_isSecondStage ? m_FPGATrackSimMapping->PlaneMap_2nd() : m_FPGATrackSimMapping->PlaneMap_1st() ); - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_tHistSvc.retrieve()); if (m_Monitor) ATH_CHECK(bookHistograms()); @@ -75,14 +75,14 @@ StatusCode HTTConstGenAlgo::initialize() m_matrix_tree->SetBranchAddress("ndim", &m_nCoords); m_matrix_tree->SetBranchAddress("nplanes", &m_nLayers); m_matrix_tree->GetEntry(0); - m_nKAverages = m_nCoords - HTTTrackPars::NPARS; + m_nKAverages = m_nCoords - FPGATrackSimTrackPars::NPARS; m_nKernel = m_nKAverages * m_nCoords; m_nCoords_2 = m_nCoords * m_nCoords; - if (static_cast<size_t>(m_nLayers) == m_HTTMapping->PlaneMap_2nd()->getNLogiLayers()) - m_pmap = m_HTTMapping->PlaneMap_2nd(); - else if (static_cast<size_t>(m_nLayers) == m_HTTMapping->PlaneMap_1st()->getNLogiLayers()) - m_pmap = m_HTTMapping->PlaneMap_1st(); + if (static_cast<size_t>(m_nLayers) == m_FPGATrackSimMapping->PlaneMap_2nd()->getNLogiLayers()) + m_pmap = m_FPGATrackSimMapping->PlaneMap_2nd(); + else if (static_cast<size_t>(m_nLayers) == m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers()) + m_pmap = m_FPGATrackSimMapping->PlaneMap_1st(); else ATH_MSG_ERROR("nLayers " << m_nLayers << " doesn't match any pmap"); @@ -98,7 +98,7 @@ StatusCode HTTConstGenAlgo::initialize() std::string tree_name = "am" + std::to_string(0); std::string tree_title = "Ambank " + std::to_string(0) + " matrices"; m_good_tree = new TTree(tree_name.c_str(), tree_title.c_str()); - ATH_CHECK(m_tHistSvc->regTree(("/TRIGHTTTREEGOODOUT/"+tree_name).c_str(), m_good_tree)); + ATH_CHECK(m_tHistSvc->regTree(("/TRIGFPGATrackSimTREEGOODOUT/"+tree_name).c_str(), m_good_tree)); // Run the constant generation generate_constants(); @@ -107,24 +107,24 @@ StatusCode HTTConstGenAlgo::initialize() } -StatusCode HTTConstGenAlgo::bookHistograms() +StatusCode FPGATrackSimConstGenAlgo::bookHistograms() { m_h_vc = new TH1F("h_vc","h_vc",500,-1e-4,1e-4); m_h_vd = new TH1F("h_vd","h_vd",500,-1e-2,1e-2); m_h_vf = new TH1F("h_vf","h_vf",500,-1e-2,1e-2); m_h_vz = new TH1F("h_vz","h_vz",500,-1e-2,1e-2); m_h_veta = new TH1F("h_veta","h_veta",500,-1e-2,1e-2); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTTREEGOODOUT/h_vc",m_h_vc)); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTTREEGOODOUT/h_vd",m_h_vd)); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTTREEGOODOUT/h_vf",m_h_vf)); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTTREEGOODOUT/h_vz",m_h_vz)); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTTREEGOODOUT/h_veta",m_h_veta)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vc",m_h_vc)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vd",m_h_vd)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vf",m_h_vf)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_vz",m_h_vz)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimTREEGOODOUT/h_veta",m_h_veta)); return StatusCode::SUCCESS; } -StatusCode HTTConstGenAlgo::copySliceTree(TFile *file) +StatusCode FPGATrackSimConstGenAlgo::copySliceTree(TFile *file) { // Read old tree TTree *old_tree = (TTree*)file->Get("slice"); @@ -152,7 +152,7 @@ StatusCode HTTConstGenAlgo::copySliceTree(TFile *file) // Write new tree TTree *new_tree = new TTree("slice", "Slice boundaries"); - ATH_CHECK(m_tHistSvc->regTree("/TRIGHTTTREEGOODOUT/slice", new_tree)); + ATH_CHECK(m_tHistSvc->regTree("/TRIGFPGATrackSimTREEGOODOUT/slice", new_tree)); new_tree->Branch("c_max", &m_sliceMax.qOverPt); new_tree->Branch("c_min", &m_sliceMin.qOverPt); @@ -180,7 +180,7 @@ StatusCode HTTConstGenAlgo::copySliceTree(TFile *file) } -StatusCode HTTConstGenAlgo::prepareOutputTree() +StatusCode FPGATrackSimConstGenAlgo::prepareOutputTree() { // Dummy variables for typing int anInt; @@ -216,12 +216,12 @@ StatusCode HTTConstGenAlgo::prepareOutputTree() m_ctree->Branch("kernel", &aDouble, "kernel[nkernel]/D"); m_ctree->Branch("kaverages", &aDouble, "kaverages[nkaverages]/D"); - ATH_CHECK(m_tHistSvc->regTree(("/TRIGHTTCTREEOUT/"+tree_name).c_str(), m_ctree)); + ATH_CHECK(m_tHistSvc->regTree(("/TRIGFPGATrackSimCTREEOUT/"+tree_name).c_str(), m_ctree)); return StatusCode::SUCCESS; } -void HTTConstGenAlgo::readSkipList(size_t nSectors) +void FPGATrackSimConstGenAlgo::readSkipList(size_t nSectors) { m_skipList.resize(nSectors); @@ -247,17 +247,17 @@ void HTTConstGenAlgo::readSkipList(size_t nSectors) // Main function. Generates constants into m_geo_consts, and copies the good matrices into m_good_tree. -void HTTConstGenAlgo::generate_constants() +void FPGATrackSimConstGenAlgo::generate_constants() { - HTTMatrixReader reader(m_matrix_tree, m_nLayers, m_nCoords); - HTTMatrixWriter writer(m_good_tree, m_nLayers, m_nCoords); + FPGATrackSimMatrixReader reader(m_matrix_tree, m_nLayers, m_nCoords); + FPGATrackSimMatrixWriter writer(m_good_tree, m_nLayers, m_nCoords); for (size_t entry = 0; entry < (size_t)m_matrix_tree->GetEntries(); entry++) { // Read the entry if (!m_skipList.empty() && m_skipList[entry]) continue; reader.readEntry(entry); std::vector<module_t> & modules = reader.getModules(); - HTTMatrixAccumulator & acc = reader.getAccumulator(); + FPGATrackSimMatrixAccumulator & acc = reader.getAccumulator(); // Check for sufficient statistics if (acc.track_bins.size() < MIN_TRACK_SEC) @@ -267,7 +267,7 @@ void HTTConstGenAlgo::generate_constants() } // Scale and normalize the accumulated variables - HTTMatrixAccumulator acc_norm = normalize(acc); + FPGATrackSimMatrixAccumulator acc_norm = normalize(acc); // Create the constants geo_constants geo(m_nCoords); @@ -284,7 +284,7 @@ void HTTConstGenAlgo::generate_constants() } } -void HTTConstGenAlgo::createMissingHitsConstants(HTTMatrixAccumulator const & acc_norm, size_t entry) +void FPGATrackSimConstGenAlgo::createMissingHitsConstants(FPGATrackSimMatrixAccumulator const & acc_norm, size_t entry) { for (int ip = 0; ip < m_nLayers; ip++) { @@ -322,12 +322,12 @@ void HTTConstGenAlgo::createMissingHitsConstants(HTTMatrixAccumulator const & ac } } -bool HTTConstGenAlgo::GetConstants(HTTMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber) +bool FPGATrackSimConstGenAlgo::GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber) { return GetConstants(acc_norm, geo, entryNumber, acc_norm.coords_usable, acc_norm.nusable()); } -bool HTTConstGenAlgo::GetConstants(HTTMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber, std::vector<bool> const &coordsToUse, unsigned int nusable) +bool FPGATrackSimConstGenAlgo::GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber, std::vector<bool> const &coordsToUse, unsigned int nusable) { // Get the reduced matrix and invert it TMatrixD mtx_reduced = getReducedMatrix(m_nCoords, acc_norm.covariance, coordsToUse, nusable); @@ -355,7 +355,7 @@ bool HTTConstGenAlgo::GetConstants(HTTMatrixAccumulator const &acc_norm, geo_con return true; } -void HTTConstGenAlgo::fillConstTree(std::vector<module_t> & modules, HTTMatrixAccumulator & acc, geo_constants & geo) +void FPGATrackSimConstGenAlgo::fillConstTree(std::vector<module_t> & modules, FPGATrackSimMatrixAccumulator & acc, geo_constants & geo) { float coverage = static_cast<float>(acc.track_bins.size()); m_ctree->SetBranchAddress("sectorID", acc.FTK_modules.data()); @@ -393,7 +393,7 @@ void HTTConstGenAlgo::fillConstTree(std::vector<module_t> & modules, HTTMatrixAc } -bool HTTConstGenAlgo::isNAN(double value, const char* name) +bool FPGATrackSimConstGenAlgo::isNAN(double value, const char* name) { if (TMath::IsNaN(value)) { @@ -406,7 +406,7 @@ bool HTTConstGenAlgo::isNAN(double value, const char* name) #define CHECK_NAN(var) (isNAN((var), #var)) // Check if constants are bad (eg, contain "nan") -bool HTTConstGenAlgo::failedConstants(geo_constants const & geo, std::vector<bool> const & usable) +bool FPGATrackSimConstGenAlgo::failedConstants(geo_constants const & geo, std::vector<bool> const & usable) { geo_constants gco = calculate_gcorth(geo, m_nCoords, usable); @@ -435,7 +435,7 @@ bool HTTConstGenAlgo::failedConstants(geo_constants const & geo, std::vector<boo if (CHECK_NAN(geo.Veta[i])) return true; } - for (int i = 0; i < m_nCoords - HTTTrackPars::NPARS; i++) + for (int i = 0; i < m_nCoords - FPGATrackSimTrackPars::NPARS; i++) { if (CHECK_NAN(geo.kaverages[i])) return true; for (int j = 0; j < m_nCoords; j++) @@ -457,13 +457,13 @@ bool HTTConstGenAlgo::failedConstants(geo_constants const & geo, std::vector<boo * is converted into the actual covariance matrix. The hix_x_par fields are * converted from sum(x_k p_i) to <x_k p_i> - <x_k> <p_i>. */ -HTTMatrixAccumulator HTTConstGenAlgo::normalize(HTTMatrixAccumulator const & acc_raw) +FPGATrackSimMatrixAccumulator FPGATrackSimConstGenAlgo::normalize(FPGATrackSimMatrixAccumulator const & acc_raw) { - HTTMatrixAccumulator acc(acc_raw); + FPGATrackSimMatrixAccumulator acc(acc_raw); double coverage = static_cast<double>(acc.track_bins.size()); size_t nCoords = acc.hit_coords.size(); - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) acc.pars[i] /= coverage; for (unsigned i = 0; i < nCoords; i++) @@ -494,7 +494,7 @@ HTTMatrixAccumulator HTTConstGenAlgo::normalize(HTTMatrixAccumulator const & acc } -geo_constants HTTConstGenAlgo::makeConsts(HTTMatrixAccumulator const & acc, std::vector<bool> const & usable, +geo_constants FPGATrackSimConstGenAlgo::makeConsts(FPGATrackSimMatrixAccumulator const & acc, std::vector<bool> const & usable, std::vector<double> const & inv_covariance, std::vector<double> const & eigvals, vector2D<double> const & eigvecs) { @@ -507,7 +507,7 @@ geo_constants HTTConstGenAlgo::makeConsts(HTTMatrixAccumulator const & acc, std: geo.Vz0 = matrix_multiply(inv_covariance, acc.hit_x_z0); geo.Veta = matrix_multiply(inv_covariance, acc.hit_x_eta); - for (size_t i = 0; i < nCoords - HTTTrackPars::NPARS; i++) + for (size_t i = 0; i < nCoords - FPGATrackSimTrackPars::NPARS; i++) { if (!usable[i]) continue; // vectors are filled with 0's by default for (size_t j = 0; j < nCoords; j++) @@ -542,7 +542,7 @@ geo_constants HTTConstGenAlgo::makeConsts(HTTMatrixAccumulator const & acc, std: * @param b - length-n vector * @return A * b (length-n vector) */ -std::vector<double> HTTConstGenAlgo::matrix_multiply(std::vector<double> const & A, std::vector<double> const & b) +std::vector<double> FPGATrackSimConstGenAlgo::matrix_multiply(std::vector<double> const & A, std::vector<double> const & b) { size_t n = b.size(); std::vector<double> x(n); @@ -555,7 +555,7 @@ std::vector<double> HTTConstGenAlgo::matrix_multiply(std::vector<double> const & } -bool HTTConstGenAlgo::isSingular(TMatrixD mtx) +bool FPGATrackSimConstGenAlgo::isSingular(TMatrixD mtx) { TDecompLU dc(mtx); // note mtx is a copy bool ok = dc.InvertLU(mtx, MTX_TOLERANCE); @@ -571,7 +571,7 @@ bool HTTConstGenAlgo::isSingular(TMatrixD mtx) * @param usable - Which rows/columns are to be kept (size n) * @param nDimToUse - Must be count(usable), size of output matrix */ -TMatrixD HTTConstGenAlgo::getReducedMatrix(size_t n, std::vector<double> const & mtx_v, std::vector<bool> const & usable, size_t nDimToUse) +TMatrixD FPGATrackSimConstGenAlgo::getReducedMatrix(size_t n, std::vector<double> const & mtx_v, std::vector<bool> const & usable, size_t nDimToUse) { TMatrixD mtx(n, n, mtx_v.data()); TMatrixD newmtx(nDimToUse, nDimToUse); @@ -604,7 +604,7 @@ TMatrixD HTTConstGenAlgo::getReducedMatrix(size_t n, std::vector<double> const & * @param mtx - A reduced matrix to be inverted (size n_redu * n_redu) * @param usable - Which rows/columns were kept (size n_full, count(usable == n_redu)) */ -std::vector<double> HTTConstGenAlgo::invert(size_t n_full, TMatrixD mtx, std::vector<bool> const & usable) +std::vector<double> FPGATrackSimConstGenAlgo::invert(size_t n_full, TMatrixD mtx, std::vector<bool> const & usable) { // Output std::vector<double> inv(n_full * n_full); // filled with 0s @@ -643,7 +643,7 @@ std::vector<double> HTTConstGenAlgo::invert(size_t n_full, TMatrixD mtx, std::ve * @param eigvals_v - Output eigenvalues (n_full), with !usable indices filled with 0 * @param eigvecs_v - Output eigenvectors (n_full * n_full, ROW! oriented), with !usable rows & columns filled with 0 */ -void HTTConstGenAlgo::eigen(size_t n_redu, size_t n_full, TMatrixD &mtx, std::vector<bool> const & usable, std::vector<double> & eigvals_full, vector2D<double> & eigvecs_full) +void FPGATrackSimConstGenAlgo::eigen(size_t n_redu, size_t n_full, TMatrixD &mtx, std::vector<bool> const & usable, std::vector<double> & eigvals_full, vector2D<double> & eigvecs_full) { // Reduced system (these are sorted by decreasing |eigenvalue|) @@ -674,7 +674,7 @@ void HTTConstGenAlgo::eigen(size_t n_redu, size_t n_full, TMatrixD &mtx, std::ve } -double HTTConstGenAlgo::dot(const double* vec1, const double* vec2, size_t size) +double FPGATrackSimConstGenAlgo::dot(const double* vec1, const double* vec2, size_t size) { double total = 0; for (size_t i = 0; i < size; i++) @@ -683,9 +683,9 @@ double HTTConstGenAlgo::dot(const double* vec1, const double* vec2, size_t size) } -geo_constants HTTConstGenAlgo::calculate_gcorth(geo_constants geo, int nCoords, std::vector<bool> const & usable) +geo_constants FPGATrackSimConstGenAlgo::calculate_gcorth(geo_constants geo, int nCoords, std::vector<bool> const & usable) { - for (int i = 0; i < nCoords - HTTTrackPars::NPARS;i++) + for (int i = 0; i < nCoords - FPGATrackSimTrackPars::NPARS;i++) { if (!usable[i]) continue; double norm = dot(geo.kernel[i], geo.kernel[i], nCoords); @@ -708,7 +708,7 @@ geo_constants HTTConstGenAlgo::calculate_gcorth(geo_constants geo, int nCoords, } -StatusCode HTTConstGenAlgo::execute() +StatusCode FPGATrackSimConstGenAlgo::execute() { // Do nothing; this class does not process events. The main algorithm is // called in initialize() and finalize(). @@ -721,7 +721,7 @@ StatusCode HTTConstGenAlgo::execute() /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTConstGenAlgo::finalize() +StatusCode FPGATrackSimConstGenAlgo::finalize() { ATH_MSG_DEBUG("finalize()"); @@ -746,12 +746,12 @@ StatusCode HTTConstGenAlgo::finalize() } -void HTTConstGenAlgo::writeSectors() +void FPGATrackSimConstGenAlgo::writeSectors() { - // Create HTTSectorSlice - HTTTrackPars copymin = m_sliceMin; - HTTTrackPars copymax = m_sliceMax; - HTTSectorSlice slice(m_geo_consts.size(), m_sliceNBins, copymin, copymax); + // Create FPGATrackSimSectorSlice + FPGATrackSimTrackPars copymin = m_sliceMin; + FPGATrackSimTrackPars copymax = m_sliceMax; + FPGATrackSimSectorSlice slice(m_geo_consts.size(), m_sliceNBins, copymin, copymax); // Open files std::string sector_filename = "sectors_raw_" + std::to_string(m_nLayers) + "L_reg" + std::to_string(m_region) + "_checkGood" + std::to_string(m_CheckGood2ndStage) + ".patt"; @@ -763,10 +763,10 @@ void HTTConstGenAlgo::writeSectors() fprintf(sectorHW_file,"%zu %d\n",m_geo_consts.size(),m_nLayers); // Write sectors - HTTMatrixReader reader(m_good_tree, m_nLayers, m_nCoords); + FPGATrackSimMatrixReader reader(m_good_tree, m_nLayers, m_nCoords); while (reader.nextEntry()) { - HTTMatrixAccumulator const & acc = reader.getAccumulator(); + FPGATrackSimMatrixAccumulator const & acc = reader.getAccumulator(); size_t sector = reader.getEntry(); fprintf(sector_file,"%zu ", sector); @@ -781,7 +781,7 @@ void HTTConstGenAlgo::writeSectors() fprintf(sectorHW_file,"0 %zu", acc.track_bins.size()); fprintf(sectorHW_file,"\n"); - for (HTTTrackParsI const & pars : acc.track_bins) + for (FPGATrackSimTrackParsI const & pars : acc.track_bins) slice.addSectorToSlice(sector, pars); } @@ -793,7 +793,7 @@ void HTTConstGenAlgo::writeSectors() // ASCII file writeout -void HTTConstGenAlgo::DumpConstants(std::vector<geo_constants> &geo_consts, std::string & filename) +void FPGATrackSimConstGenAlgo::DumpConstants(std::vector<geo_constants> &geo_consts, std::string & filename) { FILE *const_file = fopen(filename.c_str(),"w"); @@ -843,12 +843,12 @@ void HTTConstGenAlgo::DumpConstants(std::vector<geo_constants> &geo_consts, std: } fprintf(const_file,"kaverages\n"); - for(int i=0;i<m_nCoords-HTTTrackPars::NPARS;i++){ + for(int i=0;i<m_nCoords-FPGATrackSimTrackPars::NPARS;i++){ fprintf(const_file,"%e\n",m_geo_consts[sector].kaverages[i]); } fprintf(const_file,"kernel\n"); - for(int i=0;i<m_nCoords-HTTTrackPars::NPARS;i++){ + for(int i=0;i<m_nCoords-FPGATrackSimTrackPars::NPARS;i++){ for(int j=0;j<m_nCoords;j++){ fprintf(const_file,"%e\n",geo_consts[sector].kernel(i, j)); } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTConstGenAlgo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimConstGenAlgo.h similarity index 74% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTConstGenAlgo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimConstGenAlgo.h index c11ba12c80beca54bca0870ddf9f5b342926f346..96177096df2f003ed65cd008b8c8bbf8bc7126e2 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTConstGenAlgo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimConstGenAlgo.h @@ -1,16 +1,16 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTConstGenAlgo_h -#define HTTConstGenAlgo_h +#ifndef FPGATrackSimConstGenAlgo_h +#define FPGATrackSimConstGenAlgo_h /** - * @file HTTConstGenAlgo.h + * @file FPGATrackSimConstGenAlgo.h * @author Unknown; major rewrite Riley Xu - riley.xu@cern.ch * @date May 28th, 2020 * @brief Algorithm to generate fit constants. * - * This algorithm inputs matrix files generated by HTTMatrixGenAlgo, - * and outputs ROOT/text files containing the fit constants used by HTT to fit + * This algorithm inputs matrix files generated by FPGATrackSimMatrixGenAlgo, + * and outputs ROOT/text files containing the fit constants used by FPGATrackSim to fit * tracks. Each sector contains the information in geo_constants struct declared * below. * @@ -26,11 +26,11 @@ #include "GaudiKernel/ITHistSvc.h" #include "AthenaBaseComps/AthAlgorithm.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include "TTree.h" -#include "HTTMatrixAccumulator.h" +#include "FPGATrackSimMatrixAccumulator.h" #include <string> #include <vector> @@ -41,7 +41,7 @@ #include "TH1I.h" #include "TH1F.h" -class ITrigHTTMappingSvc; +class IFPGATrackSimMappingSvc; // data structure that contain definition of geometrical constants for linear fits @@ -57,7 +57,7 @@ struct geo_constants std::vector<double> kaverages; // averages, useful to keep track of // these are the constant/offset values - HTTTrackPars pars; + FPGATrackSimTrackPars pars; int real; // this value is greater than 0 if these constants are correctly evaulated @@ -67,8 +67,8 @@ struct geo_constants Vphi(nCoords), Vz0(nCoords), Veta(nCoords), - kernel(nCoords - HTTTrackPars::NPARS, nCoords), - kaverages(nCoords - HTTTrackPars::NPARS), + kernel(nCoords - FPGATrackSimTrackPars::NPARS, nCoords), + kaverages(nCoords - FPGATrackSimTrackPars::NPARS), pars(0), real(0) { @@ -76,12 +76,12 @@ struct geo_constants }; -class HTTConstGenAlgo : public AthAlgorithm +class FPGATrackSimConstGenAlgo : public AthAlgorithm { public: - HTTConstGenAlgo(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTConstGenAlgo() = default; + FPGATrackSimConstGenAlgo(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimConstGenAlgo() = default; StatusCode initialize() override; StatusCode finalize() override; @@ -95,10 +95,10 @@ class HTTConstGenAlgo : public AthAlgorithm /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping{this, "TrigHTTMappingSvc","TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this, "FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; ServiceHandle<ITHistSvc> m_tHistSvc{this, "THistSvc","THistSvc"}; - const HTTPlaneMap* m_pmap = nullptr; + const FPGATrackSimPlaneMap* m_pmap = nullptr; @@ -130,9 +130,9 @@ class HTTConstGenAlgo : public AthAlgorithm /////////////////////////////////////////////////////////////////////// // Slice Info - HTTTrackParsI m_sliceNBins; - HTTTrackPars m_sliceMin; - HTTTrackPars m_sliceMax; + FPGATrackSimTrackParsI m_sliceNBins; + FPGATrackSimTrackPars m_sliceMin; + FPGATrackSimTrackPars m_sliceMax; /////////////////////////////////////////////////////////////////////// // Sizes @@ -164,16 +164,16 @@ class HTTConstGenAlgo : public AthAlgorithm StatusCode prepareOutputTree(); void readSkipList(size_t nEntries); void generate_constants(); - void fillConstTree(std::vector<module_t> & modules, HTTMatrixAccumulator & acc, geo_constants & geo); + void fillConstTree(std::vector<module_t> & modules, FPGATrackSimMatrixAccumulator & acc, geo_constants & geo); bool isNAN(double value, const char* name); bool failedConstants(geo_constants const & geo, std::vector<bool> const & usable); void DumpConstants(std::vector<geo_constants> &geo_consts, std::string & filename); void writeSectors(); - bool GetConstants(HTTMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber); // use values in acc_norm - bool GetConstants(HTTMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber, std::vector<bool> const &coordsToUse, unsigned int nusable); // full method with different number of usable coordinates - void createMissingHitsConstants(HTTMatrixAccumulator const & acc_norm, size_t entry); - HTTMatrixAccumulator normalize(HTTMatrixAccumulator const & acc_raw); - geo_constants makeConsts(HTTMatrixAccumulator const & acc, std::vector<bool> const & usable, + bool GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber); // use values in acc_norm + bool GetConstants(FPGATrackSimMatrixAccumulator const &acc_norm, geo_constants &geo, int entryNumber, std::vector<bool> const &coordsToUse, unsigned int nusable); // full method with different number of usable coordinates + void createMissingHitsConstants(FPGATrackSimMatrixAccumulator const & acc_norm, size_t entry); + FPGATrackSimMatrixAccumulator normalize(FPGATrackSimMatrixAccumulator const & acc_raw); + geo_constants makeConsts(FPGATrackSimMatrixAccumulator const & acc, std::vector<bool> const & usable, std::vector<double> const & inv_covariance, std::vector<double> const & eigvals, vector2D<double> const & eigvecs); std::vector<double> matrix_multiply(std::vector<double> const & A, std::vector<double> const & b); @@ -188,5 +188,5 @@ class HTTConstGenAlgo : public AthAlgorithm }; -#endif // HTTConstGenAlgo_h +#endif // FPGATrackSimConstGenAlgo_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixAccumulator.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixAccumulator.cxx similarity index 85% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixAccumulator.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixAccumulator.cxx index 09cd229fb35214193c61803b693961176558f32c..3d323e08990cb3fa4a0c6fa7e6fcff31ad8f27d8 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixAccumulator.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixAccumulator.cxx @@ -1,13 +1,13 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTMatrixAccumulator.cxx + * @file FPGATrackSimMatrixAccumulator.cxx * @author Riley Xu - riley.xu@cern.ch * @date May 8th, 2020 * @brief Helper struct and functions for accumulating sector information for matrix generation. */ -#include "HTTMatrixAccumulator.h" +#include "FPGATrackSimMatrixAccumulator.h" /** @@ -19,7 +19,7 @@ * * @return true if a new sector was just added, and false if acc was accumulated into an existing item. */ -bool accumulate(AccumulateMap & map, std::vector<module_t> const & modules, HTTMatrixAccumulator const & acc) +bool accumulate(AccumulateMap & map, std::vector<module_t> const & modules, FPGATrackSimMatrixAccumulator const & acc) { auto it = map.find(modules); if (it == map.end()) // Create new entry @@ -30,7 +30,7 @@ bool accumulate(AccumulateMap & map, std::vector<module_t> const & modules, HTTM else // Add/append entries { - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) it->second.pars[i] += acc.pars[i]; size_t nDim = acc.hit_coords.size(); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixAccumulator.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixAccumulator.h similarity index 84% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixAccumulator.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixAccumulator.h index 91a5f94b9d8026e351c5276f61b792d46e28911e..50e260d0ccc0cd854dfef37d06fbd9f79edd10a6 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixAccumulator.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixAccumulator.h @@ -1,11 +1,11 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTMATRIXACCUMULATOR_H -#define HTTMATRIXACCUMULATOR_H +#ifndef FPGATrackSimMATRIXACCUMULATOR_H +#define FPGATrackSimMATRIXACCUMULATOR_H /** - * @file HTTMatrixAccumulator.h + * @file FPGATrackSimMatrixAccumulator.h * @author Riley Xu - riley.xu@cern.ch * @date May 8th, 2020 * @brief Helper struct for accumulating sector information for matrix generation. @@ -22,21 +22,21 @@ #include "TTree.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" /* * This struct stores all the information in the matrix file for a single sector. * It is an accumulation of relevant track properties from training truth tracks * used to create the sector. These are later used to generate the fit constants. - * See comments in HTTConstGenAlgo.h. + * See comments in FPGATrackSimConstGenAlgo.h. */ -struct HTTMatrixAccumulator +struct FPGATrackSimMatrixAccumulator { // nCoords is the number of hit coordinates for a full 13/13 track // (i.e. +2 per pixel layer, +1 per strip layer) -HTTMatrixAccumulator(unsigned nLayers, unsigned nCoords) : +FPGATrackSimMatrixAccumulator(unsigned nLayers, unsigned nCoords) : FTK_modules(nLayers), coords_usable(nCoords), hit_coords(nCoords), @@ -67,7 +67,7 @@ HTTMatrixAccumulator(unsigned nLayers, unsigned nCoords) : // For each track in this sector, add up the following variables. /////////////////////////////////////////////////////////////////////////// - HTTTrackPars pars; + FPGATrackSimTrackPars pars; // The hit_* vectors have size nCoords. For example, hit_x_phi stores the hit // coordinates times phi for each track, so after accumulation @@ -88,7 +88,7 @@ HTTMatrixAccumulator(unsigned nLayers, unsigned nCoords) : // For each track in this sector, append to these variables. /////////////////////////////////////////////////////////////////////////// - std::vector<HTTTrackParsI> track_bins; // Size # tracks (coverage). + std::vector<FPGATrackSimTrackParsI> track_bins; // Size # tracks (coverage). // Stores the binned track parameters of each track. // Note track_bins.size() conveniently also stores the coverage of this sector. }; @@ -105,7 +105,7 @@ struct container_hash // A useful typedef for the matrix algorithms. // Maps the sector definition (list of module identifier hashes) to an accumulator. -typedef std::unordered_map<std::vector<module_t>, HTTMatrixAccumulator, container_hash<std::vector<module_t>>> AccumulateMap; +typedef std::unordered_map<std::vector<module_t>, FPGATrackSimMatrixAccumulator, container_hash<std::vector<module_t>>> AccumulateMap; /** @@ -117,7 +117,7 @@ typedef std::unordered_map<std::vector<module_t>, HTTMatrixAccumulator, containe * * @return true if a new sector was just added, and false if acc was accumulated into an existing item. */ -bool accumulate(AccumulateMap & map, std::vector<module_t> const & modules, HTTMatrixAccumulator const & acc); +bool accumulate(AccumulateMap & map, std::vector<module_t> const & modules, FPGATrackSimMatrixAccumulator const & acc); #endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixGenAlgo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixGenAlgo.cxx similarity index 69% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixGenAlgo.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixGenAlgo.cxx index 5dbff86616ad12456fdf607088040372aac61c84..403ec65626bfd635a0de1b9a4b6a1fa93b3f7984 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixGenAlgo.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixGenAlgo.cxx @@ -1,19 +1,19 @@ // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTMatrixGenAlgo.cxx + * @file FPGATrackSimMatrixGenAlgo.cxx * @author Rewrite by Riley Xu - riley.xu@cern.ch after FTK code * @date May 8th, 2020 - * @brief See HTTMatrixGenAlgo.h + * @brief See FPGATrackSimMatrixGenAlgo.h */ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ITHistSvc.h" -#include "HTTMatrixGenAlgo.h" -#include "HTTMatrixAccumulator.h" -#include "TrigHTTConfTools/HTTRegionSlices.h" -#include "TrigHTTObjects/HTTConstants.h" +#include "FPGATrackSimMatrixGenAlgo.h" +#include "FPGATrackSimMatrixAccumulator.h" +#include "FPGATrackSimConfTools/FPGATrackSimRegionSlices.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" #include "TruthUtils/MagicNumbers.h" #include "TH1.h" @@ -32,7 +32,7 @@ // Constructors /////////////////////////////////////////////////////////////////////////////// -HTTMatrixGenAlgo::HTTMatrixGenAlgo(const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimMatrixGenAlgo::FPGATrackSimMatrixGenAlgo(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { } @@ -43,7 +43,7 @@ HTTMatrixGenAlgo::HTTMatrixGenAlgo(const std::string& name, ISvcLocator* pSvcLoc // Initialize /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixGenAlgo::initialize() +StatusCode FPGATrackSimMatrixGenAlgo::initialize() { ATH_MSG_DEBUG("initialize()"); @@ -68,7 +68,7 @@ StatusCode HTTMatrixGenAlgo::initialize() // Retrieve handles ATH_CHECK(m_tHistSvc.retrieve()); - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_hitInputTool.retrieve()); ATH_CHECK(m_hitMapTool.retrieve()); ATH_CHECK(m_EvtSel.retrieve()); @@ -80,19 +80,19 @@ StatusCode HTTMatrixGenAlgo::initialize() ATH_MSG_INFO("Hough constants method needs idealized geometry > 0, aborting."); return StatusCode::FAILURE; } - m_pmap = m_HTTMapping->PlaneMap_1st(); + m_pmap = m_FPGATrackSimMapping->PlaneMap_1st(); // Get detector configurations - m_nLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); - m_nRegions = m_HTTMapping->RegionMap_1st()->getNRegions(); - m_nDim = m_HTTMapping->PlaneMap_1st()->getNCoords(); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); + m_nRegions = m_FPGATrackSimMapping->RegionMap_1st()->getNRegions(); + m_nDim = m_FPGATrackSimMapping->PlaneMap_1st()->getNCoords(); } else { - m_pmap = m_HTTMapping->PlaneMap_2nd(); + m_pmap = m_FPGATrackSimMapping->PlaneMap_2nd(); // Get detector configurations - m_nLayers = m_HTTMapping->PlaneMap_2nd()->getNLogiLayers(); - m_nRegions = m_HTTMapping->RegionMap_2nd()->getNRegions(); - m_nDim = m_HTTMapping->PlaneMap_2nd()->getNCoords(); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_2nd()->getNLogiLayers(); + m_nRegions = m_FPGATrackSimMapping->RegionMap_2nd()->getNRegions(); + m_nDim = m_FPGATrackSimMapping->PlaneMap_2nd()->getNCoords(); } m_nDim2 = m_nDim * m_nDim; @@ -105,60 +105,60 @@ StatusCode HTTMatrixGenAlgo::initialize() // Histograms ATH_CHECK(bookHistograms()); - m_eventHeader = new HTTEventInputHeader(); + m_eventHeader = new FPGATrackSimEventInputHeader(); return StatusCode::SUCCESS; } -StatusCode HTTMatrixGenAlgo::bookHistograms() +StatusCode FPGATrackSimMatrixGenAlgo::bookHistograms() { // Training tracks - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) { - std::string name = "h_trainingTrack_" + HTTTrackPars::parName(i); - std::string title = HTTTrackPars::parName(i) + " of tracks passing pt/barcode check"; + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { + std::string name = "h_trainingTrack_" + FPGATrackSimTrackPars::parName(i); + std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks passing pt/barcode check"; m_h_trainingTrack[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/" + name, m_h_trainingTrack[i])); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_trainingTrack[i])); } // Sector pars - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) { + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { - std::string name = "h_sectorPars_" + HTTTrackPars::parName(i); - std::string title = "Average " + HTTTrackPars::parName(i) + " in sector"; + std::string name = "h_sectorPars_" + FPGATrackSimTrackPars::parName(i); + std::string title = "Average " + FPGATrackSimTrackPars::parName(i) + " in sector"; m_h_sectorPars[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/" + name, m_h_sectorPars[i])); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_sectorPars[i])); } // Select hit failure - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) { + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { - std::string name = "h_SHfailure_" + HTTTrackPars::parName(i); - std::string title = HTTTrackPars::parName(i) + " of tracks failing in selectHit()"; + std::string name = "h_SHfailure_" + FPGATrackSimTrackPars::parName(i); + std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks failing in selectHit()"; m_h_SHfailure[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/" + name, m_h_SHfailure[i])); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_SHfailure[i])); } // 3 hits in layer - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) { + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { - std::string name = "h_3hitsInLayer_" + HTTTrackPars::parName(i); - std::string title = HTTTrackPars::parName(i) + " of tracks containing 3+ hits in a single layer"; + std::string name = "h_3hitsInLayer_" + FPGATrackSimTrackPars::parName(i); + std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks containing 3+ hits in a single layer"; m_h_3hitsInLayer[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/" + name, m_h_3hitsInLayer[i])); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_3hitsInLayer[i])); } // Not enough hits - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) { - std::string name = "h_notEnoughHits_" + HTTTrackPars::parName(i); - std::string title = HTTTrackPars::parName(i) + " of tracks failing because it didn't have enough hits"; + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { + std::string name = "h_notEnoughHits_" + FPGATrackSimTrackPars::parName(i); + std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks failing because it didn't have enough hits"; m_h_notEnoughHits[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/" + name, m_h_notEnoughHits[i])); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_notEnoughHits[i])); } m_h_trackQoP_okHits = new TH1I("h_trackQoP_okHits", "half inverse pt of tracks passing hit check", @@ -167,17 +167,17 @@ StatusCode HTTMatrixGenAlgo::bookHistograms() m_nBins.qOverPt, m_sliceMin.qOverPt, m_sliceMax.qOverPt); m_h_nHit = new TH1I("h_nHit", "number of hits in sector", 100, 0, 100); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_trackQoP_okHits", m_h_trackQoP_okHits)); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_trackQoP_okRegion", m_h_trackQoP_okRegion)); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_nHit",m_h_nHit)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_trackQoP_okHits", m_h_trackQoP_okHits)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_trackQoP_okRegion", m_h_trackQoP_okRegion)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_nHit",m_h_nHit)); return StatusCode::SUCCESS; } -void fillTrackPars(TH1I* const hists[HTTTrackPars::NPARS], HTTTruthTrack const & track) +void fillTrackPars(TH1I* const hists[FPGATrackSimTrackPars::NPARS], FPGATrackSimTruthTrack const & track) { - HTTTrackPars pars = track.getPars(); - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + FPGATrackSimTrackPars pars = track.getPars(); + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) hists[i]->Fill(pars[i]); } @@ -186,7 +186,7 @@ void fillTrackPars(TH1I* const hists[HTTTrackPars::NPARS], HTTTruthTrack const & /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixGenAlgo::execute() +StatusCode FPGATrackSimMatrixGenAlgo::execute() { ATH_MSG_DEBUG("execute()"); m_eventHeader->clearHits(); @@ -195,10 +195,10 @@ StatusCode HTTMatrixGenAlgo::execute() // Get hits and training tracks from this event ATH_CHECK(m_hitInputTool->readData(m_eventHeader, Gaudi::Hive::currentContext())); - std::vector<HTTHit> hits = getLogicalHits(); + std::vector<FPGATrackSimHit> hits = getLogicalHits(); - std::vector<HTTTruthTrack> truth_tracks = m_eventHeader->optional().getTruthTracks(); - std::vector<HTTTruthTrack> tracks = filterTrainingTracks(truth_tracks); + std::vector<FPGATrackSimTruthTrack> truth_tracks = m_eventHeader->optional().getTruthTracks(); + std::vector<FPGATrackSimTruthTrack> tracks = filterTrainingTracks(truth_tracks); m_nTracks += truth_tracks.size(); if (tracks.empty()) { @@ -207,16 +207,16 @@ StatusCode HTTMatrixGenAlgo::execute() } // Prepare a map of the hits according the barcode - std::map<int, std::vector<HTTHit>> barcode_hits = makeBarcodeMap(hits, tracks); + std::map<int, std::vector<FPGATrackSimHit>> barcode_hits = makeBarcodeMap(hits, tracks); // For each training track, find the sector it belongs to and accumulate the // hit coordinates and track parameters. - for (HTTTruthTrack const & track : tracks) { + for (FPGATrackSimTruthTrack const & track : tracks) { // Get list of hits associated to the current truth track - std::vector<HTTHit> & track_hits = barcode_hits[track.getBarcode()]; + std::vector<FPGATrackSimHit> & track_hits = barcode_hits[track.getBarcode()]; // Get the hits that will form the actual sector - std::vector<HTTHit> sector_hits; + std::vector<FPGATrackSimHit> sector_hits; bool success = filterSectorHits(track_hits, sector_hits, track); if (!success) continue; // Skip this track if it has bad hits (not complete, etc.) m_h_trackQoP_okHits->Fill(track.getQOverPt()); @@ -227,20 +227,20 @@ StatusCode HTTMatrixGenAlgo::execute() m_h_trackQoP_okRegion->Fill(track.getQOverPt()); //For the Hough constants, find the Hough roads - std::vector<HTTRoad_Hough*> houghRoads; + std::vector<FPGATrackSimRoad_Hough*> houghRoads; if (m_doHoughConstants){ - std::vector<const HTTHit*> phits; - std::vector<HTTRoad*> roads; + std::vector<const FPGATrackSimHit*> phits; + std::vector<FPGATrackSimRoad*> roads; - for (const HTTHit& hit : sector_hits) phits.push_back(&hit); + for (const FPGATrackSimHit& hit : sector_hits) phits.push_back(&hit); StatusCode sc = m_roadFinderTool->getRoads(phits, roads); if (sc.isFailure()) ATH_MSG_WARNING("Hough Transform -> getRoads() failed"); if (!roads.empty()){ - for (HTTRoad* r : roads){ - HTTRoad_Hough* hr = dynamic_cast<HTTRoad_Hough*>(r); + for (FPGATrackSimRoad* r : roads){ + FPGATrackSimRoad_Hough* hr = dynamic_cast<FPGATrackSimRoad_Hough*>(r); houghRoads.push_back(hr); } } @@ -250,16 +250,16 @@ StatusCode HTTMatrixGenAlgo::execute() double x = 0.0; //For each Hough road, make the accumulator - for (HTTRoad_Hough* hr : houghRoads){ + for (FPGATrackSimRoad_Hough* hr : houghRoads){ y = hr->getY(); x = hr->getX(); // Prepare the accumulator struct std::vector<module_t> modules(m_nLayers); - HTTMatrixAccumulator acc(m_nLayers, m_nDim); + FPGATrackSimMatrixAccumulator acc(m_nLayers, m_nDim); acc.pars.qOverPt = y; acc.pars.phi = x; - std::pair<std::vector<module_t>, HTTMatrixAccumulator> modules_acc = {modules, acc}; + std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> modules_acc = {modules, acc}; ATH_CHECK(makeAccumulator(sector_hits, track, modules_acc)); // Add the track to the accumulate map @@ -275,8 +275,8 @@ StatusCode HTTMatrixGenAlgo::execute() else{ // Prepare the accumulator struct std::vector<module_t> modules(m_nLayers); - HTTMatrixAccumulator acc(m_nLayers, m_nDim); - std::pair<std::vector<module_t>, HTTMatrixAccumulator> modules_acc = {modules, acc}; + FPGATrackSimMatrixAccumulator acc(m_nLayers, m_nDim); + std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> modules_acc = {modules, acc}; ATH_CHECK(makeAccumulator(sector_hits, track, modules_acc)); // Add the track to the accumulate map @@ -289,13 +289,13 @@ StatusCode HTTMatrixGenAlgo::execute() } -// Converts raw hits from header into logical hits, and filters those in HTT layers +// Converts raw hits from header into logical hits, and filters those in FPGATrackSim layers // Could replace this with the RawToLogical tool -std::vector<HTTHit> HTTMatrixGenAlgo::getLogicalHits() +std::vector<FPGATrackSimHit> FPGATrackSimMatrixGenAlgo::getLogicalHits() { - std::vector<HTTHit> hits; + std::vector<FPGATrackSimHit> hits; //Setup the logical header... - HTTLogicalEventInputHeader logicalHeader; + FPGATrackSimLogicalEventInputHeader logicalHeader; //Map the hits to the logical header... unsigned stage = 0; if (m_doHoughConstants) stage = 1; // For now Hough constants only works on 1st stage @@ -304,19 +304,19 @@ std::vector<HTTHit> HTTMatrixGenAlgo::getLogicalHits() if (sc.isFailure()) ATH_MSG_ERROR("Hit mapping failed"); if (m_doClustering) { - std::vector<HTTCluster> clustered_hits; + std::vector<FPGATrackSimCluster> clustered_hits; sc = m_clusteringTool->DoClustering(logicalHeader, clustered_hits); if (sc.isFailure()) ATH_MSG_ERROR("Clustering failed"); - for (HTTCluster const & cluster : clustered_hits) { - HTTHit clusterEquiv = cluster.getClusterEquiv(); + for (FPGATrackSimCluster const & cluster : clustered_hits) { + FPGATrackSimHit clusterEquiv = cluster.getClusterEquiv(); hits.push_back(clusterEquiv); } } else { - std::vector<HTTTowerInputHeader> towers = logicalHeader.towers(); + std::vector<FPGATrackSimTowerInputHeader> towers = logicalHeader.towers(); for(auto &tower:towers){ - std::vector<HTTHit> const & towerHits = tower.hits(); - for (HTTHit const & hit : towerHits) + std::vector<FPGATrackSimHit> const & towerHits = tower.hits(); + for (FPGATrackSimHit const & hit : towerHits) hits.push_back(hit); } } @@ -325,11 +325,11 @@ std::vector<HTTHit> HTTMatrixGenAlgo::getLogicalHits() // Filters tracks based on m_PT_THRESHOLD and m_TRAING_PDG and D0_THRESHOLD -std::vector<HTTTruthTrack> HTTMatrixGenAlgo::filterTrainingTracks(std::vector<HTTTruthTrack> const & truth_tracks) const +std::vector<FPGATrackSimTruthTrack> FPGATrackSimMatrixGenAlgo::filterTrainingTracks(std::vector<FPGATrackSimTruthTrack> const & truth_tracks) const { - std::vector<HTTTruthTrack> training_tracks; + std::vector<FPGATrackSimTruthTrack> training_tracks; - for (HTTTruthTrack const & track : truth_tracks) { + for (FPGATrackSimTruthTrack const & track : truth_tracks) { if (HepMC::generations(track.getBarcode()) >= 1 || std::abs(track.getPDGCode()) != m_TRAIN_PDG) continue; if (std::abs(track.getD0()) > m_D0_THRESHOLD) continue; @@ -358,16 +358,16 @@ std::vector<HTTTruthTrack> HTTMatrixGenAlgo::filterTrainingTracks(std::vector<HT // Sorts 'hits' by barcodes appearing in 'tracks', drops the rest. -std::map<int, std::vector<HTTHit>> HTTMatrixGenAlgo::makeBarcodeMap(std::vector<HTTHit> const & hits, std::vector<HTTTruthTrack> const & tracks) const +std::map<int, std::vector<FPGATrackSimHit>> FPGATrackSimMatrixGenAlgo::makeBarcodeMap(std::vector<FPGATrackSimHit> const & hits, std::vector<FPGATrackSimTruthTrack> const & tracks) const { - std::map<int, std::vector<HTTHit>> map; + std::map<int, std::vector<FPGATrackSimHit>> map; // Ready the barcodes - for (const HTTTruthTrack & track : tracks) - map[track.getBarcode()] = std::vector<HTTHit>(); + for (const FPGATrackSimTruthTrack & track : tracks) + map[track.getBarcode()] = std::vector<FPGATrackSimHit>(); // Add the hits - for (const HTTHit & hit : hits) { + for (const FPGATrackSimHit & hit : hits) { // Get the predominant barcode for the current hit int barcode = hit.getTruth().best_barcode(); @@ -392,10 +392,10 @@ std::map<int, std::vector<HTTHit>> HTTMatrixGenAlgo::makeBarcodeMap(std::vector< // eta and phi will differ in general in this case // Take the lower-z hit preferentially (right thing to do? d0/pT tradeoff) // But something fishy is going on if we've got two hits on the same disk. -HTTMatrixGenAlgo::selectHit_returnCode HTTMatrixGenAlgo::selectHit(HTTHit const & old_hit, HTTHit const & new_hit) const +FPGATrackSimMatrixGenAlgo::selectHit_returnCode FPGATrackSimMatrixGenAlgo::selectHit(FPGATrackSimHit const & old_hit, FPGATrackSimHit const & new_hit) const { if ((new_hit.getSection() == old_hit.getSection()) && (new_hit.getLayer() == old_hit.getLayer()) - && (new_hit.getHTTEtaModule() == old_hit.getHTTEtaModule()) && (new_hit.getPhiModule() == old_hit.getPhiModule())) { + && (new_hit.getFPGATrackSimEtaModule() == old_hit.getFPGATrackSimEtaModule()) && (new_hit.getPhiModule() == old_hit.getPhiModule())) { ATH_MSG_DEBUG("Two hits on same module"); return selectHit_returnCode::SH_FAILURE; } @@ -406,21 +406,21 @@ HTTMatrixGenAlgo::selectHit_returnCode HTTMatrixGenAlgo::selectHit(HTTHit const if (old_section == new_section) { - if (old_hit.getHTTEtaModule() == new_hit.getHTTEtaModule()) { + if (old_hit.getFPGATrackSimEtaModule() == new_hit.getFPGATrackSimEtaModule()) { int rmax = 0; if (m_doHoughConstants) { - int reg = m_HTTMapping->RegionMap_1st()->getRegions(new_hit)[0]; // just take region with lowest index + int reg = m_FPGATrackSimMapping->RegionMap_1st()->getRegions(new_hit)[0]; // just take region with lowest index - int phi_max = m_HTTMapping->RegionMap_1st()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_max; - int phi_min = m_HTTMapping->RegionMap_1st()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_min; + int phi_max = m_FPGATrackSimMapping->RegionMap_1st()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_max; + int phi_min = m_FPGATrackSimMapping->RegionMap_1st()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_min; rmax = phi_max - phi_min; } else { - int reg = m_HTTMapping->RegionMap_2nd()->getRegions(new_hit)[0]; // just take region with lowest index + int reg = m_FPGATrackSimMapping->RegionMap_2nd()->getRegions(new_hit)[0]; // just take region with lowest index - int phi_max = m_HTTMapping->RegionMap_2nd()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_max; - int phi_min = m_HTTMapping->RegionMap_2nd()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_min; + int phi_max = m_FPGATrackSimMapping->RegionMap_2nd()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_max; + int phi_min = m_FPGATrackSimMapping->RegionMap_2nd()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_min; rmax = phi_max - phi_min; } @@ -448,16 +448,16 @@ HTTMatrixGenAlgo::selectHit_returnCode HTTMatrixGenAlgo::selectHit(HTTHit const int old_disk = 0; int new_disk = 0; if (m_doHoughConstants) { - old_isEC = m_HTTMapping->PlaneMap_1st()->isEC(layer, old_section); - new_isEC = m_HTTMapping->PlaneMap_1st()->isEC(layer, new_section); - old_disk = m_HTTMapping->PlaneMap_1st()->getLayerInfo(layer, old_section).physDisk; - new_disk = m_HTTMapping->PlaneMap_1st()->getLayerInfo(layer, new_section).physDisk; + old_isEC = m_FPGATrackSimMapping->PlaneMap_1st()->isEC(layer, old_section); + new_isEC = m_FPGATrackSimMapping->PlaneMap_1st()->isEC(layer, new_section); + old_disk = m_FPGATrackSimMapping->PlaneMap_1st()->getLayerInfo(layer, old_section).physDisk; + new_disk = m_FPGATrackSimMapping->PlaneMap_1st()->getLayerInfo(layer, new_section).physDisk; } else { - old_isEC = m_HTTMapping->PlaneMap_2nd()->isEC(layer, old_section); - new_isEC = m_HTTMapping->PlaneMap_2nd()->isEC(layer, new_section); - old_disk = m_HTTMapping->PlaneMap_2nd()->getLayerInfo(layer, old_section).physDisk; - new_disk = m_HTTMapping->PlaneMap_2nd()->getLayerInfo(layer, new_section).physDisk; + old_isEC = m_FPGATrackSimMapping->PlaneMap_2nd()->isEC(layer, old_section); + new_isEC = m_FPGATrackSimMapping->PlaneMap_2nd()->isEC(layer, new_section); + old_disk = m_FPGATrackSimMapping->PlaneMap_2nd()->getLayerInfo(layer, old_section).physDisk; + new_disk = m_FPGATrackSimMapping->PlaneMap_2nd()->getLayerInfo(layer, new_section).physDisk; } // If one is barrel and one endcap, it's definitely OK, take the barrel hit if (old_isEC != new_isEC) { @@ -486,15 +486,15 @@ HTTMatrixGenAlgo::selectHit_returnCode HTTMatrixGenAlgo::selectHit(HTTHit const // the filtered hit list with size m_nLayers. // // See selectHit() for details on which hit is chosen when there's more than 1 per layer. -bool HTTMatrixGenAlgo::filterSectorHits(std::vector<HTTHit> const & all_hits, std::vector<HTTHit> & sector_hits, - /* TEMP */ HTTTruthTrack const & t) const +bool FPGATrackSimMatrixGenAlgo::filterSectorHits(std::vector<FPGATrackSimHit> const & all_hits, std::vector<FPGATrackSimHit> & sector_hits, + /* TEMP */ FPGATrackSimTruthTrack const & t) const { - HTTHit nohit; + FPGATrackSimHit nohit; nohit.setHitType(HitType::wildcard); sector_hits.resize(m_nLayers, nohit); std::vector<int> layer_count(m_nLayers); // count number of hits seen in each layer - for (HTTHit const & hit : all_hits) { + for (FPGATrackSimHit const & hit : all_hits) { int layer = hit.getLayer(); if (layer_count[layer] == 0){ @@ -538,20 +538,20 @@ bool HTTMatrixGenAlgo::filterSectorHits(std::vector<HTTHit> const & all_hits, st // Returns the lowest index region that contains all hits in 'hits' -int HTTMatrixGenAlgo::getRegion(std::vector<HTTHit> const & hits) const +int FPGATrackSimMatrixGenAlgo::getRegion(std::vector<FPGATrackSimHit> const & hits) const { // Start with a bitmask, all true, and set a region to false if any mismatch is found std::vector<bool> region_mask(m_nRegions, true); - for (HTTHit const & hit : hits) { + for (FPGATrackSimHit const & hit : hits) { if (hit.getHitType() != HitType::wildcard){ // don't worry about hits that are WCs for (int region = 0; region < m_nRegions; region++) { if (m_doHoughConstants) { - if (!m_HTTMapping->RegionMap_1st()->isInRegion(region, hit)) + if (!m_FPGATrackSimMapping->RegionMap_1st()->isInRegion(region, hit)) region_mask[region] = false; } else { - if (!m_HTTMapping->RegionMap_2nd()->isInRegion(region, hit)) + if (!m_FPGATrackSimMapping->RegionMap_2nd()->isInRegion(region, hit)) region_mask[region] = false; } } @@ -569,10 +569,10 @@ int HTTMatrixGenAlgo::getRegion(std::vector<HTTHit> const & hits) const // Given a track and corresponding hits, returns the sector (list of modules) and the accumulation // struct. -StatusCode HTTMatrixGenAlgo::makeAccumulator(std::vector<HTTHit> const & sector_hits, HTTTruthTrack const & track, std::pair<std::vector<module_t>, HTTMatrixAccumulator> & accumulator) const +StatusCode FPGATrackSimMatrixGenAlgo::makeAccumulator(std::vector<FPGATrackSimHit> const & sector_hits, FPGATrackSimTruthTrack const & track, std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> & accumulator) const { std::vector<module_t> modules(m_nLayers); - HTTMatrixAccumulator acc(m_nLayers, m_nDim); + FPGATrackSimMatrixAccumulator acc(m_nLayers, m_nDim); double qoverpt = track.getQ() / track.getPt(); int sectorbin = 0; @@ -586,7 +586,7 @@ StatusCode HTTMatrixGenAlgo::makeAccumulator(std::vector<HTTHit> const & sector_ for (int i = 0; i < m_nLayers; i++) { if (sector_hits[i].getHitType() != HitType::wildcard) { - if (m_single) modules[i] = sector_hits[i].getHTTIdentifierHash(); + if (m_single) modules[i] = sector_hits[i].getFPGATrackSimIdentifierHash(); else modules[i] = sectorbin; // Here we used to set the identifier, now just global zero! we can change this by large region if needed } else { @@ -701,8 +701,8 @@ StatusCode HTTMatrixGenAlgo::makeAccumulator(std::vector<HTTHit> const & sector_ acc.pars.phi = x - track.getPhi(); // fit for delta phi_0 } - HTTTrackParsI bins; - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + FPGATrackSimTrackParsI bins; + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) bins[i] = (acc.pars[i] - m_sliceMin[i]) * m_nBins[i] / (m_sliceMax[i] - m_sliceMin[i]); acc.track_bins.push_back(bins); @@ -741,7 +741,7 @@ StatusCode HTTMatrixGenAlgo::makeAccumulator(std::vector<HTTHit> const & sector_ /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixGenAlgo::finalize() +StatusCode FPGATrackSimMatrixGenAlgo::finalize() { ATH_MSG_DEBUG("finalize()"); ATH_MSG_INFO("Tracks used: " << m_nTracksUsed << "/" << m_nTracks); @@ -753,7 +753,7 @@ StatusCode HTTMatrixGenAlgo::finalize() name << "am" << region; title << "Ambank " << region << " parameters"; TTree* tree = new TTree(name.str().c_str(), title.str().c_str()); - ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGHTTMATRIXOUT/%s",tree->GetName()), tree)); + ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimMATRIXOUT/%s",tree->GetName()), tree)); // Fill the tree ::fillTree(m_sector_cum[region], tree, m_nLayers, m_nDim); @@ -762,7 +762,7 @@ StatusCode HTTMatrixGenAlgo::finalize() for (auto & sector_info : m_sector_cum[region]) { double coverage = sector_info.second.track_bins.size(); m_h_nHit->Fill(coverage); - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) m_h_sectorPars[i]->Fill(sector_info.second.pars[i] / coverage); } } @@ -773,7 +773,7 @@ StatusCode HTTMatrixGenAlgo::finalize() } -void HTTMatrixGenAlgo::writeSliceTree() +void FPGATrackSimMatrixGenAlgo::writeSliceTree() { TTree* sliceTree = new TTree("slice", "Region slice boundaries"); // slice @@ -795,7 +795,7 @@ void HTTMatrixGenAlgo::writeSliceTree() sliceTree->Branch("z0_slices", &m_nBins.z0); sliceTree->Branch("eta_slices", &m_nBins.eta); - StatusCode sc = m_tHistSvc->regTree("/TRIGHTTMATRIXOUT/slice",sliceTree); + StatusCode sc = m_tHistSvc->regTree("/TRIGFPGATrackSimMATRIXOUT/slice",sliceTree); if (sc.isFailure()) ATH_MSG_ERROR("tHist failed"); sliceTree->Fill(); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixGenAlgo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixGenAlgo.h similarity index 55% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixGenAlgo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixGenAlgo.h index fc5dcceec7856a7866c4dd806b839c0c27ba8ba9..5a115afed757cdd806d7dd1cfe7da3fadc1aa988 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixGenAlgo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixGenAlgo.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTMatrixGenAlgo_h -#define HTTMatrixGenAlgo_h +#ifndef FPGATrackSimMatrixGenAlgo_h +#define FPGATrackSimMatrixGenAlgo_h /** - * @file HTTMatrixGenAlgo.h + * @file FPGATrackSimMatrixGenAlgo.h * @author Rewrite by Riley Xu - riley.xu@cern.ch after FTK code * @date May 8th, 2020 * @brief Algorithm to generate matrix files, to be used for sector and constant generation. @@ -20,19 +20,19 @@ #include "GaudiKernel/ITHistSvc.h" #include "AthenaBaseComps/AthAlgorithm.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTMaps/HTTRegionMap.h" -#include "TrigHTTSGInput/ITrigHTTInputTool.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" -#include "TrigHTTMaps/HTTClusteringToolI.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTTruthTrack.h" -#include "TrigHTTHough/IHTTRoadFinderTool.h" -#include "HTTMatrixIO.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" +#include "FPGATrackSimSGInput/IFPGATrackSimInputTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" +#include "FPGATrackSimMaps/FPGATrackSimClusteringToolI.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" +#include "FPGATrackSimMatrixIO.h" #include "TTree.h" #include "TFile.h" @@ -45,14 +45,14 @@ class ITHistSvc; class TH1F; class TH2F; -class ITrigHTTMappingSvc; -class IHTTRoadFinderTool; +class IFPGATrackSimMappingSvc; +class IFPGATrackSimRoadFinderTool; -class HTTMatrixGenAlgo : public AthAlgorithm +class FPGATrackSimMatrixGenAlgo : public AthAlgorithm { public: - HTTMatrixGenAlgo(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTMatrixGenAlgo() = default; + FPGATrackSimMatrixGenAlgo(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimMatrixGenAlgo() = default; StatusCode initialize() override; StatusCode execute() override; @@ -69,15 +69,15 @@ class HTTMatrixGenAlgo : public AthAlgorithm /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping{this,"TrigHTTMappingSvc","TrigHTTMappingSvc"}; - ServiceHandle<IHTTEventSelectionSvc> m_EvtSel{this,"HTTEventSelectionSvc","HTTEventSelectionSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel{this,"FPGATrackSimEventSelectionSvc","FPGATrackSimEventSelectionSvc"}; ServiceHandle<ITHistSvc> m_tHistSvc{this,"THistSvc","THistSvc"}; - ToolHandle<ITrigHTTInputTool> m_hitInputTool {this, "HTTSGToRawHitsTool", "HTTSGToRawHitsTool/HTTSGToRawHits", "input handler"}; - ToolHandle<HTTRawToLogicalHitsTool> m_hitMapTool {this, "HTTRawToLogicalHitsTool", "HTTRawToLogicalHitsTool/HTT_RawToLogicalHitsTool", "HTT_RawToLogicalHitsTool"}; - ToolHandle<HTTClusteringToolI> m_clusteringTool { this, "HTTClusteringFTKTool", "HTTClusteringFTKTool/HTTClusteringFTKTool", "HTTClusteringFTKTool" }; - ToolHandle<IHTTRoadFinderTool> m_roadFinderTool {this, "RoadFinder", "RoadFinder"}; - const HTTPlaneMap* m_pmap = nullptr; // alias to m_HTTMapping->PlaneMap(); + ToolHandle<IFPGATrackSimInputTool> m_hitInputTool {this, "FPGATrackSimSGToRawHitsTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimSGToRawHits", "input handler"}; + ToolHandle<FPGATrackSimRawToLogicalHitsTool> m_hitMapTool {this, "FPGATrackSimRawToLogicalHitsTool", "FPGATrackSimRawToLogicalHitsTool/FPGATrackSim_RawToLogicalHitsTool", "FPGATrackSim_RawToLogicalHitsTool"}; + ToolHandle<FPGATrackSimClusteringToolI> m_clusteringTool { this, "FPGATrackSimClusteringFTKTool", "FPGATrackSimClusteringFTKTool/FPGATrackSimClusteringFTKTool", "FPGATrackSimClusteringFTKTool" }; + ToolHandle<IFPGATrackSimRoadFinderTool> m_roadFinderTool {this, "RoadFinder", "RoadFinder"}; + const FPGATrackSimPlaneMap* m_pmap = nullptr; // alias to m_FPGATrackSimMapping->PlaneMap(); /////////////////////////////////////////////////////////////////////// @@ -111,11 +111,11 @@ class HTTMatrixGenAlgo : public AthAlgorithm int m_nDim = 0; int m_nDim2 = 0; // m_nDim ^ 2 - HTTTrackPars m_sliceMin = 0; - HTTTrackPars m_sliceMax = 0; - HTTTrackParsI m_nBins; + FPGATrackSimTrackPars m_sliceMin = 0; + FPGATrackSimTrackPars m_sliceMax = 0; + FPGATrackSimTrackParsI m_nBins; - HTTEventInputHeader* m_eventHeader = nullptr; + FPGATrackSimEventInputHeader* m_eventHeader = nullptr; /////////////////////////////////////////////////////////////////////// // Meta Data @@ -129,13 +129,13 @@ class HTTMatrixGenAlgo : public AthAlgorithm enum class selectHit_returnCode { SH_FAILURE, SH_KEEP_OLD, SH_KEEP_NEW }; StatusCode bookHistograms(); - std::vector<HTTHit> getLogicalHits() ; - std::vector<HTTTruthTrack> filterTrainingTracks(std::vector<HTTTruthTrack> const & truth_tracks) const; - std::map<int, std::vector<HTTHit>> makeBarcodeMap(std::vector<HTTHit> const & hits, std::vector<HTTTruthTrack> const & tracks) const; - selectHit_returnCode selectHit(HTTHit const & old_hit, HTTHit const & new_hit) const; - bool filterSectorHits(std::vector<HTTHit> const & all_hits, std::vector<HTTHit> & sector_hits, HTTTruthTrack const & t) const; - int getRegion(std::vector<HTTHit> const & hits) const; - StatusCode makeAccumulator(std::vector<HTTHit> const & sector_hits, HTTTruthTrack const & track, std::pair<std::vector<module_t>, HTTMatrixAccumulator> & accumulator) const; + std::vector<FPGATrackSimHit> getLogicalHits() ; + std::vector<FPGATrackSimTruthTrack> filterTrainingTracks(std::vector<FPGATrackSimTruthTrack> const & truth_tracks) const; + std::map<int, std::vector<FPGATrackSimHit>> makeBarcodeMap(std::vector<FPGATrackSimHit> const & hits, std::vector<FPGATrackSimTruthTrack> const & tracks) const; + selectHit_returnCode selectHit(FPGATrackSimHit const & old_hit, FPGATrackSimHit const & new_hit) const; + bool filterSectorHits(std::vector<FPGATrackSimHit> const & all_hits, std::vector<FPGATrackSimHit> & sector_hits, FPGATrackSimTruthTrack const & t) const; + int getRegion(std::vector<FPGATrackSimHit> const & hits) const; + StatusCode makeAccumulator(std::vector<FPGATrackSimHit> const & sector_hits, FPGATrackSimTruthTrack const & track, std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> & accumulator) const; std::vector<TTree*> createMatrixTrees(); void fillMatrixTrees(std::vector<TTree*> const & matrixTrees); void writeSliceTree(); @@ -143,16 +143,16 @@ class HTTMatrixGenAlgo : public AthAlgorithm /////////////////////////////////////////////////////////////////////// // Histograms - // These are ordered as in HTTTrackPars, phi, curvature, d0, z0, eta - TH1I* m_h_trainingTrack[HTTTrackPars::NPARS]{}; - TH1I* m_h_sectorPars[HTTTrackPars::NPARS]{}; - TH1I* m_h_SHfailure[HTTTrackPars::NPARS]{}; - TH1I* m_h_3hitsInLayer[HTTTrackPars::NPARS]{}; - TH1I* m_h_notEnoughHits[HTTTrackPars::NPARS]{}; + // These are ordered as in FPGATrackSimTrackPars, phi, curvature, d0, z0, eta + TH1I* m_h_trainingTrack[FPGATrackSimTrackPars::NPARS]{}; + TH1I* m_h_sectorPars[FPGATrackSimTrackPars::NPARS]{}; + TH1I* m_h_SHfailure[FPGATrackSimTrackPars::NPARS]{}; + TH1I* m_h_3hitsInLayer[FPGATrackSimTrackPars::NPARS]{}; + TH1I* m_h_notEnoughHits[FPGATrackSimTrackPars::NPARS]{}; TH1I* m_h_trackQoP_okHits = nullptr; TH1I* m_h_trackQoP_okRegion = nullptr; TH1I* m_h_nHit = nullptr; }; -#endif // HTTMatrixGenAlgo_h +#endif // FPGATrackSimMatrixGenAlgo_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixIO.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixIO.cxx similarity index 87% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixIO.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixIO.cxx index 2a66b1b9cc63a2351bb78d1e8060940be4b19946..2ac47d25c7af5d009693f0ed98fa14b2e28a5319 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixIO.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixIO.cxx @@ -1,18 +1,18 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTMatrixIO.cxx + * @file FPGATrackSimMatrixIO.cxx * @author Riley Xu - riley.xu@cern.ch * @date May 29th, 2020 */ -#include "HTTMatrixIO.h" +#include "FPGATrackSimMatrixIO.h" /////////////////////////////////////////////////////////////////////////////// // Reader /////////////////////////////////////////////////////////////////////////////// -HTTMatrixReader::HTTMatrixReader(TTree *tree, size_t nLayers, size_t nCoords) : +FPGATrackSimMatrixReader::FPGATrackSimMatrixReader(TTree *tree, size_t nLayers, size_t nCoords) : m_tree(tree), m_entry(0), m_nEntries(tree->GetEntries()), @@ -53,14 +53,14 @@ HTTMatrixReader::HTTMatrixReader(TTree *tree, size_t nLayers, size_t nCoords) : } -void HTTMatrixReader::readEntry(size_t entry) +void FPGATrackSimMatrixReader::readEntry(size_t entry) { m_tree->GetEntry(entry); m_acc.track_bins.clear(); for (size_t j = 0; j < m_bins_QoP.size(); j++) { - HTTTrackParsI bins; + FPGATrackSimTrackParsI bins; bins.qOverPt = m_bins_QoP[j]; bins.phi = m_bins_phi[j]; bins.d0 = m_bins_d0[j]; @@ -70,7 +70,7 @@ void HTTMatrixReader::readEntry(size_t entry) } } -bool HTTMatrixReader::nextEntry() +bool FPGATrackSimMatrixReader::nextEntry() { if (m_entry >= m_nEntries) return false; @@ -91,7 +91,7 @@ bool HTTMatrixReader::nextEntry() */ void readTree(AccumulateMap & map, TTree *tree, size_t nLayers, size_t nCoords) { - HTTMatrixReader reader(tree, nLayers, nCoords); + FPGATrackSimMatrixReader reader(tree, nLayers, nCoords); while (reader.nextEntry()) accumulate(map, reader.getModules(), reader.getAccumulator()); } @@ -105,11 +105,11 @@ void readTree(AccumulateMap & map, TTree *tree, size_t nLayers, size_t nCoords) * @param nLayers - number of logical layers * @param nCoords - number of hit coordinates in a full (13/13) track */ -std::vector<std::pair<std::vector<module_t>, HTTMatrixAccumulator>> readTree(TTree *tree, size_t nLayers, size_t nCoords) +std::vector<std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator>> readTree(TTree *tree, size_t nLayers, size_t nCoords) { - std::vector<std::pair<std::vector<module_t>, HTTMatrixAccumulator>> matrices; + std::vector<std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator>> matrices; - HTTMatrixReader reader(tree, nLayers, nCoords); + FPGATrackSimMatrixReader reader(tree, nLayers, nCoords); while (reader.nextEntry()) matrices.push_back({ reader.getModules(), reader.getAccumulator() }); @@ -122,7 +122,7 @@ std::vector<std::pair<std::vector<module_t>, HTTMatrixAccumulator>> readTree(TTr /////////////////////////////////////////////////////////////////////////////// -HTTMatrixWriter::HTTMatrixWriter(TTree *tree, int nLayers, int nCoords) : +FPGATrackSimMatrixWriter::FPGATrackSimMatrixWriter(TTree *tree, int nLayers, int nCoords) : m_tree(tree), m_nEntries(0), m_nLayers(nLayers), @@ -171,7 +171,7 @@ HTTMatrixWriter::HTTMatrixWriter(TTree *tree, int nLayers, int nCoords) : m_tree->Branch("tmpinteta", &m_peta); } -size_t HTTMatrixWriter::fill(std::vector<module_t> modules, HTTMatrixAccumulator & acc) +size_t FPGATrackSimMatrixWriter::fill(std::vector<module_t> modules, FPGATrackSimMatrixAccumulator & acc) { m_tree->SetBranchAddress("sectorID", acc.FTK_modules.data()); @@ -200,7 +200,7 @@ size_t HTTMatrixWriter::fill(std::vector<module_t> modules, HTTMatrixAccumulator m_bins_z0.clear(); m_bins_d0.clear(); m_bins_eta.clear(); - for (HTTTrackParsI const & pars : acc.track_bins) + for (FPGATrackSimTrackParsI const & pars : acc.track_bins) { m_bins_QoP.push_back(pars.qOverPt); m_bins_phi.push_back(pars.phi); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixIO.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixIO.h similarity index 79% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixIO.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixIO.h index bc4c6640078e7801de59acd228216342b6beb7dc..04e94ebb164627c6af9e4abd799e67437ed671ab 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixIO.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixIO.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTMATRIXREADER_H -#define HTTMATRIXREADER_H +#ifndef FPGATrackSimMATRIXREADER_H +#define FPGATrackSimMATRIXREADER_H /** - * @file HTTMatrixIO.h + * @file FPGATrackSimMatrixIO.h * @author Riley Xu - riley.xu@cern.ch * @date May 29th, 2020 * @brief Classes to read/write matrix files event by event. @@ -12,8 +12,8 @@ * See below for batch read and write functions. */ -#include "HTTMatrixAccumulator.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimMatrixAccumulator.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <vector> @@ -30,19 +30,19 @@ * then use getModules() or getAccumulator() to get a reference to the data. * * Example: - * HTTMatrixReader reader(tree, nLayers, nCoords); + * FPGATrackSimMatrixReader reader(tree, nLayers, nCoords); * while (reader.nextEntry()) * { * std::vector<module_t> & modules = reader.getModules(); - * HTTMatrixAccumulator & acc = reader.getAccumulator(); + * FPGATrackSimMatrixAccumulator & acc = reader.getAccumulator(); * } */ -class HTTMatrixReader +class FPGATrackSimMatrixReader { public: - HTTMatrixReader(TTree *tree, size_t nLayers, size_t nCoords); - ~HTTMatrixReader() { m_tree->ResetBranchAddresses(); } + FPGATrackSimMatrixReader(TTree *tree, size_t nLayers, size_t nCoords); + ~FPGATrackSimMatrixReader() { m_tree->ResetBranchAddresses(); } void setEntry(size_t entry) { m_entry = entry; } size_t getEntry() const { return m_entry - 1; } // last read entry number @@ -53,7 +53,7 @@ class HTTMatrixReader void readEntry(size_t entry); std::vector<module_t> & getModules() { return m_modules; } - HTTMatrixAccumulator & getAccumulator() { return m_acc; } + FPGATrackSimMatrixAccumulator & getAccumulator() { return m_acc; } private: @@ -63,7 +63,7 @@ class HTTMatrixReader size_t m_nEntries; std::vector<module_t> m_modules; - HTTMatrixAccumulator m_acc; + FPGATrackSimMatrixAccumulator m_acc; std::vector<short> m_bins_QoP; std::vector<short> m_bins_phi; @@ -83,14 +83,14 @@ class HTTMatrixReader // Writer /////////////////////////////////////////////////////////////////////////////// -class HTTMatrixWriter +class FPGATrackSimMatrixWriter { public: - HTTMatrixWriter(TTree *tree, int nLayers, int nCoords); + FPGATrackSimMatrixWriter(TTree *tree, int nLayers, int nCoords); // Returns entry filled - size_t fill(std::vector<module_t> modules, HTTMatrixAccumulator & acc); // copying, necessary since root writing is not const but map keys are + size_t fill(std::vector<module_t> modules, FPGATrackSimMatrixAccumulator & acc); // copying, necessary since root writing is not const but map keys are private: @@ -141,13 +141,13 @@ void readTree(AccumulateMap & map, TTree *tree, size_t nLayers, size_t nCoords); * @param nLayers - number of logical layers * @param nCoords - number of hit coordinates in a full (13/13) track */ -std::vector<std::pair<std::vector<module_t>, HTTMatrixAccumulator>> readTree(TTree *tree, size_t nLayers, size_t nCoords); +std::vector<std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator>> readTree(TTree *tree, size_t nLayers, size_t nCoords); /** * Writes the contents of an AccumulateMap into the supplied tree (one entry per sector). * - * @param begin - iterator to a std::pair<std::vector<module_t>, HTTMatrixAccumulator>> to begin filling + * @param begin - iterator to a std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator>> to begin filling * @param end - end iterator to stop filling * @param tree - tree to be written to; this function will create the branches * @param nLayers - number of logical layers @@ -166,7 +166,7 @@ void fillTree(Iter begin, Iter end, TTree *tree, int nLayers, int nCoords) ); // Create the writer - HTTMatrixWriter writer(tree, nLayers, nCoords); + FPGATrackSimMatrixWriter writer(tree, nLayers, nCoords); // Fill the tree for (Iter & sector_info : sorted_sectors) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixMergeAlgo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixMergeAlgo.cxx similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixMergeAlgo.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixMergeAlgo.cxx index 82dc5f9fe0eeaf885274c393cb669c446db21233..589c4c82797f451fcce425b3d8c94470d6a57e87 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixMergeAlgo.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixMergeAlgo.cxx @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTMatrixMergeAlgo.cxx + * @file FPGATrackSimMatrixMergeAlgo.cxx * @author Rewrite by Riley Xu - riley.xu@cern.ch after FTK code * @date May 8th, 2020 * @brief Algorithm to merge matrix files, to be used for sector and constant generation. @@ -10,7 +10,7 @@ */ -#include "HTTMatrixMergeAlgo.h" +#include "FPGATrackSimMatrixMergeAlgo.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ITHistSvc.h" @@ -33,13 +33,13 @@ using namespace std; // Constructor / Initialize /////////////////////////////////////////////////////////////////////////////// -HTTMatrixMergeAlgo::HTTMatrixMergeAlgo(const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimMatrixMergeAlgo::FPGATrackSimMatrixMergeAlgo(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { } -StatusCode HTTMatrixMergeAlgo::initialize() +StatusCode FPGATrackSimMatrixMergeAlgo::initialize() { ATH_MSG_DEBUG("initialize()"); @@ -93,38 +93,38 @@ StatusCode HTTMatrixMergeAlgo::initialize() } -StatusCode HTTMatrixMergeAlgo::bookHistograms() +StatusCode FPGATrackSimMatrixMergeAlgo::bookHistograms() { m_h_nSector = new TH1I("h_nSector", "number of sectors in merged file", 100, 0, 10000); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_nSector",m_h_nSector)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_nSector",m_h_nSector)); m_h_nHit = new TH1I("h_nHit", "number of hits in sector", 100, 0, 10000); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_nHit",m_h_nHit)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_nHit",m_h_nHit)); m_h_c = new TH1F("h_c", "Truth curvature in sector",100,-1e-8,1e-8); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_c",m_h_c)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_c",m_h_c)); m_h_d = new TH1F("h_d", "Truth d0 in sector",100,-2.5,2.5); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_d",m_h_d)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_d",m_h_d)); m_h_phi = new TH1F("h_phi", "Truth phi in sector",100,0,6.3); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_phi",m_h_phi)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_phi",m_h_phi)); m_h_coto = new TH1F("h_coto", "Truth coto in sector",100,-4,4); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_coto",m_h_coto)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_coto",m_h_coto)); m_h_z = new TH1F("h_z", "Truth z in sector",100,-200,200); - ATH_CHECK(m_tHistSvc->regHist("/TRIGHTTMATRIXOUT/h_z",m_h_z)); + ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_z",m_h_z)); return StatusCode::SUCCESS; } -StatusCode HTTMatrixMergeAlgo::copySliceTree(TFile *file) +StatusCode FPGATrackSimMatrixMergeAlgo::copySliceTree(TFile *file) { - HTTTrackPars max; - HTTTrackPars min; - HTTTrackParsI nBins; + FPGATrackSimTrackPars max; + FPGATrackSimTrackPars min; + FPGATrackSimTrackParsI nBins; // Read old tree TTree *old_tree = (TTree*)file->Get("slice"); @@ -152,7 +152,7 @@ StatusCode HTTMatrixMergeAlgo::copySliceTree(TFile *file) // Write new tree TTree *new_tree = new TTree("slice", "Slice boundaries"); - ATH_CHECK(m_tHistSvc->regTree("/TRIGHTTMATRIXOUT/slice", new_tree)); + ATH_CHECK(m_tHistSvc->regTree("/TRIGFPGATrackSimMATRIXOUT/slice", new_tree)); new_tree->Branch("c_max", &max.qOverPt); new_tree->Branch("c_min", &min.qOverPt); @@ -181,7 +181,7 @@ StatusCode HTTMatrixMergeAlgo::copySliceTree(TFile *file) // Read each file and accumulate everything into m_sector_cum -void HTTMatrixMergeAlgo::readFiles() +void FPGATrackSimMatrixMergeAlgo::readFiles() { for (int iFile = 0; iFile < m_nFiles; iFile++) { @@ -215,7 +215,7 @@ void HTTMatrixMergeAlgo::readFiles() /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixMergeAlgo::execute() +StatusCode FPGATrackSimMatrixMergeAlgo::execute() { // Do nothing; this class does not process events. The main algorithm is // called in initialize() and finalize(). @@ -226,7 +226,7 @@ StatusCode HTTMatrixMergeAlgo::execute() // Finalize /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixMergeAlgo::finalize() +StatusCode FPGATrackSimMatrixMergeAlgo::finalize() { for (int region = m_region_start; region < m_region_end; region++) { @@ -236,7 +236,7 @@ StatusCode HTTMatrixMergeAlgo::finalize() name << "am" << region; title << "Ambank " << region << " parameters"; TTree* tree = new TTree(name.str().c_str(), title.str().c_str()); - ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGHTTMATRIXOUT/%s",tree->GetName()), tree)); + ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimMATRIXOUT/%s",tree->GetName()), tree)); ATH_MSG_INFO("Sectors found in region " << region << ": " << m_sector_cum[region].size()); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixMergeAlgo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixMergeAlgo.h similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixMergeAlgo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixMergeAlgo.h index 23a66f657836ae28d25d52738c8c43a9a174fff4..1cef60a7f8a323d67b925ffba2fcf1b6bacfe3a9 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixMergeAlgo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixMergeAlgo.h @@ -1,15 +1,15 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTMatrixMergeAlgo_h -#define HTTMatrixMergeAlgo_h +#ifndef FPGATrackSimMatrixMergeAlgo_h +#define FPGATrackSimMatrixMergeAlgo_h /** - * @file HTTMatrixMergeAlgo.h + * @file FPGATrackSimMatrixMergeAlgo.h * @author Rewrite by Riley Xu - riley.xu@cern.ch after FTK code * @date May 8th, 2020 * @brief Algorithm to merge matrix files, to be used for sector and constant generation. * - * This algorithm merges multiple matrix files. See HTTMatrixGenAlgo.h for information + * This algorithm merges multiple matrix files. See FPGATrackSimMatrixGenAlgo.h for information * on the matrix file. This class uses the same map structure to accumulate the data. * * This algorithm doesn't run on events; the functinality takes place in initialize() @@ -19,7 +19,7 @@ #include "GaudiKernel/ITHistSvc.h" #include "AthenaBaseComps/AthAlgorithm.h" -#include "HTTMatrixIO.h" +#include "FPGATrackSimMatrixIO.h" #include "TTree.h" #include "TH1I.h" @@ -31,11 +31,11 @@ class ITHistSvc; -class HTTMatrixMergeAlgo : public AthAlgorithm +class FPGATrackSimMatrixMergeAlgo : public AthAlgorithm { public: - HTTMatrixMergeAlgo(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTMatrixMergeAlgo() = default; + FPGATrackSimMatrixMergeAlgo(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimMatrixMergeAlgo() = default; StatusCode initialize() override; // Execute does not do anything for this alg. This class does not process events, everything is done in init and finalize StatusCode execute() override; @@ -96,5 +96,5 @@ class HTTMatrixMergeAlgo : public AthAlgorithm }; -#endif // HTTMatrixMergeAlgo_h +#endif // FPGATrackSimMatrixMergeAlgo_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixReductionAlgo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixReductionAlgo.cxx similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixReductionAlgo.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixReductionAlgo.cxx index c556dc52ee2ed5641ea91ef65dcb1568e2fb439e..7165bb63d7569a692d0f4e49e1801a1ee0e3e80a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixReductionAlgo.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixReductionAlgo.cxx @@ -1,15 +1,15 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTMatrixReductionAlgo.cxx + * @file FPGATrackSimMatrixReductionAlgo.cxx * @author Rewrite by Riley Xu - riley.xu@cern.ch after FTK code * @date May 21st, 2020 * @brief Algorithm to reduce matrix files from 2nd stage to 1st stage. */ -#include "HTTMatrixReductionAlgo.h" -#include "HTTMatrixIO.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMatrixReductionAlgo.h" +#include "FPGATrackSimMatrixIO.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include "TFile.h" #include "TTree.h" @@ -22,18 +22,18 @@ // Initialize /////////////////////////////////////////////////////////////////////////////// -HTTMatrixReductionAlgo::HTTMatrixReductionAlgo(const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimMatrixReductionAlgo::FPGATrackSimMatrixReductionAlgo(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { } -StatusCode HTTMatrixReductionAlgo::initialize() +StatusCode FPGATrackSimMatrixReductionAlgo::initialize() { - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_tHistSvc.retrieve()); - m_pmap_1st = m_HTTMapping->PlaneMap_1st(); - m_pmap_2nd = m_HTTMapping->PlaneMap_2nd(); + m_pmap_1st = m_FPGATrackSimMapping->PlaneMap_1st(); + m_pmap_2nd = m_FPGATrackSimMapping->PlaneMap_2nd(); // Setup the boundaries for the merge if (m_allregion) @@ -59,12 +59,12 @@ StatusCode HTTMatrixReductionAlgo::initialize() } -StatusCode HTTMatrixReductionAlgo::copySliceTree(TFile *file) +StatusCode FPGATrackSimMatrixReductionAlgo::copySliceTree(TFile *file) { // Is there a better way to do this? Idk how the interface to tHistSvc works - HTTTrackPars max; - HTTTrackPars min; - HTTTrackParsI nBins; + FPGATrackSimTrackPars max; + FPGATrackSimTrackPars min; + FPGATrackSimTrackParsI nBins; // Read old tree TTree *old_tree = (TTree*)file->Get("slice"); @@ -92,7 +92,7 @@ StatusCode HTTMatrixReductionAlgo::copySliceTree(TFile *file) // Write new tree TTree *new_tree = new TTree("slice", "Slice boundaries"); - ATH_CHECK(m_tHistSvc->regTree("/TRIGHTTMATRIX1STSTAGEOUT/slice", new_tree)); + ATH_CHECK(m_tHistSvc->regTree("/TRIGFPGATrackSimMATRIX1STSTAGEOUT/slice", new_tree)); new_tree->Branch("c_max", &max.qOverPt); new_tree->Branch("c_min", &min.qOverPt); @@ -132,7 +132,7 @@ StatusCode HTTMatrixReductionAlgo::copySliceTree(TFile *file) * * TODO this should be handled by the pmap? */ -std::pair<std::vector<size_t>, std::vector<size_t>> HTTMatrixReductionAlgo::matchStages() +std::pair<std::vector<size_t>, std::vector<size_t>> FPGATrackSimMatrixReductionAlgo::matchStages() { size_t iCoord_1st = 0; @@ -177,12 +177,12 @@ std::pair<std::vector<size_t>, std::vector<size_t>> HTTMatrixReductionAlgo::matc * - modules_1st - First stage sector definition * - acc_1st - First stage matrix accumulator */ -std::pair<std::vector<module_t>, HTTMatrixAccumulator> HTTMatrixReductionAlgo::reduce( - std::vector<module_t> const & modules_2nd, HTTMatrixAccumulator const & acc_2nd, +std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> FPGATrackSimMatrixReductionAlgo::reduce( + std::vector<module_t> const & modules_2nd, FPGATrackSimMatrixAccumulator const & acc_2nd, std::vector<size_t> const & layers_1st_to_2nd, std::vector<size_t> const & coords_1st_to_2nd) { std::vector<module_t> modules_1st(m_pmap_1st->getNLogiLayers()); // First stage sector definition (to be filled) - HTTMatrixAccumulator acc_1st(m_pmap_1st->getNLogiLayers(), m_pmap_1st->getNCoords()); // First stage accumulator (to be filled) + FPGATrackSimMatrixAccumulator acc_1st(m_pmap_1st->getNLogiLayers(), m_pmap_1st->getNCoords()); // First stage accumulator (to be filled) acc_1st.pars = acc_2nd.pars; acc_1st.track_bins = acc_2nd.track_bins; @@ -225,12 +225,12 @@ std::pair<std::vector<module_t>, HTTMatrixAccumulator> HTTMatrixReductionAlgo::r /* * Runs the main algorithm, accumulating the 1st stage matrices from file into m_sector_cum. */ -void HTTMatrixReductionAlgo::extract_1stStage(TFile *file) +void FPGATrackSimMatrixReductionAlgo::extract_1stStage(TFile *file) { auto matched_layers_coords = matchStages(); // Read 2nd stage info from file TTree *tree_2nd = (TTree*)file->Get(Form("am0")); - HTTMatrixReader reader(tree_2nd, m_pmap_2nd->getNLogiLayers(), m_pmap_2nd->getNCoords()); + FPGATrackSimMatrixReader reader(tree_2nd, m_pmap_2nd->getNLogiLayers(), m_pmap_2nd->getNCoords()); // Create 1st stage matrix and modules, and accumulate into m_sector_cum while (reader.nextEntry()) @@ -246,7 +246,7 @@ void HTTMatrixReductionAlgo::extract_1stStage(TFile *file) /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixReductionAlgo::execute() +StatusCode FPGATrackSimMatrixReductionAlgo::execute() { // Do nothing; this class does not process events. The main algorithm is // called in initialize() and finalize(). @@ -257,7 +257,7 @@ StatusCode HTTMatrixReductionAlgo::execute() // Finalize /////////////////////////////////////////////////////////////////////////////// -StatusCode HTTMatrixReductionAlgo::finalize() +StatusCode FPGATrackSimMatrixReductionAlgo::finalize() { { // Create the tree @@ -266,7 +266,7 @@ StatusCode HTTMatrixReductionAlgo::finalize() name << "am0"; title << "Ambank 0" << " parameters"; TTree* tree = new TTree(name.str().c_str(), title.str().c_str()); - ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGHTTMATRIX1STSTAGEOUT/%s",tree->GetName()), tree)); + ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimMATRIX1STSTAGEOUT/%s",tree->GetName()), tree)); // Fill the tree ::fillTree(m_sector_cum[0], tree, m_pmap_1st->getNLogiLayers(), m_pmap_1st->getNCoords()); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixReductionAlgo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixReductionAlgo.h similarity index 71% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixReductionAlgo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixReductionAlgo.h index f070ed5a91627344b66cf221c614c163ebd3a2a8..01ad1da72282b261ab247017b142b50ace2f1928 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBankGen/src/HTTMatrixReductionAlgo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/FPGATrackSimMatrixReductionAlgo.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTMatrixReductionAlgo_h -#define HTTMatrixReductionAlgo_h +#ifndef FPGATrackSimMatrixReductionAlgo_h +#define FPGATrackSimMatrixReductionAlgo_h /** - * @file HTTMatrixReductionAlgo.h + * @file FPGATrackSimMatrixReductionAlgo.h * @author Rewrite by Riley Xu - riley.xu@cern.ch after FTK code * @date May 21st, 2020 * @brief Algorithm to reduce matrix files from 2nd stage to 1st stage. @@ -23,8 +23,8 @@ #include "GaudiKernel/ITHistSvc.h" #include "AthenaBaseComps/AthAlgorithm.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "HTTMatrixAccumulator.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMatrixAccumulator.h" class TTree; @@ -32,12 +32,12 @@ class TTree; #include <vector> -class HTTMatrixReductionAlgo: public AthAlgorithm +class FPGATrackSimMatrixReductionAlgo: public AthAlgorithm { public: - HTTMatrixReductionAlgo (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTMatrixReductionAlgo() = default; + FPGATrackSimMatrixReductionAlgo (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimMatrixReductionAlgo() = default; StatusCode initialize() override; StatusCode finalize() override; // Execute does not do anything for this alg. This class does not process events, everything is done in init and finalize @@ -48,10 +48,10 @@ class HTTMatrixReductionAlgo: public AthAlgorithm /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc","TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"}; ServiceHandle<ITHistSvc> m_tHistSvc {this, "THistSvc","THistSvc"}; - HTTPlaneMap const * m_pmap_1st = nullptr; - HTTPlaneMap const * m_pmap_2nd = nullptr; + FPGATrackSimPlaneMap const * m_pmap_1st = nullptr; + FPGATrackSimPlaneMap const * m_pmap_2nd = nullptr; /////////////////////////////////////////////////////////////////////// // Configuration @@ -73,8 +73,8 @@ class HTTMatrixReductionAlgo: public AthAlgorithm StatusCode copySliceTree(TFile *file); std::pair<std::vector<size_t>, std::vector<size_t>> matchStages(); - std::pair<std::vector<module_t>, HTTMatrixAccumulator> reduce( - std::vector<module_t> const & modules_2nd, HTTMatrixAccumulator const & acc_2nd, + std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> reduce( + std::vector<module_t> const & modules_2nd, FPGATrackSimMatrixAccumulator const & acc_2nd, std::vector<size_t> const & layers_1st_to_2nd, std::vector<size_t> const & coords_1st_to_2nd); void extract_1stStage(TFile *file); }; @@ -82,5 +82,5 @@ class HTTMatrixReductionAlgo: public AthAlgorithm -#endif // HTTMatrixReductionAlgo_h +#endif // FPGATrackSimMatrixReductionAlgo_h diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/components/FPGATrackSimBankGen_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/components/FPGATrackSimBankGen_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..81fb730e947bc1d1fac1b9031911f1fd1af23314 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBankGen/src/components/FPGATrackSimBankGen_entries.cxx @@ -0,0 +1,9 @@ +#include "../FPGATrackSimMatrixGenAlgo.h" +#include "../FPGATrackSimConstGenAlgo.h" +#include "../FPGATrackSimMatrixReductionAlgo.h" +#include "../FPGATrackSimMatrixMergeAlgo.h" + +DECLARE_COMPONENT( FPGATrackSimConstGenAlgo ) +DECLARE_COMPONENT( FPGATrackSimMatrixMergeAlgo ) +DECLARE_COMPONENT( FPGATrackSimMatrixReductionAlgo ) +DECLARE_COMPONENT( FPGATrackSimMatrixGenAlgo ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/CMakeLists.txt similarity index 52% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/CMakeLists.txt rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/CMakeLists.txt index 676cdf7089d657ef3ad5094ee03173fdc1abc582..fdf7eac210ed374cc052e2bcc6638a6bef7e0e2a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/CMakeLists.txt +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/CMakeLists.txt @@ -1,30 +1,30 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( TrigHTTBanks ) +atlas_subdir( FPGATrackSimBanks ) # External dependencies: find_package( Eigen ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO ) # Create a library for non-Gaudi components -atlas_add_library( TrigHTTBanksLib +atlas_add_library( FPGATrackSimBanksLib src/*.cxx - PUBLIC_HEADERS TrigHTTBanks + PUBLIC_HEADERS FPGATrackSimBanks INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TrigHTTMapsLib TrigHTTObjectsLib + LINK_LIBRARIES ${EIGEN_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel FPGATrackSimMapsLib FPGATrackSimObjectsLib PRIVATE_LINK_LIBRARIES AsgMessagingLib ) # Declare Gaudi component(s) in the package -atlas_add_component( TrigHTTBanks +atlas_add_component( FPGATrackSimBanks src/components/*.cxx - LINK_LIBRARIES TrigHTTBanksLib ) + LINK_LIBRARIES FPGATrackSimBanksLib ) # Install files from the package and run flake8 test: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select=ATL900,ATL901 ) -#atlas_add_test( HTTFitConstantBank_test -# SOURCES test/HTTFitConstantBank_test.cxx -# LINK_LIBRARIES TrigHTTBanksLib TrigHTTObjectsLib TrigHTTMapsLib +#atlas_add_test( FPGATrackSimFitConstantBank_test +# SOURCES test/FPGATrackSimFitConstantBank_test.cxx +# LINK_LIBRARIES FPGATrackSimBanksLib FPGATrackSimObjectsLib FPGATrackSimMapsLib #) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..dd25766f29342fa7b592ca52107c423136faf38c --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimBanks/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTFitConstantBank.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimFitConstantBank.h similarity index 76% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTFitConstantBank.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimFitConstantBank.h index 2d161fd8f03e706e090a5d1b37db7d322e284f26..c9c736194a098ae3601b9e66e5e4cf22f59a6b94 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTFitConstantBank.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimFitConstantBank.h @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTFITCONSTANTBANK_H -#define HTTFITCONSTANTBANK_H +#ifndef FPGATrackSimFITCONSTANTBANK_H +#define FPGATrackSimFITCONSTANTBANK_H #include <Eigen/StdVector> EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::MatrixXf) @@ -13,18 +13,18 @@ EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::MatrixXf) #include <fstream> #include "AthenaBaseComps/AthMessaging.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" -class HTTTrack; +class FPGATrackSimTrack; -class HTTFitConstantBank : public AthMessaging +class FPGATrackSimFitConstantBank : public AthMessaging { public: // missing plane -1 means we guess hits, we don't have separate banks for a missing plane - HTTFitConstantBank(HTTPlaneMap const * pmap, int ncoords, std::string const & fname, bool isFirstStage, int missingPlane = -1); + FPGATrackSimFitConstantBank(FPGATrackSimPlaneMap const * pmap, int ncoords, std::string const & fname, bool isFirstStage, int missingPlane = -1); /////////////////////////////////////////////////////////////////////// // Simple Getters @@ -46,17 +46,17 @@ class HTTFitConstantBank : public AthMessaging /////////////////////////////////////////////////////////////////////// // Main Interface - bool linfit(sector_t sector, HTTTrack & track, bool isSecondStage) const; - void linfit_chisq(sector_t sector, HTTTrack &trk) const; - void linfit_pars_eval(sector_t sector, HTTTrack &trk) const; - int missing_point_guess(sector_t sector, HTTTrack &track, bool isFirstStage, bool doExtrapolation) const; + bool linfit(sector_t sector, FPGATrackSimTrack & track, bool isSecondStage) const; + void linfit_chisq(sector_t sector, FPGATrackSimTrack &trk) const; + void linfit_pars_eval(sector_t sector, FPGATrackSimTrack &trk) const; + int missing_point_guess(sector_t sector, FPGATrackSimTrack &track, bool isFirstStage, bool doExtrapolation) const; - void invlinfit(sector_t sector, HTTTrack &track, double const *constr) const; + void invlinfit(sector_t sector, FPGATrackSimTrack &track, double const *constr) const; void setIdealCoordFit(bool v) { m_isIdealCoordFit = v;} private: - HTTPlaneMap const * m_pmap = nullptr; + FPGATrackSimPlaneMap const * m_pmap = nullptr; /////////////////////////////////////////////////////////////////////// // Configuration @@ -104,4 +104,4 @@ class HTTFitConstantBank : public AthMessaging }; -#endif // HTTFITCONSTANTBANK_H +#endif // FPGATrackSimFITCONSTANTBANK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTSectorBank.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimSectorBank.h similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTSectorBank.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimSectorBank.h index 7f98a1f2a89915f5c01661f3f519af6b5cb0ae5c..ef25037394f1a3d76375e9fdaec0b1f4119a368c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTSectorBank.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimSectorBank.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTSECTORBANK_H -#define HTTSECTORBANK_H +#ifndef FPGATrackSimSECTORBANK_H +#define FPGATrackSimSECTORBANK_H /** - * @file HTTSectorBank.h + * @file FPGATrackSimSectorBank.h * @author Riley Xu - rixu@cern.ch * @date April 2nd, 2020 * @brief This file declares a class that stores the module IDs of the sectors. @@ -21,16 +21,16 @@ #include <map> #include <fstream> #include <vector> -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" -class HTTHit; +class FPGATrackSimHit; -class HTTSectorBank +class FPGATrackSimSectorBank { public: - HTTSectorBank(std::string const & filepath); + FPGATrackSimSectorBank(std::string const & filepath); size_t getNLayers() const { return m_nLayers; } size_t getNSectors() const { return m_s2mMap.size(); } @@ -43,7 +43,7 @@ class HTTSectorBank // Returns the sector matching 'hits' exactly (WC must be matched with WC), or -1 if none. // If multiple hits have different hashIDs, will prefer most popular, then random. - sector_t findSector(std::vector<std::vector<const HTTHit*>> const & hits) const; + sector_t findSector(std::vector<std::vector<const FPGATrackSimHit*>> const & hits) const; private: @@ -59,4 +59,4 @@ class HTTSectorBank -#endif // HTTSECTORBANK_H +#endif // FPGATrackSimSECTORBANK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTSectorSlice.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimSectorSlice.h similarity index 64% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTSectorSlice.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimSectorSlice.h index 13ad089e3533d24b59da9de13056f1f6ad6ab10a..fd2fd5463ecb75af41c0444f08766c3bca285f55 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/TrigHTTBanks/HTTSectorSlice.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/FPGATrackSimSectorSlice.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTSectorSlice_h -#define HTTSectorSlice_h +#ifndef FPGATrackSimSectorSlice_h +#define FPGATrackSimSectorSlice_h /** - * @file HTTSectorSlice.h + * @file FPGATrackSimSectorSlice.h * @author major update Riley Xu - rixu@cern.ch * @date March 20, 2020 * @brief Stores the range of eta/phi/etc. of each sector. @@ -19,36 +19,36 @@ * the inverse fit. */ -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <TROOT.h> #include <TClonesArray.h> #include <TMath.h> -class HTTSectorSlice +class FPGATrackSimSectorSlice { public: // Create blank bitvectors for writing new slice file - HTTSectorSlice(size_t nSectors, - HTTTrackParsI const & nBins, HTTTrackPars const & min, HTTTrackPars const & max); + FPGATrackSimSectorSlice(size_t nSectors, + FPGATrackSimTrackParsI const & nBins, FPGATrackSimTrackPars const & min, FPGATrackSimTrackPars const & max); // Read from file - HTTSectorSlice(const std::string & filepath); + FPGATrackSimSectorSlice(const std::string & filepath); // Slice writing functions - void addSectorToSlice(sector_t sector, HTTTrackParsI const & bins); + void addSectorToSlice(sector_t sector, FPGATrackSimTrackParsI const & bins); void saveSlices(const std::string & filepath); // Finds the parameter boundaries for where bitmasks are non-empty. // Returns (min, max). - std::pair<HTTTrackPars, HTTTrackPars> getBoundaries() const; + std::pair<FPGATrackSimTrackPars, FPGATrackSimTrackPars> getBoundaries() const; // Returns a list of sectors that contain pars. - std::vector<sector_t> searchSectors(HTTTrackPars const & pars) const; + std::vector<sector_t> searchSectors(FPGATrackSimTrackPars const & pars) const; private: @@ -61,21 +61,21 @@ class HTTSectorSlice TClonesArray *m_bits_eta = nullptr; // Number of bins for each parameter, size of arrays above - HTTTrackParsI m_nBins; + FPGATrackSimTrackParsI m_nBins; // Min and max parameters found out in the slice file - HTTTrackPars m_min; - HTTTrackPars m_max; + FPGATrackSimTrackPars m_min; + FPGATrackSimTrackPars m_max; // Step sizes, (max - min) / nbins - HTTTrackPars m_step; + FPGATrackSimTrackPars m_step; // Helper functions void calcDependentVals(); void getBoundary(const TClonesArray *bitmasks, double x_min, double x_max, double &autoMin, double &autoMax, bool wraps, const char *debug) const; - bool checkTrackPars(HTTTrackPars const & pars) const; + bool checkTrackPars(FPGATrackSimTrackPars const & pars) const; }; -#endif // HTTSectorSlice_h +#endif // FPGATrackSimSectorSlice_h diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/IFPGATrackSimBankSvc.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/IFPGATrackSimBankSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..ac94b978ad2179455e0214aa4d5b841b1b3e4d1e --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/FPGATrackSimBanks/IFPGATrackSimBankSvc.h @@ -0,0 +1,33 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef ITRIGFPGATrackSimBANKSVC_H +#define ITRIGFPGATrackSimBANKSVC_H + +/** + * This file defines an interface for a bank service. The service is in charge + * of loading all constants, including the fit coefficients, etc + * Other classes can use this service to retrieve the banks. + */ + + +#include "GaudiKernel/IService.h" +#include "GaudiKernel/IInterface.h" + +class FPGATrackSimFitConstantBank; +class FPGATrackSimSectorSlice; +class FPGATrackSimSectorBank; + +class IFPGATrackSimBankSvc : virtual public IService +{ + public: + DeclareInterfaceID(IFPGATrackSimBankSvc, 1, 0); + virtual ~IFPGATrackSimBankSvc() = default; + + virtual const FPGATrackSimFitConstantBank* FitConstantBank_1st(int missedPlane = -1) = 0; + virtual const FPGATrackSimFitConstantBank* FitConstantBank_2nd(int missedPlane = -1) = 0; + virtual const FPGATrackSimSectorSlice* SectorSlice() = 0; + virtual const FPGATrackSimSectorBank* SectorBank_1st() = 0; + virtual const FPGATrackSimSectorBank* SectorBank_2nd() = 0; +}; + +#endif // ITRIGFPGATrackSimBANKSVC_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/README b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/README new file mode 100644 index 0000000000000000000000000000000000000000..d204e40dacde2ab66b53f0312f3e7ebefc01f88c --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/README @@ -0,0 +1,20 @@ +## FPGATrackSimBanks package + +This package contains all files that manage constant banks. This includes fit constants and pattern banks. Algorithms for generating banks are located in FPGATrackSimBankGen. +All bank classes can be retrieved using IFPGATrackSimBankSvc, except for FPGATrackSimIndexPatt, which are AthAlgTools. File and other configuration can be set using the bank tags. + +#### Bank Service: + +1. IFPGATrackSimBankSvc.h: Interface declaration for the bank service. +2. FPGATrackSimBankSvc.h: Implementation of the bank service. + +#### Sector Files: + +1. FPGATrackSimFitConstantBank.h: This class stores the fit constants for all sectors, and exposes methods to perform linear fits and inverse fits. +2. FPGATrackSimSectorSlice.h: This class manages bitvectors that describe what range of track parameters go through each sector (a slice). Primarily used by track inversion to reverse-lookup sectors given a set of track parameters. +3. FPGATrackSimSectorBank.h: This class stores the sector definitions, the list of 8 or 13 modules that define a sector. It also provides methods to reverse-lookup a sector given a list of modules. + +#### Configuration: + +1. FPGATrackSimBankConfig.py: Functions for creating the bank service and applying the bank tag to FPGATrackSimBanks objects. +2. FPGATrackSimBankTags.py: JSON-like file that lists tags for configuring the FPGATrackSimBanks objects and algorithms. diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/python/HTTBankConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/python/FPGATrackSimBankConfig.py similarity index 55% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/python/HTTBankConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/python/FPGATrackSimBankConfig.py index 308a2ad851a9a1cd587e2fa5e8c7d152a8024c9e..26d338f1434cb7321854652b05b60e175f6eeeae 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/python/HTTBankConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/python/FPGATrackSimBankConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' @author Riley Xu - rixu@cern.ch @@ -6,33 +6,33 @@ @brief This file declares functions to make and configure the bank service. ''' -from TrigHTTBanks.TrigHTTBanksConf import TrigHTTBankSvc -from TrigHTTConfTools import HTTConfigCompInit +from FPGATrackSimBanks.FPGATrackSimBanksConf import FPGATrackSimBankSvc +from FPGATrackSimConfTools import FPGATrackSimConfigCompInit import os def addBankSvc(mapTag, bankTag): ''' - Creates and returns a TrigHTTBankSvc object, configured with the supplied tag. + Creates and returns a FPGATrackSimBankSvc object, configured with the supplied tag. This function adds the returned bank service instance to SvcMgr. ''' from AthenaCommon.AppMgr import ServiceMgr - HTTBankSvc = TrigHTTBankSvc() + MyFPGATrackSimBankSvc = FPGATrackSimBankSvc() - _applyTag(HTTBankSvc, mapTag, bankTag) + _applyTag(MyFPGATrackSimBankSvc, mapTag, bankTag) - if "EOS_MGM_URL_HTT" in os.environ: # Set by the gitlab yaml - _applyGitlabOverrides(HTTBankSvc) + if "EOS_MGM_URL_FPGATrackSim" in os.environ: # Set by the gitlab yaml + _applyGitlabOverrides(MyFPGATrackSimBankSvc) - ServiceMgr += HTTBankSvc + ServiceMgr += MyFPGATrackSimBankSvc - return HTTBankSvc + return MyFPGATrackSimBankSvc -def _applyTag(HTTBankSvc, mapTag, bankTag): +def _applyTag(MyFPGATrackSimBankSvc, mapTag, bankTag): ''' Helper function that sets the filepaths of the BankSvc using the supplied tag. ''' @@ -52,8 +52,8 @@ def _applyTag(HTTBankSvc, mapTag, bankTag): ] formats = { - 'region': HTTConfigCompInit.getRegionIndex(mapTag), - 'regionName': mapTag['regionNames'][HTTConfigCompInit.getRegionIndex(mapTag)], + 'region': FPGATrackSimConfigCompInit.getRegionIndex(mapTag), + 'regionName': mapTag['regionNames'][FPGATrackSimConfigCompInit.getRegionIndex(mapTag)], } for param in filepaths: @@ -61,31 +61,31 @@ def _applyTag(HTTBankSvc, mapTag, bankTag): value = (bankDir + bankTag[param]).format(**formats) else: value = bankDir + bankTag[param] - setattr(HTTBankSvc, param, value) + setattr(MyFPGATrackSimBankSvc, param, value) for param in filelists: if bankTag['formatted']: value = [(bankDir + path).format(**formats) for path in bankTag[param]] else: value = [bankDir + path for path in bankTag[param]] - setattr(HTTBankSvc, param, value) + setattr(MyFPGATrackSimBankSvc, param, value) -def _applyGitlabOverrides(HTTBankSvc): +def _applyGitlabOverrides(MyFPGATrackSimBankSvc): ''' Alters the filepaths for running on Gitlab CI ''' # The non-root files need to be copied to the pwd for param in ['sectorBank_1st', 'sectorBank_2nd', 'constants_1st', 'constants_2nd']: - filepath = getattr(HTTBankSvc, param) + filepath = getattr(MyFPGATrackSimBankSvc, param) newpath = os.path.basename(filepath) # This doesn't work for some reason, gets a file not found #import subprocess - #subprocess.call(['xrdcp', '-f', "'" + os.environ["EOS_MGM_URL_HTT"] + filepath + "'", "'" + newpath + "'"]) - setattr(HTTBankSvc, param, newpath) + #subprocess.call(['xrdcp', '-f', "'" + os.environ["EOS_MGM_URL_FPGATrackSim"] + filepath + "'", "'" + newpath + "'"]) + setattr(MyFPGATrackSimBankSvc, param, newpath) for param in ['sectorSlices']: - setattr(HTTBankSvc, param, os.environ["EOS_MGM_URL_HTT"] + getattr(HTTBankSvc, param)) + setattr(MyFPGATrackSimBankSvc, param, os.environ["EOS_MGM_URL_FPGATrackSim"] + getattr(MyFPGATrackSimBankSvc, param)) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/python/__init__.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..75ab742d2d963261339950bf83197e0b96381612 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/python/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +__author__ = "Jahred Adelman, FPGATrackSim team" + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/share/HTTFitConstantBank_test.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/share/FPGATrackSimFitConstantBank_test.ref similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/share/HTTFitConstantBank_test.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/share/FPGATrackSimFitConstantBank_test.ref diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/TrigHTTBankSvc.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimBankSvc.cxx similarity index 55% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/TrigHTTBankSvc.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimBankSvc.cxx index aa849a1eb47dad4b62c2df6e1c1dad6b2333e59c..f5a59ecd6e465bcaba00959b277f6e4c457d7e72 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/TrigHTTBankSvc.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimBankSvc.cxx @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "TrigHTTBankSvc.h" +#include "FPGATrackSimBankSvc.h" /////////////////////////////////////////////////////////////////////////////// @@ -9,17 +9,17 @@ /////////////////////////////////////////////////////////////////////////////// -TrigHTTBankSvc::TrigHTTBankSvc(const std::string& name, ISvcLocator*svc) : +FPGATrackSimBankSvc::FPGATrackSimBankSvc(const std::string& name, ISvcLocator*svc) : base_class(name,svc), - m_HTTMapping("TrigHTTMappingSvc", name) + m_FPGATrackSimMapping("FPGATrackSimMappingSvc", name) { } -StatusCode TrigHTTBankSvc::initialize() +StatusCode FPGATrackSimBankSvc::initialize() { - ATH_MSG_DEBUG("-------------- TrigHTTBankSvc -------------------"); + ATH_MSG_DEBUG("-------------- FPGATrackSimBankSvc -------------------"); ATH_MSG_DEBUG("BankType Map = " << m_bankTypes); ATH_MSG_DEBUG("Number of 1st stage coordinates = " << m_ncoords_1st); ATH_MSG_DEBUG("Number of 2nd stage coordinates = " << m_ncoords_2nd); @@ -27,8 +27,8 @@ StatusCode TrigHTTBankSvc::initialize() // resize this to the appropriate one and to be safe, set to nullptr to start - m_FitConstantBankNoGuess_1st.resize(m_HTTMapping->PlaneMap_1st()->getNLogiLayers()); - m_FitConstantBankNoGuess_2nd.resize(m_HTTMapping->PlaneMap_2nd()->getNLogiLayers()); + m_FitConstantBankNoGuess_1st.resize(m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers()); + m_FitConstantBankNoGuess_2nd.resize(m_FPGATrackSimMapping->PlaneMap_2nd()->getNLogiLayers()); for (unsigned i = 0; i < m_FitConstantBankNoGuess_1st.size(); i++) m_FitConstantBankNoGuess_1st[i] = nullptr; for (unsigned i = 0; i < m_FitConstantBankNoGuess_2nd.size(); i++) m_FitConstantBankNoGuess_2nd[i] = nullptr; @@ -41,45 +41,45 @@ StatusCode TrigHTTBankSvc::initialize() // Load Functions /////////////////////////////////////////////////////////////////////////////// -bool TrigHTTBankSvc::LoadFitConstantBank_1st(int missedPlane) +bool FPGATrackSimBankSvc::LoadFitConstantBank_1st(int missedPlane) { if (missedPlane == -1) - m_FitConstantBank_1st = std::unique_ptr<HTTFitConstantBank>(new HTTFitConstantBank(m_HTTMapping->PlaneMap_1st(), m_ncoords_1st, m_path_constants_1st, true)); + m_FitConstantBank_1st = std::unique_ptr<FPGATrackSimFitConstantBank>(new FPGATrackSimFitConstantBank(m_FPGATrackSimMapping->PlaneMap_1st(), m_ncoords_1st, m_path_constants_1st, true)); else - m_FitConstantBankNoGuess_1st[missedPlane] = std::unique_ptr<HTTFitConstantBank> (new HTTFitConstantBank(m_HTTMapping->PlaneMap_1st(), m_ncoords_1st, m_path_constants_1st_noguess[missedPlane], true, missedPlane)); // no check on the plane number + m_FitConstantBankNoGuess_1st[missedPlane] = std::unique_ptr<FPGATrackSimFitConstantBank> (new FPGATrackSimFitConstantBank(m_FPGATrackSimMapping->PlaneMap_1st(), m_ncoords_1st, m_path_constants_1st_noguess[missedPlane], true, missedPlane)); // no check on the plane number return true; } -bool TrigHTTBankSvc::LoadFitConstantBank_2nd(int missedPlane) +bool FPGATrackSimBankSvc::LoadFitConstantBank_2nd(int missedPlane) { if (missedPlane == -1) - m_FitConstantBank_2nd = std::unique_ptr<HTTFitConstantBank> (new HTTFitConstantBank(m_HTTMapping->PlaneMap_2nd(), m_ncoords_2nd, m_path_constants_2nd, false)); + m_FitConstantBank_2nd = std::unique_ptr<FPGATrackSimFitConstantBank> (new FPGATrackSimFitConstantBank(m_FPGATrackSimMapping->PlaneMap_2nd(), m_ncoords_2nd, m_path_constants_2nd, false)); else - m_FitConstantBankNoGuess_2nd[missedPlane] = std::unique_ptr<HTTFitConstantBank> (new HTTFitConstantBank(m_HTTMapping->PlaneMap_2nd(), m_ncoords_2nd, m_path_constants_2nd_noguess[missedPlane], false, missedPlane)); // no check on the plane number + m_FitConstantBankNoGuess_2nd[missedPlane] = std::unique_ptr<FPGATrackSimFitConstantBank> (new FPGATrackSimFitConstantBank(m_FPGATrackSimMapping->PlaneMap_2nd(), m_ncoords_2nd, m_path_constants_2nd_noguess[missedPlane], false, missedPlane)); // no check on the plane number return true; } -bool TrigHTTBankSvc::LoadSectorBank_1st() +bool FPGATrackSimBankSvc::LoadSectorBank_1st() { - m_SectorBank_1st = std::unique_ptr<HTTSectorBank> (new HTTSectorBank(m_path_sectorbank_1st)); + m_SectorBank_1st = std::unique_ptr<FPGATrackSimSectorBank> (new FPGATrackSimSectorBank(m_path_sectorbank_1st)); return true; } -bool TrigHTTBankSvc::LoadSectorBank_2nd() +bool FPGATrackSimBankSvc::LoadSectorBank_2nd() { - m_SectorBank_2nd = std::unique_ptr<HTTSectorBank> (new HTTSectorBank(m_path_sectorbank_2nd)); + m_SectorBank_2nd = std::unique_ptr<FPGATrackSimSectorBank> (new FPGATrackSimSectorBank(m_path_sectorbank_2nd)); return true; } -bool TrigHTTBankSvc::LoadSectorSlice() +bool FPGATrackSimBankSvc::LoadSectorSlice() { - m_SectorSlices = std::unique_ptr<HTTSectorSlice> (new HTTSectorSlice(m_path_sectorslices)); + m_SectorSlices = std::unique_ptr<FPGATrackSimSectorSlice> (new FPGATrackSimSectorSlice(m_path_sectorslices)); return true; } @@ -88,11 +88,11 @@ bool TrigHTTBankSvc::LoadSectorSlice() /////////////////////////////////////////////////////////////////////////////// -// ITrigHTTBankSvc Functions +// IFPGATrackSimBankSvc Functions /////////////////////////////////////////////////////////////////////////////// -const HTTFitConstantBank* TrigHTTBankSvc::FitConstantBank_1st(int missedPlane) +const FPGATrackSimFitConstantBank* FPGATrackSimBankSvc::FitConstantBank_1st(int missedPlane) { if (missedPlane == -1) { // Don't need to check the return actually, will return nullptr anyways @@ -109,7 +109,7 @@ const HTTFitConstantBank* TrigHTTBankSvc::FitConstantBank_1st(int missedPlane) } -const HTTFitConstantBank* TrigHTTBankSvc::FitConstantBank_2nd(int missedPlane) +const FPGATrackSimFitConstantBank* FPGATrackSimBankSvc::FitConstantBank_2nd(int missedPlane) { if (missedPlane == -1) { // Don't need to check the return actually, will return nullptr anyways @@ -126,7 +126,7 @@ const HTTFitConstantBank* TrigHTTBankSvc::FitConstantBank_2nd(int missedPlane) } -const HTTSectorBank* TrigHTTBankSvc::SectorBank_1st() +const FPGATrackSimSectorBank* FPGATrackSimBankSvc::SectorBank_1st() { // Don't need to check the return actually, will return nullptr anyways if (!m_SectorBank_1st) LoadSectorBank_1st(); @@ -134,7 +134,7 @@ const HTTSectorBank* TrigHTTBankSvc::SectorBank_1st() return m_SectorBank_1st.get(); } -const HTTSectorBank* TrigHTTBankSvc::SectorBank_2nd() +const FPGATrackSimSectorBank* FPGATrackSimBankSvc::SectorBank_2nd() { // Don't need to check the return actually, will return nullptr anyways if (!m_SectorBank_2nd) LoadSectorBank_2nd(); @@ -143,7 +143,7 @@ const HTTSectorBank* TrigHTTBankSvc::SectorBank_2nd() } -const HTTSectorSlice* TrigHTTBankSvc::SectorSlice() +const FPGATrackSimSectorSlice* FPGATrackSimBankSvc::SectorSlice() { // Don't need to check the return actually, will return nullptr anyways if (!m_SectorSlices) LoadSectorSlice(); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/TrigHTTBankSvc.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimBankSvc.h similarity index 55% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/TrigHTTBankSvc.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimBankSvc.h index e9d7755f6f9e8226c24703bad27fb5cca020eebf..1c6632d7c81fd3d9fc67e3155d0ea6aee5a1deb6 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/TrigHTTBankSvc.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimBankSvc.h @@ -1,37 +1,37 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef TRIGHTTBANKSVC_H -#define TRIGHTTBANKSVC_H +#ifndef TRIGFPGATrackSimBANKSVC_H +#define TRIGFPGATrackSimBANKSVC_H #include "AthenaBaseComps/AthService.h" #include "GaudiKernel/Service.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTBanks/HTTFitConstantBank.h" -#include "TrigHTTBanks/HTTSectorSlice.h" -#include "TrigHTTBanks/HTTSectorBank.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimBanks/FPGATrackSimFitConstantBank.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorSlice.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorBank.h" -class TrigHTTBankSvc : public extends< AthService, ITrigHTTBankSvc > +class FPGATrackSimBankSvc : public extends< AthService, IFPGATrackSimBankSvc > { public: /////////////////////////////////////////////////////////////////////// // AthService - TrigHTTBankSvc(const std::string& name, ISvcLocator* svc); - virtual ~TrigHTTBankSvc() = default; + FPGATrackSimBankSvc(const std::string& name, ISvcLocator* svc); + virtual ~FPGATrackSimBankSvc() = default; virtual StatusCode initialize() override; /////////////////////////////////////////////////////////////////////// - // ITrigHTTBankSvc + // IFPGATrackSimBankSvc - virtual const HTTFitConstantBank* FitConstantBank_1st(int missedPlane = -1) override; - virtual const HTTFitConstantBank* FitConstantBank_2nd(int missedPlane = -1) override; - virtual const HTTSectorBank* SectorBank_1st() override; - virtual const HTTSectorBank* SectorBank_2nd() override; - virtual const HTTSectorSlice* SectorSlice() override; + virtual const FPGATrackSimFitConstantBank* FitConstantBank_1st(int missedPlane = -1) override; + virtual const FPGATrackSimFitConstantBank* FitConstantBank_2nd(int missedPlane = -1) override; + virtual const FPGATrackSimSectorBank* SectorBank_1st() override; + virtual const FPGATrackSimSectorBank* SectorBank_2nd() override; + virtual const FPGATrackSimSectorSlice* SectorSlice() override; private: // Gaudi properties @@ -48,18 +48,18 @@ class TrigHTTBankSvc : public extends< AthService, ITrigHTTBankSvc > Gaudi::Property<std::vector<std::string> > m_path_constants_1st_noguess {this, "constantsNoGuess_1st", {}, "Path of the 1st stage constants without guessing"}; Gaudi::Property<std::vector<std::string> > m_path_constants_2nd_noguess {this, "constantsNoGuess_2nd", {}, "Path of the 2nd stage constants without guessing"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping; /////////////////////////////////////////////////////////////////////// // Storage pointers - std::unique_ptr <HTTFitConstantBank> m_FitConstantBank_1st = nullptr; - std::unique_ptr <HTTFitConstantBank> m_FitConstantBank_2nd = nullptr; - std::vector<std::unique_ptr <HTTFitConstantBank> > m_FitConstantBankNoGuess_1st; - std::vector<std::unique_ptr <HTTFitConstantBank> > m_FitConstantBankNoGuess_2nd; - std::unique_ptr<HTTSectorBank> m_SectorBank_1st = nullptr; - std::unique_ptr<HTTSectorBank> m_SectorBank_2nd = nullptr; - std::unique_ptr<HTTSectorSlice> m_SectorSlices = nullptr; + std::unique_ptr <FPGATrackSimFitConstantBank> m_FitConstantBank_1st = nullptr; + std::unique_ptr <FPGATrackSimFitConstantBank> m_FitConstantBank_2nd = nullptr; + std::vector<std::unique_ptr <FPGATrackSimFitConstantBank> > m_FitConstantBankNoGuess_1st; + std::vector<std::unique_ptr <FPGATrackSimFitConstantBank> > m_FitConstantBankNoGuess_2nd; + std::unique_ptr<FPGATrackSimSectorBank> m_SectorBank_1st = nullptr; + std::unique_ptr<FPGATrackSimSectorBank> m_SectorBank_2nd = nullptr; + std::unique_ptr<FPGATrackSimSectorSlice> m_SectorSlices = nullptr; /////////////////////////////////////////////////////////////////////// // Methods for lazy loading. @@ -72,4 +72,4 @@ class TrigHTTBankSvc : public extends< AthService, ITrigHTTBankSvc > }; -#endif // TRIGHTTBANKSVC_H +#endif // TRIGFPGATrackSimBANKSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTFitConstantBank.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimFitConstantBank.cxx similarity index 91% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTFitConstantBank.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimFitConstantBank.cxx index e8ebc33bdffb40f129022ec45ba01438dbeeb2c6..3bf6e8182e9afe237f8277cdd583dd185051db4e 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTFitConstantBank.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimFitConstantBank.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #include <Eigen/StdVector> -#include "TrigHTTBanks/HTTFitConstantBank.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTConstants.h" +#include "FPGATrackSimBanks/FPGATrackSimFitConstantBank.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" #include "limits.h" #include <TMath.h> #include <Eigen/Dense> @@ -19,8 +19,8 @@ #include <sstream> -HTTFitConstantBank::HTTFitConstantBank(HTTPlaneMap const * pmap, int ncoords, std::string const & fname, bool isFirstStage, int missingPlane) : - AthMessaging ("HTTFitConstantBank"), +FPGATrackSimFitConstantBank::FPGATrackSimFitConstantBank(FPGATrackSimPlaneMap const * pmap, int ncoords, std::string const & fname, bool isFirstStage, int missingPlane) : + AthMessaging ("FPGATrackSimFitConstantBank"), m_pmap(pmap), m_bankID(0), m_nsectors(0), @@ -60,7 +60,7 @@ HTTFitConstantBank::HTTFitConstantBank(HTTPlaneMap const * pmap, int ncoords, st // Reads the file header, sets configuration and sizes the sector variables -void HTTFitConstantBank::readHeader(std::ifstream & geocfile) +void FPGATrackSimFitConstantBank::readHeader(std::ifstream & geocfile) { std::string key; int ival; @@ -104,7 +104,7 @@ void HTTFitConstantBank::readHeader(std::ifstream & geocfile) // Reads the main body of the constants file -void HTTFitConstantBank::readSectorInfo(std::ifstream & geocfile) +void FPGATrackSimFitConstantBank::readSectorInfo(std::ifstream & geocfile) { std::string key; int ival; @@ -169,7 +169,7 @@ void HTTFitConstantBank::readSectorInfo(std::ifstream & geocfile) // Majority fits are those for which we have missing hits or when we drop a hit on 8/8 to improve chi2 -void HTTFitConstantBank::calculateMajority() +void FPGATrackSimFitConstantBank::calculateMajority() { for (int isec=0;isec!=m_nsectors;++isec) @@ -208,7 +208,7 @@ void HTTFitConstantBank::calculateMajority() // Prepares the inverted constants used in the invlinfit() -void HTTFitConstantBank::prepareInvFitConstants() +void FPGATrackSimFitConstantBank::prepareInvFitConstants() { m_invfit_consts.resize(m_nsectors); @@ -301,7 +301,7 @@ void HTTFitConstantBank::prepareInvFitConstants() // This functions takes in hit coordinates from 'track' and does the linear fit // to calculate the track parameters, which are populated back into 'track'. // Returns true on success. -bool HTTFitConstantBank::linfit(sector_t sector, HTTTrack & track, bool isSecondStage) const +bool FPGATrackSimFitConstantBank::linfit(sector_t sector, FPGATrackSimTrack & track, bool isSecondStage) const { // Do majority guess if it's needed if (m_missingPlane == -1 && !m_isIdealCoordFit) @@ -324,7 +324,7 @@ bool HTTFitConstantBank::linfit(sector_t sector, HTTTrack & track, bool isSecond } -int HTTFitConstantBank::missing_point_guess(sector_t sector, HTTTrack &track, bool isFirstStage, bool doExtrapolation) const +int FPGATrackSimFitConstantBank::missing_point_guess(sector_t sector, FPGATrackSimTrack &track, bool isFirstStage, bool doExtrapolation) const { std::vector<int> coordsmask(m_ncoords); @@ -410,7 +410,7 @@ int HTTFitConstantBank::missing_point_guess(sector_t sector, HTTTrack &track, bo if(m_pmap->getDim(m_pmap->getCoordLayer(missid[m])) == 1){ - HTTHit newhit; + FPGATrackSimHit newhit; if(!doExtrapolation) newhit.setHitType(HitType::guessed); else @@ -427,11 +427,11 @@ int HTTFitConstantBank::missing_point_guess(sector_t sector, HTTTrack &track, bo newhit.setPhiCoord(missing_hits[m]); } - track.setHTTHit(missedplane, newhit); + track.setFPGATrackSimHit(missedplane, newhit); } else if (m_pmap->getDim(m_pmap->getCoordLayer(missid[m])) == 2){ - HTTHit newhit; + FPGATrackSimHit newhit; if(!doExtrapolation) newhit.setHitType(HitType::guessed); else @@ -451,14 +451,14 @@ int HTTFitConstantBank::missing_point_guess(sector_t sector, HTTTrack &track, bo } m++; //skip ahead - track.setHTTHit(missedplane, newhit); + track.setFPGATrackSimHit(missedplane, newhit); } } return nmissing; } -void HTTFitConstantBank::linfit_chisq(sector_t sector, HTTTrack &trk) const +void FPGATrackSimFitConstantBank::linfit_chisq(sector_t sector, FPGATrackSimTrack &trk) const { float chi2 = 0; @@ -490,7 +490,7 @@ void HTTFitConstantBank::linfit_chisq(sector_t sector, HTTTrack &trk) const The fits return the number of useful parameter for the fits. */ -void HTTFitConstantBank::linfit_pars_eval(sector_t sector, HTTTrack &trk) const +void FPGATrackSimFitConstantBank::linfit_pars_eval(sector_t sector, FPGATrackSimTrack &trk) const { std::vector<float> pars(m_npars); @@ -523,7 +523,7 @@ void HTTFitConstantBank::linfit_pars_eval(sector_t sector, HTTTrack &trk) const /** This method uses the track parameters and additional constraints to use the constants to calculate the corresponding hits. This method is the base of the patt-from-constant generation. */ -void HTTFitConstantBank::invlinfit(sector_t sector, HTTTrack &track, double const *constr) const +void FPGATrackSimFitConstantBank::invlinfit(sector_t sector, FPGATrackSimTrack &track, double const *constr) const { // vector of the acutal parameters, it is zeroed Eigen::VectorXf pars(m_ncoords); @@ -551,7 +551,7 @@ void HTTFitConstantBank::invlinfit(sector_t sector, HTTTrack &track, double cons for (int j = 0; j < m_ncoords ; ++j) { int plane = m_pmap->getCoordLayer(j); SiliconTech Tech = m_pmap->getDetType(plane); - HTTHit hit; + FPGATrackSimHit hit; hit.setHitType(HitType::mapped); hit.setDetType(Tech); hit.setLayer(plane); @@ -568,6 +568,6 @@ void HTTFitConstantBank::invlinfit(sector_t sector, HTTTrack &track, double cons ++j; // skip a coordinate if doing two at once } - track.setHTTHit(plane, hit); + track.setFPGATrackSimHit(plane, hit); } } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTFitConstantBank.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimFitConstantBank.h similarity index 76% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTFitConstantBank.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimFitConstantBank.h index 598b5e7b202831846e93498921d8f9cf3f44dc5a..319a9d65636725d4c038197b57ff85552d2e02d2 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTFitConstantBank.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimFitConstantBank.h @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTFITCONSTANTBANK_H -#define HTTFITCONSTANTBANK_H +#ifndef FPGATrackSimFITCONSTANTBANK_H +#define FPGATrackSimFITCONSTANTBANK_H #include <Eigen/StdVector> EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::MatrixXf) @@ -13,18 +13,18 @@ EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::MatrixXf) #include <fstream> #include "AthenaBaseComps/AthMessaging.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" -class HTTTrack; +class FPGATrackSimTrack; -class HTTFitConstantBank : public AthMessaging +class FPGATrackSimFitConstantBank : public AthMessaging { public: // missing plane -1 means we guess hits, we don't have separate banks for a missing plane - HTTFitConstantBank(HTTPlaneMap const * pmap, int ncoords, std::string const & fname, bool isFirstStage, int missingPlane = -1); + FPGATrackSimFitConstantBank(FPGATrackSimPlaneMap const * pmap, int ncoords, std::string const & fname, bool isFirstStage, int missingPlane = -1); void prepareInvFitConstants(); /////////////////////////////////////////////////////////////////////// @@ -47,17 +47,17 @@ class HTTFitConstantBank : public AthMessaging /////////////////////////////////////////////////////////////////////// // Main Interface - bool linfit(sector_t sector, HTTTrack & track, bool isSecondStage) const; - void linfit_chisq(sector_t sector, HTTTrack &trk) const; - void linfit_pars_eval(sector_t sector, HTTTrack &trk) const; - int missing_point_guess(sector_t sector, HTTTrack &track, bool isFirstStage, bool doExtrapolation) const; + bool linfit(sector_t sector, FPGATrackSimTrack & track, bool isSecondStage) const; + void linfit_chisq(sector_t sector, FPGATrackSimTrack &trk) const; + void linfit_pars_eval(sector_t sector, FPGATrackSimTrack &trk) const; + int missing_point_guess(sector_t sector, FPGATrackSimTrack &track, bool isFirstStage, bool doExtrapolation) const; - void invlinfit(sector_t sector, HTTTrack &track, double const *constr) const; + void invlinfit(sector_t sector, FPGATrackSimTrack &track, double const *constr) const; void setIdealCoordFit(bool v) { m_isIdealCoordFit = v;} private: - HTTPlaneMap const * m_pmap = nullptr; + FPGATrackSimPlaneMap const * m_pmap = nullptr; /////////////////////////////////////////////////////////////////////// // Configuration @@ -104,4 +104,4 @@ class HTTFitConstantBank : public AthMessaging }; -#endif // HTTFITCONSTANTBANK_H +#endif // FPGATrackSimFITCONSTANTBANK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorBank.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorBank.cxx similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorBank.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorBank.cxx index e4eaa1b7909314f48a57edfe0da34bda2acfc388..d6d7c69fbdfa087ee85a8f2284322d86a19b2218 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorBank.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorBank.cxx @@ -1,16 +1,16 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTSectorBank.cxx + * @file FPGATrackSimSectorBank.cxx * @author Riley Xu - rixu@cern.ch * @date April 2nd, 2020 * @brief This file declares a class that stores the module IDs of the sectors. */ -#include "TrigHTTBanks/HTTSectorBank.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorBank.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <AsgMessaging/MessageCheck.h> #include <set> @@ -20,7 +20,7 @@ using namespace asg::msgUserCode; -HTTSectorBank::HTTSectorBank(std::string const & filepath) +FPGATrackSimSectorBank::FPGATrackSimSectorBank(std::string const & filepath) { // Open the file for reading ANA_MSG_INFO("Reading " << filepath); @@ -28,7 +28,7 @@ HTTSectorBank::HTTSectorBank(std::string const & filepath) if (!fin.is_open()) { ANA_MSG_ERROR("Couldn't open " << filepath); - throw ("HTTSectorBank couldn't open " + filepath); + throw ("FPGATrackSimSectorBank couldn't open " + filepath); } // Retrieve the number of sectors and layers, resize m_s2mMap @@ -43,7 +43,7 @@ HTTSectorBank::HTTSectorBank(std::string const & filepath) // Retrieve the number of sectors and layers, resize m_s2mMap -void HTTSectorBank::readHeader(std::ifstream & fin) +void FPGATrackSimSectorBank::readHeader(std::ifstream & fin) { bool ok = true; std::string line; @@ -61,7 +61,7 @@ void HTTSectorBank::readHeader(std::ifstream & fin) } -void HTTSectorBank::readSectors(std::ifstream & fin) +void FPGATrackSimSectorBank::readSectors(std::ifstream & fin) { std::string line; bool ok = true; @@ -93,7 +93,7 @@ void HTTSectorBank::readSectors(std::ifstream & fin) // Inverts m_s2mMap, a list of module ids for each sector, into a mapping // from module ids to sectors, m_m2sMap. -void HTTSectorBank::makeInverseMap() +void FPGATrackSimSectorBank::makeInverseMap() { m_m2sMap.resize(m_nLayers); for (size_t layer = 0; layer < m_nLayers; layer++) @@ -107,7 +107,7 @@ void HTTSectorBank::makeInverseMap() } -std::vector<sector_t> HTTSectorBank::getSectors(unsigned layer, module_t module) const +std::vector<sector_t> FPGATrackSimSectorBank::getSectors(unsigned layer, module_t module) const { std::vector<sector_t> out; auto range = m_m2sMap[layer].equal_range(module); @@ -118,7 +118,7 @@ std::vector<sector_t> HTTSectorBank::getSectors(unsigned layer, module_t module) } -sector_t HTTSectorBank::findSector(std::vector<module_t> const & modules) const +sector_t FPGATrackSimSectorBank::findSector(std::vector<module_t> const & modules) const { assert(modules.size() == m_nLayers); @@ -143,7 +143,7 @@ sector_t HTTSectorBank::findSector(std::vector<module_t> const & modules) const // Returns the sector matching 'hits' exactly (WC must be matched with WC), or -1 if none. // If multiple hits have different hashIDs, will prefer most popular, then random. -sector_t HTTSectorBank::findSector(std::vector<std::vector<const HTTHit*>> const & hits) const +sector_t FPGATrackSimSectorBank::findSector(std::vector<std::vector<const FPGATrackSimHit*>> const & hits) const { std::vector<module_t> modules(hits.size()); @@ -155,12 +155,12 @@ sector_t HTTSectorBank::findSector(std::vector<std::vector<const HTTHit*>> const } else if (hits[i].size() == 1) { - modules[i] = hits[i][0]->getHTTIdentifierHash(); + modules[i] = hits[i][0]->getFPGATrackSimIdentifierHash(); } else { std::unordered_map<unsigned, unsigned> hashCount; - for (const HTTHit* h : hits[i]) hashCount[h->getHTTIdentifierHash()]++; + for (const FPGATrackSimHit* h : hits[i]) hashCount[h->getFPGATrackSimIdentifierHash()]++; modules[i] = std::max_element(hashCount.begin(), hashCount.end())->first; } } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorBank.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorBank.h similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorBank.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorBank.h index 028f7ab7388ea8fc908c28f40a62b3e22169620a..668dada5167e8a933aaadb43459cd7c4cf5fb9eb 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorBank.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorBank.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTSECTORBANK_H -#define HTTSECTORBANK_H +#ifndef FPGATrackSimSECTORBANK_H +#define FPGATrackSimSECTORBANK_H /** - * @file HTTSectorBank.h + * @file FPGATrackSimSectorBank.h * @author Riley Xu - rixu@cern.ch * @date April 2nd, 2020 * @brief This file declares a class that stores the module IDs of the sectors. @@ -21,16 +21,16 @@ #include <map> #include <fstream> #include <vector> -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" -class HTTHit; +class FPGATrackSimHit; -class HTTSectorBank +class FPGATrackSimSectorBank { public: - HTTSectorBank(std::string const & filepath); + FPGATrackSimSectorBank(std::string const & filepath); size_t getNLayers() const { return m_nLayers; } size_t getNSectors() const { return m_s2mMap.size(); } @@ -43,7 +43,7 @@ class HTTSectorBank // Returns the sector matching 'hits' exactly (WC must be matched with WC), or -1 if none. // If multiple hits have different hashIDs, will prefer most popular, then random. - sector_t findSector(std::vector<std::vector<const HTTHit*>> const & hits) const; + sector_t findSector(std::vector<std::vector<const FPGATrackSimHit*>> const & hits) const; private: @@ -59,4 +59,4 @@ class HTTSectorBank -#endif // HTTSECTORBANK_H +#endif // FPGATrackSimSECTORBANK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorSlice.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorSlice.cxx similarity index 91% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorSlice.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorSlice.cxx index 57da8b9e0e54c51f74f40677869920f2dcd15092..ab5673305877935a6c6ffd9b2e93f3ea71043853 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/src/HTTSectorSlice.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/FPGATrackSimSectorSlice.cxx @@ -1,14 +1,14 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTSectorSlice.h + * @file FPGATrackSimSectorSlice.h * @author unkown * @date nope * @brief See header. */ -#include "TrigHTTBanks/HTTSectorSlice.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorSlice.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <TFile.h> #include <TTree.h> @@ -36,8 +36,8 @@ int clamp(int bin, int min, int max) // Constructor/Initialization -HTTSectorSlice::HTTSectorSlice(size_t nSectors, - HTTTrackParsI const & nBins, HTTTrackPars const & min, HTTTrackPars const & max) +FPGATrackSimSectorSlice::FPGATrackSimSectorSlice(size_t nSectors, + FPGATrackSimTrackParsI const & nBins, FPGATrackSimTrackPars const & min, FPGATrackSimTrackPars const & max) : m_nBins(nBins), m_min(min), @@ -59,7 +59,7 @@ HTTSectorSlice::HTTSectorSlice(size_t nSectors, } -HTTSectorSlice::HTTSectorSlice(std::string const & filepath) +FPGATrackSimSectorSlice::FPGATrackSimSectorSlice(std::string const & filepath) { ANA_MSG_INFO("Reading " << filepath); TFile *slice_file = TFile::Open(filepath.c_str()); @@ -111,7 +111,7 @@ HTTSectorSlice::HTTSectorSlice(std::string const & filepath) -void HTTSectorSlice::calcDependentVals() +void FPGATrackSimSectorSlice::calcDependentVals() { m_step.phi = (m_max.phi - m_min.phi) / m_nBins.phi; @@ -125,7 +125,7 @@ void HTTSectorSlice::calcDependentVals() /////////////////////////////////////////////////////////////////////////////// // Slice writing functions -void HTTSectorSlice::addSectorToSlice(sector_t sector, HTTTrackParsI const & bins) +void FPGATrackSimSectorSlice::addSectorToSlice(sector_t sector, FPGATrackSimTrackParsI const & bins) { int bin; @@ -146,7 +146,7 @@ void HTTSectorSlice::addSectorToSlice(sector_t sector, HTTTrackParsI const & bin } -void HTTSectorSlice::saveSlices(const std::string & filepath) +void FPGATrackSimSectorSlice::saveSlices(const std::string & filepath) { TFile ofile(filepath.c_str(), "recreate"); @@ -187,7 +187,7 @@ void HTTSectorSlice::saveSlices(const std::string & filepath) // searchSectors and helpers -bool HTTSectorSlice::checkTrackPars(HTTTrackPars const & pars) const +bool FPGATrackSimSectorSlice::checkTrackPars(FPGATrackSimTrackPars const & pars) const { if (pars.phi < m_min.phi || pars.phi > m_max.phi) return false; if (pars.qOverPt < m_min.qOverPt || pars.qOverPt > m_max.qOverPt) return false; @@ -206,7 +206,7 @@ int getBin(double x, double min, double step, int clamp_max) } -std::vector<sector_t> HTTSectorSlice::searchSectors(HTTTrackPars const & pars) const +std::vector<sector_t> FPGATrackSimSectorSlice::searchSectors(FPGATrackSimTrackPars const & pars) const { std::vector<sector_t> sectors; if (!checkTrackPars(pars)) @@ -242,10 +242,10 @@ std::vector<sector_t> HTTSectorSlice::searchSectors(HTTTrackPars const & pars) c // Calculates the parameter boundaries for where bitmasks are non-empty. // Returns (min, max). -std::pair<HTTTrackPars, HTTTrackPars> HTTSectorSlice::getBoundaries() const +std::pair<FPGATrackSimTrackPars, FPGATrackSimTrackPars> FPGATrackSimSectorSlice::getBoundaries() const { - HTTTrackPars min; - HTTTrackPars max; + FPGATrackSimTrackPars min; + FPGATrackSimTrackPars max; getBoundary(m_bits_phi, m_min.phi, m_max.phi, min.phi, max.phi, true, "phi"); getBoundary(m_bits_c, m_min.qOverPt, m_max.qOverPt, min.qOverPt, max.qOverPt, false, "c"); @@ -266,7 +266,7 @@ std::pair<HTTTrackPars, HTTTrackPars> HTTSectorSlice::getBoundaries() const * @param bound_min - Return value for the boundary min x * @param bound_max - Return value for the boundary max x */ -void HTTSectorSlice::getBoundary(const TClonesArray *bitmasks, double x_min, double x_max, +void FPGATrackSimSectorSlice::getBoundary(const TClonesArray *bitmasks, double x_min, double x_max, double &bound_min, double &bound_max, bool wraps, const char *debug) const { int nbin = bitmasks->GetEntries(); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/components/FPGATrackSimBanks_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/components/FPGATrackSimBanks_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..be82a6e32017261a703bef6967a968a5eee54f9a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/src/components/FPGATrackSimBanks_entries.cxx @@ -0,0 +1,3 @@ +#include "../FPGATrackSimBankSvc.h" + +DECLARE_COMPONENT(FPGATrackSimBankSvc) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/test/HTTFitConstantBank_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/test/FPGATrackSimFitConstantBank_test.cxx similarity index 81% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/test/HTTFitConstantBank_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/test/FPGATrackSimFitConstantBank_test.cxx index 5479b49c01ab535db422e6a7230991c7f3aa19ef..d3b6d5e191b62517e686c6cd07c21bedb55c353f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/test/HTTFitConstantBank_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/test/FPGATrackSimFitConstantBank_test.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #undef NDEBUG #include <cassert> @@ -8,9 +8,9 @@ #include <filesystem> #include "AthenaKernel/getMessageSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "../src/HTTFitConstantBank.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "../src/FPGATrackSimFitConstantBank.h" #include "PathResolver/PathResolver.h" static const int ncoords=9; @@ -34,20 +34,20 @@ int main(int, char**) { std::filesystem::copy(const_path,"./test.gcon",std::filesystem::copy_options::overwrite_existing); - HTTPlaneMap pmap("./step3_01eta03_03phi05_fit.pmap", 0, 1); - HTTFitConstantBank fitconstants(&pmap, 9, "./test.gcon", false, 0); - HTTTrack track; + FPGATrackSimPlaneMap pmap("./step3_01eta03_03phi05_fit.pmap", 0, 1); + FPGATrackSimFitConstantBank fitconstants(&pmap, 9, "./test.gcon", false, 0); + FPGATrackSimTrack track; track.setNLayers(ncoords - npix); track.setTrackCorrType(TrackCorrType::Second); for (unsigned layer=0; layer < (ncoords-npix); layer++) { - HTTHit hit; + FPGATrackSimHit hit; hit.setLayer(layer); hit.setX(x[layer]); hit.setY(y[layer]); hit.setZ(z[layer]); if (layer < npix) hit.setDetType(SiliconTech::pixel); else hit.setDetType(SiliconTech::strip); - track.setHTTHit(layer, hit); + track.setFPGATrackSimHit(layer, hit); } fitconstants.linfit(0, track, false); std::cerr << "q/pt = " << track.getQOverPt() << " phi = " << track.getPhi() << " d0 = " << track.getD0() << " z0 = " << track.getZ0() << " eta = " << track.getEta() << " and chi2/ndf = " << track.getChi2ndof() << std::endl; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/test_banks/test.gcon b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/test_banks/test.gcon similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTBanks/test_banks/test.gcon rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimBanks/test_banks/test.gcon diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e790c9d5f259528cbdb34defbe14c86bfb835e1 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( FPGATrackSimConfTools ) + +# External dependencies: +find_package( ROOT COMPONENTS Core MathCore Physics ) + +# Component(s) in the package: +atlas_add_library( FPGATrackSimConfToolsLib + src/*.cxx FPGATrackSimConfTools/*.h + PUBLIC_HEADERS FPGATrackSimConfTools + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib + LINK_LIBRARIES AthenaBaseComps AtlasHepMCLib GaudiKernel FPGATrackSimObjectsLib ) + +atlas_add_component( FPGATrackSimConfTools + src/components/*.cxx + LINK_LIBRARIES FPGATrackSimConfToolsLib ) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) +atlas_install_scripts( test/FPGATrackSimInputTestSetup.sh ) + +# Tests in the package: +atlas_add_test( FPGATrackSimRegionSlices_test + SOURCES test/FPGATrackSimRegionSlices_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} FPGATrackSimConfToolsLib ) + +atlas_add_test( FPGATrackSimEventSelectionSvc_test + SCRIPT python -m FPGATrackSimConfTools.FPGATrackSimConfigCompInit + POST_EXEC_SCRIPT noerror.sh ) + +atlas_add_test( FPGATrackSimConfigFlags_test + SCRIPT python -m FPGATrackSimConfTools.FPGATrackSimConfigFlags + POST_EXEC_SCRIPT noerror.sh ) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..0fb0bd83551a7055e593aa4d8d3740ff3c3cbd6a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimConfTools diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/FPGATrackSimRegionSlices.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/FPGATrackSimRegionSlices.h new file mode 100644 index 0000000000000000000000000000000000000000..b58e4ab5e4604b33688b450d09ce683502a88c86 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/FPGATrackSimRegionSlices.h @@ -0,0 +1,43 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +/** + * @file FPGATrackSimRegionSlices.h + * @author Riley Xu - riley.xu@cern.ch + * @date Janurary 7th, 2021 + * @brief Stores slice definitions for FPGATrackSim regions + * + * This class reads the slice description file to get the region definition in + * terms of track parameters. This is complementary to FPGATrackSimRegionMap, which defines + * the modules that belong in each region. + */ + +#ifndef FPGATrackSimCONFTOOLS_TTREGIONSLICES_H +#define FPGATrackSimCONFTOOLS_TTREGIONSLICES_H + +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" + +#include <vector> +#include <utility> + + +class FPGATrackSimRegionSlices +{ + public: + FPGATrackSimRegionSlices(std::string const & filepath); + + unsigned nRegions() const { return m_regions.size(); } + + std::pair<FPGATrackSimTrackPars, FPGATrackSimTrackPars> const & getRegion(unsigned region) const { return m_regions.at(region); } + FPGATrackSimTrackPars const & getMin(unsigned region) const { return m_regions.at(region).first; } + FPGATrackSimTrackPars const & getMax(unsigned region) const { return m_regions.at(region).second; } + + bool inRegion(unsigned region, FPGATrackSimTruthTrack const & t) const; + + private: + + std::vector<std::pair<FPGATrackSimTrackPars, FPGATrackSimTrackPars>> m_regions; // index by region, min/max + +}; + +#endif // FPGATrackSimCONFTOOLS_TTREGIONSLICES_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..a55d4d12f0c261edf873a3dc0e9f021956b7483b --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimCONFTOOLS_IFPGATrackSimEVENTSELECTIONSVC_H +#define FPGATrackSimCONFTOOLS_IFPGATrackSimEVENTSELECTIONSVC_H + +#include "GaudiKernel/IInterface.h" +#include "GaudiKernel/IService.h" + +class FPGATrackSimHit; +class FPGATrackSimTrack; +class FPGATrackSimOfflineTrack; +class FPGATrackSimTruthTrack; +class FPGATrackSimTrackPars; +class FPGATrackSimRegionSlices; +class FPGATrackSimEventInputHeader; +class FPGATrackSimLogicalEventInputHeader; +enum class SampleType; + +class IFPGATrackSimEventSelectionSvc : public virtual IService +{ + public: + + static const InterfaceID& interfaceID(); + + virtual FPGATrackSimTrackPars getMin() const = 0; + virtual FPGATrackSimTrackPars getMax() const = 0; + virtual unsigned getRegionID() const = 0; + virtual SampleType getSampleType() const = 0; + virtual bool checkPU() const = 0; + virtual int getLRTpdgID() const = 0; + virtual const FPGATrackSimRegionSlices* getRegions() = 0; + + virtual bool passCuts(const FPGATrackSimHit&) const = 0; + virtual bool passCuts(const FPGATrackSimTrack&) const = 0; + virtual bool passCuts(const FPGATrackSimOfflineTrack&) const = 0; + virtual bool passCuts(const FPGATrackSimTruthTrack&) const = 0; + + virtual bool passMatching(FPGATrackSimTrack const &) const = 0; + virtual bool passMatching(FPGATrackSimTruthTrack const &) const = 0; + + virtual bool selectEvent(FPGATrackSimEventInputHeader*) const = 0; + virtual bool selectEvent(FPGATrackSimLogicalEventInputHeader*) const = 0; + + virtual bool passQOverPt(const FPGATrackSimTrack&) const = 0; + virtual bool passEta(const FPGATrackSimTrack&) const = 0; + virtual bool passPhi(const FPGATrackSimTrack&) const = 0; + virtual bool passD0(const FPGATrackSimTrack&) const = 0; + virtual bool passZ0(const FPGATrackSimTrack&) const = 0; + + virtual bool passQOverPt(const FPGATrackSimOfflineTrack&) const = 0; + virtual bool passEta(const FPGATrackSimOfflineTrack&) const = 0; + virtual bool passPhi(const FPGATrackSimOfflineTrack&) const = 0; + virtual bool passD0(const FPGATrackSimOfflineTrack&) const = 0; + virtual bool passZ0(const FPGATrackSimOfflineTrack&) const = 0; +}; + +inline const InterfaceID& IFPGATrackSimEventSelectionSvc::interfaceID() +{ + static const InterfaceID IID("IFPGATrackSimEventSelectionSvc", 1, 0); + return IID; +} + +#endif //FPGATrackSimCONFTOOLS_IFPGATrackSimEVENTSELECTIONSVC_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/README.md b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1aabc2d6681b6906734634e732df8431eb73ae2a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/README.md @@ -0,0 +1,16 @@ +# This package contains config of FPGATrackSim simulation and various FPGATrackSim utilities + + +# How to run FPGATrackSimMapMaker jobs +See info on how to run this in rel 21: https://gitlab.cern.ch/atlas-tdaq-ph2upgrades/atlas-tdaq-htt/tdaq-htt-offline/athena/-/blob/21.9/Trigger/FPGATrackSim/FPGATrackSimAlgorithms/README.md + +and the info on the format of the map files: https://gitlab.cern.ch/atlas-tdaq-ph2upgrades/atlas-tdaq-htt/tdaq-htt-offline/athena/-/blob/21.9/Trigger/FPGATrackSim/FPGATrackSimMaps/README.md + +To run the FPGATrackSimMapMaker in master: +``` +python3 -m FPGATrackSimConfTools.FPGATrackSimMapMakerConfig --filesInput=../singlemu_invPtFlat1_1M_wrap.root --evtMax=5 OutFileName="NN_" region=0 Exec.DebugMessageComponents='["*/FPGATrackSim*"]' +``` +There is more options exposed (look for the addFlags in the FPGATrackSimMapMakerConfig.py) + + + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTAlgorithmTags.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAlgorithmTags.py similarity index 98% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTAlgorithmTags.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAlgorithmTags.py index 9666bc3ff414d6ecfda9fcaf8040f0ad7b40485e..5eb7531011dc0ff96664eb30a0c09ecedea1dcd8 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTAlgorithmTags.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAlgorithmTags.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' -@file HTTAlgorithmTags.py +@file FPGATrackSimAlgorithmTags.py @author Riley Xu - riley.xu@cern.ch @date Mar 16th 2020 @@ -9,7 +9,7 @@ All options can be further overridden from the command line or job options. In general, tags should not be edited after creation for consistent results. -See TrigHTT README for more info on tag heirarchy and usage. +See FPGATrackSim README for more info on tag heirarchy and usage. ''' @@ -115,7 +115,7 @@ def update( otherdict ): defaultTag = 'dev_21-02-15' -HTTAlgorithmTags = { +FPGATrackSimAlgorithmTags = { 'hough_1d': { # Runs the Hough 1D transform # Common 'name': 'hough_1d', diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..7390116a761d2a41e0fdc5a44f5086aa3f68b1b1 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimAnalysisConfig.py @@ -0,0 +1,390 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + + +def FPGATrackSimAnalysisConfig(): + print('FPGATrackSimAnalysisConfig') + + +def getNSubregions(path): + import os + + from PyJobTransforms.trfUtils import findFile + path = findFile(os.environ['DATAPATH'], path) + + with open(path, 'r') as f: + fields = f.readline().split() + assert(fields[0] == 'towers') + return int(fields[1]) + + +def FPGATrackSimEventSelectionCfg(): + result=ComponentAccumulator() + eventSelector = CompFactory.FPGATrackSimEventSelectionSvc() + eventSelector.regions = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/slices_v01_Jan21.txt" + eventSelector.regionID = 0 + eventSelector.sampleType = 'singleMuons' + eventSelector.withPU = False + result.addService(eventSelector, create=True, primary=True) + return result + +def FPGATrackSimMappingCfg(): + result=ComponentAccumulator() + pathMapping = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/' + FPGATrackSimMapping = CompFactory.FPGATrackSimMappingSvc() + FPGATrackSimMapping.mappingType = "FILE" + FPGATrackSimMapping.rmap = f'{pathMapping}map_file/rmaps/eta0103phi0305_ATLAS-P2-ITK-22-02-00.rmap' + FPGATrackSimMapping.subrmap = f'{pathMapping}zslicemaps/ATLAS-P2-ITK-22-02-00/eta0103phi0305_KeyLayer-strip_barrel_2_extra03_trim_0_001_NSlices-6.rmap' + FPGATrackSimMapping.pmap = f'{pathMapping}map_file/ATLAS-P2-ITK-22-02-00.pmap' + FPGATrackSimMapping.modulemap = f'{pathMapping}map_file/ITk.global-to-local.moduleidmap' + FPGATrackSimMapping.NNmap = f'{pathMapping}map_file/NN_DNN_Region_0p1_0p3_HTTFake_HTTTrueMu_SingleP_8L_Nom_v6.json' + FPGATrackSimMapping.layerOverride = {} + result.addService(FPGATrackSimMapping, create=True, primary=True) + return result + +def FPGATrackSimBankSvcCfg(): + result=ComponentAccumulator() + FPGATrackSimBankSvc = CompFactory.FPGATrackSimBankSvc() + pathBankSvc = '/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-ITK-22-02-00/21.9.16/eta0103phi0305/SectorBanks/' + FPGATrackSimBankSvc.constantsNoGuess_1st = [ + f'{pathBankSvc}corrgen_raw_8L_skipPlane0.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane1.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane2.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane3.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane4.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane5.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane6.gcon', + f'{pathBankSvc}corrgen_raw_8L_skipPlane7.gcon'] + FPGATrackSimBankSvc.constantsNoGuess_2nd = [ + f'{pathBankSvc}corrgen_raw_13L_skipPlane0.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane1.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane2.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane3.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane4.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane5.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane6.gcon', + f'{pathBankSvc}corrgen_raw_13L_skipPlane7.gcon'] + FPGATrackSimBankSvc.constants_1st = f'{pathBankSvc}corrgen_raw_8L.gcon' + FPGATrackSimBankSvc.constants_2nd = f'{pathBankSvc}corrgen_raw_13L_reg0_checkGood1.gcon' + FPGATrackSimBankSvc.sectorBank_1st = f'{pathBankSvc}sectorsHW_raw_8L.patt' + FPGATrackSimBankSvc.sectorBank_2nd = f'{pathBankSvc}sectorsHW_raw_13L_reg0_checkGood1.patt' + FPGATrackSimBankSvc.sectorSlices = f'{pathBankSvc}slices_8L.root' + result.addService(FPGATrackSimBankSvc, create=True, primary=True) + return result + + +def FPGATrackSimRoadUnionToolCfg(flags): + result=ComponentAccumulator() + RF = CompFactory.FPGATrackSimRoadUnionTool() + + xBins = flags.Trigger.FPGATrackSim.ActiveConfig.xBins + xBufferBins = flags.Trigger.FPGATrackSim.ActiveConfig.xBufferBins + yBins = flags.Trigger.FPGATrackSim.ActiveConfig.yBins + yBufferBins = flags.Trigger.FPGATrackSim.ActiveConfig.yBufferBins + xMin = flags.Trigger.FPGATrackSim.ActiveConfig.phiMin + xMax = flags.Trigger.FPGATrackSim.ActiveConfig.phiMax + xBuffer = (xMax - xMin) / xBins * xBufferBins + xMin = xMin - xBuffer + xMax = xMax + xBuffer + yMin = flags.Trigger.FPGATrackSim.ActiveConfig.qptMin + yMax = flags.Trigger.FPGATrackSim.ActiveConfig.qptMax + yBuffer = (yMax - yMin) / yBins * yBufferBins + yMin -= yBuffer + yMax += yBuffer + tools = [] + FPGATrackSimMapping = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + + for number in range(getNSubregions(FPGATrackSimMapping.subrmap)): + HoughTransform = CompFactory.FPGATrackSimHoughTransformTool("HoughTransform_0_" + str(number)) + HoughTransform.FPGATrackSimEventSelectionSvc = FPGATrackSimEventSelectionCfg().getService("FPGATrackSimEventSelectionSvc") + HoughTransform.FPGATrackSimBankSvc = FPGATrackSimBankSvcCfg().getService("FPGATrackSimBankSvc") + HoughTransform.FPGATrackSimMappingSvc = FPGATrackSimMapping + HoughTransform.combine_layers = flags.Trigger.FPGATrackSim.ActiveConfig.combineLayers + HoughTransform.convSize_x = flags.Trigger.FPGATrackSim.ActiveConfig.convSizeX + HoughTransform.convSize_y = flags.Trigger.FPGATrackSim.ActiveConfig.convSizeY + HoughTransform.convolution = flags.Trigger.FPGATrackSim.ActiveConfig.convolution + HoughTransform.d0_max = 0 + HoughTransform.d0_min = 0 + HoughTransform.fieldCorrection = flags.Trigger.FPGATrackSim.ActiveConfig.fieldCorrection + HoughTransform.hitExtend_x = flags.Trigger.FPGATrackSim.ActiveConfig.hitExtendX + HoughTransform.localMaxWindowSize = flags.Trigger.FPGATrackSim.ActiveConfig.localMaxWindowSize + HoughTransform.nBins_x = xBins + 2 * xBufferBins + HoughTransform.nBins_y = yBins + 2 * yBufferBins + HoughTransform.phi_max = xMax + HoughTransform.phi_min = xMin + HoughTransform.qpT_max = yMax + HoughTransform.qpT_min = yMin + HoughTransform.scale = flags.Trigger.FPGATrackSim.ActiveConfig.scale + HoughTransform.subRegion = number + HoughTransform.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.threshold + HoughTransform.traceHits = False + tools.append(HoughTransform) + + RF.tools = tools + result.addPublicTool(RF, primary=True) + return result + + +def FPGATrackSimRawLogicCfg(flags): + result=ComponentAccumulator() + FPGATrackSimRawLogic = CompFactory.FPGATrackSimRawToLogicalHitsTool() + FPGATrackSimRawLogic.SaveOptional = 2 + if (flags.Trigger.FPGATrackSim.ActiveConfig.sampleType == 'skipTruth'): + FPGATrackSimRawLogic.SaveOptional = 1 + FPGATrackSimRawLogic.TowersToMap = [0] # TODO TODO why is this hardcoded? + FPGATrackSimRawLogic.FPGATrackSimEventSelectionSvc = FPGATrackSimEventSelectionCfg().getService("FPGATrackSimEventSelectionSvc") + FPGATrackSimRawLogic.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + result.addPublicTool(FPGATrackSimRawLogic, primary=True) + return result + +def FPGATrackSimDataFlowToolCfg(): + result=ComponentAccumulator() + DataFlowTool = CompFactory.FPGATrackSimDataFlowTool() + DataFlowTool.FPGATrackSimEventSelectionSvc = FPGATrackSimEventSelectionCfg().getService("FPGATrackSimEventSelectionSvc") + DataFlowTool.FPGATrackSimMappingSvc =FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + DataFlowTool.THistSvc = CompFactory.THistSvc() + result.setPrivateTools(DataFlowTool) + return result + +def FPGATrackSimSpacePointsToolCfg(flags): + result=ComponentAccumulator() + SpacePointTool = CompFactory.FPGATrackSimSpacePointsTool_v2() + SpacePointTool.Filtering = flags.Trigger.FPGATrackSim.ActiveConfig.spacePointFiltering + SpacePointTool.FilteringClosePoints = False + SpacePointTool.PhiWindow = 0.008 + SpacePointTool.Duplication = True + result.addPublicTool(SpacePointTool, primary=True) + return result + + +def FPGATrackSimHitFilteringToolCfg(): + result=ComponentAccumulator() + HitFilteringTool = CompFactory.FPGATrackSimHitFilteringTool() + HitFilteringTool.barrelStubDphiCut = 3.0 + HitFilteringTool.doRandomRemoval = False + HitFilteringTool.doStubs = False + HitFilteringTool.endcapStubDphiCut = 1.5 + HitFilteringTool.pixelClusRmFrac = 0 + HitFilteringTool.pixelHitRmFrac = 0 + HitFilteringTool.stripClusRmFrac = 0 + HitFilteringTool.stripHitRmFrac = 0 + HitFilteringTool.useNstrips = False + result.addPublicTool(HitFilteringTool, primary=True) + return result + + +def FPGATrackSimHoughRootOutputToolCfg(): + result=ComponentAccumulator() + HoughRootOutputTool = CompFactory.FPGATrackSimHoughRootOutputTool() + HoughRootOutputTool.FPGATrackSimEventSelectionSvc = FPGATrackSimEventSelectionCfg().getService("FPGATrackSimEventSelectionSvc") + HoughRootOutputTool.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + HoughRootOutputTool.THistSvc = CompFactory.THistSvc() + result.setPrivateTools(HoughRootOutputTool) + return result + +def LRTRoadFinderCfg(flags): + result=ComponentAccumulator() + LRTRoadFinder =CompFactory.FPGATrackSimHoughTransform_d0phi0_Tool() + LRTRoadFinder.FPGATrackSimBankSvc = FPGATrackSimBankSvcCfg().getService("FPGATrackSimBankSvc") + LRTRoadFinder.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + LRTRoadFinder.combine_layers = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackCombineLayers + LRTRoadFinder.convolution = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackConvolution + LRTRoadFinder.hitExtend_x = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackHitExtendX + LRTRoadFinder.scale = flags.Trigger.FPGATrackSim.ActiveConfig.scale + LRTRoadFinder.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackThreshold + result.setPrivateTools(LRTRoadFinder) + return result + +def NNTrackToolCfg(): + result=ComponentAccumulator() + NNTrackTool = CompFactory.FPGATrackSimNNTrackTool() + NNTrackTool.THistSvc = CompFactory.THistSvc() + NNTrackTool.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + result.setPrivateTools(NNTrackTool) + return result + +def FPGATrackSimWriteOutputCfg(flags): + result=ComponentAccumulator() + FPGATrackSimWriteOutput = CompFactory.FPGATrackSimOutputHeaderTool("FPGATrackSimWriteOutput") + FPGATrackSimWriteOutput.InFileName = ["test"] + FPGATrackSimWriteOutput.RWstatus = "HEADER" # do not open file, use THistSvc + FPGATrackSimWriteOutput.RunSecondStage = flags.Trigger.FPGATrackSim.ActiveConfig.secondStage + result.addPublicTool(FPGATrackSimWriteOutput, primary=True) + return result + +def FPGATrackSimTrackFitterToolCfg(flags): + result=ComponentAccumulator() + TF_1st = CompFactory.FPGATrackSimTrackFitterTool("FPGATrackSimTrackFitterTool_1st") + TF_1st.GuessHits = flags.Trigger.FPGATrackSim.ActiveConfig.guessHits + TF_1st.IdealCoordFitType = flags.Trigger.FPGATrackSim.ActiveConfig.idealCoordFitType + TF_1st.FPGATrackSimBankSvc = FPGATrackSimBankSvcCfg().getService("FPGATrackSimBankSvc") + TF_1st.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + TF_1st.chi2DofRecoveryMax = flags.Trigger.FPGATrackSim.ActiveConfig.chi2DoFRecoveryMax + TF_1st.chi2DofRecoveryMin = flags.Trigger.FPGATrackSim.ActiveConfig.chi2DoFRecoveryMin + TF_1st.doMajority = flags.Trigger.FPGATrackSim.ActiveConfig.doMajority + TF_1st.nHits_noRecovery = flags.Trigger.FPGATrackSim.ActiveConfig.nHitsNoRecovery + TF_1st.DoDeltaGPhis = flags.Trigger.FPGATrackSim.ActiveConfig.doDeltaGPhis + TF_1st.DoMissingHitsChecks = flags.Trigger.FPGATrackSim.ActiveConfig.doMissingHitsChecks + result.addPublicTool(TF_1st, primary=True) + return result + +def FPGATrackSimOverlapRemovalToolCfg(flags): + result=ComponentAccumulator() + OR_1st = CompFactory.FPGATrackSimOverlapRemovalTool("FPGATrackSimOverlapRemovalTool_1st") + OR_1st.ORAlgo = "Normal" + OR_1st.doFastOR =flags.Trigger.FPGATrackSim.ActiveConfig.doFastOR + OR_1st.NumOfHitPerGrouping = 5 + OR_1st.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + if flags.Trigger.FPGATrackSim.ActiveConfig.hough: + OR_1st.nBins_x = flags.Trigger.FPGATrackSim.ActiveConfig.xBins + 2 * flags.Trigger.FPGATrackSim.ActiveConfig.xBufferBins + OR_1st.nBins_y = flags.Trigger.FPGATrackSim.ActiveConfig.yBins + 2 * flags.Trigger.FPGATrackSim.ActiveConfig.yBufferBins + OR_1st.localMaxWindowSize = flags.Trigger.FPGATrackSim.ActiveConfig.localMaxWindowSize + OR_1st.roadSliceOR = flags.Trigger.FPGATrackSim.ActiveConfig.roadSliceOR + + result.addPublicTool(OR_1st, primary=True) + return result + + +def FPGATrackSimOverlapRemovalTool_2ndCfg(flags): + result=ComponentAccumulator() + OR_2nd = CompFactory.FPGATrackSimOverlapRemovalTool("FPGATrackSimOverlapRemovalTool_2nd") + OR_2nd.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + if flags.Trigger.FPGATrackSim.ActiveConfig.secondStage: + OR_2nd.DoSecondStage = True + OR_2nd.ORAlgo = "Normal" + OR_2nd.doFastOR = flags.Trigger.FPGATrackSim.ActiveConfig.doFastOR + OR_2nd.NumOfHitPerGrouping = 5 + result.setPrivateTools(OR_2nd) + return result + + +def FPGATrackSimTrackFitterTool_2ndCfg(flags): + result=ComponentAccumulator() + TF_2nd = CompFactory.FPGATrackSimTrackFitterTool("FPGATrackSimTrackFitterTool_2nd") + TF_2nd.FPGATrackSimBankSvc = FPGATrackSimBankSvcCfg().getService("FPGATrackSimBankSvc") + TF_2nd.FPGATrackSimMappingSvc = FPGATrackSimMappingCfg().getService("FPGATrackSimMappingSvc") + if flags.Trigger.FPGATrackSim.ActiveConfig.secondStage: + TF_2nd.Do2ndStageTrackFit = True + result.setPrivateTools(TF_2nd) + return result + + +def checkIfAlgoTagExist(flags, tag): + if not flags.hasFlag(tag) and not flags.hasFlagCategory(tag): + raise Exception(f'{tag} does not appear to be flag category') + +def FPGATrackSimReadInputCfg(flags): + result=ComponentAccumulator() + InputTool = CompFactory.FPGATrackSimInputHeaderTool("FPGATrackSimReadInput", + InFileName = flags.Input.Files) + result.addPublicTool(InputTool, primary=True) + return result + + +def FPGATrackSimLogicalHistProcessAlgCfg(flags): + + result=ComponentAccumulator() + + + theFPGATrackSimLogicalHistProcessAlg=CompFactory.FPGATrackSimLogicalHitsProcessAlg() + theFPGATrackSimLogicalHistProcessAlg.HitFiltering = flags.Trigger.FPGATrackSim.ActiveConfig.hitFiltering + theFPGATrackSimLogicalHistProcessAlg.writeOutputData = flags.Trigger.FPGATrackSim.ActiveConfig.writeOutputData + theFPGATrackSimLogicalHistProcessAlg.Clustering = True + theFPGATrackSimLogicalHistProcessAlg.tracking = flags.Trigger.FPGATrackSim.ActiveConfig.doTracking + theFPGATrackSimLogicalHistProcessAlg.outputHitTxt = flags.Trigger.FPGATrackSim.ActiveConfig.outputHitTxt + theFPGATrackSimLogicalHistProcessAlg.RunSecondStage = flags.Trigger.FPGATrackSim.ActiveConfig.secondStage + theFPGATrackSimLogicalHistProcessAlg.DoMissingHitsChecks = flags.Trigger.FPGATrackSim.ActiveConfig.doMissingHitsChecks + theFPGATrackSimLogicalHistProcessAlg.DoHoughRootOutput = False + theFPGATrackSimLogicalHistProcessAlg.DoNNTrack = False + theFPGATrackSimLogicalHistProcessAlg.eventSelector = result.getPrimaryAndMerge(FPGATrackSimEventSelectionCfg()) + + FPGATrackSimMaping = result.getPrimaryAndMerge(FPGATrackSimMappingCfg()) + theFPGATrackSimLogicalHistProcessAlg.FPGATrackSimMapping = FPGATrackSimMaping + + result.getPrimaryAndMerge(FPGATrackSimBankSvcCfg()) + + theFPGATrackSimLogicalHistProcessAlg.RoadFinder = result.getPrimaryAndMerge(FPGATrackSimRoadUnionToolCfg(flags)) + theFPGATrackSimLogicalHistProcessAlg.RawToLogicalHitsTool = result.getPrimaryAndMerge(FPGATrackSimRawLogicCfg(flags)) + + theFPGATrackSimLogicalHistProcessAlg.InputTool = result.getPrimaryAndMerge(FPGATrackSimReadInputCfg(flags)) + + InputTool2 = CompFactory.FPGATrackSimReadRawRandomHitsTool("FPGATrackSimReadRawRandomHitsTool") + InputTool2.InFileName = flags.Input.Files[0] + result.addPublicTool(InputTool2) + theFPGATrackSimLogicalHistProcessAlg.InputTool2 = InputTool2 + + theFPGATrackSimLogicalHistProcessAlg.DataFlowTool = result.getPrimaryAndMerge(FPGATrackSimDataFlowToolCfg()) + theFPGATrackSimLogicalHistProcessAlg.SpacePointTool = result.getPrimaryAndMerge(FPGATrackSimSpacePointsToolCfg(flags)) + + RoadFilter = CompFactory.FPGATrackSimEtaPatternFilterTool() + RoadFilter.FPGATrackSimMappingSvc = FPGATrackSimMaping + theFPGATrackSimLogicalHistProcessAlg.RoadFilter = RoadFilter + + theFPGATrackSimLogicalHistProcessAlg.HitFilteringTool = result.getPrimaryAndMerge(FPGATrackSimHitFilteringToolCfg()) + theFPGATrackSimLogicalHistProcessAlg.HoughRootOutputTool = result.getPrimaryAndMerge(FPGATrackSimHoughRootOutputToolCfg()) + + LRTRoadFilter = CompFactory.FPGATrackSimLLPRoadFilterTool() + result.addPublicTool(LRTRoadFilter) + theFPGATrackSimLogicalHistProcessAlg.LRTRoadFilter = LRTRoadFilter + + theFPGATrackSimLogicalHistProcessAlg.LRTRoadFinder = result.getPrimaryAndMerge(LRTRoadFinderCfg(flags)) + theFPGATrackSimLogicalHistProcessAlg.NNTrackTool = result.getPrimaryAndMerge(NNTrackToolCfg()) + + RoadFilter2 = CompFactory.FPGATrackSimPhiRoadFilterTool() + RoadFilter2.FPGATrackSimMappingSvc = FPGATrackSimMaping + RoadFilter2.window = [] + theFPGATrackSimLogicalHistProcessAlg.RoadFilter2 = RoadFilter2 + + theFPGATrackSimLogicalHistProcessAlg.ClusteringTool = CompFactory.FPGATrackSimClusteringTool() + theFPGATrackSimLogicalHistProcessAlg.OutputTool = result.getPrimaryAndMerge(FPGATrackSimWriteOutputCfg(flags)) + theFPGATrackSimLogicalHistProcessAlg.TrackFitter_1st = result.getPrimaryAndMerge(FPGATrackSimTrackFitterToolCfg(flags)) + theFPGATrackSimLogicalHistProcessAlg.OverlapRemoval_1st = result.getPrimaryAndMerge(FPGATrackSimOverlapRemovalToolCfg(flags)) + theFPGATrackSimLogicalHistProcessAlg.OverlapRemoval_2nd = result.getPrimaryAndMerge(FPGATrackSimOverlapRemovalTool_2ndCfg(flags)) + theFPGATrackSimLogicalHistProcessAlg.TrackFitter_2nd = result.getPrimaryAndMerge(FPGATrackSimTrackFitterTool_2ndCfg(flags)) + + + if flags.Trigger.FPGATrackSim.ActiveConfig.secondStage: + FPGATrackSimExtrapolatorTool = CompFactory.FPGATrackSimExtrapolator() + FPGATrackSimExtrapolatorTool.Ncombinations = 16 + theFPGATrackSimLogicalHistProcessAlg.Extrapolator = FPGATrackSimExtrapolatorTool + + + if flags.Trigger.FPGATrackSim.ActiveConfig.lrt: + assert flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseBasicHitFilter != flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseMlHitFilter, 'Inconsistent LRT hit filtering setup, need either ML of Basic filtering enabled' + assert flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseStraightTrackHT != flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseDoubletHT, 'Inconsistent LRT HT setup, need either double or strightTrack enabled' + theFPGATrackSimLogicalHistProcessAlg.doLRT = True + theFPGATrackSimLogicalHistProcessAlg.LRTHitFiltering = (not flags.Trigger.FPGATrackSim.ActiveConfig.lrtSkipHitFiltering) + + from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmConfig import FPGATrackSimLogicalHitsProcessAlgMonitoringCfg + theFPGATrackSimLogicalHistProcessAlg.MonTool = result.getPrimaryAndMerge(FPGATrackSimLogicalHitsProcessAlgMonitoringCfg(flags)) + + result.addEventAlgo(theFPGATrackSimLogicalHistProcessAlg) + return result + + +def prepareFlagsForFPGATrackSimLogicalHistProcessAlg(flags): + flags.Trigger.FPGATrackSim.algoTag="Hough" + checkIfAlgoTagExist(flags.Trigger.FPGATrackSim, flags.Trigger.FPGATrackSim.algoTag) + newFlags = flags.cloneAndReplace("Trigger.FPGATrackSim.ActiveConfig", "Trigger.FPGATrackSim." + flags.Trigger.FPGATrackSim.algoTag) + return newFlags + + +if __name__ == "__main__": + from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + flags = initConfigFlags() + flags.Input.Files = ['FPGATrackSimWrapper.singlemu_Pt10.root'] + + newFlags = prepareFlagsForFPGATrackSimLogicalHistProcessAlg(flags) + del flags + + acc=MainServicesCfg(newFlags) + acc.addService(CompFactory.THistSvc(Output = ["EXPERT DATAFILE='monitoring.root', OPT='RECREATE'"])) + acc.merge(FPGATrackSimLogicalHistProcessAlgCfg(newFlags)) + acc.store(open('AnalysisConfig.pkl','wb')) + + statusCode = acc.run() + assert statusCode.isSuccess() is True, "Application execution did not succeed" + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTBankTags.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimBankTags.py similarity index 97% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTBankTags.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimBankTags.py index c53b7fcde532bc7aa26ec1fa097c9c4361dd35f7..4a184e206922f5911237ce5b5878a4f8ee57dbc1 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTBankTags.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimBankTags.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' -@file HTTBankTags.py +@file FPGATrackSimBankTags.py @author Riley Xu - riley.xu@cern.ch @date Feb 6th 2020 @@ -18,7 +18,7 @@ All options can be further overridden from the command line or job options. For example, if you're working outside of lxplus but the tag references files on EOS, you can simply just copy the files to some directory and then override the bankDir variable. The bank service will still use the file names in the tag. -See HTTBankConfig.py, HTTBankGenConfig.py, and the top-level HTT README for details. +See FPGATrackSimBankConfig.py, FPGATrackSimBankGenConfig.py, and the top-level FPGATrackSim README for details. ''' # Template to add a new tag, and some description of the fields @@ -29,7 +29,7 @@ empty_tag = { ### Files 'bankDir': '', # Root directory of all the files referenced below - 'formatted': False, # If the filenames below have {} replacement fields (see HTTTagConfig) + 'formatted': False, # If the filenames below have {} replacement fields (see FPGATrackSimTagConfig) 'constants_1st': '', # Filename for first stage constants 'constants_2nd': '', # Filename for second stage constants 'constantsNoGuess_1st': [], # Filenames for first stage no-guess missing hit constants @@ -47,7 +47,7 @@ empty_tag = { defaultTag = 'EF_TaskForce_dev22' # Listed with most recent first. Keys are the tag names. -HTTBankTags = { +FPGATrackSimBankTags = { 'EF_TaskForce_dev22': { ### Basic 'name': 'EF_TaskForce_dev22', diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTConfigCompInit.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimConfigCompInit.py similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTConfigCompInit.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimConfigCompInit.py index 4a60237ebef12fda3bd940acc326312188d0ab36..33b5b3f940b34e0cc1e9f3a95146b85322eca417 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTConfigCompInit.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimConfigCompInit.py @@ -1,14 +1,14 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' @author Riley Xu - riley.xu@cern.ch @date Feb 23rd 2021 -@brief This file declares functions to configure HTTConfig components +@brief This file declares functions to configure FPGATrackSimConfig components ''' import os from PyJobTransforms.trfUtils import findFile -#import TrigHTTConfTools.TrigHTTConfToolsConf as Config +#import FPGATrackSimConfTools.FPGATrackSimConfToolsConf as Config def getRegionIndex(map_tag): @@ -31,16 +31,16 @@ def getWithPU(map_tag): def addEvtSelSvc(map_tag,name=""): ''' - Creates and returns a HTTEventSelectionSvc object, configured with the specified tags. + Creates and returns a FPGATrackSimEventSelectionSvc object, configured with the specified tags. This function adds the returned map service instance to SvcMgr. ''' from AthenaCommon.Constants import INFO - import TrigHTTConfTools.TrigHTTConfToolsConf as Config + import FPGATrackSimConfTools.FPGATrackSimConfToolsConf as Config if name : - ES = Config.HTTEventSelectionSvc(name) + ES = Config.FPGATrackSimEventSelectionSvc(name) else : - ES = Config.HTTEventSelectionSvc() + ES = Config.FPGATrackSimEventSelectionSvc() ES.regionID = getRegionIndex(map_tag) ES.regions = findFile(os.environ['DATAPATH'], map_tag['slices']) ES.sampleType = getSampleType(map_tag) @@ -58,8 +58,8 @@ if __name__=='__main__': from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - import TrigHTTConfTools.HTTTagConfig as HTTTagConfig - tags = HTTTagConfig.getTags(stage='bank') + import FPGATrackSimConfTools.FPGATrackSimTagConfig as FPGATrackSimTagConfig + tags = FPGATrackSimTagConfig.getTags(stage='bank') map_tag = tags['map'] ES = addEvtSelSvc(map_tag) ES.sampleType="singleMuons" diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTConfigFlags.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimConfigFlags.py similarity index 85% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTConfigFlags.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimConfigFlags.py index aa5fe57062faa0749edd50415e531cfc9da6c498..e69a206cd6a0438a04ca5ece8f6b8a8b2b6df353 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTConfigFlags.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimConfigFlags.py @@ -1,38 +1,38 @@ -#Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +#Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -def createHTTConfigFlags(): +def createFPGATrackSimConfigFlags(): from AthenaConfiguration.AthConfigFlags import AthConfigFlags cf = AthConfigFlags() cf.addFlag('algoTag', '') + cf.addFlag('wrapperFileName', 'FPGATrackSimWrapper.root') def __httHough1DFlags(): """Additional function delays import""" - from TrigHTTConfTools.HTTConfigFlags import createHough1dHTTConfigFlags - return createHough1dHTTConfigFlags() + from FPGATrackSimConfTools.FPGATrackSimConfigFlags import createHough1dFPGATrackSimConfigFlags + return createHough1dFPGATrackSimConfigFlags() cf.addFlagsCategory("Hough1D", __httHough1DFlags, prefix=True ) def __httHoughFlags(): """Additional function delays import""" - from TrigHTTConfTools.HTTConfigFlags import createHoughHTTConfigFlags - return createHoughHTTConfigFlags() + from FPGATrackSimConfTools.FPGATrackSimConfigFlags import createHoughFPGATrackSimConfigFlags + return createHoughFPGATrackSimConfigFlags() cf.addFlagsCategory("Hough", __httHoughFlags, prefix=True ) def __httDev21_02_15Flags(): """Additional function delays import""" - from TrigHTTConfTools.HTTConfigFlags import createDev21_02_15_HTTConfigFlags - return createDev21_02_15_HTTConfigFlags() + from FPGATrackSimConfTools.FPGATrackSimConfigFlags import createDev21_02_15_FPGATrackSimConfigFlags + return createDev21_02_15_FPGATrackSimConfigFlags() cf.addFlagsCategory("Dev21_02_15", __httDev21_02_15Flags, prefix=True ) return cf -def createBasicHTTConfigFlags(): +def createBasicFPGATrackSimConfigFlags(): from AthenaConfiguration.AthConfigFlags import AthConfigFlags cf = AthConfigFlags() # common cf.addFlag('name', '') - cf.addFlag('wrapperFileName', 'HTTWrapper.root') # input cf.addFlag('firstInputToolN', 1) @@ -114,7 +114,7 @@ def createBasicHTTConfigFlags(): cf.addFlag('lrtMonD0Range', (-100,100)) cf.addFlag('lrtMonZ0Range', (-300,300)) - # HTTLogicalHistProcessAlg + # FPGATrackSimLogicalHistProcessAlg # cf.addFlag('etaPatternRoadFilter', None) #TO DO (will be uncomment when the value is known) # cf.addFlag('phiRoadFilter', None) #TO DO (will be uncomment when the value is known) cf.addFlag('sampleType', '') @@ -122,8 +122,8 @@ def createBasicHTTConfigFlags(): return cf -def createHough1dHTTConfigFlags(): - cf = createBasicHTTConfigFlags() +def createHough1dFPGATrackSimConfigFlags(): + cf = createBasicFPGATrackSimConfigFlags() cf.name = 'hough_1d' @@ -141,8 +141,8 @@ def createHough1dHTTConfigFlags(): return cf -def createHoughHTTConfigFlags(): - cf = createBasicHTTConfigFlags() +def createHoughFPGATrackSimConfigFlags(): + cf = createBasicFPGATrackSimConfigFlags() cf.name = 'hough' cf.hough = True @@ -185,8 +185,8 @@ def createHoughHTTConfigFlags(): return cf -def createDev21_02_15_HTTConfigFlags(): - cf = createBasicHTTConfigFlags() +def createDev21_02_15_FPGATrackSimConfigFlags(): + cf = createBasicFPGATrackSimConfigFlags() cf.name = 'dev_21-02-15' cf.phiMin = 0.3 @@ -216,7 +216,7 @@ def createDev21_02_15_HTTConfigFlags(): if __name__ == "__main__": - flags = createHTTConfigFlags() + flags = createFPGATrackSimConfigFlags() flags.loadAllDynamicFlags() flags.initAll() flags.dump() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTMapMakerConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimMapMakerConfig.py similarity index 72% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTMapMakerConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimMapMakerConfig.py index d3c2cb359f77aba984126ee4b4cc93c891d200a9..666dac5bebf110854aa1685daa6f84de1330a823 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTMapMakerConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimMapMakerConfig.py @@ -4,16 +4,16 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def HTTMapMakerCfg(flags): +def FPGATrackSimMapMakerCfg(flags): acc = ComponentAccumulator() - from TrigHTTConfTools.HTTAnalysisConfig import HTTReadInputCfg - alg = CompFactory.HTTMapMakerAlg( + from FPGATrackSimConfTools.FPGATrackSimAnalysisConfig import FPGATrackSimReadInputCfg + alg = CompFactory.FPGATrackSimMapMakerAlg( OutFileName=flags.OutFileName, KeyString=flags.KeyString, nSlices=flags.nSlices, region=flags.region, trim=flags.trim, - InputTool = acc.getPrimaryAndMerge(HTTReadInputCfg(flags)) + InputTool = acc.getPrimaryAndMerge(FPGATrackSimReadInputCfg(flags)) ) acc.addEventAlgo(alg) @@ -31,13 +31,13 @@ if __name__ == "__main__": flags.addFlag("region", 0) - flags.Input.Files = ['HTTWrapper.singlemu_Pt10.root'] + flags.Input.Files = ['FPGATrackSimWrapper.singlemu_Pt10.root'] flags.fillFromArgs() flags.lock() acc=MainServicesCfg(flags) - acc.store(open('HTTMapMakerConfig.pkl','wb')) - acc.merge(HTTMapMakerCfg(flags)) + acc.store(open('FPGATrackSimMapMakerConfig.pkl','wb')) + acc.merge(FPGATrackSimMapMakerCfg(flags)) from AthenaConfiguration.Utils import setupLoggingLevels setupLoggingLevels(flags, acc) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTMapTags.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimMapTags.py similarity index 94% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTMapTags.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimMapTags.py index e0360a084a50d6799e701221800f3fc36725805d..ac328eaed7b86310b540e552320c237b4875a608 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTMapTags.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimMapTags.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' -@file HTTMapTags.py +@file FPGATrackSimMapTags.py @author Riley Xu - riley.xu@cern.ch @date March 3rd 2020 @@ -19,7 +19,7 @@ empty_tag = { 'package': 'map', # Package identifier 'release': '', # Athena release number 'geoTag': '', # ATLAS geometry tag - 'formatted': False, # If the filenames below have {} replacement fields (see HTTTagConfig) + 'formatted': False, # If the filenames below have {} replacement fields (see FPGATrackSimTagConfig) 'withPU': False, # Flag to say if there is pile-up or not # Files @@ -46,7 +46,7 @@ empty_tag = { 'stripHitRmFrac': 0, # Fraction of strip hits to remove at random 'stripClusRmFrac': 0, # Fraction of strip clusters to remove at random 'doStubs': False, # do stub filtering - 'stubCutsFile': '', # read in stub cuts from this text file (either absolute path, or TrigHTTHitFiltering/file.txt if in config/) + 'stubCutsFile': '', # read in stub cuts from this text file (either absolute path, or FPGATrackSimHitFiltering/file.txt if in config/) 'barrelStubDphiCut': 0, # endcap stub dphi cut (if no cuts file given) 'endcapStubDphiCut': 0, # endcap stub dphi cut (if no cuts file given) 'useNstrips': False, # use number of strips, rather than dPhi, to make stub cuts @@ -57,7 +57,7 @@ empty_tag = { defaultTag = 'EF_TaskForce_dev22' # Listed with most recent first -HTTMapTags = { +FPGATrackSimMapTags = { 'EF_TaskForce_dev23' : { 'name': 'EF_TaskForce_dev23', 'package': 'map', @@ -83,7 +83,7 @@ HTTMapTags = { 'eta0103phi0305', # 0 'eta0709phi0305', # 1 'eta1214phi0305', # 2 - 'eta2022phi0305', # 3 + 'eta2023phi0305', # 3 'eta3234phi0305', # 4 ], }, @@ -112,7 +112,7 @@ HTTMapTags = { 'eta0103phi0305', # 0 'eta0709phi0305', # 1 'eta1214phi0305', # 2 - 'eta2022phi0305', # 3 + 'eta2023phi0305', # 3 'eta3234phi0305', # 4 ], # Hit Filtering @@ -123,7 +123,7 @@ HTTMapTags = { 'stripClusRmFrac': 0, 'doStubs': False, - 'stubCutsFile': 'TrigHTTMaps/stub_cuts_2pct_50evt_rings_Jun11.txt', + 'stubCutsFile': 'FPGATrackSimMaps/stub_cuts_2pct_50evt_rings_Jun11.txt', 'barrelStubDphiCut': 3.0, 'endcapStubDphiCut': 1.5, 'useNstrips': False, diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTTagConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimTagConfig.py similarity index 77% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTTagConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimTagConfig.py index 007217070e3470df5907ba380722ce27d9461ac4..f86124670ee014111bf50855e37f450b7c0d3823 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/HTTTagConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/FPGATrackSimTagConfig.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' -@file HTTTagConfig.py +@file FPGATrackSimTagConfig.py @author Riley Xu - riley.xu@cern.ch @date August 27, 2020 @@ -10,9 +10,9 @@ from their respective files. ''' -import TrigHTTConfTools.HTTMapTags as HTTMapTags -import TrigHTTConfTools.HTTBankTags as HTTBankTags -import TrigHTTConfTools.HTTAlgorithmTags as HTTAlgorithmTags +import FPGATrackSimConfTools.FPGATrackSimMapTags as FPGATrackSimMapTags +import FPGATrackSimConfTools.FPGATrackSimBankTags as FPGATrackSimBankTags +import FPGATrackSimConfTools.FPGATrackSimAlgorithmTags as FPGATrackSimAlgorithmTags _tagDependency = { @@ -24,7 +24,7 @@ _tagDependency = { def getTags(stage = 'algo', options = {}): ''' - Returns a set of tags used to configure various HTT components, configured + Returns a set of tags used to configure various FPGATrackSim components, configured with additional user options. This function will do consistency checks on tag dependencies. @@ -33,9 +33,9 @@ def getTags(stage = 'algo', options = {}): different tag from the default (see below). Extra/missing keys are ok. To swith to a different tag, use the following keys: - HTTMaps - mapTag - HTTBanks - bankTag - HTTAlgorithms - algoTag + FPGATrackSimMaps - mapTag + FPGATrackSimBanks - bankTag + FPGATrackSimAlgorithms - algoTag @param stage - Which stage this function is being called from: map/bank/algo. This is limits the returned tags and the dependency checking to the given stage. @@ -74,16 +74,16 @@ def _getTag(package, options): ''' if package == 'map': - tagName = HTTMapTags.defaultTag - tagList = HTTMapTags.HTTMapTags + tagName = FPGATrackSimMapTags.defaultTag + tagList = FPGATrackSimMapTags.FPGATrackSimMapTags keyName = 'mapTag' elif package == 'bank': - tagName = HTTBankTags.defaultTag - tagList = HTTBankTags.HTTBankTags + tagName = FPGATrackSimBankTags.defaultTag + tagList = FPGATrackSimBankTags.FPGATrackSimBankTags keyName = 'bankTag' elif package == 'algo': - tagName = HTTAlgorithmTags.defaultTag - tagList = HTTAlgorithmTags.HTTAlgorithmTags + tagName = FPGATrackSimAlgorithmTags.defaultTag + tagList = FPGATrackSimAlgorithmTags.FPGATrackSimAlgorithmTags keyName = 'algoTag' else: raise NameError("Unknown package: " + package) @@ -109,11 +109,11 @@ def getDescription(*args, **kwargs): description = '' for tag in args: if tag['package'] == 'map': - original_tag = HTTMapTags.HTTMapTags[tag['name']].copy() + original_tag = FPGATrackSimMapTags.FPGATrackSimMapTags[tag['name']].copy() elif tag['package'] == 'bank': - original_tag = HTTBankTags.HTTBankTags[tag['name']].copy() + original_tag = FPGATrackSimBankTags.FPGATrackSimBankTags[tag['name']].copy() elif tag['package'] == 'algo': - original_tag = HTTAlgorithmTags.HTTAlgorithmTags[tag['name']].copy() + original_tag = FPGATrackSimAlgorithmTags.FPGATrackSimAlgorithmTags[tag['name']].copy() if 'filename' in kwargs and kwargs['filename']: skip_keys = ['bankDir'] diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/__init__.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..937751f3130524464d37bf17d789f4fa172b2339 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/__init__.py @@ -0,0 +1,5 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +__version__ = "$Revision$" +__author__ = "Riley Xu, FPGATrackSim team" + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/parseRunArgs.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/parseRunArgs.py similarity index 79% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/parseRunArgs.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/parseRunArgs.py index 59026e38dce6116619457a25a459486f148c25de..b668aa0ccc80ce8cbebefabca76e07d1a56c71ec 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/python/parseRunArgs.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/python/parseRunArgs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' @file parseRunArgs.py @author Riley Xu - riley.xu@cern.ch @@ -6,7 +6,7 @@ @brief Configuration file that parses run arguments from transforms This file collects all transform run argument parsing into a centralized area -for configuring various HTT transforms. +for configuring various FPGATrackSim transforms. Note that the parse functions return a dictionary that contain keys to correspond to those in the various package tags. We don't want to use the tags directly here @@ -15,10 +15,10 @@ copied to this file. Usage: transform: - addHTTBanksArgs(trf.parser) + addFPGATrackSimBanksArgs(trf.parser) skeleton: - opts = parseHTTArgs(runArgs) - HTTTagConfig.getTags(opts) + opts = parseFPGATrackSimArgs(runArgs) + FPGATrackSimTagConfig.getTags(opts) ''' import itertools @@ -26,11 +26,11 @@ import PyJobTransforms.trfArgClasses as trfArgClasses from PyJobTransforms.trfLogger import msg ############################################################################### -## HTTMaps +## FPGATrackSimMaps ############################################################################### -_HTTMapsArgs = [ - ('mapTag', trfArgClasses.argString, 'Switch to a different tag than the default listed in HTTMapTags'), +_FPGATrackSimMapsArgs = [ + ('mapTag', trfArgClasses.argString, 'Switch to a different tag than the default listed in FPGATrackSimMapTags'), ('region', trfArgClasses.argString, 'Region index or name'), ('pmap', trfArgClasses.argString, "plane map (first stage)"), ('layerOverride', trfArgClasses.argIntList, "Overrides the selection of the 1st stage logical layers in the plane map. Each entry declares a detector layer to use as a logical layer. Specify a detector layer with { SilictonTech * 1000 + DetectorZone * 100 + PhysicalLayer }"), @@ -42,29 +42,29 @@ _HTTMapsArgs = [ ] -def addHTTMapsArgs(parser): +def addFPGATrackSimMapsArgs(parser): ''' - Adds arguments used by HTTMaps to a transform parser. + Adds arguments used by FPGATrackSimMaps to a transform parser. ''' - parser.defineArgGroup('TrigHTTMaps', 'Options for TrigHTTMaps. ' - 'These options will override the default configuration specified in HTTMapTags.') + parser.defineArgGroup('FPGATrackSimMaps', 'Options for FPGATrackSimMaps. ' + 'These options will override the default configuration specified in FPGATrackSimMapTags.') def addArg(argName, argType, helpText=""): parser.add_argument('--' + argName, type=trfArgClasses.argFactory(argType, runarg=True), help=helpText, - group='TrigHTTMaps') + group='FPGATrackSimMaps') - for arg in _HTTMapsArgs: + for arg in _FPGATrackSimMapsArgs: addArg(*arg) ############################################################################### -## HTTBanks +## FPGATrackSimBanks ############################################################################### -_HTTBanksArgs = [ - ("bankTag", trfArgClasses.argString, "Switch to a different tag than the default listed in HTTBankTags"), +_FPGATrackSimBanksArgs = [ + ("bankTag", trfArgClasses.argString, "Switch to a different tag than the default listed in FPGATrackSimBankTags"), ("bankDir", trfArgClasses.argString, "Common directory path to be prepended to all filenames below. If not all files are in the same directory, you can change bankDir to a common parent directory or just '' and use fully-qualified paths for the individual filenames."), ("constants_1st", trfArgClasses.argString, "Filename of the 1st stage constants"), ("constants_2nd", trfArgClasses.argString, "Filename of the 2nd stage constants"), @@ -74,29 +74,29 @@ _HTTBanksArgs = [ ] -def addHTTBanksArgs(parser): +def addFPGATrackSimBanksArgs(parser): ''' - Adds arguments used by HTTBanks to a transform parser. + Adds arguments used by FPGATrackSimBanks to a transform parser. ''' - parser.defineArgGroup('TrigHTTBanks', 'Optional overrides for TrigHTTBanks. ' - 'These options will override the default configuration specified in HTTBankTags.') + parser.defineArgGroup('FPGATrackSimBanks', 'Optional overrides for FPGATrackSimBanks. ' + 'These options will override the default configuration specified in FPGATrackSimBankTags.') def addArg(argName, argType, helpText=""): parser.add_argument('--' + argName, type=trfArgClasses.argFactory(argType, runarg=True), help=helpText, - group='TrigHTTBanks') + group='FPGATrackSimBanks') - for arg in _HTTBanksArgs: + for arg in _FPGATrackSimBanksArgs: addArg(*arg) ############################################################################### -## HTTAlgorithms +## FPGATrackSimAlgorithms ############################################################################### -_HTTAlgorithmsArgs = [ +_FPGATrackSimAlgorithmsArgs = [ ("algoTag", trfArgClasses.argString, "Tag to use for algorithm configuration"), ("FirstInputToolN", trfArgClasses.argInt, "number of times to reuse each event in first input tool, i.e. for overlaying"), ("realHitsOverlay", trfArgClasses.argBool, "Use a second real hits tool"), @@ -122,7 +122,7 @@ _HTTAlgorithmsArgs = [ ("writeOutputData", trfArgClasses.argBool, "write out Tree in the output file") ] -_HTTHoughTransformArgs = [ +_FPGATrackSimHoughTransformArgs = [ ('phi_min', trfArgClasses.argFloat), ('phi_max', trfArgClasses.argFloat), ('qpt_min', trfArgClasses.argFloat), @@ -148,7 +148,7 @@ _HTTHoughTransformArgs = [ ("fieldCorrection", trfArgClasses.argBool, "Apply corrections to hough equation due to field nonuniformity"), ] -_HTTLRTArgs = [ +_FPGATrackSimLRTArgs = [ ('lrt', trfArgClasses.argBool, "Enable LRT stage"), ('lrt_use_basicHitFilter', trfArgClasses.argBool, "Enable basic hits filtering"), ('lrt_use_mlHitFilter', trfArgClasses.argBool, "Enable ML ts filtering"), @@ -166,14 +166,14 @@ _HTTLRTArgs = [ #TODO add options for stright track HT and hit filter tools ] -def addHTTAlgorithmsArgs(parser): +def addFPGATrackSimAlgorithmsArgs(parser): ''' - Adds arguments used by HTTAlgorithms to a transform parser. + Adds arguments used by FPGATrackSimAlgorithms to a transform parser. ''' - parser.defineArgGroup('HTTAlgorithms', 'Options for HTTAlgorithms configuration') - parser.defineArgGroup('HTTHoughTransform', 'Options for HTT Hough transform') - parser.defineArgGroup('HTTLRT', 'Options for HTT Hough transform') + parser.defineArgGroup('FPGATrackSimAlgorithms', 'Options for FPGATrackSimAlgorithms configuration') + parser.defineArgGroup('FPGATrackSimHoughTransform', 'Options for FPGATrackSim Hough transform') + parser.defineArgGroup('FPGATrackSimLRT', 'Options for FPGATrackSim Hough transform') def addArg(group, argName, argType, helpText=""): parser.add_argument('--' + argName, @@ -181,16 +181,16 @@ def addHTTAlgorithmsArgs(parser): help=helpText, group=group) - for arg in _HTTAlgorithmsArgs: - addArg('HTTAlgorithms', *arg) + for arg in _FPGATrackSimAlgorithmsArgs: + addArg('FPGATrackSimAlgorithms', *arg) - for arg in _HTTHoughTransformArgs: - addArg('HTTHoughTransform', *arg) + for arg in _FPGATrackSimHoughTransformArgs: + addArg('FPGATrackSimHoughTransform', *arg) - for arg in _HTTLRTArgs: - addArg('HTTLRT', *arg) + for arg in _FPGATrackSimLRTArgs: + addArg('FPGATrackSimLRT', *arg) -_HTTHitFilteringArgs = [ +_FPGATrackSimHitFilteringArgs = [ ('doRandomRemoval', trfArgClasses.argBool), ('pixelHitRmFrac', trfArgClasses.argFloat), ('pixelClusRmFrac', trfArgClasses.argFloat), @@ -204,12 +204,12 @@ _HTTHitFilteringArgs = [ ('useNstrips', trfArgClasses.argBool), ] -def addHTTHitFilteringArgs(parser): +def addFPGATrackSimHitFilteringArgs(parser): ''' - Adds arguments used by HTTHitFiltering to a transform parser. + Adds arguments used by FPGATrackSimHitFiltering to a transform parser. ''' - parser.defineArgGroup('HTTHitFiltering', 'Options for HTTHitFiltering configuration') + parser.defineArgGroup('FPGATrackSimHitFiltering', 'Options for FPGATrackSimHitFiltering configuration') def addArg(group, argName, argType, helpText=""): parser.add_argument('--' + argName, @@ -217,8 +217,8 @@ def addHTTHitFilteringArgs(parser): help=helpText, group=group) - for arg in _HTTHitFilteringArgs: - addArg('HTTHitFiltering', *arg) + for arg in _FPGATrackSimHitFilteringArgs: + addArg('FPGATrackSimHitFiltering', *arg) @@ -226,13 +226,13 @@ def addHTTHitFilteringArgs(parser): ## Parsing ############################################################################### -def parseHTTArgs(runArgs): +def parseFPGATrackSimArgs(runArgs): ''' - Collects HTT arguments from runArgs into a dictionary of (parameter: value) pairs. + Collects FPGATrackSim arguments from runArgs into a dictionary of (parameter: value) pairs. Use the corresponding add***Args() functions above to add arguments to a transform parser. ''' opts = {} - for arg in itertools.chain(_HTTMapsArgs, _HTTBanksArgs, _HTTAlgorithmsArgs, _HTTHoughTransformArgs, _HTTHitFilteringArgs, _HTTLRTArgs): + for arg in itertools.chain(_FPGATrackSimMapsArgs, _FPGATrackSimBanksArgs, _FPGATrackSimAlgorithmsArgs, _FPGATrackSimHoughTransformArgs, _FPGATrackSimHitFilteringArgs, _FPGATrackSimLRTArgs): key = arg[0] if hasattr(runArgs, key): opts[key] = getattr(runArgs, key) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/share/HTTRegionSlices_test.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/share/FPGATrackSimRegionSlices_test.ref similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/share/HTTRegionSlices_test.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/share/FPGATrackSimRegionSlices_test.ref diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTEventSelectionSvc.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimEventSelectionSvc.cxx similarity index 72% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTEventSelectionSvc.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimEventSelectionSvc.cxx index 035159c3495d447f7e2b7ea1b3f7c97d31c4d438..f38662d076b0c528f61a07533a8f55f26c1f0dfc 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTEventSelectionSvc.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimEventSelectionSvc.cxx @@ -1,28 +1,28 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "TMath.h" -#include "HTTEventSelectionSvc.h" -#include "TrigHTTConfTools/HTTRegionSlices.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" -#include "TrigHTTObjects/HTTTruthTrack.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimConfTools/FPGATrackSimRegionSlices.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <AsgMessaging/MessageCheck.h> #include "AtlasHepMC/MagicNumbers.h" using namespace asg::msgUserCode; -HTTEventSelectionSvc::HTTEventSelectionSvc(const std::string& name, ISvcLocator* svc) : +FPGATrackSimEventSelectionSvc::FPGATrackSimEventSelectionSvc(const std::string& name, ISvcLocator* svc) : base_class(name,svc) {} -StatusCode HTTEventSelectionSvc::initialize() +StatusCode FPGATrackSimEventSelectionSvc::initialize() { if (!m_regions) createRegions(); @@ -57,7 +57,7 @@ StatusCode HTTEventSelectionSvc::initialize() // Should really be printing the full information, but it conflicts with // the requirement that log files be identical ..... - ATH_MSG_INFO("HTTEventSelectionSvc::initialize(): " << + ATH_MSG_INFO("FPGATrackSimEventSelectionSvc::initialize(): " << "regionID = " << m_regionID << ", " << "min = {" << m_min << "}, " << "max = {" << m_max << "}, " << @@ -67,22 +67,22 @@ StatusCode HTTEventSelectionSvc::initialize() return StatusCode::SUCCESS; } -StatusCode HTTEventSelectionSvc::finalize() +StatusCode FPGATrackSimEventSelectionSvc::finalize() { if (m_regions) delete m_regions; - ATH_MSG_INFO("HTTEventSelectionSvc::finalize()"); + ATH_MSG_INFO("FPGATrackSimEventSelectionSvc::finalize()"); return StatusCode::SUCCESS; } -StatusCode HTTEventSelectionSvc::queryInterface(const InterfaceID& riid, void** ppvIf) +StatusCode FPGATrackSimEventSelectionSvc::queryInterface(const InterfaceID& riid, void** ppvIf) { if ( !ppvIf ) return StatusCode::FAILURE; // find indirect interfaces : - if (IHTTEventSelectionSvc::interfaceID().versionMatch(riid)) { - *ppvIf = dynamic_cast<IHTTEventSelectionSvc*>(this); + if (IFPGATrackSimEventSelectionSvc::interfaceID().versionMatch(riid)) { + *ppvIf = dynamic_cast<IFPGATrackSimEventSelectionSvc*>(this); } else if (base_class::queryInterface(riid, ppvIf).isSuccess()) { return StatusCode::SUCCESS; } else { @@ -94,7 +94,7 @@ StatusCode HTTEventSelectionSvc::queryInterface(const InterfaceID& riid, void** } -bool HTTEventSelectionSvc::passCuts(const HTTHit& hit) const +bool FPGATrackSimEventSelectionSvc::passCuts(const FPGATrackSimHit& hit) const { float eta = TMath::ASinH(hit.getGCotTheta()); float phi = hit.getGPhi(); @@ -106,7 +106,7 @@ bool HTTEventSelectionSvc::passCuts(const HTTHit& hit) const return false; } -bool HTTEventSelectionSvc::passCuts(const HTTTrack& track) const +bool FPGATrackSimEventSelectionSvc::passCuts(const FPGATrackSimTrack& track) const { if (track.getQOverPt() >= m_trackmin.qOverPt && track.getQOverPt() <= m_trackmax.qOverPt && track.getEta() >= m_trackmin.eta && track.getEta() <= m_trackmax.eta @@ -118,7 +118,7 @@ bool HTTEventSelectionSvc::passCuts(const HTTTrack& track) const return false; } -bool HTTEventSelectionSvc::passQOverPt(const HTTTrack& track) const +bool FPGATrackSimEventSelectionSvc::passQOverPt(const FPGATrackSimTrack& track) const { if (track.getQOverPt() >= m_trackmin.qOverPt && track.getQOverPt() <= m_trackmax.qOverPt) return true; @@ -126,7 +126,7 @@ bool HTTEventSelectionSvc::passQOverPt(const HTTTrack& track) const return false; } -bool HTTEventSelectionSvc::passEta(const HTTTrack& track) const +bool FPGATrackSimEventSelectionSvc::passEta(const FPGATrackSimTrack& track) const { if (track.getEta() >= m_trackmin.eta && track.getEta() <= m_trackmax.eta) return true; @@ -134,7 +134,7 @@ bool HTTEventSelectionSvc::passEta(const HTTTrack& track) const return false; } -bool HTTEventSelectionSvc::passPhi(const HTTTrack& track) const +bool FPGATrackSimEventSelectionSvc::passPhi(const FPGATrackSimTrack& track) const { if (track.getPhi() >= m_trackmin.phi && track.getPhi() <= m_trackmax.phi) return true; @@ -142,7 +142,7 @@ bool HTTEventSelectionSvc::passPhi(const HTTTrack& track) const return false; } -bool HTTEventSelectionSvc::passD0(const HTTTrack& track) const +bool FPGATrackSimEventSelectionSvc::passD0(const FPGATrackSimTrack& track) const { if (track.getD0() >= m_trackmin.d0 && track.getD0() <= m_trackmax.d0) return true; @@ -150,7 +150,7 @@ bool HTTEventSelectionSvc::passD0(const HTTTrack& track) const return false; } -bool HTTEventSelectionSvc::passZ0(const HTTTrack& track) const +bool FPGATrackSimEventSelectionSvc::passZ0(const FPGATrackSimTrack& track) const { if (track.getZ0() >= m_trackmin.z0 && track.getZ0() <= m_trackmax.z0) return true; @@ -158,7 +158,7 @@ bool HTTEventSelectionSvc::passZ0(const HTTTrack& track) const return false; } -bool HTTEventSelectionSvc::passCuts(const HTTOfflineTrack& offlineTrack) const +bool FPGATrackSimEventSelectionSvc::passCuts(const FPGATrackSimOfflineTrack& offlineTrack) const { if (offlineTrack.getQOverPt() >= m_trackmin.qOverPt && offlineTrack.getQOverPt() <= m_trackmax.qOverPt && offlineTrack.getEta() >= m_trackmin.eta && offlineTrack.getEta() <= m_trackmax.eta @@ -170,7 +170,7 @@ bool HTTEventSelectionSvc::passCuts(const HTTOfflineTrack& offlineTrack) const return false; } -bool HTTEventSelectionSvc::passQOverPt(const HTTOfflineTrack& offlineTrack) const +bool FPGATrackSimEventSelectionSvc::passQOverPt(const FPGATrackSimOfflineTrack& offlineTrack) const { if (offlineTrack.getQOverPt() >= m_trackmin.qOverPt && offlineTrack.getQOverPt() <= m_trackmax.qOverPt) return true; @@ -178,7 +178,7 @@ bool HTTEventSelectionSvc::passQOverPt(const HTTOfflineTrack& offlineTrack) cons return false; } -bool HTTEventSelectionSvc::passEta(const HTTOfflineTrack& offlineTrack) const +bool FPGATrackSimEventSelectionSvc::passEta(const FPGATrackSimOfflineTrack& offlineTrack) const { if (offlineTrack.getEta() >= m_trackmin.eta && offlineTrack.getEta() <= m_trackmax.eta) return true; @@ -186,7 +186,7 @@ bool HTTEventSelectionSvc::passEta(const HTTOfflineTrack& offlineTrack) const return false; } -bool HTTEventSelectionSvc::passPhi(const HTTOfflineTrack& offlineTrack) const +bool FPGATrackSimEventSelectionSvc::passPhi(const FPGATrackSimOfflineTrack& offlineTrack) const { if (offlineTrack.getPhi() >= m_trackmin.phi && offlineTrack.getPhi() <= m_trackmax.phi) return true; @@ -194,7 +194,7 @@ bool HTTEventSelectionSvc::passPhi(const HTTOfflineTrack& offlineTrack) const return false; } -bool HTTEventSelectionSvc::passD0(const HTTOfflineTrack& offlineTrack) const +bool FPGATrackSimEventSelectionSvc::passD0(const FPGATrackSimOfflineTrack& offlineTrack) const { if (offlineTrack.getD0() >= m_trackmin.d0 && offlineTrack.getD0() <= m_trackmax.d0) return true; @@ -202,7 +202,7 @@ bool HTTEventSelectionSvc::passD0(const HTTOfflineTrack& offlineTrack) const return false; } -bool HTTEventSelectionSvc::passZ0(const HTTOfflineTrack& offlineTrack) const +bool FPGATrackSimEventSelectionSvc::passZ0(const FPGATrackSimOfflineTrack& offlineTrack) const { if (offlineTrack.getZ0() >= m_trackmin.z0 && offlineTrack.getZ0() <= m_trackmax.z0) return true; @@ -210,13 +210,13 @@ bool HTTEventSelectionSvc::passZ0(const HTTOfflineTrack& offlineTrack) const return false; } -bool HTTEventSelectionSvc::passCuts(const HTTTruthTrack& truthTrack) const +bool FPGATrackSimEventSelectionSvc::passCuts(const FPGATrackSimTruthTrack& truthTrack) const { // Want a version that allows us to modify the selection parameters here. // If m_trackmin and m_trackmax are unmodified from the region definitions // this should return exactly the same. - HTTTrackPars cur = truthTrack.getPars(); - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + FPGATrackSimTrackPars cur = truthTrack.getPars(); + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { if (cur[i] < m_trackmin[i]) { return false; @@ -230,7 +230,7 @@ bool HTTEventSelectionSvc::passCuts(const HTTTruthTrack& truthTrack) const return true; } -bool HTTEventSelectionSvc::passMatching(HTTTrack const & track) const +bool FPGATrackSimEventSelectionSvc::passMatching(FPGATrackSimTrack const & track) const { if (track.getBarcode() == 0 || track.getBarcode() == std::numeric_limits<long>::max()) return false; if (track.getEventIndex() == std::numeric_limits<long>::max()) return false; @@ -239,7 +239,7 @@ bool HTTEventSelectionSvc::passMatching(HTTTrack const & track) const return true; } -bool HTTEventSelectionSvc::passMatching(HTTTruthTrack const & truthTrack) const +bool FPGATrackSimEventSelectionSvc::passMatching(FPGATrackSimTruthTrack const & truthTrack) const { if (truthTrack.getBarcode() == 0 || truthTrack.getQ() == 0) return false; if ((!m_allowHighBarcode) && m_st != SampleType::skipTruth && HepMC::is_simulation_particle(truthTrack.getBarcode())) return false; @@ -248,7 +248,7 @@ bool HTTEventSelectionSvc::passMatching(HTTTruthTrack const & truthTrack) const return true; } -bool HTTEventSelectionSvc::selectEvent(HTTEventInputHeader* eventHeader) const +bool FPGATrackSimEventSelectionSvc::selectEvent(FPGATrackSimEventInputHeader* eventHeader) const { if (m_st == SampleType::skipTruth) return true; @@ -268,7 +268,7 @@ bool HTTEventSelectionSvc::selectEvent(HTTEventInputHeader* eventHeader) const } } -bool HTTEventSelectionSvc::selectEvent(HTTLogicalEventInputHeader* eventHeader) const +bool FPGATrackSimEventSelectionSvc::selectEvent(FPGATrackSimLogicalEventInputHeader* eventHeader) const { if (m_st == SampleType::skipTruth) return true; @@ -289,24 +289,24 @@ bool HTTEventSelectionSvc::selectEvent(HTTLogicalEventInputHeader* eventHeader) } -const HTTRegionSlices* HTTEventSelectionSvc::getRegions() +const FPGATrackSimRegionSlices* FPGATrackSimEventSelectionSvc::getRegions() { if (!m_regions) createRegions(); return m_regions; } -void HTTEventSelectionSvc::createRegions() +void FPGATrackSimEventSelectionSvc::createRegions() { if (!m_regions) { ATH_MSG_INFO("Creating the slices object"); - MsgStream cmsg(msgSvc(), "HTTRegionSlices"); + MsgStream cmsg(msgSvc(), "FPGATrackSimRegionSlices"); cmsg.setLevel(msg().level()); // cause AthMessaging is stupid and doesn't have this function - m_regions = new HTTRegionSlices(m_regions_path.value()); + m_regions = new FPGATrackSimRegionSlices(m_regions_path.value()); } } -bool HTTEventSelectionSvc::checkTruthTracks(const std::vector<HTTTruthTrack>& truthTracks) const +bool FPGATrackSimEventSelectionSvc::checkTruthTracks(const std::vector<FPGATrackSimTruthTrack>& truthTracks) const { // find at least one track in the region bool good=false; @@ -332,7 +332,7 @@ bool HTTEventSelectionSvc::checkTruthTracks(const std::vector<HTTTruthTrack>& tr } -bool HTTEventSelectionSvc::checkTruthTracksLRT(const std::vector<HTTTruthTrack>& truthTracks) const +bool FPGATrackSimEventSelectionSvc::checkTruthTracksLRT(const std::vector<FPGATrackSimTruthTrack>& truthTracks) const { ATH_MSG_DEBUG("selectEvent(): Checking truth tracks with LRT requirements"); // Ideally we would make this flexible to use either of two conditions diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimEventSelectionSvc.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimEventSelectionSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..9e551f639693aa8699b141752d672a470fbfe42c --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimEventSelectionSvc.h @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimCONFTOOLS_FPGATrackSimEVENTSELECTIONSVC_H +#define FPGATrackSimCONFTOOLS_FPGATrackSimEVENTSELECTIONSVC_H + +#include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/ToolHandle.h" + +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" + +class FPGATrackSimHit; +class FPGATrackSimTrack; +class FPGATrackSimOfflineTrack; +class FPGATrackSimTruthTrack; +class FPGATrackSimRegionSlices; +class FPGATrackSimEventInputHeader; +class FPGATrackSimLogicalEventInputHeader; + + +class FPGATrackSimEventSelectionSvc : public extends< AthService, IFPGATrackSimEventSelectionSvc > +{ + public: + + FPGATrackSimEventSelectionSvc(const std::string& name, ISvcLocator* svc); + virtual ~FPGATrackSimEventSelectionSvc() = default; + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + //static const InterfaceID& interfaceID(); + virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIf) override; + + virtual unsigned getRegionID() const override { return m_regionID; } + virtual SampleType getSampleType() const override { return m_st; } + virtual bool checkPU() const override { return m_withPU.value(); } + virtual const FPGATrackSimRegionSlices* getRegions() override; + virtual int getLRTpdgID() const override { return m_LRT_pdgID; } + + virtual FPGATrackSimTrackPars getMin() const override { return m_min; } + virtual FPGATrackSimTrackPars getMax() const override { return m_max; } + + virtual bool passCuts(const FPGATrackSimHit&) const override; + virtual bool passCuts(const FPGATrackSimTrack&) const override; + virtual bool passCuts(const FPGATrackSimOfflineTrack&) const override; + virtual bool passCuts(const FPGATrackSimTruthTrack&) const override; + + virtual bool passQOverPt(const FPGATrackSimTrack&) const override; + virtual bool passEta(const FPGATrackSimTrack&) const override; + virtual bool passPhi(const FPGATrackSimTrack&) const override; + virtual bool passD0(const FPGATrackSimTrack&) const override; + virtual bool passZ0(const FPGATrackSimTrack&) const override; + virtual bool passQOverPt(const FPGATrackSimOfflineTrack&) const override; + virtual bool passEta(const FPGATrackSimOfflineTrack&) const override; + virtual bool passPhi(const FPGATrackSimOfflineTrack&) const override; + virtual bool passD0(const FPGATrackSimOfflineTrack&) const override; + virtual bool passZ0(const FPGATrackSimOfflineTrack&) const override; + + virtual bool passMatching(FPGATrackSimTrack const &) const override; + virtual bool passMatching(FPGATrackSimTruthTrack const &) const override; + + virtual bool selectEvent(FPGATrackSimEventInputHeader*) const override; + virtual bool selectEvent(FPGATrackSimLogicalEventInputHeader*) const override; + + private: + + // Gaudi parameters: + Gaudi::Property<unsigned int> m_regionID { this, "regionID", 0, "current region under processing"}; // Current region of interest + Gaudi::Property<std::string> m_regions_path { this, "regions", "", "path of the slices file"}; // path to slices file + Gaudi::Property<std::string> m_sampleType { this, "sampleType", "singleMuons", "type of sample under processing (skipTruth, singleElectrons, singleMuons, singlePions, or LLPs)"}; // type of sample ("skipTruth", "singleElectrons", "singleMuons", "singlePions") + Gaudi::Property<bool> m_withPU { this, "withPU", false, "flag to say if there is pile-up or not"}; // flag to say if there is pile-up or not + Gaudi::Property<bool> m_LRT { this, "doLRT", false, "Change track selection to LRT quantities; hit selection unchanged"}; // flag to require cancelling of selections on d0 and z0 in the case of large-radius tracking + Gaudi::Property<float> m_minLRTpT { this, "minLRTpT", 5., "Minimum pT to use in LRT selection, in GeV"}; // minimum pT, in GeV, to use in LRT selection + Gaudi::Property<int> m_LRT_pdgID { this, "lrt_truthMatchPDGID", 0, "If we are running an LLP sample but want only some PDGID of output in the truth selection, set this"}; // If we are running an LLP sample but want only some PDGID of output in the truth selection, set this + Gaudi::Property<bool> m_allowHighBarcode { this, "allowHighBarcode", false, "Whether or not to allow barcodes over 200000 in truth matching"}; // whether or not to allow barcodes over 200000 in truth matching + + + + SampleType m_st = SampleType::skipTruth; // internal value for faster comparisons in selectEvent() + FPGATrackSimRegionSlices* m_regions = nullptr; // pointer to RegionSlices class + + FPGATrackSimTrackPars m_min; // min limits of current region + FPGATrackSimTrackPars m_max; // max limits of current region + FPGATrackSimTrackPars m_trackmin; // min limits of tracks to be accepted in region + FPGATrackSimTrackPars m_trackmax; // max limits of tracks to be accepted in region + + + void createRegions(); // helper function to create RegionSlices object + bool checkTruthTracks(const std::vector<FPGATrackSimTruthTrack>&) const; // helper function to check the truth tracks for selectEvent() + bool checkTruthTracksLRT(const std::vector<FPGATrackSimTruthTrack>&) const; // check the truth tracks for selectEvent() with LRT requirements +}; + +/*inline const InterfaceID& FPGATrackSimEventSelectionSvc::interfaceID() +{ + static const InterfaceID IID_FPGATrackSimEventSelectionSvc("FPGATrackSimEventSelectionSvc", 1, 0); + return IID_FPGATrackSimEventSelectionSvc; +}*/ + +#endif // FPGATrackSimCONFTOOLS_FPGATrackSimEVENTSELECTIONSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTRegionSlices.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimRegionSlices.cxx similarity index 70% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTRegionSlices.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimRegionSlices.cxx index b11f297440d9d3f8e1199024962e0cddb65456ce..126ca10904a5efd1305d03589f4a2aadd89ceb00 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/src/HTTRegionSlices.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/FPGATrackSimRegionSlices.cxx @@ -1,15 +1,15 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTRegionSlices.h + * @file FPGATrackSimRegionSlices.h * @author Riley Xu - riley.xu@cern.ch * @date Janurary 7th, 2021 - * @brief Stores slice definitions for HTT regions + * @brief Stores slice definitions for FPGATrackSim regions * * See header. */ -#include "TrigHTTConfTools/HTTRegionSlices.h" +#include "FPGATrackSimConfTools/FPGATrackSimRegionSlices.h" #include <AsgMessaging/MessageCheck.h> @@ -24,20 +24,20 @@ using namespace asg::msgUserCode; /////////////////////////////////////////////////////////////////////////////// -HTTRegionSlices::HTTRegionSlices(std::string const & filepath) +FPGATrackSimRegionSlices::FPGATrackSimRegionSlices(std::string const & filepath) { // Open the file std::ifstream fin(filepath); if (!fin.is_open()) { ANA_MSG_ERROR("Couldn't open " << filepath); - throw ("HTTRegionSlices couldn't open " + filepath); + throw ("FPGATrackSimRegionSlices couldn't open " + filepath); } // Variables to fill unsigned region; std::string line, key; - HTTTrackPars min, max; + FPGATrackSimTrackPars min, max; // Parse the file bool ok = true; @@ -53,8 +53,8 @@ HTTRegionSlices::HTTRegionSlices(std::string const & filepath) ok = ok && (sline >> region); if (ok && region > 0) m_regions.push_back({ min, max }); ok = ok && (region == m_regions.size()); - min = HTTTrackPars(); // reset - max = HTTTrackPars(); // reset + min = FPGATrackSimTrackPars(); // reset + max = FPGATrackSimTrackPars(); // reset } else if (key == "phi") ok = ok && (sline >> min.phi >> max.phi); else if (key == "eta") ok = ok && (sline >> min.eta >> max.eta); @@ -69,7 +69,7 @@ HTTRegionSlices::HTTRegionSlices(std::string const & filepath) if (!ok) { ANA_MSG_ERROR("Found error reading file at line: " << line); - throw "HTTRegionSlices read error"; + throw "FPGATrackSimRegionSlices read error"; } m_regions.push_back({ min, max }); // last region still needs to be added @@ -82,18 +82,18 @@ HTTRegionSlices::HTTRegionSlices(std::string const & filepath) /////////////////////////////////////////////////////////////////////////////// -bool HTTRegionSlices::inRegion(unsigned region, HTTTruthTrack const & t) const +bool FPGATrackSimRegionSlices::inRegion(unsigned region, FPGATrackSimTruthTrack const & t) const { if (region >= m_regions.size()) { ANA_MSG_WARNING("inRegion() region " << region << " out-of-bounds " << m_regions.size()); return false; } - HTTTrackPars min = m_regions[region].first; - HTTTrackPars max = m_regions[region].second; - HTTTrackPars cur = t.getPars(); + FPGATrackSimTrackPars min = m_regions[region].first; + FPGATrackSimTrackPars max = m_regions[region].second; + FPGATrackSimTrackPars cur = t.getPars(); - for (unsigned i = 0; i < HTTTrackPars::NPARS; i++) + for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) { if (cur[i] < min[i]) return false; if (cur[i] > max[i]) return false; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/components/FPGATrackSimConfig_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/components/FPGATrackSimConfig_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6811ee6da704f63f0a092e3573926f22b62dc971 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/src/components/FPGATrackSimConfig_entries.cxx @@ -0,0 +1,5 @@ +#include "../FPGATrackSimEventSelectionSvc.h" + +DECLARE_COMPONENT( FPGATrackSimEventSelectionSvc ) + + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/test/FPGATrackSimInputTestSetup.sh b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/test/FPGATrackSimInputTestSetup.sh new file mode 100755 index 0000000000000000000000000000000000000000..49e93dfb9e69520c3f0290bbbb8dfe14c87a9dbd --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/test/FPGATrackSimInputTestSetup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +#RDOs: +export FPGATrackSimRDOFile=$EOS_MGM_URL_FPGATrackSim/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/RUN +#wrappers: + +export FPGATrackSimRawHitFile=$EOS_MGM_URL_FPGATrackSim/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/test/HTTRegionSlices_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/test/FPGATrackSimRegionSlices_test.cxx similarity index 80% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/test/HTTRegionSlices_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/test/FPGATrackSimRegionSlices_test.cxx index 0c8b57f6a8d9ee18426b697b72e965d414b280c1..4645c134973a40a5eb09602532c29ee12ae87f2a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTConfTools/test/HTTRegionSlices_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimConfTools/test/FPGATrackSimRegionSlices_test.cxx @@ -1,29 +1,29 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /* - * HTTRegionSlices_test.cxx: Unit tests for HTTRegionSlices + * FPGATrackSimRegionSlices_test.cxx: Unit tests for FPGATrackSimRegionSlices */ #include <cstdio> #include <iostream> #include <cassert> -#include "TrigHTTConfTools/HTTRegionSlices.h" +#include "FPGATrackSimConfTools/FPGATrackSimRegionSlices.h" #include "TLorentzVector.h" int main(int, char**) { std::string filePath = "/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/slices_v01_Jan21.txt"; - HTTRegionSlices regionSlice(filePath.c_str()); + FPGATrackSimRegionSlices regionSlice(filePath.c_str()); const double eta(0.2), phi(0.4); const double bad_eta(0.7), bad_phi(0.8); const double pt(1), m(0); TLorentzVector tlv; - HTTTruthTrack track; + FPGATrackSimTruthTrack track; tlv.SetPtEtaPhiM(pt,eta,phi,m); track.setPX(tlv.Px()); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..11b4d06316011c30188c66c4d7b4a5f73faf2888 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimHough/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/CMakeLists.txt similarity index 54% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/CMakeLists.txt rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/CMakeLists.txt index 14f4eba1eb71b53c97f8bf7e889f3ebb40c27f3c..6631195c2487144c6f63e80fc329b86730dfa49e 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/CMakeLists.txt +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/CMakeLists.txt @@ -1,24 +1,24 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( TrigHTTHough ) +atlas_subdir( FPGATrackSimHough ) # External dependencies: find_package( Boost ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: -atlas_add_library( TrigHTTHoughLib +atlas_add_library( FPGATrackSimHoughLib src/*.cxx - PUBLIC_HEADERS TrigHTTHough + PUBLIC_HEADERS FPGATrackSimHough INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TrigHTTMapsLib TrigHTTObjectsLib + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel FPGATrackSimMapsLib FPGATrackSimObjectsLib PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} TrigHTTBanksLib TrigHTTConfToolsLib ) + PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} FPGATrackSimBanksLib FPGATrackSimConfToolsLib ) -atlas_add_component( TrigHTTHough +atlas_add_component( FPGATrackSimHough src/components/*.cxx - LINK_LIBRARIES TrigHTTBanksLib TrigHTTHoughLib ) + LINK_LIBRARIES FPGATrackSimBanksLib FPGATrackSimHoughLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/HTTHoughRootOutputTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/FPGATrackSimHoughRootOutputTool.h similarity index 73% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/HTTHoughRootOutputTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/FPGATrackSimHoughRootOutputTool.h index c0a9f6d4328a4750a426a79260c868bd4c53a4cb..ee2ae444386427d7a86cccdee5f9c58205a973d5 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/TrigHTTHough/HTTHoughRootOutputTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/FPGATrackSimHoughRootOutputTool.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTHOUGHROOTOUTPUTTOOL_H -#define HTTHOUGHROOTOUTPUTTOOL_H +#ifndef FPGATrackSimHOUGHROOTOUTPUTTOOL_H +#define FPGATrackSimHOUGHROOTOUTPUTTOOL_H /** - * @file HTTHoughRootOutputTool.h + * @file FPGATrackSimHoughRootOutputTool.h * @author Jahred Adelman * @date Jan 30 2021 * @brief Output roads into a ROOT file @@ -14,34 +14,34 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTMultiTruth.h" -#include "TrigHTTObjects/HTTTruthTrack.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" #include "GaudiKernel/ITHistSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include "TTree.h" -class ITrigHTTMappingSvc; -class IHTTEventSelectionSvc; +class IFPGATrackSimMappingSvc; +class IFPGATrackSimEventSelectionSvc; -class HTTHoughRootOutputTool : public AthAlgTool +class FPGATrackSimHoughRootOutputTool : public AthAlgTool { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTHoughRootOutputTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimHoughRootOutputTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; - StatusCode fillTree(std::vector<HTTRoad*> &roads, const std::vector<HTTTruthTrack> &truthTracks, const std::vector<HTTOfflineTrack> &offlineTracks); + StatusCode fillTree(std::vector<FPGATrackSimRoad*> &roads, const std::vector<FPGATrackSimTruthTrack> &truthTracks, const std::vector<FPGATrackSimOfflineTrack> &offlineTracks); private: @@ -49,8 +49,8 @@ class HTTHoughRootOutputTool : public AthAlgTool void ResetVectors(); - ServiceHandle<IHTTEventSelectionSvc> m_EvtSel {this, "HTTEventSelectionSvc", "HTTEventSelectionSvc"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel {this, "FPGATrackSimEventSelectionSvc", "FPGATrackSimEventSelectionSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; ServiceHandle<ITHistSvc> m_tHistSvc {this, "THistSvc", "THistSvc"}; @@ -124,4 +124,4 @@ class HTTHoughRootOutputTool : public AthAlgTool }; -#endif // HTTHOUGHROOTOUTPUTTOOL_H +#endif // FPGATrackSimHOUGHROOTOUTPUTTOOL_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..c4ec2d0909b284cdeb430503e271e56681734250 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h @@ -0,0 +1,39 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimROADFILTERI_H +#define FPGATrackSimROADFILTERI_H + +/** + * @file IFPGATrackSimRoadFilterTool.h + * @author Elliot Lipeles lipeles@cern.ch + * @date 03/25/21 + * @brief Interface declaration for road filter tools + * + * This class is implemented by + * - FPGATrackSimEtaPatternFilterTool + */ + +#include "GaudiKernel/IAlgTool.h" + +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" + +#include <vector> + + +/** + * A road filter returns a vector of roads given a vector of roads. + * + * Note that the postfilter_roads are owned by the tool, and are cleared at each successive + * call of filterRoads(). + */ + +class IFPGATrackSimRoadFilterTool : virtual public IAlgTool +{ + public: + DeclareInterfaceID(IFPGATrackSimRoadFilterTool, 1, 0); + virtual StatusCode filterRoads(const std::vector<FPGATrackSimRoad*> & prefilter_roads, std::vector<FPGATrackSimRoad*> & postfilter_roads) = 0; +}; + + +#endif diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h new file mode 100644 index 0000000000000000000000000000000000000000..ad7b825c9f1e038f75936d19f2157b7acd7ae10e --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h @@ -0,0 +1,46 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimROADFINDERI_H +#define FPGATrackSimROADFINDERI_H + +/** + * @file IFPGATrackSimRoadFinderTool.h + * @author Riley Xu - rixu@cern.ch + * @date 10/23/19 + * @brief Interface declaration for road finder tools + * + * This class is implemented by + * - FPGATrackSimRoadUnionTool + * - FPGATrackSimPatternMatchTool + * - FPGATrackSimSectorMatchTool + * - FPGATrackSimHoughTransformTool + * - FPGATrackSimHough1DShiftTool + */ + +#include "GaudiKernel/IAlgTool.h" + +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" + +#include <vector> + +class FPGATrackSimHit; + + +/** + * A road finder returns a vector of roads given a vector of hits. + * + * Note that the roads are owned by the tool, and are cleared at each successive + * call of getRoads(). + */ + + +class IFPGATrackSimRoadFinderTool : virtual public IAlgTool +{ + public: + DeclareInterfaceID(IFPGATrackSimRoadFinderTool, 1, 0); + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) = 0; +}; + + +#endif diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/python/__init__.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6c55bd939e6c44aa16ca5a61e08d7da6250e1f4b --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/python/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/scripts/Hough_plots.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/scripts/Hough_plots.py similarity index 96% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/scripts/Hough_plots.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/scripts/Hough_plots.py index 8e6575c71630528d57889369e1e12b8863fdfb4e..10eed98a5ec10899a36f17fbb6a61534b91546d1 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/scripts/Hough_plots.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/scripts/Hough_plots.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTEtaPatternFilterTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimEtaPatternFilterTool.cxx similarity index 72% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTEtaPatternFilterTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimEtaPatternFilterTool.cxx index 66c7d505681702227ad40a941bae00f58dcfa8bb..5bc5f3f3a895494ebcf8e00b347473b51d060e4b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTEtaPatternFilterTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimEtaPatternFilterTool.cxx @@ -1,18 +1,18 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTEtaPatternFilterTool.cxx + * @file FPGATrackSimEtaPatternFilterTool.cxx * @author Elliot Lipeles - lipeles@cern.ch * @date March 25th, 2021 * @brief Implements road filtering using eta module patterns */ -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "HTTEtaPatternFilterTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimEtaPatternFilterTool.h" #include "TH2.h" @@ -23,7 +23,7 @@ #include <boost/dynamic_bitset.hpp> #include <iostream> -inline bool operator <(const HTTEtaPatternFilterTool::ModuleId& lhs, const HTTEtaPatternFilterTool::ModuleId& rhs) +inline bool operator <(const FPGATrackSimEtaPatternFilterTool::ModuleId& lhs, const FPGATrackSimEtaPatternFilterTool::ModuleId& rhs) { if (lhs.siTech != rhs.siTech) return lhs.siTech < rhs.siTech; if (lhs.zone != rhs.zone) return lhs.zone < rhs.zone; @@ -34,17 +34,17 @@ inline bool operator <(const HTTEtaPatternFilterTool::ModuleId& lhs, const HTTEt /////////////////////////////////////////////////////////////////////////////// // AthAlgTool -HTTEtaPatternFilterTool::HTTEtaPatternFilterTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimEtaPatternFilterTool::FPGATrackSimEtaPatternFilterTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc) { - declareInterface<IHTTRoadFilterTool>(this); + declareInterface<IFPGATrackSimRoadFilterTool>(this); } -StatusCode HTTEtaPatternFilterTool::initialize() +StatusCode FPGATrackSimEtaPatternFilterTool::initialize() { // Retrieve info - ATH_CHECK(m_HTTMapping.retrieve()); - m_nLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); // Check inputs if (m_pattern_file_path.empty()) { @@ -61,14 +61,14 @@ StatusCode HTTEtaPatternFilterTool::initialize() } -void HTTEtaPatternFilterTool::readPatterns(std::string const & filepath) +void FPGATrackSimEtaPatternFilterTool::readPatterns(std::string const & filepath) { // Open the file std::ifstream fin(filepath); if (!fin.is_open()) { ATH_MSG_FATAL("Couldn't open " << filepath); - throw ("HTTEtaPatternFilterTool couldn't open " + filepath); + throw ("FPGATrackSimEtaPatternFilterTool couldn't open " + filepath); } // Parse the file @@ -97,14 +97,14 @@ void HTTEtaPatternFilterTool::readPatterns(std::string const & filepath) if (!ok) { ATH_MSG_FATAL("Found error reading file at line: " << line); - throw "HTTEtaPatternFilterTool read error"; + throw "FPGATrackSimEtaPatternFilterTool read error"; } ATH_MSG_INFO("Read " << m_patternmap.size() << " patterns from " << filepath); } -void HTTEtaPatternFilterTool::buildMap() +void FPGATrackSimEtaPatternFilterTool::buildMap() { ATH_MSG_DEBUG("Building Map "); m_moduleHits.resize(m_nLayers); @@ -124,7 +124,7 @@ void HTTEtaPatternFilterTool::buildMap() /////////////////////////////////////////////////////////////////////////////// // Main Algorithm -StatusCode HTTEtaPatternFilterTool::filterRoads(const std::vector<HTTRoad*> & prefilter_roads, std::vector<HTTRoad*> & postfilter_roads) +StatusCode FPGATrackSimEtaPatternFilterTool::filterRoads(const std::vector<FPGATrackSimRoad*> & prefilter_roads, std::vector<FPGATrackSimRoad*> & postfilter_roads) { m_postfilter_roads.clear(); postfilter_roads.clear(); @@ -167,13 +167,13 @@ StatusCode HTTEtaPatternFilterTool::filterRoads(const std::vector<HTTRoad*> & pr // copy roads to outputs postfilter_roads.reserve(m_postfilter_roads.size()); - for (HTTRoad & r : m_postfilter_roads) + for (FPGATrackSimRoad & r : m_postfilter_roads) postfilter_roads.push_back(&r); return StatusCode::SUCCESS; } -void HTTEtaPatternFilterTool::resetCounters() +void FPGATrackSimEtaPatternFilterTool::resetCounters() { for (auto & entry : m_patternmap) entry.second = 0; @@ -183,13 +183,13 @@ void HTTEtaPatternFilterTool::resetCounters() entry.second.reset(); } -void HTTEtaPatternFilterTool::addHitsToMap(HTTRoad* r) +void FPGATrackSimEtaPatternFilterTool::addHitsToMap(FPGATrackSimRoad* r) { for (unsigned lyr = 0; lyr < m_nLayers; lyr++) for (auto & hit : r->getHits(lyr)) if (hit->getHitType() != HitType::wildcard) { - ModuleId mod = { hit->getDetType(), hit->getDetectorZone(), hit->getHTTEtaModule() }; + ModuleId mod = { hit->getDetType(), hit->getDetectorZone(), hit->getFPGATrackSimEtaModule() }; auto itr = m_moduleHits[lyr].find(mod); if (itr != m_moduleHits[lyr].end()) itr->second.addHit(hit); @@ -200,7 +200,7 @@ void HTTEtaPatternFilterTool::addHitsToMap(HTTRoad* r) // Dropping hits from currPattern can still result in valid (duplicated) patterns above threshold. // This functions adds all of those duplicates to a blacklist in "usedPatterns". -void HTTEtaPatternFilterTool::addRedundantPatterns(std::set<EtaPattern> & usedPatterns, EtaPattern const & currPatt, unsigned nExtra) +void FPGATrackSimEtaPatternFilterTool::addRedundantPatterns(std::set<EtaPattern> & usedPatterns, EtaPattern const & currPatt, unsigned nExtra) { usedPatterns.insert(currPatt); @@ -231,9 +231,9 @@ void HTTEtaPatternFilterTool::addRedundantPatterns(std::set<EtaPattern> & usedPa } } -HTTRoad_Hough HTTEtaPatternFilterTool::buildRoad(std::pair<EtaPattern, layer_bitmask_t> const & patt, HTTRoad* origr) const +FPGATrackSimRoad_Hough FPGATrackSimEtaPatternFilterTool::buildRoad(std::pair<EtaPattern, layer_bitmask_t> const & patt, FPGATrackSimRoad* origr) const { - HTTRoad_Hough r(*dynamic_cast<HTTRoad_Hough*>(origr)); // only works with Hough roads TODO! + FPGATrackSimRoad_Hough r(*dynamic_cast<FPGATrackSimRoad_Hough*>(origr)); // only works with Hough roads TODO! r.setHitLayers(patt.second); for (unsigned lyr = 0; lyr < m_nLayers; lyr++) @@ -246,7 +246,7 @@ HTTRoad_Hough HTTEtaPatternFilterTool::buildRoad(std::pair<EtaPattern, layer_bit /////////////////////////////////////////////////////////////////////////////// // Prints -std::string HTTEtaPatternFilterTool::to_string(const std::vector<unsigned> &v) const +std::string FPGATrackSimEtaPatternFilterTool::to_string(const std::vector<unsigned> &v) const { std::ostringstream oss; oss << "["; @@ -259,7 +259,7 @@ std::string HTTEtaPatternFilterTool::to_string(const std::vector<unsigned> &v) c return oss.str(); } -std::string HTTEtaPatternFilterTool::to_string(const EtaPattern &patt) const +std::string FPGATrackSimEtaPatternFilterTool::to_string(const EtaPattern &patt) const { std::ostringstream oss; oss << "["; @@ -272,7 +272,7 @@ std::string HTTEtaPatternFilterTool::to_string(const EtaPattern &patt) const return oss.str(); } -std::string HTTEtaPatternFilterTool::to_string(const HTTRoad &road) const +std::string FPGATrackSimEtaPatternFilterTool::to_string(const FPGATrackSimRoad &road) const { std::ostringstream oss; oss << road.getNHits() << " : ["; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTEtaPatternFilterTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimEtaPatternFilterTool.h similarity index 63% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTEtaPatternFilterTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimEtaPatternFilterTool.h index 750802808c7ce2274f5b12f1db20759bf56ef07d..1535bca722c782568e68fe2fd4731635c5af827e 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTEtaPatternFilterTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimEtaPatternFilterTool.h @@ -1,30 +1,30 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTETAPATTERNFILTERTOOL_H -#define HTTETAPATTERNFILTERTOOL_H +#ifndef FPGATrackSimETAPATTERNFILTERTOOL_H +#define FPGATrackSimETAPATTERNFILTERTOOL_H /** - * @file HTTEtaPatternFilterTool.h + * @file FPGATrackSimEtaPatternFilterTool.h * @author Elliot Lipeles - lipeles@cern.ch * @date March 25th, 2021 * @brief Implements road filtering using eta module patterns * * Declarations in this file: - * class HTTEtaPatternFilterTool : public AthAlgTool, virtual public IHTTRoadFilterTool + * class FPGATrackSimEtaPatternFilterTool : public AthAlgTool, virtual public IFPGATrackSimRoadFilterTool * */ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTHough/IHTTRoadFilterTool.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" #include "TFile.h" @@ -32,27 +32,27 @@ #include <vector> #include <map> -class HTTEtaPatternFilterTool : public extends<AthAlgTool, IHTTRoadFilterTool> +class FPGATrackSimEtaPatternFilterTool : public extends<AthAlgTool, IFPGATrackSimRoadFilterTool> { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTEtaPatternFilterTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimEtaPatternFilterTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; /////////////////////////////////////////////////////////////////////// - // IHTTRoadFilterTool + // IFPGATrackSimRoadFilterTool - virtual StatusCode filterRoads(const std::vector<HTTRoad*> & prefilter_roads, std::vector<HTTRoad*> & postfilter_roads) override; + virtual StatusCode filterRoads(const std::vector<FPGATrackSimRoad*> & prefilter_roads, std::vector<FPGATrackSimRoad*> & postfilter_roads) override; private: /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; /////////////////////////////////////////////////////////////////////// // Properties @@ -81,11 +81,11 @@ class HTTEtaPatternFilterTool : public extends<AthAlgTool, IHTTRoadFilterTool> struct ModulesToPattern { std::vector<layer_bitmask_t*> m_pattern_bitmasks; // these point to the values in m_pattermap, created in initialize() - std::vector<const HTTHit*> m_hits; // reset every input road + std::vector<const FPGATrackSimHit*> m_hits; // reset every input road void reset() { m_hits.clear(); } void addPattern(layer_bitmask_t* counter) { m_pattern_bitmasks.push_back(counter); } - void addHit(const HTTHit* hit) + void addHit(const FPGATrackSimHit* hit) { if (hit->getHitType() != HitType::wildcard) { m_hits.push_back(hit); @@ -93,18 +93,18 @@ class HTTEtaPatternFilterTool : public extends<AthAlgTool, IHTTRoadFilterTool> (*counter) |= (1 << hit->getLayer()); } } - const std::vector<const HTTHit*> & getHits() const { return m_hits; } + const std::vector<const FPGATrackSimHit*> & getHits() const { return m_hits; } }; /////////////////////////////////////////////////////////////////////// // Event Storage - std::vector<HTTRoad_Hough> m_postfilter_roads; + std::vector<FPGATrackSimRoad_Hough> m_postfilter_roads; /////////////////////////////////////////////////////////////////////// // Convenience - unsigned m_nLayers = 0U; // alias to m_HTTMapping->PlaneMap1stStage()->getNLogiLayers(); + unsigned m_nLayers = 0U; // alias to m_FPGATrackSimMapping->PlaneMap1stStage()->getNLogiLayers(); // The below maps are created in initialize, with fixed keys. But the counters (values) // are reset every input road. @@ -121,12 +121,12 @@ class HTTEtaPatternFilterTool : public extends<AthAlgTool, IHTTRoadFilterTool> void readPatterns(std::string const & filepath); void buildMap(); void resetCounters(); - void addHitsToMap(HTTRoad* r); + void addHitsToMap(FPGATrackSimRoad* r); void addRedundantPatterns(std::set<EtaPattern> & usedPatterns, EtaPattern const & currPatt, unsigned nExtra); - HTTRoad_Hough buildRoad(std::pair<EtaPattern, layer_bitmask_t> const & patt, HTTRoad* origr) const; + FPGATrackSimRoad_Hough buildRoad(std::pair<EtaPattern, layer_bitmask_t> const & patt, FPGATrackSimRoad* origr) const; std::string to_string(const EtaPattern &patt) const; - std::string to_string(const HTTRoad &road) const; + std::string to_string(const FPGATrackSimRoad &road) const; std::string to_string(const std::vector<unsigned> &v) const; }; -#endif // HTTETAPATTERNFILTERTOOL_H +#endif // FPGATrackSimETAPATTERNFILTERTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHough1DShiftTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHough1DShiftTool.cxx similarity index 81% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHough1DShiftTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHough1DShiftTool.cxx index f04add581d1f368a78424478baf24095e53ad150..4723933890f58b5af01829f4ff2d6001065ffb3f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHough1DShiftTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHough1DShiftTool.cxx @@ -1,22 +1,22 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTHough1DShiftTool.cxx + * @file FPGATrackSimHough1DShiftTool.cxx * @author Riley Xu - riley.xu@cern.ch * @date October 31st, 2020 * @brief See header file. */ -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTConfTools/HTTRegionSlices.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTMaps/HTTRegionMap.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "HTTHough1DShiftTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimConfTools/FPGATrackSimRegionSlices.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimHough1DShiftTool.h" #include "TH2.h" @@ -35,16 +35,16 @@ static inline void updateBinHits(std::vector<boost::dynamic_bitset<>> & binHits, /////////////////////////////////////////////////////////////////////////////// // AthAlgTool -HTTHough1DShiftTool::HTTHough1DShiftTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimHough1DShiftTool::FPGATrackSimHough1DShiftTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc), m_name(instance_name(name)), m_monitorFile((m_name + ".root").c_str(), "RECREATE") { - declareInterface<IHTTRoadFinderTool>(this); + declareInterface<IFPGATrackSimRoadFinderTool>(this); } -StatusCode HTTHough1DShiftTool::initialize() +StatusCode FPGATrackSimHough1DShiftTool::initialize() { // Config printout ATH_MSG_INFO("Phi range: (" << m_phiMin << "," << m_phiMax << "," << m_phiBins << ")"); @@ -52,9 +52,9 @@ StatusCode HTTHough1DShiftTool::initialize() if (m_variableExtend) ATH_MSG_INFO("variableExtend Set True"); // Retrieve info - ATH_CHECK(m_HTTBankSvc.retrieve()); - ATH_CHECK(m_HTTMapping.retrieve()); - m_nLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); + ATH_CHECK(m_FPGATrackSimBankSvc.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); // Error checking if (m_phiMin >= m_phiMax || m_phiBins == 0) { @@ -76,7 +76,7 @@ StatusCode HTTHough1DShiftTool::initialize() if (m_iterStep == 0) m_iterStep = m_hitExtend[m_iterLayer] * 2 + 1; // default 1 // Copy correct r values - auto pmap = m_HTTMapping->PlaneMap_1st(); + auto pmap = m_FPGATrackSimMapping->PlaneMap_1st(); m_r.resize(m_nLayers); if (m_radii_file.value().empty()) { for (unsigned logilyr = 0; logilyr < m_nLayers; logilyr++) @@ -107,7 +107,7 @@ StatusCode HTTHough1DShiftTool::initialize() // Fills m_shifts -void HTTHough1DShiftTool::calculateShifts() +void FPGATrackSimHough1DShiftTool::calculateShifts() { // Calculated d0shift if selected if (m_d0spread>0) calculated0Shifts(); @@ -171,14 +171,14 @@ void HTTHough1DShiftTool::calculateShifts() // for 4/5 matching, i.e (layer 0 is right-most bit). // // See /eos/atlas/atlascerngroupdisk/det-htt/sectors_constants/BitShiftHoughPatterns/2021-02-20/ -void HTTHough1DShiftTool::readShifts(std::string const & filepath) +void FPGATrackSimHough1DShiftTool::readShifts(std::string const & filepath) { // Open the file std::ifstream fin(filepath); if (!fin.is_open()) { ATH_MSG_FATAL("Couldn't open " << filepath); - throw ("HTTHough1DShiftTool couldn't open " + filepath); + throw ("FPGATrackSimHough1DShiftTool couldn't open " + filepath); } // Variables to fill @@ -219,21 +219,21 @@ void HTTHough1DShiftTool::readShifts(std::string const & filepath) if (!ok) { ATH_MSG_FATAL("Found error reading file at line: " << line); - throw "HTTHough1DShiftTool read error"; + throw "FPGATrackSimHough1DShiftTool read error"; } ATH_MSG_INFO("Read " << m_shifts.size() << " patterns from " << filepath); } -void HTTHough1DShiftTool::readRadii(std::string const & filepath) +void FPGATrackSimHough1DShiftTool::readRadii(std::string const & filepath) { // Open the file std::ifstream fin(filepath); if (!fin.is_open()) { ATH_MSG_FATAL("Couldn't open " << filepath); - throw ("HTTHough1DShiftTool couldn't open " + filepath); + throw ("FPGATrackSimHough1DShiftTool couldn't open " + filepath); } // Variables to fill @@ -269,7 +269,7 @@ void HTTHough1DShiftTool::readRadii(std::string const & filepath) if (!ok) { ATH_MSG_FATAL("Found error reading file at line: " << line); - throw "HTTHough1DShiftTool read error"; + throw "FPGATrackSimHough1DShiftTool read error"; } } @@ -279,7 +279,7 @@ void HTTHough1DShiftTool::readRadii(std::string const & filepath) /////////////////////////////////////////////////////////////////////////////// // Main Algorithm -StatusCode HTTHough1DShiftTool::getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) +StatusCode FPGATrackSimHough1DShiftTool::getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) { roads.clear(); m_roads.clear(); @@ -322,19 +322,19 @@ StatusCode HTTHough1DShiftTool::getRoads(const std::vector<const HTTHit*> & hits } roads.reserve(m_roads.size()); - for (HTTRoad_Hough & r : m_roads) roads.push_back(&r); + for (FPGATrackSimRoad_Hough & r : m_roads) roads.push_back(&r); m_event++; return StatusCode::SUCCESS; } -std::vector<boost::dynamic_bitset<>> HTTHough1DShiftTool::makeHitMasks(const std::vector<const HTTHit*> & hits) +std::vector<boost::dynamic_bitset<>> FPGATrackSimHough1DShiftTool::makeHitMasks(const std::vector<const FPGATrackSimHit*> & hits) { std::vector<boost::dynamic_bitset<>> hitMasks(m_nLayers, boost::dynamic_bitset<>(m_phiBins)); - for (const HTTHit* hit : hits) + for (const FPGATrackSimHit* hit : hits) { - if (m_subRegion >= 0 && !m_HTTMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; + if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; auto bins = getBins(hit); @@ -346,14 +346,14 @@ std::vector<boost::dynamic_bitset<>> HTTHough1DShiftTool::makeHitMasks(const std } -HTTRoad_Hough HTTHough1DShiftTool::makeRoad(const std::vector<const HTTHit*>& hits, int bin_track, std::vector<int> const & shifts) +FPGATrackSimRoad_Hough FPGATrackSimHough1DShiftTool::makeRoad(const std::vector<const FPGATrackSimHit*>& hits, int bin_track, std::vector<int> const & shifts) { - std::vector<const HTTHit*> road_hits; + std::vector<const FPGATrackSimHit*> road_hits; layer_bitmask_t hitLayers = 0; - for (const HTTHit* hit : hits) + for (const FPGATrackSimHit* hit : hits) { - if (m_subRegion >= 0 && !m_HTTMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; + if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; // Get the shifted bins of the hit auto bins = getBins(hit); @@ -371,7 +371,7 @@ HTTRoad_Hough HTTHough1DShiftTool::makeRoad(const std::vector<const HTTHit*>& hi auto sorted_hits = ::sortByLayer(road_hits); sorted_hits.resize(m_nLayers); // If no hits in last layer, return from sortByLayer will be too short - HTTRoad_Hough r; + FPGATrackSimRoad_Hough r; r.setHitLayers(hitLayers); r.setHits(sorted_hits); r.setSubRegion(m_subRegion); @@ -386,7 +386,7 @@ HTTRoad_Hough HTTHough1DShiftTool::makeRoad(const std::vector<const HTTHit*>& hi // Given a relative shift between iterLayer and layer 0, returns the corresponding qpt. // This does a linear approximation of the Hough transform equation. -float HTTHough1DShiftTool::getPtFromShiftDiff(int shift) const +float FPGATrackSimHough1DShiftTool::getPtFromShiftDiff(int shift) const { if (m_iterLayer == 0) ATH_MSG_FATAL("getPtFromShiftDiff() iterLayer can't be 0"); return (shift * m_phiStep / htt::A) / (m_r[m_iterLayer] - m_r[0]); @@ -394,7 +394,7 @@ float HTTHough1DShiftTool::getPtFromShiftDiff(int shift) const // Returns the range of bins (inclusive) given a phi and an extension in number of bins -std::pair<int, int> HTTHough1DShiftTool::getBins(const HTTHit* hit) const +std::pair<int, int> FPGATrackSimHough1DShiftTool::getBins(const FPGATrackSimHit* hit) const { float phi = hit->getGPhi(); float bin_extend = m_hitExtend[hit->getLayer()]; @@ -418,7 +418,7 @@ std::pair<int, int> HTTHough1DShiftTool::getBins(const HTTHit* hit) const return { low, high }; } -float HTTHough1DShiftTool::qPt(float r, float deltaPhi) const +float FPGATrackSimHough1DShiftTool::qPt(float r, float deltaPhi) const { if (m_useDiff) { float r1=m_r[0]; @@ -429,14 +429,14 @@ float HTTHough1DShiftTool::qPt(float r, float deltaPhi) const return sin(deltaPhi) / (htt::A * r); } -float HTTHough1DShiftTool::phitrkDiff(float r1, float phi1, float r2, float phi2) const +float FPGATrackSimHough1DShiftTool::phitrkDiff(float r1, float phi1, float r2, float phi2) const { float phi_track = phi1+ atan2(r2-r1*cos(phi2-phi1),r1*sin(phi2-phi1)) - TMath::Pi()/2.0; return phi_track; } -std::pair<float, bool> HTTHough1DShiftTool::phitrk(int bin, std::vector<int> const & shifts ) const +std::pair<float, bool> FPGATrackSimHough1DShiftTool::phitrk(int bin, std::vector<int> const & shifts ) const { int inner_bin = int(bin)-int(shifts[0]); int outer_bin = int(bin)-int(shifts[m_nLayers-1]); @@ -487,7 +487,7 @@ static inline void updateBinHits(std::vector<boost::dynamic_bitset<>> & binHits, if (b[i]) binHits[i].set(layer); } -void HTTHough1DShiftTool::printHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks) const +void FPGATrackSimHough1DShiftTool::printHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks) const { std::stringstream ss; ss << "Hit Masks:\n"; @@ -504,7 +504,7 @@ void HTTHough1DShiftTool::printHitMasks(std::vector<boost::dynamic_bitset<>> con ATH_MSG_DEBUG(ss.str() << "\n\n"); } -void HTTHough1DShiftTool::drawHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks, std::string const & name) +void FPGATrackSimHough1DShiftTool::drawHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks, std::string const & name) { m_monitorFile.cd(); @@ -520,7 +520,7 @@ void HTTHough1DShiftTool::drawHitMasks(std::vector<boost::dynamic_bitset<>> cons h.Write(); } -void HTTHough1DShiftTool::drawHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks, std::string const & name, std::vector<int> const & shifts) +void FPGATrackSimHough1DShiftTool::drawHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks, std::string const & name, std::vector<int> const & shifts) { std::vector<boost::dynamic_bitset<>> shiftedMasks; for (size_t layer = 0; layer < m_nLayers; layer++) @@ -529,7 +529,7 @@ void HTTHough1DShiftTool::drawHitMasks(std::vector<boost::dynamic_bitset<>> cons drawHitMasks(shiftedMasks, name); } -void HTTHough1DShiftTool::printShifts() const +void FPGATrackSimHough1DShiftTool::printShifts() const { std::stringstream ss; ss << "Shifts:\n"; @@ -544,7 +544,7 @@ void HTTHough1DShiftTool::printShifts() const ATH_MSG_INFO(ss.str()); } -void HTTHough1DShiftTool::calculated0Shifts() +void FPGATrackSimHough1DShiftTool::calculated0Shifts() { int steps=1; while (true) { @@ -563,7 +563,7 @@ void HTTHough1DShiftTool::calculated0Shifts() ATH_MSG_INFO("d0 Shifts Found = " << m_d0shifts.size()); } -std::vector<int> HTTHough1DShiftTool::applyVariation(std::vector<int> &base, std::vector<int> &var, int sign) const +std::vector<int> FPGATrackSimHough1DShiftTool::applyVariation(std::vector<int> &base, std::vector<int> &var, int sign) const { std::vector<int> retv; @@ -577,7 +577,7 @@ std::vector<int> HTTHough1DShiftTool::applyVariation(std::vector<int> &base, std return retv; } -std::vector<int> HTTHough1DShiftTool::shiftWithDrop(std::vector<int>& shift,unsigned droplayer) const +std::vector<int> FPGATrackSimHough1DShiftTool::shiftWithDrop(std::vector<int>& shift,unsigned droplayer) const { std::vector<int> retv(m_nLayers-1); for (unsigned lyr = 0; lyr < m_nLayers; lyr++) { @@ -586,7 +586,7 @@ std::vector<int> HTTHough1DShiftTool::shiftWithDrop(std::vector<int>& shift,unsi return retv; } -void HTTHough1DShiftTool::calculateDropable() +void FPGATrackSimHough1DShiftTool::calculateDropable() { // one set per layer with shift set diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHough1DShiftTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHough1DShiftTool.h similarity index 77% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHough1DShiftTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHough1DShiftTool.h index df64e3353f8d416d81bd195150d54c74e0cb9391..78ead9e5e19dbebc7bbc9adc1cd49385a161b299 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHough1DShiftTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHough1DShiftTool.h @@ -1,16 +1,16 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTHOUGH1DSHIFTTOOL_H -#define HTTHOUGH1DSHIFTTOOL_H +#ifndef FPGATrackSimHOUGH1DSHIFTTOOL_H +#define FPGATrackSimHOUGH1DSHIFTTOOL_H /** - * @file HTTHough1DShiftTool.h + * @file FPGATrackSimHough1DShiftTool.h * @author Riley Xu - riley.xu@cern.ch * @date November 6th, 2020 * @brief Implements road finding using Elliot's simplified Hough transform. * * Declarations in this file: - * class HTTHough1DShiftTool : public AthAlgTool, virtual public IHTTRoadFinderTool + * class FPGATrackSimHough1DShiftTool : public AthAlgTool, virtual public IFPGATrackSimRoadFinderTool * * Using the Lorentz force equation, one can relate the phi of a track and the * coordinate of a single hit: @@ -40,16 +40,16 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTHough/IHTTRoadFinderTool.h" -#include "TrigHTTHough/IHTTRoadFilterTool.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" #include "TFile.h" @@ -79,30 +79,30 @@ * q : e * pT : GeV / c */ -class HTTHough1DShiftTool : public extends<AthAlgTool, IHTTRoadFinderTool> +class FPGATrackSimHough1DShiftTool : public extends<AthAlgTool, IFPGATrackSimRoadFinderTool> { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTHough1DShiftTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimHough1DShiftTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; /////////////////////////////////////////////////////////////////////// - // IHTTRoadFinderTool + // IFPGATrackSimRoadFinderTool - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) override; + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) override; private: /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<IHTTEventSelectionSvc> m_EvtSel {this, "HTTEventSelectionSvc", "HTTEventSelectionSvc"}; - ServiceHandle<ITrigHTTBankSvc> m_HTTBankSvc {this, "TrigHTTBankSvc", "TrigHTTBankSvc"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel {this, "FPGATrackSimEventSelectionSvc", "FPGATrackSimEventSelectionSvc"}; + ServiceHandle<IFPGATrackSimBankSvc> m_FPGATrackSimBankSvc {this, "FPGATrackSimBankSvc", "FPGATrackSimBankSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; /////////////////////////////////////////////////////////////////////// // Properties @@ -135,15 +135,15 @@ class HTTHough1DShiftTool : public extends<AthAlgTool, IHTTRoadFinderTool> /////////////////////////////////////////////////////////////////////// // Convenience - unsigned m_nLayers = 0; // alias to m_HTTMapping->PlaneMap1stStage()->getNLogiLayers(); + unsigned m_nLayers = 0; // alias to m_FPGATrackSimMapping->PlaneMap1stStage()->getNLogiLayers(); float m_phiStep = 0; // width of one phi bin std::vector<double> m_bins; // size == m_phiBins + 1. // Bin boundaries, where m_bins[i] is the lower bound of bin i. // These are calculated from m_phiMin/Max. - HTTTrackPars m_regionMin = (0); // alias to m_EvtSel->getRegions()->getMin(m_EvtSel->getReginID()) - HTTTrackPars m_regionMax = (0); // alias to m_EvtSel->getRegions()->getMax(m_EvtSel->getReginID()) + FPGATrackSimTrackPars m_regionMin = (0); // alias to m_EvtSel->getRegions()->getMin(m_EvtSel->getReginID()) + FPGATrackSimTrackPars m_regionMax = (0); // alias to m_EvtSel->getRegions()->getMax(m_EvtSel->getReginID()) std::vector<std::vector<int>> m_shifts; // size (nShifts, nLayers) std::vector<boost::dynamic_bitset<>> m_dropable; // size (nShifts, nLayers) @@ -154,7 +154,7 @@ class HTTHough1DShiftTool : public extends<AthAlgTool, IHTTRoadFinderTool> /////////////////////////////////////////////////////////////////////// // Event Storage - std::vector<HTTRoad_Hough> m_roads; + std::vector<FPGATrackSimRoad_Hough> m_roads; /////////////////////////////////////////////////////////////////////// // Metadata and Monitoring @@ -169,14 +169,14 @@ class HTTHough1DShiftTool : public extends<AthAlgTool, IHTTRoadFinderTool> void calculateShifts(); float getPtFromShiftDiff(int shift) const; void readShifts(std::string const & filepath); - std::vector<boost::dynamic_bitset<>> makeHitMasks(const std::vector<const HTTHit*> & hits); - HTTRoad_Hough makeRoad(const std::vector<const HTTHit*>& hits, int bin_track, std::vector<int> const & shifts); + std::vector<boost::dynamic_bitset<>> makeHitMasks(const std::vector<const FPGATrackSimHit*> & hits); + FPGATrackSimRoad_Hough makeRoad(const std::vector<const FPGATrackSimHit*>& hits, int bin_track, std::vector<int> const & shifts); void printHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks) const; void drawHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks, std::string const & name); void drawHitMasks(std::vector<boost::dynamic_bitset<>> const & hitMasks, std::string const & name, std::vector<int> const & shifts); void printShifts() const; - std::pair<int, int> getBins(const HTTHit*) const; + std::pair<int, int> getBins(const FPGATrackSimHit*) const; float phitrkDiff(float r1, float phi1, float r2, float phi2) const; std::pair<float, bool> phitrk(int bin, std::vector<int> const & shifts ) const; // returns phi of track and a bool if the // value is invalid because at the edge @@ -191,4 +191,4 @@ class HTTHough1DShiftTool : public extends<AthAlgTool, IHTTRoadFinderTool> }; -#endif // HTTHOUGH1DSHIFTTOOL_H +#endif // FPGATrackSimHOUGH1DSHIFTTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughRootOutputTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughRootOutputTool.cxx similarity index 79% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughRootOutputTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughRootOutputTool.cxx index f682e3301a7539022bd99d2e0733f9ef1f31ab4a..8db436da0b753e68e7ba11d024fc1ff7c3e04978 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughRootOutputTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughRootOutputTool.cxx @@ -1,22 +1,22 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTHough/HTTHoughRootOutputTool.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTObjects/HTTFunctions.h" +#include "FPGATrackSimHough/FPGATrackSimHoughRootOutputTool.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimFunctions.h" ///////////////////////////////////////////////////////////////////////////// -HTTHoughRootOutputTool::HTTHoughRootOutputTool(const std::string& algname, const std::string& name, const IInterface *ifc) : +FPGATrackSimHoughRootOutputTool::FPGATrackSimHoughRootOutputTool(const std::string& algname, const std::string& name, const IInterface *ifc) : AthAlgTool(algname, name, ifc) { } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTHoughRootOutputTool::initialize() +StatusCode FPGATrackSimHoughRootOutputTool::initialize() { - ATH_CHECK(m_HTTMapping.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_tHistSvc.retrieve()); ATH_CHECK(m_EvtSel.retrieve()); @@ -26,9 +26,9 @@ StatusCode HTTHoughRootOutputTool::initialize() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTHoughRootOutputTool::bookTree() +StatusCode FPGATrackSimHoughRootOutputTool::bookTree() { - m_tree = new TTree("HTTHoughRootOutput","HTTHoughRootOutput"); + m_tree = new TTree("FPGATrackSimHoughRootOutput","FPGATrackSimHoughRootOutput"); m_tree->Branch("x",&m_x); m_tree->Branch("y",&m_y); m_tree->Branch("z",&m_z); @@ -54,7 +54,7 @@ StatusCode HTTHoughRootOutputTool::bookTree() m_treeindex = 0; - m_truthtree = new TTree("HTTTruthTree","HTTTruthTree"); + m_truthtree = new TTree("FPGATrackSimTruthTree","FPGATrackSimTruthTree"); m_truthtree->Branch("truth_d0",&m_truth_d0); m_truthtree->Branch("truth_z0",&m_truth_z0); m_truthtree->Branch("truth_pt",&m_truth_pt); @@ -66,7 +66,7 @@ StatusCode HTTHoughRootOutputTool::bookTree() m_truthtree->Branch("truth_eventindex",&m_truth_eventindex); - m_offlinetree = new TTree("HTTOfflineTree","HTTOfflineTree"); + m_offlinetree = new TTree("FPGATrackSimOfflineTree","FPGATrackSimOfflineTree"); m_offlinetree->Branch("offline_d0",&m_offline_d0); m_offlinetree->Branch("offline_z0",&m_offline_z0); m_offlinetree->Branch("offline_pt",&m_offline_pt); @@ -84,16 +84,16 @@ StatusCode HTTHoughRootOutputTool::bookTree() m_offlinetree->Branch("offline_n_outlier",&m_offline_n_outlier); m_offlinetree->Branch("offline_n_other",&m_offline_n_other); - ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGHTTHOUGHOUTPUT/%s",m_tree->GetName()), m_tree)); - ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGHTTHOUGHOUTPUT/%s",m_truthtree->GetName()), m_truthtree)); - ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGHTTHOUGHOUTPUT/%s",m_offlinetree->GetName()), m_offlinetree)); + ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimHOUGHOUTPUT/%s",m_tree->GetName()), m_tree)); + ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimHOUGHOUTPUT/%s",m_truthtree->GetName()), m_truthtree)); + ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimHOUGHOUTPUT/%s",m_offlinetree->GetName()), m_offlinetree)); return StatusCode::SUCCESS; } -StatusCode HTTHoughRootOutputTool::fillTree(std::vector<HTTRoad*> &roads, const std::vector<HTTTruthTrack> &truthTracks, const std::vector<HTTOfflineTrack> &offlineTracks) +StatusCode FPGATrackSimHoughRootOutputTool::fillTree(std::vector<FPGATrackSimRoad*> &roads, const std::vector<FPGATrackSimTruthTrack> &truthTracks, const std::vector<FPGATrackSimOfflineTrack> &offlineTracks) { m_tracknumber = 0; ResetVectors(); @@ -151,15 +151,15 @@ StatusCode HTTHoughRootOutputTool::fillTree(std::vector<HTTRoad*> &roads, const m_offlinetree->Fill(); // for calculating the truth for the entire combination, not just an individual hit - std::vector<HTTMultiTruth> mtv; - mtv.reserve( m_HTTMapping->PlaneMap_1st()->getNLogiLayers()); + std::vector<FPGATrackSimMultiTruth> mtv; + mtv.reserve( m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers()); // now we loop over all the roads. The tree is stored per combination, not per event, so there is an tree index // that can be used to map to the above for (size_t iroad = 0; iroad < roads.size(); iroad++) { m_roadnumber = iroad; - HTTRoad_Hough *road = dynamic_cast<HTTRoad_Hough*>(roads[iroad]); + FPGATrackSimRoad_Hough *road = dynamic_cast<FPGATrackSimRoad_Hough*>(roads[iroad]); if (road == nullptr) continue; // Not Hough roads std::vector<std::vector<int>> combs = ::getComboIndices(road->getNHits_layer()); @@ -172,18 +172,18 @@ StatusCode HTTHoughRootOutputTool::fillTree(std::vector<HTTRoad*> &roads, const mtv.clear(); std::vector<int> const & hit_indices = combs[icomb]; // size nLayers - for (unsigned layer = 0; layer < m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); layer++) + for (unsigned layer = 0; layer < m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); layer++) { if (hit_indices[layer] >= 0) { - const HTTHit* hit = road->getHits(layer)[hit_indices[layer]]; + const FPGATrackSimHit* hit = road->getHits(layer)[hit_indices[layer]]; - HTTMultiTruth truth = hit->getTruth(); + FPGATrackSimMultiTruth truth = hit->getTruth(); truth.assign_equal_normalization(); mtv.push_back( truth ); - HTTMultiTruth::Barcode tbarcode; - HTTMultiTruth::Weight tfrac; + FPGATrackSimMultiTruth::Barcode tbarcode; + FPGATrackSimMultiTruth::Weight tfrac; const bool ok = truth.best(tbarcode,tfrac); if( ok ) { m_eventindex.push_back((int)(tbarcode.first)); @@ -204,18 +204,18 @@ StatusCode HTTHoughRootOutputTool::fillTree(std::vector<HTTRoad*> &roads, const m_isBarrel.push_back(hit->isBarrel() ? 1 : 0); m_etawidth.push_back(hit->getEtaWidth()); m_phiwidth.push_back(hit->getPhiWidth()); - m_etamodule.push_back(hit->getHTTEtaModule()); + m_etamodule.push_back(hit->getFPGATrackSimEtaModule()); m_phimodule.push_back(hit->getPhiModule()); - m_ID.push_back(hit->getHTTIdentifierHash()); + m_ID.push_back(hit->getFPGATrackSimIdentifierHash()); } } // done looping over hits, now we do the truth calculation for this track candidate // first compute the best geant match, the barcode with the largest number of contributing hits // frac is then the fraction of the total number of hits on the candidate attributed to the barcode. - HTTMultiTruth mt( std::accumulate(mtv.begin(),mtv.end(),HTTMultiTruth(),HTTMultiTruth::AddAccumulator()) ); + FPGATrackSimMultiTruth mt( std::accumulate(mtv.begin(),mtv.end(),FPGATrackSimMultiTruth(),FPGATrackSimMultiTruth::AddAccumulator()) ); // retrieve the best barcode and frac and store it - HTTMultiTruth::Barcode tbarcode; - HTTMultiTruth::Weight tfrac; + FPGATrackSimMultiTruth::Barcode tbarcode; + FPGATrackSimMultiTruth::Weight tfrac; const bool ok = mt.best(tbarcode,tfrac); if( ok ) { m_candidate_eventindex = (int)(tbarcode.first); @@ -236,7 +236,7 @@ StatusCode HTTHoughRootOutputTool::fillTree(std::vector<HTTRoad*> &roads, const return StatusCode::SUCCESS; } -void HTTHoughRootOutputTool::ResetVectors() { +void FPGATrackSimHoughRootOutputTool::ResetVectors() { m_x.clear(); m_y.clear(); m_z.clear(); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughTransformTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughTransformTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx index c7cf6642df661ca011afd81491b77882366948c4..c36a79f5aa92142f3dd7934a09b9545db5057886 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughTransformTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx @@ -1,23 +1,23 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTHoughTransformTool.cxx + * @file FPGATrackSimHoughTransformTool.cxx * @author Riley Xu - riley.xu@cern.ch * @date October 31st, 2020 * @brief See header file. */ -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTMaps/HTTRegionMap.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTBanks/HTTSectorBank.h" -#include "HTTHoughTransformTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorBank.h" +#include "FPGATrackSimHoughTransformTool.h" #include <sstream> #include <cmath> @@ -31,14 +31,14 @@ static inline std::string to_string(const std::vector<T> &v); /////////////////////////////////////////////////////////////////////////////// // AthAlgTool -HTTHoughTransformTool::HTTHoughTransformTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimHoughTransformTool::FPGATrackSimHoughTransformTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc) { - declareInterface<IHTTRoadFinderTool>(this); + declareInterface<IFPGATrackSimRoadFinderTool>(this); } -StatusCode HTTHoughTransformTool::initialize() +StatusCode FPGATrackSimHoughTransformTool::initialize() { // Move temp variables over from properties to struct @@ -57,9 +57,9 @@ StatusCode HTTHoughTransformTool::initialize() ATH_MSG_INFO("Hit Extend: " << to_string(const_cast<std::vector<unsigned>&>(m_hitExtend_x.value()))); // Retrieve info - ATH_CHECK(m_HTTBankSvc.retrieve()); - ATH_CHECK(m_HTTMapping.retrieve()); - m_nLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); + ATH_CHECK(m_FPGATrackSimBankSvc.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); // Error checking // TODO check bounds are set correctly @@ -94,7 +94,7 @@ StatusCode HTTHoughTransformTool::initialize() { if (m_useSectors) { - ATH_MSG_WARNING("initialize() idealGeoRoads conflicts with useSectors, switching off HTT sector matching"); + ATH_MSG_WARNING("initialize() idealGeoRoads conflicts with useSectors, switching off FPGATrackSim sector matching"); m_useSectors = false; } if (!m_traceHits) @@ -136,7 +136,7 @@ StatusCode HTTHoughTransformTool::initialize() /////////////////////////////////////////////////////////////////////////////// // Main Algorithm -StatusCode HTTHoughTransformTool::getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) +StatusCode FPGATrackSimHoughTransformTool::getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) { roads.clear(); m_roads.clear(); @@ -154,19 +154,19 @@ StatusCode HTTHoughTransformTool::getRoads(const std::vector<const HTTHit*> & hi } roads.reserve(m_roads.size()); - for (HTTRoad_Hough & r : m_roads) roads.push_back(&r); + for (FPGATrackSimRoad_Hough & r : m_roads) roads.push_back(&r); return StatusCode::SUCCESS; } -HTTHoughTransformTool::Image HTTHoughTransformTool::createLayerImage(std::vector<unsigned> const & layers, std::vector<HTTHit const *> const & hits, unsigned const scale) const +FPGATrackSimHoughTransformTool::Image FPGATrackSimHoughTransformTool::createLayerImage(std::vector<unsigned> const & layers, std::vector<FPGATrackSimHit const *> const & hits, unsigned const scale) const { Image image(m_imageSize_y, m_imageSize_x); - for (HTTHit const * hit : hits) + for (FPGATrackSimHit const * hit : hits) { if (std::find(layers.begin(), layers.end(), hit->getLayer()) == layers.end()) continue; - if (m_subRegion >= 0 && !m_HTTMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; + if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; // This scans over y (pT) because that is more efficient in memory, in C. // Unknown if firmware will want to scan over x instead. unsigned new_size_y = m_imageSize_y / scale; @@ -191,7 +191,7 @@ HTTHoughTransformTool::Image HTTHoughTransformTool::createLayerImage(std::vector return image; } -HTTHoughTransformTool::Image HTTHoughTransformTool::createImage(std::vector<HTTHit const *> const & hits) const +FPGATrackSimHoughTransformTool::Image FPGATrackSimHoughTransformTool::createImage(std::vector<FPGATrackSimHit const *> const & hits) const { Image image(m_imageSize_y, m_imageSize_x); @@ -210,7 +210,7 @@ HTTHoughTransformTool::Image HTTHoughTransformTool::createImage(std::vector<HTTH return image; } -HTTHoughTransformTool::Image HTTHoughTransformTool::convolute(Image const & image) const +FPGATrackSimHoughTransformTool::Image FPGATrackSimHoughTransformTool::convolute(Image const & image) const { Image out(m_imageSize_y, m_imageSize_x); @@ -232,7 +232,7 @@ HTTHoughTransformTool::Image HTTHoughTransformTool::convolute(Image const & imag return out; } -bool HTTHoughTransformTool::passThreshold(Image const & image, unsigned x, unsigned y) const +bool FPGATrackSimHoughTransformTool::passThreshold(Image const & image, unsigned x, unsigned y) const { // Pass window threshold unsigned width = m_threshold.size() / 2; @@ -290,7 +290,7 @@ static inline std::string to_string(const std::vector<T> &v) } -double HTTHoughTransformTool::fieldCorrection(unsigned region, double qpt, double r) +double FPGATrackSimHoughTransformTool::fieldCorrection(unsigned region, double qpt, double r) { r = r / 1000; // convert to meters if (region == 3) @@ -306,11 +306,11 @@ double HTTHoughTransformTool::fieldCorrection(unsigned region, double qpt, doubl else return 0; } -double HTTHoughTransformTool::yToX(double y, HTTHit const * hit) const +double FPGATrackSimHoughTransformTool::yToX(double y, FPGATrackSimHit const * hit) const { double x = 0; - if (m_par_x == HTTTrackPars::IPHI && m_par_y == HTTTrackPars::IHIP) + if (m_par_x == FPGATrackSimTrackPars::IPHI && m_par_y == FPGATrackSimTrackPars::IHIP) { double r = hit->getR(); // mm double phi_hit = hit->getGPhi(); // radians @@ -329,7 +329,7 @@ double HTTHoughTransformTool::yToX(double y, HTTHit const * hit) const // Find the min/max x bins of the hit's line, in each y bin. Max is exclusive. // Note this assumes yToX is monotonic. Returns {0, 0} if hit lies out of bounds. -std::pair<unsigned, unsigned> HTTHoughTransformTool::yToXBins(size_t yBin_min, size_t yBin_max, HTTHit const * hit) const +std::pair<unsigned, unsigned> FPGATrackSimHoughTransformTool::yToXBins(size_t yBin_min, size_t yBin_max, FPGATrackSimHit const * hit) const { // Get float values double x_min = yToX(m_bins_y[yBin_min], hit); @@ -355,7 +355,7 @@ std::pair<unsigned, unsigned> HTTHoughTransformTool::yToXBins(size_t yBin_min, s } // We allow variable extension based on the size of m_hitExtend_x. See comments below. -unsigned HTTHoughTransformTool::getExtension(unsigned y, unsigned layer) const +unsigned FPGATrackSimHoughTransformTool::getExtension(unsigned y, unsigned layer) const { if (m_hitExtend_x.size() == m_nLayers) return m_hitExtend_x[layer]; if (m_hitExtend_x.size() == m_nLayers * 2) @@ -368,7 +368,7 @@ unsigned HTTHoughTransformTool::getExtension(unsigned y, unsigned layer) const return 0; } -void HTTHoughTransformTool::matchIdealGeoSector(HTTRoad_Hough & r) const +void FPGATrackSimHoughTransformTool::matchIdealGeoSector(FPGATrackSimRoad_Hough & r) const { float pt = r.getY()*0.001; // convert to MeV auto bounds = std::equal_range(htt::QOVERPT_BINS.begin(),htt::QOVERPT_BINS.end(),pt); @@ -386,31 +386,31 @@ void HTTHoughTransformTool::matchIdealGeoSector(HTTRoad_Hough & r) const wc_layers |= (0x1 << il); r.setWCLayers(wc_layers); - HTTHit *wcHit = new HTTHit(); + FPGATrackSimHit *wcHit = new FPGATrackSimHit(); wcHit->setHitType(HitType::wildcard); wcHit->setLayer(il); - wcHit->setDetType(m_HTTMapping->PlaneMap_1st()->getDetType(il)); - std::vector<const HTTHit*> wcHits; + wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_1st()->getDetType(il)); + std::vector<const FPGATrackSimHit*> wcHits; wcHits.push_back(wcHit); r.setHits(il,wcHits); } else modules.push_back(sectorbin); } - const HTTSectorBank* sectorbank = m_HTTBankSvc->SectorBank_1st(); + const FPGATrackSimSectorBank* sectorbank = m_FPGATrackSimBankSvc->SectorBank_1st(); r.setSector(sectorbank->findSector(modules)); } // Creates a road from hits that pass through the given bin (x, y), and pushes it onto m_roads -void HTTHoughTransformTool::addRoad(std::vector<std::vector<const HTTHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) +void FPGATrackSimHoughTransformTool::addRoad(std::vector<std::vector<const FPGATrackSimHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) { m_roads.emplace_back(); - HTTRoad_Hough & r = m_roads.back(); + FPGATrackSimRoad_Hough & r = m_roads.back(); r.setRoadID(m_roads.size() - 1); r.setPID(y * m_imageSize_y + x); r.setHits(hits); - if (m_useSectors) r.setSector(m_HTTBankSvc->SectorBank_1st()->findSector(hits)); + if (m_useSectors) r.setSector(m_FPGATrackSimBankSvc->SectorBank_1st()->findSector(hits)); else if (m_idealGeoRoads) matchIdealGeoSector(r); r.setHitLayers(hitLayers); r.setSubRegion(m_subRegion); @@ -422,10 +422,10 @@ void HTTHoughTransformTool::addRoad(std::vector<std::vector<const HTTHit*>> cons // Creates a road from hits that pass through the given bin (x, y), and pushes it onto m_roads -void HTTHoughTransformTool::addRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y) +void FPGATrackSimHoughTransformTool::addRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) { layer_bitmask_t hitLayers = 0; - for (HTTHit const * hit : hits) + for (FPGATrackSimHit const * hit : hits) hitLayers |= 1 << hit->getLayer(); auto sorted_hits = ::sortByLayer(hits); @@ -435,14 +435,14 @@ void HTTHoughTransformTool::addRoad(std::unordered_set<const HTTHit*> const & hi } // Use this version of addRoad when hit tracing is turned off -void HTTHoughTransformTool::addRoad(std::vector<const HTTHit*> const & hits, unsigned x, unsigned y) +void FPGATrackSimHoughTransformTool::addRoad(std::vector<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) { // Get the road hits - std::vector<HTTHit const *> road_hits; + std::vector<FPGATrackSimHit const *> road_hits; layer_bitmask_t hitLayers = 0; - for (const HTTHit * hit : hits) + for (const FPGATrackSimHit * hit : hits) { - if (m_subRegion >= 0 && !m_HTTMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; + if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; // Find the min/max y bins (after scaling) unsigned int y_bin_min = (y / m_binScale[hit->getLayer()]) * m_binScale[hit->getLayer()]; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughTransformTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.h similarity index 72% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughTransformTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.h index 02728c2a3008852aa081bb84c359ddbadebfde5d..9a3c85053090a29af0cc9f764e529ba7ddf59a9f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTHoughTransformTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.h @@ -1,16 +1,16 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTHOUGHTRANSFORMTOOL_H -#define HTTHOUGHTRANSFORMTOOL_H +#ifndef FPGATrackSimHOUGHTRANSFORMTOOL_H +#define FPGATrackSimHOUGHTRANSFORMTOOL_H /** - * @file HTTHoughTransformTool.h + * @file FPGATrackSimHoughTransformTool.h * @author Riley Xu - riley.xu@cern.ch * @date October 31st, 2020 * @brief Implements road finding using a Hough transform. * * Declarations in this file: - * class HTTHoughTransformTool : public AthAlgTool, virtual public IHTTRoadFinderTool + * class FPGATrackSimHoughTransformTool : public AthAlgTool, virtual public IFPGATrackSimRoadFinderTool * * Using the Lorentz force equation, one can relate the phi of a track and the * coordinate of a single hit: @@ -47,16 +47,16 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTHough/IHTTRoadFinderTool.h" -#include "TrigHTTHough/IHTTRoadFilterTool.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" #include "TFile.h" @@ -86,24 +86,24 @@ * q : e * pT : GeV / c */ -class HTTHoughTransformTool : public extends <AthAlgTool, IHTTRoadFinderTool> +class FPGATrackSimHoughTransformTool : public extends <AthAlgTool, IFPGATrackSimRoadFinderTool> { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTHoughTransformTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimHoughTransformTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; /////////////////////////////////////////////////////////////////////// - // IHTTRoadFinderTool + // IFPGATrackSimRoadFinderTool - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) override; + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) override; /////////////////////////////////////////////////////////////////////// - // HTTHoughTransformTool + // FPGATrackSimHoughTransformTool double getMinX() const { return m_parMin[m_par_x]; } double getMaxX() const { return m_parMax[m_par_x]; } @@ -116,10 +116,10 @@ class HTTHoughTransformTool : public extends <AthAlgTool, IHTTRoadFinderTool> // phi_track. static double fieldCorrection(unsigned region, double y, double r); - double yToX(double y, HTTHit const * h) const; + double yToX(double y, FPGATrackSimHit const * h) const; - typedef vector2D<std::pair<int, std::unordered_set<const HTTHit*>>> Image; + typedef vector2D<std::pair<int, std::unordered_set<const FPGATrackSimHit*>>> Image; // An image is a 2d array of points, where each point has a value. // The value starts as the number of hit layers, but can change with effects // like a convolution. Also stored are all hits that contributed to each bin. @@ -131,19 +131,19 @@ class HTTHoughTransformTool : public extends <AthAlgTool, IHTTRoadFinderTool> /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<IHTTEventSelectionSvc> m_EvtSel {this, "HTTEventSelectionSvc", "HTTEventSelectionSvc"}; - ServiceHandle<ITrigHTTBankSvc> m_HTTBankSvc {this, "TrigHTTBankSvc", "TrigHTTBankSvc"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel {this, "FPGATrackSimEventSelectionSvc", "FPGATrackSimEventSelectionSvc"}; + ServiceHandle<IFPGATrackSimBankSvc> m_FPGATrackSimBankSvc {this, "FPGATrackSimBankSvc", "FPGATrackSimBankSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; /////////////////////////////////////////////////////////////////////// // Properties // === Image === - HTTTrackPars m_parMin; // These are the bounds of the image, i.e. the region of interest - HTTTrackPars m_parMax; // Only the two parameters chosen above are used for the image, however others may be used for slicing + FPGATrackSimTrackPars m_parMin; // These are the bounds of the image, i.e. the region of interest + FPGATrackSimTrackPars m_parMax; // Only the two parameters chosen above are used for the image, however others may be used for slicing - HTTTrackPars::pars_index m_par_x = HTTTrackPars::IPHI; // sets phi as the x variable - HTTTrackPars::pars_index m_par_y = HTTTrackPars::IHIP; // sets q/pT as the y variable + FPGATrackSimTrackPars::pars_index m_par_x = FPGATrackSimTrackPars::IPHI; // sets phi as the x variable + FPGATrackSimTrackPars::pars_index m_par_y = FPGATrackSimTrackPars::IHIP; // sets q/pT as the y variable Gaudi::Property <int> m_subRegion { this, "subRegion", 0," -1 for entire region (no slicing)"}; Gaudi::Property <float> m_tempMin_phi { this, "phi_min", 0, "min phi"}; @@ -172,7 +172,7 @@ class HTTHoughTransformTool : public extends <AthAlgTool, IHTTRoadFinderTool> /////////////////////////////////////////////////////////////////////// // Convenience - unsigned m_nLayers = 0U; // alias to m_HTTMapping->PlaneMap1stStage()->getNLogiLayers(); + unsigned m_nLayers = 0U; // alias to m_FPGATrackSimMapping->PlaneMap1stStage()->getNLogiLayers(); unsigned m_nCombineLayers = 0U; // number of layers after combined double m_step_x = 0; // step size of the bin boundaries in x @@ -186,31 +186,31 @@ class HTTHoughTransformTool : public extends <AthAlgTool, IHTTRoadFinderTool> // Event Storage Image m_image; - std::vector<HTTRoad_Hough> m_roads; + std::vector<FPGATrackSimRoad_Hough> m_roads; /////////////////////////////////////////////////////////////////////// // Core - // std::vector<HTTHit const *> filterHits(std::vector<HTTHit const *> const & hits) const; - Image createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<HTTHit const *> const & hits, unsigned const scale) const; - Image createImage(std::vector<HTTHit const *> const & hits) const; + // std::vector<FPGATrackSimHit const *> filterHits(std::vector<FPGATrackSimHit const *> const & hits) const; + Image createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<FPGATrackSimHit const *> const & hits, unsigned const scale) const; + Image createImage(std::vector<FPGATrackSimHit const *> const & hits) const; Image convolute(Image const & image) const; /////////////////////////////////////////////////////////////////////// // Helpers - std::pair<unsigned, unsigned> yToXBins(size_t yBin_min, size_t yBin_max, HTTHit const * hit) const; + std::pair<unsigned, unsigned> yToXBins(size_t yBin_min, size_t yBin_max, FPGATrackSimHit const * hit) const; unsigned getExtension(unsigned y, unsigned layer) const; bool passThreshold(Image const & image, unsigned x, unsigned y) const; - void matchIdealGeoSector(HTTRoad_Hough & r) const; - void addRoad(std::vector<std::vector<const HTTHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y); - void addRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y); - void addRoad(std::vector<const HTTHit*> const & hits, unsigned x, unsigned y); + void matchIdealGeoSector(FPGATrackSimRoad_Hough & r) const; + void addRoad(std::vector<std::vector<const FPGATrackSimHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y); + void addRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y); + void addRoad(std::vector<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y); int conv(unsigned y, unsigned x) { return m_conv[y * m_convSize_x + x]; } // NOTE: y index is first void drawImage(Image const & image, std::string const & name); }; -#endif // HTTHOUGHTRANSFORMTOOL_H +#endif // FPGATrackSimHOUGHTRANSFORMTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTPhiRoadFilterTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimPhiRoadFilterTool.cxx similarity index 62% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTPhiRoadFilterTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimPhiRoadFilterTool.cxx index f8ddfc2f91ffd9c61bde2225d4a06300db84d356..bbb29f25322b82bf4d183024ad50abfd76ba354d 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTPhiRoadFilterTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimPhiRoadFilterTool.cxx @@ -1,18 +1,18 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTPhiRoadFilterTool.cxx + * @file FPGATrackSimPhiRoadFilterTool.cxx * @author Elliot Lipeles - lipeles@cern.ch * @date March 25th, 2021 * @brief Implements road filtering using eta module patterns */ -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "HTTPhiRoadFilterTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimPhiRoadFilterTool.h" #include "TH2.h" @@ -29,19 +29,19 @@ static inline std::string instance_name(std::string const & s); /////////////////////////////////////////////////////////////////////////////// // AthAlgTool -HTTPhiRoadFilterTool::HTTPhiRoadFilterTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimPhiRoadFilterTool::FPGATrackSimPhiRoadFilterTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc), m_name(instance_name(name)) { - declareInterface<IHTTRoadFilterTool>(this); + declareInterface<IFPGATrackSimRoadFilterTool>(this); } -StatusCode HTTPhiRoadFilterTool::initialize() +StatusCode FPGATrackSimPhiRoadFilterTool::initialize() { // Retrieve info - ATH_CHECK(m_HTTMapping.retrieve()); - m_nLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); return StatusCode::SUCCESS; } @@ -50,7 +50,7 @@ StatusCode HTTPhiRoadFilterTool::initialize() /////////////////////////////////////////////////////////////////////////////// // Main Algorithm -StatusCode HTTPhiRoadFilterTool::filterRoads(const std::vector<HTTRoad*> & prefilter_roads, std::vector<HTTRoad*> & postfilter_roads) +StatusCode FPGATrackSimPhiRoadFilterTool::filterRoads(const std::vector<FPGATrackSimRoad*> & prefilter_roads, std::vector<FPGATrackSimRoad*> & postfilter_roads) { ATH_MSG_INFO("Start Phi Road Filter"); @@ -59,7 +59,7 @@ StatusCode HTTPhiRoadFilterTool::filterRoads(const std::vector<HTTRoad*> & prefi // Filter roads for (auto & road : prefilter_roads) { - HTTRoad newroad = buildRoad(road); + FPGATrackSimRoad newroad = buildRoad(road); unsigned hit_layers = newroad.getHitLayers(); unsigned layer_cnt=0; @@ -75,7 +75,7 @@ StatusCode HTTPhiRoadFilterTool::filterRoads(const std::vector<HTTRoad*> & prefi // copy roads to outputs postfilter_roads.reserve(m_postfilter_roads.size()); - for (HTTRoad & r : m_postfilter_roads) postfilter_roads.push_back(&r); + for (FPGATrackSimRoad & r : m_postfilter_roads) postfilter_roads.push_back(&r); ATH_MSG_INFO("Event Done"); @@ -84,21 +84,21 @@ StatusCode HTTPhiRoadFilterTool::filterRoads(const std::vector<HTTRoad*> & prefi } -HTTRoad_Hough HTTPhiRoadFilterTool::buildRoad(HTTRoad* origr) const +FPGATrackSimRoad_Hough FPGATrackSimPhiRoadFilterTool::buildRoad(FPGATrackSimRoad* origr) const { ATH_MSG_DEBUG("PhiRoad Build Road"); - HTTRoad_Hough& origr_hough = static_cast<HTTRoad_Hough&>(*origr); + FPGATrackSimRoad_Hough& origr_hough = static_cast<FPGATrackSimRoad_Hough&>(*origr); float phi = origr_hough.getX(); float qPt = origr_hough.getY(); // make new road -- main alg doesn't keep it if not needed - HTTRoad_Hough r(origr_hough); // only works with Hough roads! + FPGATrackSimRoad_Hough r(origr_hough); // only works with Hough roads! r.setNLayers(m_nLayers); layer_bitmask_t hitLayers = 0; // add hits for (unsigned lyr = 0; lyr < m_nLayers; lyr++) { - std::vector<const HTTHit*> road_hits; + std::vector<const FPGATrackSimHit*> road_hits; for (auto hit : origr->getHits(lyr)) { float phi_expected = -1.0*asin(htt::A * hit->getR() * qPt) + phi; if (abs(hit->getGPhi()-phi_expected)< (m_window.value()[lyr]+qPt*m_ptscaling)) { diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTPhiRoadFilterTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimPhiRoadFilterTool.h similarity index 54% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTPhiRoadFilterTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimPhiRoadFilterTool.h index 3271a5bd42db67505896ed17bde9811c1c801731..01e8b7139f98bac650821ec2ae76232a90cac59a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTPhiRoadFilterTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimPhiRoadFilterTool.h @@ -1,28 +1,28 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTPHIROADFILTERTOOL_H -#define HTTPHIROADFILTERTOOL_H +#ifndef FPGATrackSimPHIROADFILTERTOOL_H +#define FPGATrackSimPHIROADFILTERTOOL_H /** - * @file HTTPhiRoadFilterTool.h + * @file FPGATrackSimPhiRoadFilterTool.h * @author Elliot Lipeles - lipeles@cern.ch * @date March 28th, 2021 * @brief Implements road filtering using eta module patterns * * Declarations in this file: - * class HTTPhiRoadFilterTool : public AthAlgTool, virtual public IHTTRoadFilterTool + * class FPGATrackSimPhiRoadFilterTool : public AthAlgTool, virtual public IFPGATrackSimRoadFilterTool * */ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTHough/IHTTRoadFilterTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFilterTool.h" #include "TFile.h" @@ -30,31 +30,31 @@ #include <vector> #include <map> -class ITrigHTTBankSvc; -class ITrigHTTMappingSvc; +class IFPGATrackSimBankSvc; +class IFPGATrackSimMappingSvc; -class HTTPhiRoadFilterTool : public extends <AthAlgTool, IHTTRoadFilterTool> +class FPGATrackSimPhiRoadFilterTool : public extends <AthAlgTool, IFPGATrackSimRoadFilterTool> { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTPhiRoadFilterTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimPhiRoadFilterTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; /////////////////////////////////////////////////////////////////////// - // IHTTRoadFilterTool + // IFPGATrackSimRoadFilterTool - virtual StatusCode filterRoads(const std::vector<HTTRoad*> & prefilter_roads, std::vector<HTTRoad*> & postfilter_roads) override; + virtual StatusCode filterRoads(const std::vector<FPGATrackSimRoad*> & prefilter_roads, std::vector<FPGATrackSimRoad*> & postfilter_roads) override; private: /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; /////////////////////////////////////////////////////////////////////// // Properties @@ -66,11 +66,11 @@ class HTTPhiRoadFilterTool : public extends <AthAlgTool, IHTTRoadFilterTool> ////////////////////////////////////////////////////////////////////// // Event Storage - std::vector<HTTRoad> m_postfilter_roads; + std::vector<FPGATrackSimRoad> m_postfilter_roads; /////////////////////////////////////////////////////////////////////// // Convenience - unsigned m_nLayers = 0U; // alias to m_HTTMapping->PlaneMap1stStage()->getNLogiLayers(); + unsigned m_nLayers = 0U; // alias to m_FPGATrackSimMapping->PlaneMap1stStage()->getNLogiLayers(); /////////////////////////////////////////////////////////////////////// // Metadata and Monitoring @@ -80,8 +80,8 @@ class HTTPhiRoadFilterTool : public extends <AthAlgTool, IHTTRoadFilterTool> /////////////////////////////////////////////////////////////////////// // Helpers - HTTRoad_Hough buildRoad(HTTRoad* origr) const; + FPGATrackSimRoad_Hough buildRoad(FPGATrackSimRoad* origr) const; }; -#endif // HTTPHIROADFILTERTOOL_H +#endif // FPGATrackSimPHIROADFILTERTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTRoadUnionTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimRoadUnionTool.cxx similarity index 52% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTRoadUnionTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimRoadUnionTool.cxx index 917b07edd209b1c7990962434a27c14e6fa26672..61f54bb8322dab46c1634f0d864b0dde4a830f5f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTHough/src/HTTRoadUnionTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimRoadUnionTool.cxx @@ -1,26 +1,26 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTRoadUnionTool.cxx + * @file FPGATrackSimRoadUnionTool.cxx * @author Riley Xu - riley.xu@cern.ch * @date November 20th, 2020 * @brief See header file. */ -#include "HTTRoadUnionTool.h" +#include "FPGATrackSimRoadUnionTool.h" -HTTRoadUnionTool::HTTRoadUnionTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimRoadUnionTool::FPGATrackSimRoadUnionTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc), m_tools(this) { - declareInterface<IHTTRoadFinderTool>(this); - declareProperty("tools", m_tools, "Array of HTTRoadFinderTools"); + declareInterface<IFPGATrackSimRoadFinderTool>(this); + declareProperty("tools", m_tools, "Array of FPGATrackSimRoadFinderTools"); } -StatusCode HTTRoadUnionTool::initialize() +StatusCode FPGATrackSimRoadUnionTool::initialize() { // Retrieve ATH_MSG_INFO("Using " << m_tools.size() << " tools"); @@ -34,12 +34,12 @@ StatusCode HTTRoadUnionTool::initialize() } -StatusCode HTTRoadUnionTool::getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) +StatusCode FPGATrackSimRoadUnionTool::getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) { roads.clear(); for (auto & tool : m_tools) { - std::vector<HTTRoad*> r; + std::vector<FPGATrackSimRoad*> r; ATH_CHECK(tool->getRoads(hits, r)); roads.insert(roads.end(), std::make_move_iterator(r.begin()), std::make_move_iterator(r.end())); } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimRoadUnionTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimRoadUnionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..c630d075299451a92bacd0675aa351ce811f0c96 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimRoadUnionTool.h @@ -0,0 +1,52 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimROADUNIONTOOL_H +#define FPGATrackSimROADUNIONTOOL_H + +/** + * @file FPGATrackSimRoadUnionTool.h + * @author Riley Xu - riley.xu@cern.ch + * @date November 20th, 2020 + * @brief Wrapper class to combine multiple road-finding tools + * + * Declarations in this file: + * class FPGATrackSimRoadUnionTool : public AthAlgTool, virtual public IFPGATrackSimRoadFinderTool + */ + +#include "GaudiKernel/ServiceHandle.h" +#include "AthenaBaseComps/AthAlgTool.h" + +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" + + +// This class is merely a lightweight wrapper around multiple road finder tools. +class FPGATrackSimRoadUnionTool : public extends <AthAlgTool, IFPGATrackSimRoadFinderTool> +{ + public: + + /////////////////////////////////////////////////////////////////////// + // AthAlgTool + + FPGATrackSimRoadUnionTool(const std::string&, const std::string&, const IInterface*); + + virtual StatusCode initialize() override; + + /////////////////////////////////////////////////////////////////////// + // IFPGATrackSimRoadFinderTool + + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) override; + + /////////////////////////////////////////////////////////////////////// + // FPGATrackSimRoadUnionTool + + ToolHandleArray<IFPGATrackSimRoadFinderTool> const & tools() const { return m_tools; } + + private: + + /////////////////////////////////////////////////////////////////////// + // Handles + + ToolHandleArray<IFPGATrackSimRoadFinderTool> m_tools; +}; + +#endif diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/components/FPGATrackSimHough_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/components/FPGATrackSimHough_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..07d04e12ce19f15a9b13e468cc0c6423d23eba27 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/components/FPGATrackSimHough_entries.cxx @@ -0,0 +1,14 @@ +#include "../FPGATrackSimEtaPatternFilterTool.h" +#include "../FPGATrackSimHough1DShiftTool.h" +#include "FPGATrackSimHough/FPGATrackSimHoughRootOutputTool.h" +#include "../FPGATrackSimHoughTransformTool.h" +#include "../FPGATrackSimPhiRoadFilterTool.h" +#include "../FPGATrackSimRoadUnionTool.h" + +DECLARE_COMPONENT( FPGATrackSimEtaPatternFilterTool ) +DECLARE_COMPONENT( FPGATrackSimHough1DShiftTool ) +DECLARE_COMPONENT( FPGATrackSimHoughRootOutputTool ) +DECLARE_COMPONENT( FPGATrackSimHoughTransformTool ) +DECLARE_COMPONENT( FPGATrackSimPhiRoadFilterTool ) +DECLARE_COMPONENT( FPGATrackSimRoadUnionTool ) + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..07f67628e1e623c77f161ad54df824e191cc535a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +atlas_subdir( FPGATrackSimInput ) + +# External dependencies: +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( FPGATrackSimInputLib + src/*.cxx + PUBLIC_HEADERS FPGATrackSimInput + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel InDetReadoutGeometry + FPGATrackSimConfToolsLib FPGATrackSimMapsLib FPGATrackSimObjectsLib + PRIVATE_LINK_LIBRARIES AthContainers InDetIdentifier StoreGateLib FPGATrackSimSGInputLib ) + +atlas_add_component( FPGATrackSimInput + src/components/*.cxx + LINK_LIBRARIES FPGATrackSimInputLib +) + +# Install files from the package: +atlas_install_joboptions( share/*.py test/*.py) +atlas_install_scripts( scripts/*) +atlas_install_python_modules( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select=ATL900,ATL901 ) + +# Test in the package: +atlas_add_test( testReadRawHit + SCRIPT test/test_FPGATrackSimReadRawHitsWrapperAlg.sh + LOG_SELECT_PATTERN "FPGATrackSimRawHitsWrapp" + PRIVATE_WORKING_DIRECTORY +) + +atlas_add_test( testRawToLogical + SCRIPT test/test_FPGATrackSimRawToLogicalWrapperAlg.sh + LOG_SELECT_PATTERN "FPGATrackSimReadLogical" + PRIVATE_WORKING_DIRECTORY +) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/ATLAS_CHECK_THREAD_SAFETY similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/TrigHTTInput/ATLAS_CHECK_THREAD_SAFETY rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/ATLAS_CHECK_THREAD_SAFETY diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f05e5c336f8e74fa4a3dd4249e8615100a386418 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimRAWTOLOGICALHITSTOOL_H +#define FPGATrackSimRAWTOLOGICALHITSTOOL_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" + + +// Forward declaration +class IFPGATrackSimMappingSvc; +class FPGATrackSimEventInputHeader; +class FPGATrackSimLogicalEventInputHeader; + + +class FPGATrackSimRawToLogicalHitsTool : public AthAlgTool +{ + public: + + FPGATrackSimRawToLogicalHitsTool(const std::string&, const std::string&, const IInterface*); + virtual ~FPGATrackSimRawToLogicalHitsTool() = default; + virtual StatusCode initialize() override; + + StatusCode convert(unsigned stage, const FPGATrackSimEventInputHeader& header, + FPGATrackSimLogicalEventInputHeader& logicheader); + StatusCode getUnmapped(std::vector<FPGATrackSimHit>& missing_hits); + + const FPGATrackSimPlaneMap* getPlaneMap_1st(); + + +private: + + // JO configuration + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel {this, "FPGATrackSimEventSelectionSvc", "FPGATrackSimEventSelectionSvc"}; + IntegerProperty m_saveOptional {this, "SaveOptional", 2, "flag to enable the truth/offline tracking save =0 no optional saved, =1 saved in region, =2 save all "}; + IntegerArrayProperty m_towersToMap {this, "TowersToMap", {}, "Which Towers to map, goes from 0 to 96!"}; + + // internal members + std::vector<int> m_towers; + std::vector<FPGATrackSimHit> m_missing_hits;// vector to save hits not mapped, debugging only + std::vector<int> m_missing_hit_codes; // for histograms used in debugging + +}; + +#endif // FPGATrackSimRAWTOLOGICALHITSTOOL_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/FPGATrackSimReadRawRandomHitsTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/FPGATrackSimReadRawRandomHitsTool.h new file mode 100644 index 0000000000000000000000000000000000000000..dcc3825a03d5f715ad45305ef327f6fb0c577c5a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/FPGATrackSimReadRawRandomHitsTool.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimREADRAWRANDOMHITSTOOL_H +#define FPGATrackSimREADRAWRANDOMHITSTOOL_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" + +#include "TFile.h" +#include "TTree.h" + + + +class FPGATrackSimReadRawRandomHitsTool : public extends<AthAlgTool, IFPGATrackSimEventInputHeaderTool> +{ + public: + + FPGATrackSimReadRawRandomHitsTool(const std::string&, const std::string&, const IInterface*); + virtual ~FPGATrackSimReadRawRandomHitsTool() = default; + virtual StatusCode initialize() override; + virtual StatusCode readData(FPGATrackSimEventInputHeader* header, bool &last) override; + virtual StatusCode writeData(FPGATrackSimEventInputHeader* header) override; + virtual StatusCode finalize() override; + + StatusCode readData(FPGATrackSimEventInputHeader* header, bool &last, bool doReset); + + private: + // JO configuration + StringProperty m_inpath {this, "InFileName", "httsim_smartwrapper.root", "input path"}; + + // Internal pointers + unsigned int m_nEntries = 0U; + unsigned m_entry = 0; +}; + +#endif // FPGATrackSimREADRAWRANDOMHINPUTTOOL_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h new file mode 100644 index 0000000000000000000000000000000000000000..1dc497b1d14f9c56fd836bbb014fa2a25c2702b6 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file IFPGATrackSimEventInputHeaderTool.h + * + * This declares a basic interface for input tools which provide the FPGATrackSimEventInputHeader data + * to all FPGATrackSim processing. + */ + +#ifndef IFPGATrackSimEventInputHeaderTool_H +#define IFPGATrackSimEventInputHeaderTool_H + +#include "GaudiKernel/IAlgTool.h" +#include "TFile.h" +#include "TTree.h" + + +// to do: merge this with FPGATrackSimSGInput/IFPGATrackSimInputTool +// since they are both abstract interfaces + +class FPGATrackSimEventInputHeader; +class IFPGATrackSimEventInputHeaderTool : virtual public ::IAlgTool +{ + public: + virtual ~IFPGATrackSimEventInputHeaderTool() = default; + DeclareInterfaceID( IFPGATrackSimEventInputHeaderTool, 1, 0); + + + virtual StatusCode readData(FPGATrackSimEventInputHeader* header, bool &last) = 0; + virtual StatusCode writeData(FPGATrackSimEventInputHeader* header) = 0; + virtual FPGATrackSimEventInputHeader* getEventInputHeader() {return m_eventHeader; }; + virtual TTree* getEventTree() {return m_EventTree;}; + + protected: + + FPGATrackSimEventInputHeader * m_eventHeader; + TFile * m_infile = nullptr; + TTree * m_EventTree = nullptr; + +}; + + +#endif // IFPGATrackSimEventInputHeaderTool_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h new file mode 100644 index 0000000000000000000000000000000000000000..c0eaaa60032b2dad516b0798feba799547a6f980 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef IFPGATrackSimEventOutputHeaderTool_H +#define IFPGATrackSimEventOutputHeaderTool_H + +#include "GaudiKernel/IAlgTool.h" +#include "TFile.h" +#include "TTree.h" + +class FPGATrackSimLogicalEventOutputHeader; +class FPGATrackSimLogicalEventInputHeader; + +class IFPGATrackSimEventOutputHeaderTool : virtual public ::IAlgTool +{ + public: + + DeclareInterfaceID( IFPGATrackSimEventOutputHeaderTool, 1, 0); + virtual ~IFPGATrackSimEventOutputHeaderTool() = default; + + virtual StatusCode readData(FPGATrackSimLogicalEventInputHeader* INheader_1st, FPGATrackSimLogicalEventInputHeader* INheader_2nd, FPGATrackSimLogicalEventOutputHeader* OUTheader, bool &last) = 0; + virtual StatusCode writeData(FPGATrackSimLogicalEventInputHeader* INheader_1st, FPGATrackSimLogicalEventInputHeader* INheader_2nd, FPGATrackSimLogicalEventOutputHeader* OUTheader) = 0; + + virtual TTree* getEventTree() {return m_EventTree;}; + virtual FPGATrackSimLogicalEventInputHeader* getLogicalEventInputHeader_1st() {return m_eventInputHeader_1st; }; + virtual FPGATrackSimLogicalEventInputHeader* getLogicalEventInputHeader_2nd() {return m_eventInputHeader_2nd; }; + virtual FPGATrackSimLogicalEventOutputHeader* getLogicalEventOutputHeader() {return m_eventOutputHeader;}; + + protected: + + FPGATrackSimLogicalEventInputHeader *m_eventInputHeader_1st; + FPGATrackSimLogicalEventInputHeader *m_eventInputHeader_2nd; + FPGATrackSimLogicalEventOutputHeader *m_eventOutputHeader; + + + + TFile *m_infile = nullptr; + TTree *m_EventTree = nullptr; + +}; + + +#endif // IFPGATrackSimEventOutputHeaderTool_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/scripts/HTTPlotHits.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/scripts/FPGATrackSimPlotHits.py similarity index 94% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/scripts/HTTPlotHits.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/scripts/FPGATrackSimPlotHits.py index 5953baf544f8680518d411fa45e499daca62a263..d9dcb2feacd6838f5df25ca5da652eb2093cce0d 100755 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/scripts/HTTPlotHits.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/scripts/FPGATrackSimPlotHits.py @@ -1,12 +1,12 @@ #!/usr/bin/env python """ -@file HTTPlotHits.py +@file FPGATrackSimPlotHits.py @author Riley Xu - riley.xu@cern.ch @date April 8th, 2021 @brief Plots the hits from a specific event -HTTPlotHits.py input_wrapper event +FPGATrackSimPlotHits.py input_wrapper event """ import sys @@ -25,12 +25,12 @@ def plot(filename, event): c = ROOT.TCanvas("c1","c1",1200,900) c.Divide(2,2) - t = f.Get("HTTEventTree") + t = f.Get("FPGATrackSimEventTree") if event >= t.GetEntries(): raise IndexError("Bad entry " + str(event)) t.GetEntry(event) - hits = t.HTTEventInputHeader.hits() + hits = t.FPGATrackSimEventInputHeader.hits() nhits = len(hits) coords = np.empty((nhits, 3)) colors = np.empty(nhits, dtype=int) @@ -82,7 +82,7 @@ def plot(filename, event): g2._markers.append(m) # otherwise python will garbage collect the marker - offline = t.HTTEventInputHeader.optional().getOfflineClusters() + offline = t.FPGATrackSimEventInputHeader.optional().getOfflineClusters() noff = len(offline) off_coords = np.empty((noff, 3)) off_colors = np.empty(noff, dtype=int) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/FPGATrackSimDumpCond_jobOptions.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/FPGATrackSimDumpCond_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..5b71a698a3f75439b4c04e13a28da6f554346b4a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/FPGATrackSimDumpCond_jobOptions.py @@ -0,0 +1,34 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#----------------------------------------------------------------------------- +# Athena imports +#----------------------------------------------------------------------------- +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + +from AthenaCommon.AppMgr import ToolSvc + +import AthenaCommon.Configurable as Configurable +from AthenaCommon.Constants import INFO +Configurable.log.setLevel(INFO) + +#-------------------------------------------------------------- +# FPGATrackSim Includes +#-------------------------------------------------------------- + + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimDetectorTool, FPGATrackSimDumpDetStatusAlgo + +import FPGATrackSimConfTools.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig + +tags = FPGATrackSimTagConfig.getTags(stage='map') +map_tag = tags['map'] +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) + +FPGATrackSimDet = FPGATrackSimDetectorTool() +ToolSvc += FPGATrackSimDet + +FPGATrackSimDumpCond = FPGATrackSimDumpDetStatusAlgo("FPGATrackSimDumpDetStatusAlgo") +FPGATrackSimDumpCond.DumpGlobalToLocalMap = True +theJob += FPGATrackSimDumpCond diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testDumpOutputStat.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testDumpOutputStat.ref new file mode 100644 index 0000000000000000000000000000000000000000..2d7b0bd27368668d175a54928144bc48db4f661b --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testDumpOutputStat.ref @@ -0,0 +1,82 @@ +Py:FPGATrackSimDumpOutputStatAlg INFO Output file ['httsim_output.root'] +|-Members = ['FPGATrackSimDumpOutputStatAlg/FPGATrackSimDumpOutputStatAlg'] (default: []) +|=/***** Algorithm FPGATrackSimDumpOutputStatAlg/FPGATrackSimDumpOutputStatAlg ***************************************** +| \----- (End of Algorithm FPGATrackSimDumpOutputStatAlg/FPGATrackSimDumpOutputStatAlg) -------------------------------- +FPGATrackSimDumpOutputSt... INFO FPGATrackSimDumpOutputStatAlg::initialize() +FPGATrackSimDumpOutputSt... DEBUG Initialized in READ MODE +FPGATrackSimDumpOutputSt... DEBUG Opening file httsim_output.root in RECREATE mode. +FPGATrackSimDumpOutputSt... INFO Creating empty branches in output file +FPGATrackSimDumpOutputSt... DEBUG Adding private ToolHandle tool FPGATrackSimDumpOutputStatAlg.FPGATrackSimReadInput (FPGATrackSimOutputHeaderTool) +FPGATrackSimDumpOutputSt... DEBUG Adding private ToolHandle tool FPGATrackSimDumpOutputStatAlg.FPGATrackSimWriteOutput (FPGATrackSimOutputHeaderTool) +FPGATrackSimDumpOutputSt... DEBUG Running on event +FPGATrackSimDumpOutputSt... DEBUG Asked Event 0 in this file; current total is 0 +FPGATrackSimDumpOutputSt... DEBUG Asked in first stage header event: Event 100007001 Run 242000 +FPGATrackSimDumpOutputSt... DEBUG n.roads_1st = 15 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_1st = 15 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=511 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=495 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=383 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=508 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=978 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=255 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=5 SECTOR1=2658 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=503 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=6 SECTOR1=3258 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=495 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=7 SECTOR1=5158 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=508 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=8 SECTOR1=8519 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=507 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=9 SECTOR1=9470 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=511 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=10 SECTOR1=9470 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=495 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=11 SECTOR1=18557 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=507 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=12 SECTOR1=19816 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=511 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=13 SECTOR1=19816 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=383 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=14 SECTOR1=25190 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=255 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262143 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262095 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262140 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=260095 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007001 HITMAP=262131 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG Writing data in TTree +FPGATrackSimDumpOutputSt... DEBUG Wrote Event 0 in first stage header event Event 100007001 Run 242000 +FPGATrackSimDumpOutputSt... DEBUG n.roads_1st = 15 +FPGATrackSimDumpOutputSt... DEBUG n.roads_2nd = 5 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_1st = 15 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_2nd = 5 +FPGATrackSimDumpOutputSt... DEBUG Running on event +FPGATrackSimDumpOutputSt... DEBUG Asked Event 1 in this file; current total is 1 +FPGATrackSimDumpOutputSt... DEBUG Asked in first stage header event: Event 100007018 Run 242000 +FPGATrackSimDumpOutputSt... DEBUG n.roads_1st = 5 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_1st = 5 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=16185 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=511 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=16185 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=507 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=33439 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=507 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=44304 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=511 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=48352 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=255 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=262140 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007018 HITMAP=262095 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG Writing data in TTree +FPGATrackSimDumpOutputSt... DEBUG Wrote Event 1 in first stage header event Event 100007018 Run 242000 +FPGATrackSimDumpOutputSt... DEBUG n.roads_1st = 5 +FPGATrackSimDumpOutputSt... DEBUG n.roads_2nd = 2 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_1st = 5 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_2nd = 2 +FPGATrackSimDumpOutputSt... DEBUG Running on event +FPGATrackSimDumpOutputSt... DEBUG Asked Event 2 in this file; current total is 2 +FPGATrackSimDumpOutputSt... DEBUG Asked in first stage header event: Event 100007024 Run 242000 +FPGATrackSimDumpOutputSt... DEBUG n.roads_1st = 8 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_1st = 8 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=1578 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=507 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=511 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=503 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=3 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=479 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=4 SECTOR1=1967 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=508 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=5 SECTOR1=2216 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=508 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=6 SECTOR1=14946 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=508 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=7 SECTOR1=17119 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=503 TYPE=0 NMISS=1 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=0 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=262143 TYPE=0 NMISS=0 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=1 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=262140 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG TRACK: ID=2 SECTOR1=-1 BANK=-1 BARCODE=10001 BARCODE_F=1 EVENT=100007024 HITMAP=262131 TYPE=0 NMISS=2 +FPGATrackSimDumpOutputSt... DEBUG Writing data in TTree +FPGATrackSimDumpOutputSt... DEBUG Wrote Event 2 in first stage header event Event 100007024 Run 242000 +FPGATrackSimDumpOutputSt... DEBUG n.roads_1st = 8 +FPGATrackSimDumpOutputSt... DEBUG n.roads_2nd = 3 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_1st = 8 +FPGATrackSimDumpOutputSt... DEBUG n.tracks_2nd = 3 +FPGATrackSimDumpOutputSt... INFO Contains 3 entries, over 3 events run diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testRawToLogical.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testRawToLogical.ref new file mode 100644 index 0000000000000000000000000000000000000000..1501f061684e2f90f30390fd684f7ccb36ee7238 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testRawToLogical.ref @@ -0,0 +1,502 @@ +Tue Jun 13 16:43:28 CEST 2023 +Preloading tcmalloc_minimal.so +Py:Athena INFO using release [WorkDir-24.0.6] [x86_64-centos7-gcc11-opt] [Kill-HTT/45db40f] -- built on [2023-06-12T2128] +Py:Athena INFO including file "AthenaCommon/Preparation.py" +Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" +Py:Athena INFO executing ROOT6Setup +Py:Athena INFO including file "AthenaCommon/Execution.py" +Py:Athena INFO including file "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsWrapperAlg_jobOptions.py" +Py:FPGATrackSimRawToLogicalHitsWrapperAlg INFO OutFPGATrackSim file ['fpgatracksim_loghits_wrap.OUT.root'] +Py:Athena INFO including file "AthenaCommon/runbatch.py" +Py:ConfigurableDb INFO Read module info for 5239 configurables from 13 genConfDb files +Py:ConfigurableDb WARNING Found 1 duplicates among the 13 genConfDb files : +Py:ConfigurableDb WARNING -------------------------------------------------- +Py:ConfigurableDb WARNING -<component name>: <module> - [ <duplicates> ] +Py:ConfigurableDb WARNING -------------------------------------------------- +Py:ConfigurableDb WARNING -FPGATrackSimRawHitsWrapperAlg: FPGATrackSimSGInput.FPGATrackSimSGInputConf - ['FPGATrackSimInput.FPGATrackSimInputConf', 'FPGATrackSimInput.FPGATrackSimInputConf'] +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v36r13) + running on lxplus725.cern.ch on Tue Jun 13 16:43:42 2023 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +AthDictLoaderSvc INFO in initialize... +AthDictLoaderSvc INFO acquired Dso-registry +ClassIDSvc INFO getRegistryEntries: read 3092 CLIDRegistry entries for module ALL +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 14(Alarm clock) +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr +FPGATrackSimLog... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimLog... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimLog... DEBUG Opening file /eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root in READ mode +FPGATrackSimLog... INFO Input file: /eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root has 100 event entries +FPGATrackSimLog... INFO Getting branch and set EventHeader +FPGATrackSimLog... DEBUG Initialized in READ MODE +FPGATrackSimLog... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimLog... DEBUG Opening file fpgatracksim_loghits_wrap.OUT.root in RECREATE mode. +FPGATrackSimLog... INFO Creating empty branches in output file +FPGATrackSimLog... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimEve... INFO Creating the slices object +FPGATrackSimEve... INFO FPGATrackSimEventSelectionSvc::initialize(): regionID = 'regionID':0, min = {phi:0.3 q/pt:-0.001 d0:-2 z0:-150 eta:0.1}, max = {phi:0.5 q/pt:0.001 d0:2 z0:150 eta:0.3}, sampleType = singleMuons, withPU = 0 +Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/ATLAS-P2-ITK-22-02-00.pmap +Package.UserCode INFO Allocating map for geometry ATLAS-P2-ITK-22-02-00 diskIndex size=5 +Package.UserCode INFO Using 8 logical layers and 9 coordinates +Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/ATLAS-P2-ITK-22-02-00.pmap +Package.UserCode INFO Allocating map for geometry ATLAS-P2-ITK-22-02-00 diskIndex size=5 +Package.UserCode INFO Using 13 logical layers and 18 coordinates +Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/rmaps/eta0103phi0305_ATLAS-P2-ITK-22-02-00.rmap +Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/rmaps/eta0103phi0305_ATLAS-P2-ITK-22-02-00.rmap +Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/zslicemaps/ATLAS-P2-ITK-22-02-00/eta0103phi0305_KeyLayer-strip_barrel_2_extra03_trim_0_001_NSlices-6.rmap +Package.UserCode INFO Reading module LUT/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/ITk.global-to-local.moduleidmap +Package.UserCode INFO Reading module LUT/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/ITk.global-to-local.moduleidmap +Package.UserCode INFO Opened file: /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/NN_DNN_Region_0p1_0p3_HTTFake_HTTTrueMu_SingleP_8L_Nom_v6.json +FPGATrackSimLog... INFO SaveOptional= 'SaveOptional':2 +FPGATrackSimLog... DEBUG Configured to process 1 towers +FPGATrackSimLog... DEBUG List of Towers: , 0 +FPGATrackSimLog... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimLog... INFO Clustering is enabled +FPGATrackSimLog... DEBUG input handles: 0 +FPGATrackSimLog... DEBUG output handles: 0 +FPGATrackSimLog... DEBUG Adding private ToolHandle tool FPGATrackSimLogicalHitsWrapperAlg.FPGATrackSimInputHeaderTool (FPGATrackSimInputHeaderTool) +FPGATrackSimLog... DEBUG Adding private ToolHandle tool FPGATrackSimLogicalHitsWrapperAlg.FPGATrackSimWriteOutput (FPGATrackSimOutputHeaderTool) +FPGATrackSimLog... DEBUG Adding private ToolHandle tool FPGATrackSimLogicalHitsWrapperAlg.FPGATrackSimClusteringTool (FPGATrackSimClusteringTool) +FPGATrackSimLog... DEBUG Adding private ToolHandle tool FPGATrackSimLogicalHitsWrapperAlg.FPGATrackSimRawToLogicalHitsTool (FPGATrackSimRawToLogicalHitsTool) +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr INFO Application Manager Started successfully +AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #1, run #1 0 events processed so far <<<=== +FPGATrackSimLog... DEBUG Asked Event 0 in this file; current total is 0 +FPGATrackSimLog... INFO 0 +FPGATrackSimLog... DEBUG Reading event Event 38001 Run 242000 +FPGATrackSimLog... DEBUG Event: Event 38001 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=21 + 0 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=12 physLayer=0 eta=13 phi=292 + 1 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=12 physLayer=0 eta=12 phi=292 + 2 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=12 physLayer=0 eta=90 phi=302 + 3 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=12 physLayer=0 eta=90 phi=303 + 4 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=12 physLayer=0 eta=182 phi=315 + 5 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=12 physLayer=0 eta=290 phi=330 + 6 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=12 physLayer=0 eta=289 phi=330 + 7 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=13 physLayer=0 eta=70 phi=40 + 8 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=13 physLayer=0 eta=70 phi=41 + 9 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=13 physLayer=0 eta=161 phi=21 + 10 type=unmapped tech=pixel zone=posEndcap etamod=12 phimod=14 physLayer=2 eta=89 phi=290 + 11 type=unmapped tech=pixel zone=posEndcap etamod=12 phimod=14 physLayer=2 eta=89 phi=291 + 12 type=unmapped tech=pixel zone=posEndcap etamod=13 phimod=14 physLayer=2 eta=281 phi=280 + 13 type=unmapped tech=pixel zone=posEndcap etamod=14 phimod=14 physLayer=2 eta=497 phi=267 + 14 type=unmapped tech=pixel zone=posEndcap etamod=15 phimod=14 physLayer=2 eta=745 phi=253 + 15 type=unmapped tech=pixel zone=posEndcap etamod=15 phimod=14 physLayer=2 eta=744 phi=253 + 16 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=6 physLayer=4 eta=256 phi=653 + 17 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=6 physLayer=4 eta=255 phi=653 + 18 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=6 physLayer=4 eta=578 phi=679 + 19 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=7 physLayer=4 eta=229 phi=2 + 20 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=9 physLayer=6 eta=386 phi=385 + +FPGATrackSimLog... DEBUG Mapping 21 hits using stage 1 +FPGATrackSimLog... DEBUG Getting Event Event 38001 Run 242000 +FPGATrackSimLog... DEBUG Created 1 towers. Now map Hits +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 6 element in m_diskIndex which is of size 5 +FPGATrackSimLog... DEBUG Event: Event 38001 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +FPGATrackSimLog... DEBUG Produced 0 clusters +FPGATrackSimLog... INFO Ending with 0 clusters +FPGATrackSimLog... DEBUG Writing data in TTree +FPGATrackSimLog... DEBUG Wrote Event 0 in first stage header event Event 38001 Run 242000 +FPGATrackSimLog... DEBUG n.roads_1st = 0 +FPGATrackSimLog... DEBUG n.roads_2nd = 0 +FPGATrackSimLog... DEBUG n.tracks_1st = 0 +FPGATrackSimLog... DEBUG n.tracks_2nd = 0 +AthenaEventLoopMgr INFO ===>>> done processing event #1, run #1 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #2, run #1 1 events processed so far <<<=== +FPGATrackSimLog... DEBUG Asked Event 1 in this file; current total is 1 +FPGATrackSimLog... INFO 1 +FPGATrackSimLog... DEBUG Reading event Event 38005 Run 242000 +FPGATrackSimLog... DEBUG Event: Event 38005 Run 242000 Optional: nOfflineClusters: 12, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=14 + 0 type=unmapped tech=pixel zone=negEndcap etamod=12 phimod=7 physLayer=0 eta=26 phi=53 + 1 type=unmapped tech=pixel zone=negEndcap etamod=13 phimod=7 physLayer=0 eta=101 phi=37 + 2 type=unmapped tech=pixel zone=negEndcap etamod=13 phimod=7 physLayer=0 eta=100 phi=37 + 3 type=unmapped tech=pixel zone=negEndcap etamod=14 phimod=7 physLayer=0 eta=187 phi=18 + 4 type=unmapped tech=pixel zone=negEndcap etamod=14 phimod=7 physLayer=0 eta=187 phi=19 + 5 type=unmapped tech=pixel zone=negEndcap etamod=12 phimod=8 physLayer=0 eta=38 phi=298 + 6 type=unmapped tech=pixel zone=negEndcap etamod=13 phimod=8 physLayer=0 eta=114 phi=309 + 7 type=unmapped tech=pixel zone=negEndcap etamod=14 phimod=8 physLayer=0 eta=201 phi=321 + 8 type=unmapped tech=pixel zone=negEndcap etamod=4 phimod=13 physLayer=1 eta=83 phi=199 + 9 type=unmapped tech=pixel zone=negEndcap etamod=5 phimod=13 physLayer=1 eta=220 phi=199 + 10 type=unmapped tech=pixel zone=negEndcap etamod=21 phimod=8 physLayer=2 eta=175 phi=104 + 11 type=unmapped tech=pixel zone=negEndcap etamod=22 phimod=8 physLayer=2 eta=373 phi=73 + 12 type=unmapped tech=pixel zone=negEndcap etamod=21 phimod=9 physLayer=2 eta=171 phi=662 + 13 type=unmapped tech=pixel zone=negEndcap etamod=22 phimod=9 physLayer=2 eta=369 phi=693 + +FPGATrackSimLog... DEBUG Mapping 14 hits using stage 1 +FPGATrackSimLog... DEBUG Getting Event Event 38005 Run 242000 +FPGATrackSimLog... DEBUG Created 1 towers. Now map Hits +FPGATrackSimLog... DEBUG Event: Event 38005 Run 242000 Optional: nOfflineClusters: 12, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +FPGATrackSimLog... DEBUG Produced 0 clusters +FPGATrackSimLog... INFO Ending with 0 clusters +FPGATrackSimLog... DEBUG Writing data in TTree +FPGATrackSimLog... DEBUG Wrote Event 1 in first stage header event Event 38005 Run 242000 +FPGATrackSimLog... DEBUG n.roads_1st = 0 +FPGATrackSimLog... DEBUG n.roads_2nd = 0 +FPGATrackSimLog... DEBUG n.tracks_1st = 0 +FPGATrackSimLog... DEBUG n.tracks_2nd = 0 +AthenaEventLoopMgr INFO ===>>> done processing event #2, run #1 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #3, run #1 2 events processed so far <<<=== +FPGATrackSimLog... DEBUG Asked Event 2 in this file; current total is 2 +FPGATrackSimLog... INFO 2 +FPGATrackSimLog... DEBUG Reading event Event 38014 Run 242000 +FPGATrackSimLog... DEBUG Event: Event 38014 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=32 + 0 type=unmapped tech=pixel zone=barrel etamod=4 phimod=7 physLayer=0 eta=57 phi=52 + 1 type=unmapped tech=pixel zone=barrel etamod=4 phimod=7 physLayer=0 eta=58 phi=52 + 2 type=unmapped tech=pixel zone=barrel etamod=4 phimod=7 physLayer=0 eta=59 phi=52 + 3 type=unmapped tech=pixel zone=barrel etamod=4 phimod=11 physLayer=1 eta=743 phi=311 + 4 type=unmapped tech=pixel zone=barrel etamod=4 phimod=11 physLayer=1 eta=742 phi=311 + 5 type=unmapped tech=pixel zone=barrel etamod=4 phimod=11 physLayer=1 eta=741 phi=311 + 6 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=157 phi=654 + 7 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=156 phi=654 + 8 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=155 phi=654 + 9 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=155 phi=653 + 10 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=154 phi=653 + 11 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=153 phi=653 + 12 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=692 phi=13 + 13 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=691 phi=13 + 14 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=690 phi=13 + 15 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=689 phi=13 + 16 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=688 phi=13 + 17 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=252 phi=344 + 18 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=251 phi=344 + 19 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=250 phi=344 + 20 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=249 phi=344 + 21 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=248 phi=344 + 22 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=30 physLayer=7 eta=374 phi=695 + 23 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=31 physLayer=7 eta=376 phi=29 + 24 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=31 physLayer=7 eta=375 phi=29 + 25 type=unmapped tech=strip zone=barrel etamod=96 phimod=15 physLayer=0 eta=0 phi=323 + 26 type=unmapped tech=strip zone=barrel etamod=100 phimod=15 physLayer=1 eta=0 phi=339 + 27 type=unmapped tech=strip zone=barrel etamod=100 phimod=15 physLayer=1 eta=0 phi=340 + 28 type=unmapped tech=strip zone=barrel etamod=136 phimod=21 physLayer=2 eta=0 phi=934 + 29 type=unmapped tech=strip zone=barrel etamod=140 phimod=21 physLayer=3 eta=0 phi=956 + 30 type=unmapped tech=strip zone=barrel etamod=46 phimod=30 physLayer=4 eta=0 phi=568 + 31 type=unmapped tech=strip zone=barrel etamod=46 phimod=30 physLayer=5 eta=0 phi=596 + +FPGATrackSimLog... DEBUG Mapping 32 hits using stage 1 +FPGATrackSimLog... DEBUG Getting Event Event 38014 Run 242000 +FPGATrackSimLog... DEBUG Created 1 towers. Now map Hits +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 7 element in m_diskIndex which is of size 5 +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 7 element in m_diskIndex which is of size 5 +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 7 element in m_diskIndex which is of size 5 +FPGATrackSimLog... DEBUG Unmapped hit: pixel=0 Barrel=1 Layer=1 PLayer=0 section=0 +FPGATrackSimLog... DEBUG Unmapped hit: pixel=0 Barrel=1 Layer=2 PLayer=2 section=0 +FPGATrackSimLog... DEBUG Unmapped hit: pixel=0 Barrel=1 Layer=3 PLayer=3 section=0 +FPGATrackSimLog... DEBUG Unmapped hit: pixel=0 Barrel=1 Layer=4 PLayer=4 section=0 +FPGATrackSimLog... DEBUG Unmapped hit: pixel=0 Barrel=1 Layer=5 PLayer=5 section=0 +FPGATrackSimLog... DEBUG Found 5 missing mapped hits in this event +FPGATrackSimLog... DEBUG Event: Event 38014 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +FPGATrackSimLog... DEBUG Produced 0 clusters +FPGATrackSimLog... INFO Ending with 0 clusters +FPGATrackSimLog... DEBUG Writing data in TTree +FPGATrackSimLog... DEBUG Wrote Event 2 in first stage header event Event 38014 Run 242000 +FPGATrackSimLog... DEBUG n.roads_1st = 0 +FPGATrackSimLog... DEBUG n.roads_2nd = 0 +FPGATrackSimLog... DEBUG n.tracks_1st = 0 +FPGATrackSimLog... DEBUG n.tracks_2nd = 0 +AthenaEventLoopMgr INFO ===>>> done processing event #3, run #1 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #4, run #1 3 events processed so far <<<=== +FPGATrackSimLog... DEBUG Asked Event 3 in this file; current total is 3 +FPGATrackSimLog... INFO 3 +FPGATrackSimLog... DEBUG Reading event Event 38015 Run 242000 +FPGATrackSimLog... DEBUG Event: Event 38015 Run 242000 Optional: nOfflineClusters: 15, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=23 + 0 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=13 physLayer=0 eta=64 phi=321 + 1 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=13 physLayer=0 eta=146 phi=334 + 2 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=13 physLayer=0 eta=146 phi=335 + 3 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=13 physLayer=0 eta=242 phi=350 + 4 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=13 physLayer=0 eta=242 phi=351 + 5 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=13 physLayer=0 eta=343 phi=367 + 6 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=13 physLayer=0 eta=342 phi=367 + 7 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=14 physLayer=0 eta=69 phi=63 + 8 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=14 physLayer=0 eta=68 phi=63 + 9 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=14 physLayer=0 eta=151 phi=48 + 10 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=14 physLayer=0 eta=246 phi=30 + 11 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=14 physLayer=0 eta=346 phi=12 + 12 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=14 physLayer=0 eta=346 phi=11 + 13 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=23 physLayer=1 eta=319 phi=133 + 14 type=unmapped tech=pixel zone=posEndcap etamod=15 phimod=15 physLayer=2 eta=139 phi=395 + 15 type=unmapped tech=pixel zone=posEndcap etamod=16 phimod=15 physLayer=2 eta=318 phi=397 + 16 type=unmapped tech=pixel zone=posEndcap etamod=17 phimod=15 physLayer=2 eta=520 phi=398 + 17 type=unmapped tech=pixel zone=posEndcap etamod=17 phimod=15 physLayer=2 eta=520 phi=399 + 18 type=unmapped tech=pixel zone=posEndcap etamod=18 phimod=15 physLayer=2 eta=750 phi=400 + 19 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=8 physLayer=4 eta=159 phi=599 + 20 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=8 physLayer=4 eta=158 phi=599 + 21 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=8 physLayer=4 eta=472 phi=621 + 22 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=8 physLayer=4 eta=472 phi=620 + +FPGATrackSimLog... DEBUG Mapping 23 hits using stage 1 +FPGATrackSimLog... DEBUG Getting Event Event 38015 Run 242000 +FPGATrackSimLog... DEBUG Created 1 towers. Now map Hits +getLayerSection(siTech=1, DZ=1, layer=75) out of bounds +getLayerSection(siTech=1, DZ=1, layer=75) out of bounds +getLayerSection(siTech=1, DZ=1, layer=75) out of bounds +getLayerSection(siTech=1, DZ=1, layer=75) out of bounds +FPGATrackSimLog... DEBUG Event: Event 38015 Run 242000 Optional: nOfflineClusters: 15, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +FPGATrackSimLog... DEBUG Produced 0 clusters +FPGATrackSimLog... INFO Ending with 0 clusters +FPGATrackSimLog... DEBUG Writing data in TTree +FPGATrackSimLog... DEBUG Wrote Event 3 in first stage header event Event 38015 Run 242000 +FPGATrackSimLog... DEBUG n.roads_1st = 0 +FPGATrackSimLog... DEBUG n.roads_2nd = 0 +FPGATrackSimLog... DEBUG n.tracks_1st = 0 +FPGATrackSimLog... DEBUG n.tracks_2nd = 0 +AthenaEventLoopMgr INFO ===>>> done processing event #4, run #1 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #5, run #1 4 events processed so far <<<=== +FPGATrackSimLog... DEBUG Asked Event 4 in this file; current total is 4 +FPGATrackSimLog... INFO 4 +FPGATrackSimLog... DEBUG Reading event Event 38016 Run 242000 +FPGATrackSimLog... DEBUG Event: Event 38016 Run 242000 Optional: nOfflineClusters: 30, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=82 + 0 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=31 phi=305 + 1 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=35 phi=306 + 2 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=32 phi=305 + 3 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=33 phi=305 + 4 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=34 phi=305 + 5 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=34 phi=306 + 6 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=604 phi=480 + 7 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=615 phi=478 + 8 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=614 phi=478 + 9 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=613 phi=478 + 10 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=612 phi=478 + 11 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=611 phi=478 + 12 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=610 phi=478 + 13 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=609 phi=478 + 14 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=603 phi=481 + 15 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=617 phi=478 + 16 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=603 phi=480 + 17 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=616 phi=478 + 18 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=602 phi=480 + 19 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=607 phi=481 + 20 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=606 phi=481 + 21 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=605 phi=481 + 22 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=604 phi=481 + 23 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=608 phi=478 + 24 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=607 phi=478 + 25 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=606 phi=478 + 26 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=18 physLayer=2 eta=468 phi=220 + 27 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=18 physLayer=2 eta=629 phi=141 + 28 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=18 physLayer=2 eta=628 phi=141 + 29 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=18 physLayer=2 eta=380 phi=249 + 30 type=unmapped tech=pixel zone=posEndcap etamod=2 phimod=18 physLayer=2 eta=439 phi=360 + 31 type=unmapped tech=pixel zone=posEndcap etamod=2 phimod=18 physLayer=2 eta=439 phi=359 + 32 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=18 physLayer=2 eta=245 phi=250 + 33 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=18 physLayer=2 eta=244 phi=250 + 34 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=18 physLayer=2 eta=244 phi=251 + 35 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=18 physLayer=2 eta=387 phi=215 + 36 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=18 physLayer=2 eta=387 phi=214 + 37 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=18 physLayer=2 eta=48 phi=156 + 38 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=18 physLayer=2 eta=48 phi=157 + 39 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=18 physLayer=2 eta=359 phi=226 + 40 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=18 physLayer=2 eta=358 phi=226 + 41 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=18 physLayer=2 eta=358 phi=225 + 42 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=142 phi=382 + 43 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=141 phi=382 + 44 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=141 phi=381 + 45 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=137 phi=372 + 46 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=137 phi=371 + 47 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=137 phi=370 + 48 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=136 phi=370 + 49 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=136 phi=369 + 50 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=276 phi=330 + 51 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=277 phi=330 + 52 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=277 phi=331 + 53 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=278 phi=332 + 54 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=278 phi=333 + 55 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=140 phi=381 + 56 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=279 phi=333 + 57 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=279 phi=334 + 58 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=294 phi=339 + 59 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=296 phi=339 + 60 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=297 phi=339 + 61 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=297 phi=338 + 62 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=298 phi=338 + 63 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=299 phi=338 + 64 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=300 phi=338 + 65 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=301 phi=338 + 66 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=21 physLayer=3 eta=364 phi=411 + 67 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=21 physLayer=3 eta=365 phi=411 + 68 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=29 physLayer=5 eta=265 phi=344 + 69 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=37 physLayer=7 eta=473 phi=277 + 70 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=37 physLayer=7 eta=473 phi=276 + 71 type=unmapped tech=strip zone=barrel etamod=164 phimod=18 physLayer=0 eta=0 phi=517 + 72 type=unmapped tech=strip zone=barrel etamod=168 phimod=18 physLayer=1 eta=0 phi=558 + 73 type=unmapped tech=strip zone=posEndcap etamod=1030251365 phimod=21 physLayer=0 eta=0 phi=818 + 74 type=unmapped tech=strip zone=posEndcap etamod=1030251365 phimod=21 physLayer=1 eta=0 phi=876 + 75 type=unmapped tech=strip zone=posEndcap etamod=1635018016 phimod=43 physLayer=2 eta=0 phi=45 + 76 type=unmapped tech=strip zone=posEndcap etamod=1635018016 phimod=43 physLayer=3 eta=0 phi=121 + 77 type=unmapped tech=strip zone=posEndcap etamod=1685024105 phimod=43 physLayer=4 eta=0 phi=52 + 78 type=unmapped tech=strip zone=posEndcap etamod=1685024105 phimod=43 physLayer=5 eta=0 phi=146 + 79 type=unmapped tech=strip zone=posEndcap etamod=1282636136 phimod=43 physLayer=6 eta=0 phi=66 + 80 type=unmapped tech=strip zone=posEndcap etamod=1282636136 phimod=43 physLayer=7 eta=0 phi=166 + 81 type=unmapped tech=strip zone=posEndcap etamod=1919252833 phimod=43 physLayer=8 eta=0 phi=229 + +FPGATrackSimLog... DEBUG Mapping 82 hits using stage 1 +FPGATrackSimLog... DEBUG Getting Event Event 38016 Run 242000 +FPGATrackSimLog... DEBUG Created 1 towers. Now map Hits +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 5 element in m_diskIndex which is of size 5 +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 7 element in m_diskIndex which is of size 5 +Package.UserCode ERROR /afs/cern.ch/work/j/jahreda/athena_renamehtt/athena/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx:246 (void FPGATrackSimPlaneMap::map(FPGATrackSimHit&) const): Error: requesting 7 element in m_diskIndex which is of size 5 +FPGATrackSimLog... DEBUG Unmapped hit: pixel=0 Barrel=1 Layer=1 PLayer=0 section=0 +FPGATrackSimLog... DEBUG Found 1 missing mapped hits in this event +FPGATrackSimLog... DEBUG Event: Event 38016 Run 242000 Optional: nOfflineClusters: 30, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +FPGATrackSimLog... DEBUG Produced 0 clusters +FPGATrackSimLog... INFO Ending with 0 clusters +FPGATrackSimLog... DEBUG Writing data in TTree +FPGATrackSimLog... DEBUG Wrote Event 4 in first stage header event Event 38016 Run 242000 +FPGATrackSimLog... DEBUG n.roads_1st = 0 +FPGATrackSimLog... DEBUG n.roads_2nd = 0 +FPGATrackSimLog... DEBUG n.tracks_1st = 0 +FPGATrackSimLog... DEBUG n.tracks_2nd = 0 +AthenaEventLoopMgr INFO ===>>> done processing event #5, run #1 5 events processed so far <<<=== +ApplicationMgr INFO Application Manager Stopped successfully +FPGATrackSimEve... INFO FPGATrackSimEventSelectionSvc::finalize() +AthDictLoaderSvc INFO in finalize... +ToolSvc INFO Removing all tools created by ToolSvc +FPGATrackSimLog... INFO finalize: closing files +****************************************************************************** +*Tree :FPGATrackSimLogicalEventTree: data * +*Entries : 5 : Total = 21048 bytes File Size = 0 * +* : : Tree compression factor = 1.00 * +****************************************************************************** +*Br 0 :FPGATrackSimLogicalEventInputHeader_1st : * +* | FPGATrackSimLogicalEventInputHeader * +*Entries : 5 : Total Size= 18335 bytes One basket in memory * +*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * +*............................................................................* +*Br 1 :FPGATrackSimLogicalEventOutputHeader : * +* | FPGATrackSimLogicalEventOutputHeader * +*Entries : 5 : Total Size= 2247 bytes One basket in memory * +*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * +*............................................................................* +FPGATrackSimLog... INFO Contains 5 entries, over 5 events run +FPGATrackSimLog... INFO finalize: closing files +ApplicationMgr INFO Application Manager Finalized successfully +ApplicationMgr INFO Application Manager Terminated successfully +Py:Athena INFO leaving with code 0: "successful run" +Produced file fpgatracksim_loghits_wrap.OUT.root, now read it back +Tue Jun 13 16:43:44 CEST 2023 +Preloading tcmalloc_minimal.so +Py:Athena INFO using release [WorkDir-24.0.6] [x86_64-centos7-gcc11-opt] [Kill-HTT/45db40f] -- built on [2023-06-12T2128] +Py:Athena INFO including file "AthenaCommon/Preparation.py" +Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" +Py:Athena INFO executing ROOT6Setup +Py:Athena INFO including file "AthenaCommon/Execution.py" +Py:Athena INFO including file "FPGATrackSimInput/FPGATrackSimReadLogicalHitsAlg_jobOptions.py" +Py:FPGATrackSimReadLogicalHitsAlg INFO Input file ['fpgatracksim_loghits_wrap.OUT.root'] +Py:Athena INFO including file "AthenaCommon/runbatch.py" +Py:ConfigurableDb INFO Read module info for 5239 configurables from 13 genConfDb files +Py:ConfigurableDb WARNING Found 1 duplicates among the 13 genConfDb files : +Py:ConfigurableDb WARNING -------------------------------------------------- +Py:ConfigurableDb WARNING -<component name>: <module> - [ <duplicates> ] +Py:ConfigurableDb WARNING -------------------------------------------------- +Py:ConfigurableDb WARNING -FPGATrackSimRawHitsWrapperAlg: FPGATrackSimSGInput.FPGATrackSimSGInputConf - ['FPGATrackSimInput.FPGATrackSimInputConf', 'FPGATrackSimInput.FPGATrackSimInputConf'] +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v36r13) + running on lxplus725.cern.ch on Tue Jun 13 16:43:55 2023 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +AthDictLoaderSvc INFO in initialize... +AthDictLoaderSvc INFO acquired Dso-registry +ClassIDSvc INFO getRegistryEntries: read 3092 CLIDRegistry entries for module ALL +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 14(Alarm clock) +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr +FPGATrackSimRea... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimRea... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimRea... DEBUG Opening file fpgatracksim_loghits_wrap.OUT.root in READ mode. +FPGATrackSimRea... INFO Input file: fpgatracksim_loghits_wrap.OUT.root has 5 event entries. +FPGATrackSimRea... DEBUG Initialized in READ MODE +FPGATrackSimRea... DEBUG input handles: 0 +FPGATrackSimRea... DEBUG output handles: 0 +FPGATrackSimRea... DEBUG Adding private ToolHandle tool FPGATrackSimReadLogicalHitsAlg.FPGATrackSimReadInput (FPGATrackSimOutputHeaderTool) +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr INFO Application Manager Started successfully +AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #1, run #1 0 events processed so far <<<=== +FPGATrackSimRea... DEBUG Asked Event 0 in this file; current total is 0 +FPGATrackSimRea... DEBUG Asked in first stage header event: Event 38001 Run 242000 +FPGATrackSimRea... DEBUG n.roads_1st = 0 +FPGATrackSimRea... DEBUG n.tracks_1st = 0 +FPGATrackSimRea... DEBUG Event: Event 38001 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +AthenaEventLoopMgr INFO ===>>> done processing event #1, run #1 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #2, run #1 1 events processed so far <<<=== +FPGATrackSimRea... DEBUG Asked Event 1 in this file; current total is 1 +FPGATrackSimRea... DEBUG Asked in first stage header event: Event 38005 Run 242000 +FPGATrackSimRea... DEBUG n.roads_1st = 0 +FPGATrackSimRea... DEBUG n.tracks_1st = 0 +FPGATrackSimRea... DEBUG Event: Event 38005 Run 242000 Optional: nOfflineClusters: 12, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +AthenaEventLoopMgr INFO ===>>> done processing event #2, run #1 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #3, run #1 2 events processed so far <<<=== +FPGATrackSimRea... DEBUG Asked Event 2 in this file; current total is 2 +FPGATrackSimRea... DEBUG Asked in first stage header event: Event 38014 Run 242000 +FPGATrackSimRea... DEBUG n.roads_1st = 0 +FPGATrackSimRea... DEBUG n.tracks_1st = 0 +FPGATrackSimRea... DEBUG Event: Event 38014 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +AthenaEventLoopMgr INFO ===>>> done processing event #3, run #1 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #4, run #1 3 events processed so far <<<=== +FPGATrackSimRea... DEBUG Asked Event 3 in this file; current total is 3 +FPGATrackSimRea... DEBUG Asked in first stage header event: Event 38015 Run 242000 +FPGATrackSimRea... DEBUG n.roads_1st = 0 +FPGATrackSimRea... DEBUG n.tracks_1st = 0 +FPGATrackSimRea... DEBUG Event: Event 38015 Run 242000 Optional: nOfflineClusters: 15, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +AthenaEventLoopMgr INFO ===>>> done processing event #4, run #1 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #5, run #1 4 events processed so far <<<=== +FPGATrackSimRea... DEBUG Asked Event 4 in this file; current total is 4 +FPGATrackSimRea... DEBUG Asked in first stage header event: Event 38016 Run 242000 +FPGATrackSimRea... DEBUG n.roads_1st = 0 +FPGATrackSimRea... DEBUG n.tracks_1st = 0 +FPGATrackSimRea... DEBUG Event: Event 38016 Run 242000 Optional: nOfflineClusters: 30, nOfflineTracks: 1, nTruthTracks: 1 + NTowers: 1 + 0 Tower: id=0 eta=0 phi=0 Nhits=0 + + +AthenaEventLoopMgr INFO ===>>> done processing event #5, run #1 5 events processed so far <<<=== +ApplicationMgr INFO Application Manager Stopped successfully +AthDictLoaderSvc INFO in finalize... +ToolSvc INFO Removing all tools created by ToolSvc +FPGATrackSimRea... INFO finalize: closing files +ApplicationMgr INFO Application Manager Finalized successfully +ApplicationMgr INFO Application Manager Terminated successfully +Py:Athena INFO leaving with code 0: "successful run" diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testReadRawHit.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testReadRawHit.ref new file mode 100644 index 0000000000000000000000000000000000000000..2357f08e2d32db4f191c64c499f9482afd63db2d --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/share/testReadRawHit.ref @@ -0,0 +1,281 @@ +Tue Jun 13 17:58:14 CEST 2023 +Preloading tcmalloc_minimal.so +Py:Athena INFO using release [WorkDir-24.0.6] [x86_64-centos7-gcc11-opt] [Kill-HTT/45db40f] -- built on [2023-06-13T1751] +Py:Athena INFO including file "AthenaCommon/Preparation.py" +Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" +Py:Athena INFO executing ROOT6Setup +Py:Athena INFO including file "AthenaCommon/Execution.py" +Py:Athena INFO including file "FPGATrackSimInput/FPGATrackSimReadRawHitsWrapperAlg_jobOptions.py" +Py:FPGATrackSimReadRawHitsWrapperAlg INFO Input file ['/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root'] +Py:FPGATrackSimReadRawHitsWrapperAlg INFO OutFPGATrackSim file ['httsim_rawhits_wrap.OUT.root'] +Py:Athena INFO including file "AthenaCommon/runbatch.py" +Py:ConfigurableDb INFO Read module info for 5240 configurables from 13 genConfDb files +Py:ConfigurableDb INFO No duplicates have been found: that's good ! +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v36r13) + running on lxplus725.cern.ch on Tue Jun 13 17:58:24 2023 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +AthDictLoaderSvc INFO in initialize... +AthDictLoaderSvc INFO acquired Dso-registry +ClassIDSvc INFO getRegistryEntries: read 3092 CLIDRegistry entries for module ALL +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 14(Alarm clock) +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr +FPGATrackSimRaw... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimRaw... INFO FPGATrackSimRawHitsWrapperAlg::initialize() +FPGATrackSimRaw... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimRaw... DEBUG Opening file /eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root in READ mode +FPGATrackSimRaw... INFO Input file: /eos/atlas/atlascerngroupdisk/det-htt/HTTsim/ATLAS-P2-RUN4-01-01-00/single_mu.root has 100 event entries +FPGATrackSimRaw... INFO Getting branch and set EventHeader +FPGATrackSimRaw... DEBUG Initialized in READ MODE +FPGATrackSimRaw... DEBUG Property update for OutputLevel : new value = 2 +FPGATrackSimRaw... DEBUG Opening file httsim_rawhits_wrap.OUT.root in RECREATE mode +FPGATrackSimRaw... INFO Creating empty brnaches in output file +FPGATrackSimRaw... DEBUG input handles: 0 +FPGATrackSimRaw... DEBUG output handles: 0 +FPGATrackSimRaw... DEBUG Adding private ToolHandle tool FPGATrackSimRawHitsWrapperAlg.FPGATrackSimReadInput (FPGATrackSimInputHeaderTool) +FPGATrackSimRaw... DEBUG Adding private ToolHandle tool FPGATrackSimRawHitsWrapperAlg.FPGATrackSimWriteInput (FPGATrackSimInputHeaderTool) +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr INFO Application Manager Started successfully +AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #1, run #1 0 events processed so far <<<=== +FPGATrackSimRaw... DEBUG Running on event +FPGATrackSimRaw... DEBUG Asked Event 0 in this file; current total is 0 +FPGATrackSimRaw... INFO 0 +FPGATrackSimRaw... DEBUG Reading event Event 38001 Run 242000 +FPGATrackSimRaw... DEBUG Event: Event 38001 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=21 + 0 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=12 physLayer=0 eta=13 phi=292 + 1 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=12 physLayer=0 eta=12 phi=292 + 2 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=12 physLayer=0 eta=90 phi=302 + 3 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=12 physLayer=0 eta=90 phi=303 + 4 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=12 physLayer=0 eta=182 phi=315 + 5 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=12 physLayer=0 eta=290 phi=330 + 6 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=12 physLayer=0 eta=289 phi=330 + 7 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=13 physLayer=0 eta=70 phi=40 + 8 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=13 physLayer=0 eta=70 phi=41 + 9 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=13 physLayer=0 eta=161 phi=21 + 10 type=unmapped tech=pixel zone=posEndcap etamod=12 phimod=14 physLayer=2 eta=89 phi=290 + 11 type=unmapped tech=pixel zone=posEndcap etamod=12 phimod=14 physLayer=2 eta=89 phi=291 + 12 type=unmapped tech=pixel zone=posEndcap etamod=13 phimod=14 physLayer=2 eta=281 phi=280 + 13 type=unmapped tech=pixel zone=posEndcap etamod=14 phimod=14 physLayer=2 eta=497 phi=267 + 14 type=unmapped tech=pixel zone=posEndcap etamod=15 phimod=14 physLayer=2 eta=745 phi=253 + 15 type=unmapped tech=pixel zone=posEndcap etamod=15 phimod=14 physLayer=2 eta=744 phi=253 + 16 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=6 physLayer=4 eta=256 phi=653 + 17 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=6 physLayer=4 eta=255 phi=653 + 18 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=6 physLayer=4 eta=578 phi=679 + 19 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=7 physLayer=4 eta=229 phi=2 + 20 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=9 physLayer=6 eta=386 phi=385 + +FPGATrackSimRaw... DEBUG Wrote Event 0 in header event Event 38001 Run 242000 +AthenaEventLoopMgr INFO ===>>> done processing event #1, run #1 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #2, run #1 1 events processed so far <<<=== +FPGATrackSimRaw... DEBUG Running on event +FPGATrackSimRaw... DEBUG Asked Event 1 in this file; current total is 1 +FPGATrackSimRaw... INFO 1 +FPGATrackSimRaw... DEBUG Reading event Event 38005 Run 242000 +FPGATrackSimRaw... DEBUG Event: Event 38005 Run 242000 Optional: nOfflineClusters: 12, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=14 + 0 type=unmapped tech=pixel zone=negEndcap etamod=12 phimod=7 physLayer=0 eta=26 phi=53 + 1 type=unmapped tech=pixel zone=negEndcap etamod=13 phimod=7 physLayer=0 eta=101 phi=37 + 2 type=unmapped tech=pixel zone=negEndcap etamod=13 phimod=7 physLayer=0 eta=100 phi=37 + 3 type=unmapped tech=pixel zone=negEndcap etamod=14 phimod=7 physLayer=0 eta=187 phi=18 + 4 type=unmapped tech=pixel zone=negEndcap etamod=14 phimod=7 physLayer=0 eta=187 phi=19 + 5 type=unmapped tech=pixel zone=negEndcap etamod=12 phimod=8 physLayer=0 eta=38 phi=298 + 6 type=unmapped tech=pixel zone=negEndcap etamod=13 phimod=8 physLayer=0 eta=114 phi=309 + 7 type=unmapped tech=pixel zone=negEndcap etamod=14 phimod=8 physLayer=0 eta=201 phi=321 + 8 type=unmapped tech=pixel zone=negEndcap etamod=4 phimod=13 physLayer=1 eta=83 phi=199 + 9 type=unmapped tech=pixel zone=negEndcap etamod=5 phimod=13 physLayer=1 eta=220 phi=199 + 10 type=unmapped tech=pixel zone=negEndcap etamod=21 phimod=8 physLayer=2 eta=175 phi=104 + 11 type=unmapped tech=pixel zone=negEndcap etamod=22 phimod=8 physLayer=2 eta=373 phi=73 + 12 type=unmapped tech=pixel zone=negEndcap etamod=21 phimod=9 physLayer=2 eta=171 phi=662 + 13 type=unmapped tech=pixel zone=negEndcap etamod=22 phimod=9 physLayer=2 eta=369 phi=693 + +FPGATrackSimRaw... DEBUG Wrote Event 1 in header event Event 38005 Run 242000 +AthenaEventLoopMgr INFO ===>>> done processing event #2, run #1 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #3, run #1 2 events processed so far <<<=== +FPGATrackSimRaw... DEBUG Running on event +FPGATrackSimRaw... DEBUG Asked Event 2 in this file; current total is 2 +FPGATrackSimRaw... INFO 2 +FPGATrackSimRaw... DEBUG Reading event Event 38014 Run 242000 +FPGATrackSimRaw... DEBUG Event: Event 38014 Run 242000 Optional: nOfflineClusters: 14, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=32 + 0 type=unmapped tech=pixel zone=barrel etamod=4 phimod=7 physLayer=0 eta=57 phi=52 + 1 type=unmapped tech=pixel zone=barrel etamod=4 phimod=7 physLayer=0 eta=58 phi=52 + 2 type=unmapped tech=pixel zone=barrel etamod=4 phimod=7 physLayer=0 eta=59 phi=52 + 3 type=unmapped tech=pixel zone=barrel etamod=4 phimod=11 physLayer=1 eta=743 phi=311 + 4 type=unmapped tech=pixel zone=barrel etamod=4 phimod=11 physLayer=1 eta=742 phi=311 + 5 type=unmapped tech=pixel zone=barrel etamod=4 phimod=11 physLayer=1 eta=741 phi=311 + 6 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=157 phi=654 + 7 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=156 phi=654 + 8 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=155 phi=654 + 9 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=155 phi=653 + 10 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=154 phi=653 + 11 type=unmapped tech=pixel zone=barrel etamod=7 phimod=17 physLayer=2 eta=153 phi=653 + 12 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=692 phi=13 + 13 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=691 phi=13 + 14 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=690 phi=13 + 15 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=689 phi=13 + 16 type=unmapped tech=pixel zone=barrel etamod=6 phimod=18 physLayer=2 eta=688 phi=13 + 17 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=252 phi=344 + 18 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=251 phi=344 + 19 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=250 phi=344 + 20 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=249 phi=344 + 21 type=unmapped tech=pixel zone=barrel etamod=9 phimod=24 physLayer=3 eta=248 phi=344 + 22 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=30 physLayer=7 eta=374 phi=695 + 23 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=31 physLayer=7 eta=376 phi=29 + 24 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=31 physLayer=7 eta=375 phi=29 + 25 type=unmapped tech=strip zone=barrel etamod=96 phimod=15 physLayer=0 eta=0 phi=323 + 26 type=unmapped tech=strip zone=barrel etamod=100 phimod=15 physLayer=1 eta=0 phi=339 + 27 type=unmapped tech=strip zone=barrel etamod=100 phimod=15 physLayer=1 eta=0 phi=340 + 28 type=unmapped tech=strip zone=barrel etamod=136 phimod=21 physLayer=2 eta=0 phi=934 + 29 type=unmapped tech=strip zone=barrel etamod=140 phimod=21 physLayer=3 eta=0 phi=956 + 30 type=unmapped tech=strip zone=barrel etamod=46 phimod=30 physLayer=4 eta=0 phi=568 + 31 type=unmapped tech=strip zone=barrel etamod=46 phimod=30 physLayer=5 eta=0 phi=596 + +FPGATrackSimRaw... DEBUG Wrote Event 2 in header event Event 38014 Run 242000 +AthenaEventLoopMgr INFO ===>>> done processing event #3, run #1 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #4, run #1 3 events processed so far <<<=== +FPGATrackSimRaw... DEBUG Running on event +FPGATrackSimRaw... DEBUG Asked Event 3 in this file; current total is 3 +FPGATrackSimRaw... INFO 3 +FPGATrackSimRaw... DEBUG Reading event Event 38015 Run 242000 +FPGATrackSimRaw... DEBUG Event: Event 38015 Run 242000 Optional: nOfflineClusters: 15, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=23 + 0 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=13 physLayer=0 eta=64 phi=321 + 1 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=13 physLayer=0 eta=146 phi=334 + 2 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=13 physLayer=0 eta=146 phi=335 + 3 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=13 physLayer=0 eta=242 phi=350 + 4 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=13 physLayer=0 eta=242 phi=351 + 5 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=13 physLayer=0 eta=343 phi=367 + 6 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=13 physLayer=0 eta=342 phi=367 + 7 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=14 physLayer=0 eta=69 phi=63 + 8 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=14 physLayer=0 eta=68 phi=63 + 9 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=14 physLayer=0 eta=151 phi=48 + 10 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=14 physLayer=0 eta=246 phi=30 + 11 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=14 physLayer=0 eta=346 phi=12 + 12 type=unmapped tech=pixel zone=posEndcap etamod=10 phimod=14 physLayer=0 eta=346 phi=11 + 13 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=23 physLayer=1 eta=319 phi=133 + 14 type=unmapped tech=pixel zone=posEndcap etamod=15 phimod=15 physLayer=2 eta=139 phi=395 + 15 type=unmapped tech=pixel zone=posEndcap etamod=16 phimod=15 physLayer=2 eta=318 phi=397 + 16 type=unmapped tech=pixel zone=posEndcap etamod=17 phimod=15 physLayer=2 eta=520 phi=398 + 17 type=unmapped tech=pixel zone=posEndcap etamod=17 phimod=15 physLayer=2 eta=520 phi=399 + 18 type=unmapped tech=pixel zone=posEndcap etamod=18 phimod=15 physLayer=2 eta=750 phi=400 + 19 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=8 physLayer=4 eta=159 phi=599 + 20 type=unmapped tech=pixel zone=posEndcap etamod=8 phimod=8 physLayer=4 eta=158 phi=599 + 21 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=8 physLayer=4 eta=472 phi=621 + 22 type=unmapped tech=pixel zone=posEndcap etamod=9 phimod=8 physLayer=4 eta=472 phi=620 + +FPGATrackSimRaw... DEBUG Wrote Event 3 in header event Event 38015 Run 242000 +AthenaEventLoopMgr INFO ===>>> done processing event #4, run #1 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #5, run #1 4 events processed so far <<<=== +FPGATrackSimRaw... DEBUG Running on event +FPGATrackSimRaw... DEBUG Asked Event 4 in this file; current total is 4 +FPGATrackSimRaw... INFO 4 +FPGATrackSimRaw... DEBUG Reading event Event 38016 Run 242000 +FPGATrackSimRaw... DEBUG Event: Event 38016 Run 242000 Optional: nOfflineClusters: 30, nOfflineTracks: 1, nTruthTracks: 1 + Nhits=82 + 0 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=31 phi=305 + 1 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=35 phi=306 + 2 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=32 phi=305 + 3 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=33 phi=305 + 4 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=34 phi=305 + 5 type=unmapped tech=pixel zone=barrel etamod=4 phimod=8 physLayer=0 eta=34 phi=306 + 6 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=604 phi=480 + 7 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=615 phi=478 + 8 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=614 phi=478 + 9 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=613 phi=478 + 10 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=612 phi=478 + 11 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=611 phi=478 + 12 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=610 phi=478 + 13 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=609 phi=478 + 14 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=603 phi=481 + 15 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=617 phi=478 + 16 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=603 phi=480 + 17 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=616 phi=478 + 18 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=602 phi=480 + 19 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=607 phi=481 + 20 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=606 phi=481 + 21 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=605 phi=481 + 22 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=604 phi=481 + 23 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=608 phi=478 + 24 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=607 phi=478 + 25 type=unmapped tech=pixel zone=barrel etamod=6 phimod=13 physLayer=1 eta=606 phi=478 + 26 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=18 physLayer=2 eta=468 phi=220 + 27 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=18 physLayer=2 eta=629 phi=141 + 28 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=18 physLayer=2 eta=628 phi=141 + 29 type=unmapped tech=pixel zone=posEndcap etamod=1 phimod=18 physLayer=2 eta=380 phi=249 + 30 type=unmapped tech=pixel zone=posEndcap etamod=2 phimod=18 physLayer=2 eta=439 phi=360 + 31 type=unmapped tech=pixel zone=posEndcap etamod=2 phimod=18 physLayer=2 eta=439 phi=359 + 32 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=18 physLayer=2 eta=245 phi=250 + 33 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=18 physLayer=2 eta=244 phi=250 + 34 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=18 physLayer=2 eta=244 phi=251 + 35 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=18 physLayer=2 eta=387 phi=215 + 36 type=unmapped tech=pixel zone=posEndcap etamod=4 phimod=18 physLayer=2 eta=387 phi=214 + 37 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=18 physLayer=2 eta=48 phi=156 + 38 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=18 physLayer=2 eta=48 phi=157 + 39 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=18 physLayer=2 eta=359 phi=226 + 40 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=18 physLayer=2 eta=358 phi=226 + 41 type=unmapped tech=pixel zone=posEndcap etamod=6 phimod=18 physLayer=2 eta=358 phi=225 + 42 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=142 phi=382 + 43 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=141 phi=382 + 44 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=141 phi=381 + 45 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=137 phi=372 + 46 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=137 phi=371 + 47 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=137 phi=370 + 48 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=136 phi=370 + 49 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=136 phi=369 + 50 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=276 phi=330 + 51 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=277 phi=330 + 52 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=277 phi=331 + 53 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=278 phi=332 + 54 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=278 phi=333 + 55 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=140 phi=381 + 56 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=279 phi=333 + 57 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=279 phi=334 + 58 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=294 phi=339 + 59 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=296 phi=339 + 60 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=297 phi=339 + 61 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=297 phi=338 + 62 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=298 phi=338 + 63 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=299 phi=338 + 64 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=300 phi=338 + 65 type=unmapped tech=pixel zone=posEndcap etamod=7 phimod=18 physLayer=2 eta=301 phi=338 + 66 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=21 physLayer=3 eta=364 phi=411 + 67 type=unmapped tech=pixel zone=posEndcap etamod=0 phimod=21 physLayer=3 eta=365 phi=411 + 68 type=unmapped tech=pixel zone=posEndcap etamod=3 phimod=29 physLayer=5 eta=265 phi=344 + 69 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=37 physLayer=7 eta=473 phi=277 + 70 type=unmapped tech=pixel zone=posEndcap etamod=5 phimod=37 physLayer=7 eta=473 phi=276 + 71 type=unmapped tech=strip zone=barrel etamod=164 phimod=18 physLayer=0 eta=0 phi=517 + 72 type=unmapped tech=strip zone=barrel etamod=168 phimod=18 physLayer=1 eta=0 phi=558 + 73 type=unmapped tech=strip zone=posEndcap etamod=1030251365 phimod=21 physLayer=0 eta=0 phi=818 + 74 type=unmapped tech=strip zone=posEndcap etamod=1030251365 phimod=21 physLayer=1 eta=0 phi=876 + 75 type=unmapped tech=strip zone=posEndcap etamod=1635018016 phimod=43 physLayer=2 eta=0 phi=45 + 76 type=unmapped tech=strip zone=posEndcap etamod=1635018016 phimod=43 physLayer=3 eta=0 phi=121 + 77 type=unmapped tech=strip zone=posEndcap etamod=1685024105 phimod=43 physLayer=4 eta=0 phi=52 + 78 type=unmapped tech=strip zone=posEndcap etamod=1685024105 phimod=43 physLayer=5 eta=0 phi=146 + 79 type=unmapped tech=strip zone=posEndcap etamod=1282636136 phimod=43 physLayer=6 eta=0 phi=66 + 80 type=unmapped tech=strip zone=posEndcap etamod=1282636136 phimod=43 physLayer=7 eta=0 phi=166 + 81 type=unmapped tech=strip zone=posEndcap etamod=1919252833 phimod=43 physLayer=8 eta=0 phi=229 + +FPGATrackSimRaw... DEBUG Wrote Event 4 in header event Event 38016 Run 242000 +AthenaEventLoopMgr INFO ===>>> done processing event #5, run #1 5 events processed so far <<<=== +ApplicationMgr INFO Application Manager Stopped successfully +FPGATrackSimRaw... INFO Finalized: n.hits =172 n.truth=5 n.offline tracks=5 +AthDictLoaderSvc INFO in finalize... +ToolSvc INFO Removing all tools created by ToolSvc +FPGATrackSimRaw... INFO finalize: closing files +****************************************************************************** +*Tree :FPGATrackSimEventTree: data * +*Entries : 5 : Total = 45889 bytes File Size = 8035 * +* : : Tree compression factor = 5.59 * +****************************************************************************** +*Br 0 :FPGATrackSimEventInputHeader : FPGATrackSimEventInputHeader * +*Entries : 5 : Total Size= 45503 bytes File Size = 8035 * +*Baskets : 2 : Basket Size= 32000 bytes Compression= 5.59 * +*............................................................................* +FPGATrackSimRaw... INFO finalize: closing files +ApplicationMgr INFO Application Manager Finalized successfully +ApplicationMgr INFO Application Manager Terminated successfully +Py:Athena INFO leaving with code 0: "successful run" diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDetectorTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDetectorTool.cxx similarity index 76% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDetectorTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDetectorTool.cxx index 4e8d0496b1ec563ed3d2f4f265e0d20f7531861a..22aeff338418af7c939de1f959fdf67133999b74 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDetectorTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDetectorTool.cxx @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "HTTDetectorTool.h" -#include "TrigHTTMaps/HTTRegionMap.h" +#include "FPGATrackSimDetectorTool.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" #include "InDetIdentifier/PixelID.h" #include "InDetIdentifier/SCT_ID.h" @@ -11,30 +11,30 @@ -HTTDetectorTool::HTTDetectorTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimDetectorTool::FPGATrackSimDetectorTool(const std::string& algname, const std::string &name, const IInterface *ifc) : AthAlgTool(algname,name,ifc) {} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDetectorTool::initialize(){ +StatusCode FPGATrackSimDetectorTool::initialize(){ ATH_CHECK( detStore()->retrieve(m_PIX_mgr, "Pixel")); ATH_CHECK( detStore()->retrieve(m_pixelId, "PixelID") ); ATH_CHECK( detStore()->retrieve(m_sctId, "SCT_ID") ); - ATH_CHECK( m_HTTMapping.retrieve() ) ; + ATH_CHECK( m_FPGATrackSimMapping.retrieve() ) ; return StatusCode::SUCCESS; } /* this method loops over all the ID modules, pixel and SCT, with the goal * to create the online and offline map used to describe the modules within - * the HTT system. In particular can create the list of the modules in HTT + * the FPGATrackSim system. In particular can create the list of the modules in FPGATrackSim * towers, organized by layer, as used to calcualte the SS */ -void HTTDetectorTool::dumpGlobalToLocalModuleMap() { - /* All the modules are collected as HTTHit, allowing to interact efficiently - * with HTT elements as PMAP or RMAP +void FPGATrackSimDetectorTool::dumpGlobalToLocalModuleMap() { + /* All the modules are collected as FPGATrackSimHit, allowing to interact efficiently + * with FPGATrackSim elements as PMAP or RMAP */ - std::list<HTTHit> CompleteIDModuleList; + std::list<FPGATrackSimHit> CompleteIDModuleList; // To save the SRAM lookup into an output file std::ofstream fout_pix(m_sram_path_pix); @@ -46,7 +46,7 @@ void HTTDetectorTool::dumpGlobalToLocalModuleMap() { Identifier id = sielement->identify(); IdentifierHash idhash = sielement->identifyHash(); - HTTHit tmpmodraw; + FPGATrackSimHit tmpmodraw; tmpmodraw.setHitType(HitType::unmapped); tmpmodraw.setDetType(SiliconTech::pixel); @@ -72,7 +72,7 @@ void HTTDetectorTool::dumpGlobalToLocalModuleMap() { const Identifier id = *wafer_it; const IdentifierHash idhash = m_sctId->wafer_hash(id); - HTTHit tmpmodraw; + FPGATrackSimHit tmpmodraw; tmpmodraw.setHitType(HitType::unmapped); tmpmodraw.setDetType(SiliconTech::strip); @@ -93,27 +93,27 @@ void HTTDetectorTool::dumpGlobalToLocalModuleMap() { /* The modules are store by tower and by logical layer */ - int nregions(m_HTTMapping->RegionMap_2nd()->getNRegions()); // get the number of towers - int nplanes(m_HTTMapping->PlaneMap_2nd()->getNLogiLayers()); + int nregions(m_FPGATrackSimMapping->RegionMap_2nd()->getNRegions()); // get the number of towers + int nplanes(m_FPGATrackSimMapping->PlaneMap_2nd()->getNLogiLayers()); std::set<unsigned int> **grouped_modules = new std::set<unsigned int>*[nregions]; for (int ireg=0;ireg!=nregions;++ireg) grouped_modules[ireg] = new std::set<unsigned int>[nplanes]; for (auto& curmodrawhit: CompleteIDModuleList) { // loop over the modules, represente as raw hits // verify if accoring the current pmap this is module that has to be mapped - // convert the HTTHit representation in HTTHit to interact with the PMAP - m_HTTMapping->PlaneMap_2nd()->map(curmodrawhit); + // convert the FPGATrackSimHit representation in FPGATrackSimHit to interact with the PMAP + m_FPGATrackSimMapping->PlaneMap_2nd()->map(curmodrawhit); bool hasOneRegion(false); // it will become true if at least 1 tower is associated with the module for (int ireg=0;ireg!=nregions;++ireg) { // loop over the regions - if (m_HTTMapping->RegionMap_2nd()->isInRegion(ireg,curmodrawhit)) { + if (m_FPGATrackSimMapping->RegionMap_2nd()->isInRegion(ireg,curmodrawhit)) { hasOneRegion = true; // the module is compatible with the current - grouped_modules[ireg][curmodrawhit.getLayer()].insert(curmodrawhit.getHTTIdentifierHash()); + grouped_modules[ireg][curmodrawhit.getLayer()].insert(curmodrawhit.getFPGATrackSimIdentifierHash()); } } // end loop over the regions - if (!hasOneRegion) ATH_MSG_WARNING ( "The module with hash " << curmodrawhit.getHTTIdentifierHash() << " and HTT ID (" << curmodrawhit.getLayer() << "," << curmodrawhit.getSection() << ") is not associated to a tower"); + if (!hasOneRegion) ATH_MSG_WARNING ( "The module with hash " << curmodrawhit.getFPGATrackSimIdentifierHash() << " and FPGATrackSim ID (" << curmodrawhit.getLayer() << "," << curmodrawhit.getSection() << ") is not associated to a tower"); } // end loop over the modules // Save the map into the output file and print at screen a small message diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDetectorTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDetectorTool.h similarity index 62% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDetectorTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDetectorTool.h index 6e0b74d4d2b0e60ea158d4b2174b27a21711d4b0..8b8e0645110df669895ea79695619abe1ef76fd5 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDetectorTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDetectorTool.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTDETECTORTOOL_H -#define HTTDETECTORTOOL_H +#ifndef FPGATrackSimDETECTORTOOL_H +#define FPGATrackSimDETECTORTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ServiceHandle.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" #include <string> #include <vector> @@ -27,19 +27,19 @@ class PixelID; class SCT_ID; -/* This class interface the ID hits with the HTT simulation +/* This class interface the ID hits with the FPGATrackSim simulation implemented in Athena. Original code */ -class HTTDetectorTool : public ::AthAlgTool { +class FPGATrackSimDetectorTool : public ::AthAlgTool { public: - HTTDetectorTool(const std::string&, const std::string&, const IInterface*); - virtual ~HTTDetectorTool() = default; + FPGATrackSimDetectorTool(const std::string&, const std::string&, const IInterface*); + virtual ~FPGATrackSimDetectorTool() = default; virtual StatusCode initialize() override; void dumpGlobalToLocalModuleMap(); private: - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; Gaudi::Property<std::string> m_global2local_path {this,"GlobalToLocalMapPath", "global-to-local-map.moduleidmap"}; Gaudi::Property<std::string> m_sram_path_pix {this, "SRAMPathPixel", "sram_lookup_pixel.txt"}; Gaudi::Property<std::string> m_sram_path_sct {this, "SRAMPathSCT", "sram_lookup_sct.txt"}; @@ -52,4 +52,4 @@ private: }; -#endif // HTTDETECTORTOOL_H +#endif // FPGATrackSimDETECTORTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpDetStatusAlgo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpDetStatusAlgo.cxx similarity index 73% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpDetStatusAlgo.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpDetStatusAlgo.cxx index 23f291c2f7b82190b7e900098e43bfbbb7873c60..21df9df80dfd3d92de7cbb89575225236568f8ba 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpDetStatusAlgo.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpDetStatusAlgo.cxx @@ -1,20 +1,20 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "HTTDumpDetStatusAlgo.h" +#include "FPGATrackSimDumpDetStatusAlgo.h" #include <sstream> #include <iostream> #include <fstream> ///////////////////////////////////////////////////////////////////////////// -HTTDumpDetStatusAlgo::HTTDumpDetStatusAlgo(const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimDumpDetStatusAlgo::FPGATrackSimDumpDetStatusAlgo(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) {} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDumpDetStatusAlgo::initialize(){ +StatusCode FPGATrackSimDumpDetStatusAlgo::initialize(){ // select how the input is obtained if (m_DumpBadModules || m_DumpGlobalToLocalMap) { // Use the SG to retrieve the hits, this also means other Athena tools can be used @@ -24,11 +24,11 @@ StatusCode HTTDumpDetStatusAlgo::initialize(){ } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTDumpDetStatusAlgo::execute() { +StatusCode FPGATrackSimDumpDetStatusAlgo::execute() { if (m_DumpBadModules) { // These are not available yet - ATH_MSG_WARNING( "HTTDumpDetStatusAlgo DumpBadModules not available yet"); + ATH_MSG_WARNING( "FPGATrackSimDumpDetStatusAlgo DumpBadModules not available yet"); //m_detectorTool->makeBadModuleMap(); //Dump bad SS map //m_detectorTool->dumpDeadModuleSummary(); //Dump bad module map m_DumpBadModules = false; // in case you run on more than 1 event, only dump once @@ -41,7 +41,7 @@ StatusCode HTTDumpDetStatusAlgo::execute() { if (m_DumpIDMap) { // This is not available yet - ATH_MSG_WARNING( "HTTDumpDetStatusAlgo DumpIDMap not available yet" ); + ATH_MSG_WARNING( "FPGATrackSimDumpDetStatusAlgo DumpIDMap not available yet" ); //m_detectorTool->dumpIDMap(); m_DumpIDMap = false; // in case you run on more than 1 event, only dump once } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpDetStatusAlgo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpDetStatusAlgo.h similarity index 57% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpDetStatusAlgo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpDetStatusAlgo.h index 5ada1a63ddd0fe5c248956fbb811cf63b0b01104..7b78a4a9ecabdc083647319d07ec9fbbb840e47b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpDetStatusAlgo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpDetStatusAlgo.h @@ -1,29 +1,29 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTDumpDetStatusAlgo_h -#define HTTDumpDetStatusAlgo_h +#ifndef FPGATrackSimDumpDetStatusAlgo_h +#define FPGATrackSimDumpDetStatusAlgo_h #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ToolHandle.h" -#include "HTTDetectorTool.h" +#include "FPGATrackSimDetectorTool.h" ///////////////////////////////////////////////////////////////////////////// -class HTTDumpDetStatusAlgo: public AthAlgorithm { +class FPGATrackSimDumpDetStatusAlgo: public AthAlgorithm { public: - HTTDumpDetStatusAlgo (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTDumpDetStatusAlgo () override = default; + FPGATrackSimDumpDetStatusAlgo (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimDumpDetStatusAlgo () override = default; virtual StatusCode initialize() override ; virtual StatusCode execute() override; private: - ToolHandle<HTTDetectorTool> m_detectorTool {this, "HTTDetectorTool", "HTTDetectorTool/HTTDetectorTool"}; - Gaudi::Property<bool> m_DumpBadModules {this, "DumpBadModules", false, "If true enable dump of bad modules for HTT"}; + ToolHandle<FPGATrackSimDetectorTool> m_detectorTool {this, "FPGATrackSimDetectorTool", "FPGATrackSimDetectorTool/FPGATrackSimDetectorTool"}; + Gaudi::Property<bool> m_DumpBadModules {this, "DumpBadModules", false, "If true enable dump of bad modules for FPGATrackSim"}; Gaudi::Property<bool> m_DumpModuleIDMap {this, "DumpModuleIDMap", false, "If true dumps the map of the modules in each tower"}; Gaudi::Property<bool> m_DumpGlobalToLocalMap {this, "DumpGlobalToLocalMap",false, "True if you want to produce the Global-to-Local map"}; Gaudi::Property<bool> m_DumpIDMap {this, "DumpIDMap", false}; @@ -31,4 +31,4 @@ private: }; -#endif // HTTDumpDetStatusAlgo_h +#endif // FPGATrackSimDumpDetStatusAlgo_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpOutputStatAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpOutputStatAlg.cxx similarity index 56% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpOutputStatAlg.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpOutputStatAlg.cxx index b194f1da2f1e0aa7ce733a5fc0cff436ea6499d3..be5d7480f67fd4dbfc1bf8d30a3c2b8c7f080480 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTDumpOutputStatAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpOutputStatAlg.cxx @@ -1,18 +1,18 @@ -#include "HTTDumpOutputStatAlg.h" +#include "FPGATrackSimDumpOutputStatAlg.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" -#include "TrigHTTObjects/HTTTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" #include "TH2F.h" -HTTDumpOutputStatAlg::HTTDumpOutputStatAlg (const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimDumpOutputStatAlg::FPGATrackSimDumpOutputStatAlg (const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) {} -StatusCode HTTDumpOutputStatAlg::initialize() +StatusCode FPGATrackSimDumpOutputStatAlg::initialize() { - ATH_MSG_INFO ( "HTTDumpOutputStatAlg::initialize()"); + ATH_MSG_INFO ( "FPGATrackSimDumpOutputStatAlg::initialize()"); ATH_CHECK( m_readOutputTool.retrieve()); ATH_CHECK( m_writeOutputTool.retrieve()); @@ -24,18 +24,18 @@ StatusCode HTTDumpOutputStatAlg::initialize() } -StatusCode HTTDumpOutputStatAlg::BookHistograms(){ +StatusCode FPGATrackSimDumpOutputStatAlg::BookHistograms(){ //m_hits_r_vs_z = new TH2F("h_hits_r_vs_z", "r/z ITK hit map; z[mm];r[mm]", 3500, 0., 3500., 450, 0., 450.); return StatusCode::SUCCESS; } -StatusCode HTTDumpOutputStatAlg::execute() { +StatusCode FPGATrackSimDumpOutputStatAlg::execute() { ATH_MSG_DEBUG ("Running on event "); - HTTLogicalEventInputHeader eventInputHeader_1st; - HTTLogicalEventInputHeader eventInputHeader_2nd; - HTTLogicalEventOutputHeader eventOutputHeader; + FPGATrackSimLogicalEventInputHeader eventInputHeader_1st; + FPGATrackSimLogicalEventInputHeader eventInputHeader_2nd; + FPGATrackSimLogicalEventOutputHeader eventOutputHeader; bool last=false; ATH_CHECK (m_readOutputTool->readData(&eventInputHeader_1st, &eventInputHeader_2nd, &eventOutputHeader, last)); @@ -46,14 +46,14 @@ StatusCode HTTDumpOutputStatAlg::execute() { ATH_MSG_VERBOSE (eventInputHeader_2nd); // fill histograms - for (const auto& track : eventOutputHeader.getHTTTracks_1st()) { + for (const auto& track : eventOutputHeader.getFPGATrackSimTracks_1st()) { ATH_MSG_DEBUG (track); //commented out for future debugging //float r= std::sqrt(hit.getX()*hit.getX() + hit.getY()*hit.getY()); //m_hits_r_vs_z->Fill(hit.getZ(), r); } - for (const auto &track : eventOutputHeader.getHTTTracks_2nd()) { + for (const auto &track : eventOutputHeader.getFPGATrackSimTracks_2nd()) { ATH_MSG_DEBUG (track); } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpOutputStatAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpOutputStatAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..37cb01c2d5127823be7ed1c546b78c0cd6c991bd --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimDumpOutputStatAlg.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef FPGATrackSim_DUMPOUTPUTSTATALG_H +#define FPGATrackSim_DUMPOUTPUTSTATALG_H + + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h" + + +class TH2F; + +class FPGATrackSimDumpOutputStatAlg : public AthAlgorithm { +public: + FPGATrackSimDumpOutputStatAlg (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimDumpOutputStatAlg () {}; + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + StatusCode BookHistograms(); + + +private: + ToolHandle<IFPGATrackSimEventOutputHeaderTool> m_readOutputTool { this, "InputTool", "FPGATrackSimOutputHeaderTool/ReadOutputHeaderTool", "Input Tool" }; + ToolHandle<IFPGATrackSimEventOutputHeaderTool> m_writeOutputTool { this, "OutputTool", "FPGATrackSimOutputHeaderTool/WriteOutputHeaderTool", "Output Tool" }; + + // histograms + //TH2F* m_hits_r_vs_z = nullptr; +}; + +#endif // FPGATrackSim_DUMPOUTPUTSTATALG_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTInputHeaderTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimInputHeaderTool.cxx similarity index 76% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTInputHeaderTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimInputHeaderTool.cxx index f522015c4b7c1037d0771bed09ad255f88fde1dc..fe5812f0998aa557f7ca11250e259b84443c5aea 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTInputHeaderTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimInputHeaderTool.cxx @@ -1,17 +1,16 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + 0;95;0c Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -#include "HTTInputHeaderTool.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" +#include "FPGATrackSimInputHeaderTool.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" -std::string const HTTInputHeaderTool::m_branchName="HTTEventInputHeader"; -HTTInputHeaderTool::HTTInputHeaderTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimInputHeaderTool::FPGATrackSimInputHeaderTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname,name,ifc) {} -StatusCode HTTInputHeaderTool::openFile(std::string const & path) +StatusCode FPGATrackSimInputHeaderTool::openFile(std::string const & path) { // close old file if (m_infile && m_infile->IsOpen()) @@ -29,11 +28,11 @@ StatusCode HTTInputHeaderTool::openFile(std::string const & path) ATH_MSG_FATAL("Could not open input file: " << path); return StatusCode::FAILURE; } - if (m_rwoption.value()==std::string("READ") ) { - //get the tree - m_EventTree = (TTree*) m_infile->Get("HTTEventTree"); + //get the tree, try the old name and also the new name for backwards compatability + m_EventTree = (TTree*) m_infile->Get("FPGATrackSimEventTree"); + if (m_EventTree == nullptr || m_EventTree->GetEntries() == -1 ){ ATH_MSG_FATAL ("Input file: " << path << " has no entries"); return StatusCode::FAILURE; @@ -41,23 +40,24 @@ StatusCode HTTInputHeaderTool::openFile(std::string const & path) ATH_MSG_INFO ( "Input file: " << path << " has "<< m_EventTree->GetEntries() <<" event entries" ); if(!m_EventTree->GetListOfBranches()->FindObject(m_branchName.c_str())){ - ATH_MSG_FATAL ("Branch: " << m_branchName << " not found!"); - return StatusCode::FAILURE; + ATH_MSG_FATAL ("Branch: " << m_branchName << " not found!"); + return StatusCode::FAILURE; } ATH_MSG_INFO ( "Getting branch and set EventHeader" ); TBranch *branch = m_EventTree->GetBranch(m_branchName.c_str()); branch->SetAddress(&m_eventHeader); } - m_event=0; return StatusCode::SUCCESS; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTInputHeaderTool::initialize(){ +StatusCode FPGATrackSimInputHeaderTool::initialize(){ - m_eventHeader = new HTTEventInputHeader(); + m_eventHeader = new FPGATrackSimEventInputHeader(); + // set default name + m_branchName="FPGATrackSimEventInputHeader"; // open input file if( m_rwoption.value()!=std::string("HEADER")) @@ -69,14 +69,12 @@ StatusCode HTTInputHeaderTool::initialize(){ } ATH_CHECK(openFile(m_inpath.value().front())); } - - if (m_rwoption.value()==std::string("READ") ) { ATH_MSG_DEBUG ("Initialized in READ MODE"); } else if (m_rwoption.value()==std::string("RECREATE") || m_rwoption.value()==std::string("HEADER")) { ATH_MSG_INFO ("Creating empty brnaches in output file"); - m_EventTree = new TTree("HTTEventTree","data"); + m_EventTree = new TTree("FPGATrackSimEventTree","data"); m_EventTree->Branch(m_branchName.c_str(), m_branchName.c_str(),// class name &m_eventHeader); @@ -85,15 +83,13 @@ StatusCode HTTInputHeaderTool::initialize(){ ATH_MSG_ERROR("RWstatus =" <<m_rwoption.value()<<" not allowed!"); return StatusCode::FAILURE; } - m_event=0; // in file m_totevent=0; // total counter - return StatusCode::SUCCESS; } -StatusCode HTTInputHeaderTool::finalize(){ +StatusCode FPGATrackSimInputHeaderTool::finalize(){ ATH_MSG_INFO ( "finalize: closing files"); if (m_rwoption.value()==std::string("RECREATE")){ m_EventTree->Print(); @@ -108,7 +104,7 @@ StatusCode HTTInputHeaderTool::finalize(){ } -StatusCode HTTInputHeaderTool::writeData(HTTEventInputHeader* header) { +StatusCode FPGATrackSimInputHeaderTool::writeData(FPGATrackSimEventInputHeader* header) { if (m_rwoption.value()==std::string("READ") ){ ATH_MSG_WARNING ("Asked to write file in READ mode"); return StatusCode::SUCCESS; @@ -125,7 +121,7 @@ StatusCode HTTInputHeaderTool::writeData(HTTEventInputHeader* header) { return StatusCode::SUCCESS; } -StatusCode HTTInputHeaderTool::readData(HTTEventInputHeader* header, bool &last) +StatusCode FPGATrackSimInputHeaderTool::readData(FPGATrackSimEventInputHeader* header, bool &last) { if (m_rwoption.value()!=std::string("READ") ){ ATH_MSG_WARNING ("Asked to read file that is not in READ mode"); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimInputHeaderTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimInputHeaderTool.h new file mode 100644 index 0000000000000000000000000000000000000000..a4197f94117e88f243b780dddda213b838fc2c75 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimInputHeaderTool.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimInputHeaderTool_H +#define FPGATrackSimInputHeaderTool_H + +/** + * @file FPGATrackSimInputHeaderTool.h + * + * This class reads FPGATrackSim input data from a ROOT file (wrapper file) + * Designed to be not thread-safe + */ + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" + +#include <atomic> + +class FPGATrackSimEventInputHeader; + +class FPGATrackSimInputHeaderTool : public extends<AthAlgTool, IFPGATrackSimEventInputHeaderTool> { + public: + + FPGATrackSimInputHeaderTool(const std::string&, const std::string&, const IInterface*); + virtual ~FPGATrackSimInputHeaderTool() = default; + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode readData(FPGATrackSimEventInputHeader* header, bool &last) override; + virtual StatusCode writeData(FPGATrackSimEventInputHeader* header) override; + + + private: + StringArrayProperty m_inpath {this, "InFileName", {"."}, "input file paths"}; + StringProperty m_rwoption {this, "RWstatus", std::string("READ"), "define read or write file option: READ, RECREATE, HEADER"}; + + + //internal counters + std::atomic<unsigned> m_event = 0; + std::atomic<unsigned> m_totevent = 0; + std::atomic<unsigned> m_file = 0; + + std::string m_branchName; + StatusCode openFile(std::string const & path); + +}; + +#endif // FPGATrackSimInputHeaderTool_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimLogicalHitsWrapperAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimLogicalHitsWrapperAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fe994711562eb24d8277b3c99f7c5cd320a9f251 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimLogicalHitsWrapperAlg.cxx @@ -0,0 +1,62 @@ +#include "FPGATrackSimLogicalHitsWrapperAlg.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h" + +FPGATrackSimLogicalHitsWrapperAlg::FPGATrackSimLogicalHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator) +{} + + +StatusCode FPGATrackSimLogicalHitsWrapperAlg::initialize() +{ + ATH_CHECK( m_hitInputTool.retrieve()); + ATH_CHECK( m_writeOutputTool.retrieve()); + ATH_CHECK( m_hitMapTool.retrieve()); + + if (m_Clustering ) { + ATH_CHECK( m_clusteringTool.retrieve()); + ATH_MSG_INFO ("Clustering is enabled"); + } + + return StatusCode::SUCCESS; +} + +StatusCode FPGATrackSimLogicalHitsWrapperAlg::BookHistograms(){ + return StatusCode::SUCCESS; +} + + +StatusCode FPGATrackSimLogicalHitsWrapperAlg::execute() +{ + FPGATrackSimEventInputHeader eventHeader; + + bool last = false; + ATH_CHECK (m_hitInputTool->readData(&eventHeader, last)); + if (last) return StatusCode::SUCCESS; + + ATH_MSG_DEBUG (eventHeader); + + // Map hits: + FPGATrackSimLogicalEventInputHeader logicEventHeader_1st; + ATH_CHECK(m_hitMapTool->convert(1, eventHeader, logicEventHeader_1st)); + ATH_MSG_DEBUG (logicEventHeader_1st); + + // clustering: + if (m_Clustering) { + std::vector<FPGATrackSimCluster> clusters; + ATH_CHECK(m_clusteringTool->DoClustering(logicEventHeader_1st, clusters)); + ATH_MSG_INFO ("Ending with " << clusters.size() << " clusters"); + } + + FPGATrackSimLogicalEventInputHeader logicEventHeader_2nd;//fake empty + FPGATrackSimLogicalEventOutputHeader logicEventOutputHeader; + ATH_CHECK (m_writeOutputTool->writeData(&logicEventHeader_1st, &logicEventHeader_2nd, &logicEventOutputHeader)); + + return StatusCode::SUCCESS; +} + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimLogicalHitsWrapperAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimLogicalHitsWrapperAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..570bbc7a66f82ede2f376329ae1e26b99b9b3507 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimLogicalHitsWrapperAlg.h @@ -0,0 +1,37 @@ +#ifndef FPGATrackSim_LOGICALHITSWRAPPERALG_H +#define FPGATrackSim_LOGICALHITSWRAPPERALG_H + + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "AthContainers/DataVector.h" + +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h" +#include "FPGATrackSimMaps/FPGATrackSimClusteringToolI.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" + +class FPGATrackSimEventInputHeader; +class FPGATrackSimLogicalEventInputHeader; + +class FPGATrackSimLogicalHitsWrapperAlg : public AthAlgorithm { +public: + FPGATrackSimLogicalHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimLogicalHitsWrapperAlg () = default; + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + StatusCode BookHistograms(); + + +private: + + ToolHandle<IFPGATrackSimEventInputHeaderTool> m_hitInputTool { this, "InputTool", "FPGATrackSimInputHeaderTool/FPGATrackSimInputHeaderTool", "Input Tool" }; + ToolHandle<IFPGATrackSimEventOutputHeaderTool> m_writeOutputTool { this, "OutputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool", "Output Tool" }; + ToolHandle<FPGATrackSimClusteringToolI> m_clusteringTool { this, "ClusteringTool", "FPGATrackSimClusteringTool/FPGATrackSimClusteringTool", "FPGATrackSim Clustering Tool" }; + ToolHandle<FPGATrackSimRawToLogicalHitsTool> m_hitMapTool { this, "RawToLogicalHitsTool", "FPGATrackSimRawToLogicalHitsTool/FPGATrackSimRawToLogicalHitsTool", "Map Raw to Logical hit Tool" }; + + Gaudi::Property<bool> m_Clustering {this, "Clustering", false, "flag to enable the clustering"}; + +}; + +#endif // FPGATrackSimSGRORAWHITSWRAPPERALG_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTOutputHeaderTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimOutputHeaderTool.cxx similarity index 73% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTOutputHeaderTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimOutputHeaderTool.cxx index 17ba9cb33cf27253cc02edbf404d2ed75a42eb82..883c53591e9c0967a66ab56020d38f20e078bfab 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTOutputHeaderTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimOutputHeaderTool.cxx @@ -1,21 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "HTTOutputHeaderTool.h" -#include "TrigHTTObjects/HTTLogicalEventOutputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" +#include "FPGATrackSimOutputHeaderTool.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" -const std::string HTTOutputHeaderTool::m_branchNameIn_1st = "HTTLogicalEventInputHeader_1st"; -const std::string HTTOutputHeaderTool::m_branchNameIn_2nd = "HTTLogicalEventInputHeader_2nd"; -const std::string HTTOutputHeaderTool::m_branchNameOut = "HTTLogicalEventOutputHeader"; - -HTTOutputHeaderTool::HTTOutputHeaderTool(std::string const & algname, std::string const & name, IInterface const * ifc) : +FPGATrackSimOutputHeaderTool::FPGATrackSimOutputHeaderTool(std::string const & algname, std::string const & name, IInterface const * ifc) : base_class(algname, name, ifc) {} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTOutputHeaderTool::openFile(std::string const & path) +StatusCode FPGATrackSimOutputHeaderTool::openFile(std::string const & path) { // close old file (I don't think we delete the pointer. Does ROOT handle that?) if (m_infile && m_infile->IsOpen()) m_infile->Close(); @@ -30,8 +26,8 @@ StatusCode HTTOutputHeaderTool::openFile(std::string const & path) } if (m_rwoption.value() == std::string("READ")) { - // get the tree - m_EventTree = (TTree*) m_infile->Get("HTTLogicalEventTree"); + // get the tree, work on backwards compatability, so try two of them + m_EventTree = (TTree*) m_infile->Get("FPGATrackSimLogicalEventTree"); if (!m_EventTree || m_EventTree->GetEntries() == -1) { ATH_MSG_FATAL ("Input file: " << m_inpath.value() << " has no entries"); return StatusCode::FAILURE; @@ -73,11 +69,16 @@ StatusCode HTTOutputHeaderTool::openFile(std::string const & path) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTOutputHeaderTool::initialize() +StatusCode FPGATrackSimOutputHeaderTool::initialize() { - m_eventInputHeader_1st = new HTTLogicalEventInputHeader(); - m_eventOutputHeader = new HTTLogicalEventOutputHeader(); - if (m_runSecondStage) m_eventInputHeader_2nd = new HTTLogicalEventInputHeader(); + m_eventInputHeader_1st = new FPGATrackSimLogicalEventInputHeader(); + m_eventOutputHeader = new FPGATrackSimLogicalEventOutputHeader(); + if (m_runSecondStage) m_eventInputHeader_2nd = new FPGATrackSimLogicalEventInputHeader(); + + // set defaults + m_branchNameIn_1st = "FPGATrackSimLogicalEventInputHeader_1st"; + m_branchNameIn_2nd = "FPGATrackSimLogicalEventInputHeader_2nd"; + m_branchNameOut = "FPGATrackSimLogicalEventOutputHeader"; if( m_rwoption.value()!=std::string("HEADER")) { @@ -94,18 +95,18 @@ StatusCode HTTOutputHeaderTool::initialize() } else if (m_rwoption.value()==std::string("RECREATE") || m_rwoption.value()==std::string("HEADER")) { ATH_MSG_INFO ("Creating empty branches in output file"); - m_EventTree = new TTree("HTTLogicalEventTree","data"); + m_EventTree = new TTree("FPGATrackSimLogicalEventTree","data"); m_EventTree->Branch(m_branchNameIn_1st.c_str(), - "HTTLogicalEventInputHeader", // class name + "FPGATrackSimLogicalEventInputHeader", // class name &m_eventInputHeader_1st); if (m_runSecondStage) { m_EventTree->Branch(m_branchNameIn_2nd.c_str(), - "HTTLogicalEventInputHeader", // class name + "FPGATrackSimLogicalEventInputHeader", // class name &m_eventInputHeader_2nd); } m_EventTree->Branch(m_branchNameOut.c_str(), - "HTTLogicalEventOutputHeader", // class name + "FPGATrackSimLogicalEventOutputHeader", // class name &m_eventOutputHeader); } else { @@ -121,7 +122,7 @@ StatusCode HTTOutputHeaderTool::initialize() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTOutputHeaderTool::finalize() +StatusCode FPGATrackSimOutputHeaderTool::finalize() { ATH_MSG_INFO ("finalize: closing files"); @@ -143,7 +144,7 @@ StatusCode HTTOutputHeaderTool::finalize() } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTOutputHeaderTool::writeData(HTTLogicalEventInputHeader* INheader_1st, HTTLogicalEventInputHeader* INheader_2nd, HTTLogicalEventOutputHeader* OUTheader) +StatusCode FPGATrackSimOutputHeaderTool::writeData(FPGATrackSimLogicalEventInputHeader* INheader_1st, FPGATrackSimLogicalEventInputHeader* INheader_2nd, FPGATrackSimLogicalEventOutputHeader* OUTheader) { if (m_rwoption.value() == std::string("READ")) { ATH_MSG_WARNING ("Asked to write file in READ mode"); @@ -177,10 +178,10 @@ StatusCode HTTOutputHeaderTool::writeData(HTTLogicalEventInputHeader* INheader_1 ATH_MSG_DEBUG ("Wrote Event " << m_event << " in second stage header event " << m_eventInputHeader_2nd->event()); } if (m_eventOutputHeader) { - ATH_MSG_DEBUG ("n.roads_1st = " << m_eventOutputHeader->nHTTRoads_1st()); - ATH_MSG_DEBUG ("n.roads_2nd = " << m_eventOutputHeader->nHTTRoads_2nd()); - ATH_MSG_DEBUG ("n.tracks_1st = " << m_eventOutputHeader->nHTTTracks_1st()); - ATH_MSG_DEBUG ("n.tracks_2nd = " << m_eventOutputHeader->nHTTTracks_2nd()); + ATH_MSG_DEBUG ("n.roads_1st = " << m_eventOutputHeader->nFPGATrackSimRoads_1st()); + ATH_MSG_DEBUG ("n.roads_2nd = " << m_eventOutputHeader->nFPGATrackSimRoads_2nd()); + ATH_MSG_DEBUG ("n.tracks_1st = " << m_eventOutputHeader->nFPGATrackSimTracks_1st()); + ATH_MSG_DEBUG ("n.tracks_2nd = " << m_eventOutputHeader->nFPGATrackSimTracks_2nd()); } m_event++; @@ -193,7 +194,7 @@ StatusCode HTTOutputHeaderTool::writeData(HTTLogicalEventInputHeader* INheader_1 } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTOutputHeaderTool::readData(HTTLogicalEventInputHeader* INheader_1st, HTTLogicalEventInputHeader* INheader_2nd, HTTLogicalEventOutputHeader* OUTheader, bool &last) +StatusCode FPGATrackSimOutputHeaderTool::readData(FPGATrackSimLogicalEventInputHeader* INheader_1st, FPGATrackSimLogicalEventInputHeader* INheader_2nd, FPGATrackSimLogicalEventOutputHeader* OUTheader, bool &last) { if (m_rwoption.value() != std::string("READ")) { ATH_MSG_WARNING ("Asked to read file that is not in READ mode"); @@ -232,12 +233,12 @@ StatusCode HTTOutputHeaderTool::readData(HTTLogicalEventInputHeader* INheader_1s ATH_MSG_DEBUG ("Asked in first stage header event: " << m_eventInputHeader_1st->event()); if (m_runSecondStage) ATH_MSG_DEBUG ("Asked in second stage header event: " << m_eventInputHeader_2nd->event()); - ATH_MSG_DEBUG ("n.roads_1st = " << m_eventOutputHeader->nHTTRoads_1st()); - ATH_MSG_DEBUG ("n.tracks_1st = " << m_eventOutputHeader->nHTTTracks_1st()); + ATH_MSG_DEBUG ("n.roads_1st = " << m_eventOutputHeader->nFPGATrackSimRoads_1st()); + ATH_MSG_DEBUG ("n.tracks_1st = " << m_eventOutputHeader->nFPGATrackSimTracks_1st()); if (m_runSecondStage) { - ATH_MSG_DEBUG ("n.roads_2nd = " << m_eventOutputHeader->nHTTRoads_2nd()); - ATH_MSG_DEBUG ("n.tracks_2nd = " << m_eventOutputHeader->nHTTTracks_2nd()); + ATH_MSG_DEBUG ("n.roads_2nd = " << m_eventOutputHeader->nFPGATrackSimRoads_2nd()); + ATH_MSG_DEBUG ("n.tracks_2nd = " << m_eventOutputHeader->nFPGATrackSimTracks_2nd()); } *INheader_1st = *m_eventInputHeader_1st; //copy object to the external pointer diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimOutputHeaderTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimOutputHeaderTool.h new file mode 100644 index 0000000000000000000000000000000000000000..4f19f8ba4f445f17a1f7f148cd96d9f301e2bd0f --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimOutputHeaderTool.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSim_READOUTPUTHEADERTOOL_H +#define FPGATrackSim_READOUTPUTHEADERTOOL_H + +/** + * @file FPGATrackSimOutputHeaderTool.h + * + * This class reads/write FPGATrackSim output data from/to a ROOT file + * Designed to be not thread-safe + */ + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h" +#include <numeric> +#include <atomic> + +class FPGATrackSimLogicalEventInputHeader; +class FPGATrackSimLogicalEventOutputHeader; + +class FPGATrackSimOutputHeaderTool : public extends<AthAlgTool, IFPGATrackSimEventOutputHeaderTool> +{ + +public: + + FPGATrackSimOutputHeaderTool(std::string const &, std::string const &, IInterface const *); + virtual ~FPGATrackSimOutputHeaderTool() = default; + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + virtual StatusCode readData(FPGATrackSimLogicalEventInputHeader* INheader_1st, FPGATrackSimLogicalEventInputHeader* INheader_2nd, FPGATrackSimLogicalEventOutputHeader* OUTheader, bool &last) override; + virtual StatusCode writeData(FPGATrackSimLogicalEventInputHeader* INheader_1st, FPGATrackSimLogicalEventInputHeader* INheader_2nd, FPGATrackSimLogicalEventOutputHeader* OUTheader) override; + + std::string fileName() { return std::accumulate(m_inpath.value().begin(), m_inpath.value().end(), std::string{}); } + +private: + // JO configuration + StringArrayProperty m_inpath {this, "InFileName", {"."}, "input file paths"}; + StringProperty m_rwoption {this, "RWstatus", std::string("READ"), "define read or write file option: READ, RECREATE, HEADER"}; + BooleanProperty m_runSecondStage {this, "RunSecondStage",false, "flag to enable running the second stage fitting"}; + + // internal counters + std::atomic<unsigned> m_event = 0; + std::atomic<unsigned> m_totevent = 0; + std::atomic<unsigned> m_file = 0; + + std::string m_branchNameIn_1st; + std::string m_branchNameIn_2nd; + std::string m_branchNameOut; + + StatusCode openFile(std::string const & path); + +}; + +#endif // FPGATrackSim_READOUTPUTHEADERTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawHitsWrapperAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawHitsWrapperAlg.cxx similarity index 66% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawHitsWrapperAlg.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawHitsWrapperAlg.cxx index 4ddf7ff270abff3184489219bfe6d6d36af1bce0..eaba5efad48bab7de0136f2ec8fe5d1f9ed91347 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawHitsWrapperAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawHitsWrapperAlg.cxx @@ -1,16 +1,16 @@ -#include "HTTRawHitsWrapperAlg.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" +#include "FPGATrackSimRawHitsWrapperAlg.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" #include "TObjectTable.h" -HTTRawHitsWrapperAlg::HTTRawHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimRawHitsWrapperAlg::FPGATrackSimRawHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator){} -StatusCode HTTRawHitsWrapperAlg::initialize() +StatusCode FPGATrackSimRawHitsWrapperAlg::initialize() { - ATH_MSG_INFO ( "HTTRawHitsWrapperAlg::initialize()"); + ATH_MSG_INFO ( "FPGATrackSimRawHitsWrapperAlg::initialize()"); ATH_CHECK(m_readOutputTool.retrieve()); ATH_CHECK(m_writeOutputTool.retrieve()); @@ -23,13 +23,13 @@ StatusCode HTTRawHitsWrapperAlg::initialize() return StatusCode::SUCCESS; } -StatusCode HTTRawHitsWrapperAlg::BookHistograms(){ +StatusCode FPGATrackSimRawHitsWrapperAlg::BookHistograms(){ return StatusCode::SUCCESS; } -StatusCode HTTRawHitsWrapperAlg::execute() { +StatusCode FPGATrackSimRawHitsWrapperAlg::execute() { ATH_MSG_DEBUG ("Running on event "); - HTTEventInputHeader eventHeader; + FPGATrackSimEventInputHeader eventHeader; bool last=false; ATH_CHECK(m_readOutputTool->readData(&eventHeader, last)); if (last) return StatusCode::SUCCESS; @@ -47,7 +47,7 @@ StatusCode HTTRawHitsWrapperAlg::execute() { } -StatusCode HTTRawHitsWrapperAlg::finalize() +StatusCode FPGATrackSimRawHitsWrapperAlg::finalize() { ATH_MSG_INFO("Finalized: n.hits ="<<m_tot_hits <<" n.truth="<<m_tot_truth diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawHitsWrapperAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawHitsWrapperAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..0c48d53b32092597a53a10d1c8b1819d22074251 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawHitsWrapperAlg.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef FPGATrackSim_RAWHITSWRAPPERALG_H +#define FPGATrackSim_RAWHITSWRAPPERALG_H + + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" + +class FPGATrackSimRawHitsWrapperAlg : public AthAlgorithm { +public: + FPGATrackSimRawHitsWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimRawHitsWrapperAlg () = default; + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + StatusCode BookHistograms(); + + +private: + // configuration parameters + //TODO: use input from SG: FPGATrackSimSGToRawHitsTool/IFPGATrackSimInputTool + ToolHandle<IFPGATrackSimEventInputHeaderTool> m_readOutputTool { this, "InputTool", "FPGATrackSimInputHeaderTool/ReadInputHeaderTool", "Input Tool" }; + ToolHandle<IFPGATrackSimEventInputHeaderTool> m_writeOutputTool { this, "OutputTool", "FPGATrackSimInputHeaderTool/WriteInputHeaderTool", "Output Tool" }; + + // some debug counters + unsigned int m_tot_hits=0; + unsigned int m_tot_truth=0; + unsigned int m_tot_oftracks=0; +}; + +#endif // FPGATrackSimRAWHITSWRAPPERALG_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawNtupleWrapperAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawNtupleWrapperAlg.cxx similarity index 82% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawNtupleWrapperAlg.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawNtupleWrapperAlg.cxx index 0a7bdfd4b9fceca140163b4062e67d806b216b42..6f19b35a3f0129c33bc2b0fbc4b834ae8b622cd7 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawNtupleWrapperAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawNtupleWrapperAlg.cxx @@ -1,26 +1,26 @@ -#include "HTTRawNtupleWrapperAlg.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTTowerInputHeader.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" -#include "TrigHTTObjects/HTTOfflineHit.h" +#include "FPGATrackSimRawNtupleWrapperAlg.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineHit.h" #include "TFile.h" #include "TTree.h" -HTTRawNtupleWrapperAlg::HTTRawNtupleWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator) : +FPGATrackSimRawNtupleWrapperAlg::FPGATrackSimRawNtupleWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) {} -StatusCode HTTRawNtupleWrapperAlg::initialize() +StatusCode FPGATrackSimRawNtupleWrapperAlg::initialize() { ATH_CHECK(m_hitInputTool.retrieve()); ATH_MSG_INFO ("Creating output file: " ); m_outfile = TFile::Open(m_outpath.value().c_str(),"recreate"); - m_eventHeader = new HTTEventInputHeader(); + m_eventHeader = new FPGATrackSimEventInputHeader(); // create a TTree to store the truth tracks m_trackstree = new TTree("truthtracks","Truth tracks"); @@ -40,9 +40,9 @@ StatusCode HTTRawNtupleWrapperAlg::initialize() m_evtinfo->Branch("ActualInteractionsPerCrossing",&m_actualInteractionsPerCrossing,"ActualInteractionsPerCrossing/F"); // create and populate the TTree - m_hittree = new TTree("htthits","Raw hits for the HTT simulation"); + m_hittree = new TTree("htthits","Raw hits for the FPGATrackSim simulation"); // prepare a branch for each tower - m_original_hits = new std::vector<HTTHit>[m_ntowers]; + m_original_hits = new std::vector<FPGATrackSimHit>[m_ntowers]; for (int ireg=0;ireg!=m_ntowers;++ireg) { // towers loop m_hittree->Branch(Form("RawHits%d.",ireg),&m_original_hits[ireg], 32000, 1); } // end towers loop @@ -94,7 +94,7 @@ StatusCode HTTRawNtupleWrapperAlg::initialize() -StatusCode HTTRawNtupleWrapperAlg::execute() { +StatusCode FPGATrackSimRawNtupleWrapperAlg::execute() { ATH_MSG_DEBUG ( "Start execute"); bool last=false; ATH_CHECK (m_hitInputTool->readData(m_eventHeader, last)); @@ -107,7 +107,7 @@ StatusCode HTTRawNtupleWrapperAlg::execute() { m_original_hits[ireg].clear(); } - const HTTEventInfo event=m_eventHeader->event(); + const FPGATrackSimEventInfo event=m_eventHeader->event(); m_run_number = event.runNumber(); // event's run number m_event_number = event.eventNumber(); // event number m_LB = event.LB(); @@ -119,13 +119,13 @@ StatusCode HTTRawNtupleWrapperAlg::execute() { m_extendedLevel1ID = event.extendedLevel1ID(); m_evtinfo->Fill(); - std::vector<HTTHit> fulllist = m_eventHeader->hits(); + std::vector<FPGATrackSimHit> fulllist = m_eventHeader->hits(); ATH_MSG_VERBOSE("Going to run on "<< fulllist.size()<<" hits"); - std::vector<HTTHit>::const_iterator ihit = fulllist.begin(); - std::vector<HTTHit>::const_iterator ihitE = fulllist.end(); + std::vector<FPGATrackSimHit>::const_iterator ihit = fulllist.begin(); + std::vector<FPGATrackSimHit>::const_iterator ihitE = fulllist.end(); for (;ihit!=ihitE;++ihit) { // hit loop - const HTTHit &currawhit = *ihit; + const FPGATrackSimHit &currawhit = *ihit; for (int ireg=0;ireg!=m_ntowers;++ireg) { // if the equivalent hit is compatible with this tower the hit is saved m_original_hits[ireg].push_back(currawhit); @@ -136,7 +136,7 @@ StatusCode HTTRawNtupleWrapperAlg::execute() { //truth tracks m_truth_tracks.clear(); - const std::vector<HTTTruthTrack> &truthtracks = m_eventHeader->optional().getTruthTracks(); + const std::vector<FPGATrackSimTruthTrack> &truthtracks = m_eventHeader->optional().getTruthTracks(); m_truth_tracks.insert(m_truth_tracks.end(),truthtracks.begin(),truthtracks.end()); // Write the tracks m_trackstree->Fill(); @@ -161,7 +161,7 @@ StatusCode HTTRawNtupleWrapperAlg::execute() { m_offline_barcode->clear(); m_offline_barcode_frac->clear(); - const std::vector<HTTOfflineTrack> &offlinetracks = m_eventHeader->optional().getOfflineTracks(); + const std::vector<FPGATrackSimOfflineTrack> &offlinetracks = m_eventHeader->optional().getOfflineTracks(); for (auto &offline_t: offlinetracks){ @@ -193,7 +193,7 @@ StatusCode HTTRawNtupleWrapperAlg::execute() { } -StatusCode HTTRawNtupleWrapperAlg::finalize() +StatusCode FPGATrackSimRawNtupleWrapperAlg::finalize() { // close the output files, but check that it exists (for athenaMT) if (m_outfile) { diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawNtupleWrapperAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawNtupleWrapperAlg.h similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawNtupleWrapperAlg.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawNtupleWrapperAlg.h index 88c490128cf8e4e19a0fb0c98c374a80aeed5c86..be1b896496bb7e3f9faca9b3418ea1dd4601b89b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawNtupleWrapperAlg.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawNtupleWrapperAlg.h @@ -1,36 +1,36 @@ -#ifndef HTT_RAWNTUPLEWRAPPERALG_H -#define HTT_RAWNTUPLEWRAPPERALG_H +#ifndef FPGATrackSim_RAWNTUPLEWRAPPERALG_H +#define FPGATrackSim_RAWNTUPLEWRAPPERALG_H #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "TrigHTTInput/IHTTEventInputHeaderTool.h" -#include "TrigHTTObjects/HTTTruthTrack.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" class TFile; class TTree; -class HTTEventInputHeader; -class HTTHit; -class HTTTruthTrack; +class FPGATrackSimEventInputHeader; +class FPGATrackSimHit; +class FPGATrackSimTruthTrack; -class HTTRawNtupleWrapperAlg : public AthAlgorithm { +class FPGATrackSimRawNtupleWrapperAlg : public AthAlgorithm { public: - HTTRawNtupleWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator); - virtual ~HTTRawNtupleWrapperAlg () = default; + FPGATrackSimRawNtupleWrapperAlg (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimRawNtupleWrapperAlg () = default; virtual StatusCode initialize() override; virtual StatusCode execute() override; virtual StatusCode finalize() override; private: // configuration parameters - ToolHandle<IHTTEventInputHeaderTool> m_hitInputTool { this, "InputTool", "HTTSGToRawHitsTool/HTTSGToRawHitsTool", "Input Tool" }; + ToolHandle<IFPGATrackSimEventInputHeaderTool> m_hitInputTool { this, "InputTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimSGToRawHitsTool", "Input Tool" }; StringProperty m_outpath {this, "OutFileName", "httsim_smartwrapper.root", "output path"}; BooleanProperty m_getOffline {this, "GetOffline", false, "flag to enable the offline tracking save"}; // internal pointers - HTTEventInputHeader* m_eventHeader = nullptr; + FPGATrackSimEventInputHeader* m_eventHeader = nullptr; int m_ntowers = 1; // Tree structure @@ -50,8 +50,8 @@ private: unsigned int m_extendedLevel1ID = 0U; unsigned int m_level1TriggerType = 0U; std::vector<unsigned int> m_level1TriggerInfo; - std::vector<HTTHit> *m_original_hits = nullptr; // variables related to the HTTHit storage - std::vector<HTTTruthTrack> m_truth_tracks; + std::vector<FPGATrackSimHit> *m_original_hits = nullptr; // variables related to the FPGATrackSimHit storage + std::vector<FPGATrackSimTruthTrack> m_truth_tracks; //offline clusters std::vector<float> *m_offline_locX = nullptr; std::vector<float> *m_offline_locY = nullptr; @@ -71,4 +71,4 @@ private: std::vector<float> *m_offline_barcode_frac = nullptr; }; -#endif // HTTSGRORAWHITSWRAPPERALG_h +#endif // FPGATrackSimSGRORAWHITSWRAPPERALG_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawToLogicalHitsTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawToLogicalHitsTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx index 1a486938d59a406776254326f6227c931003a353..d1e3f5cc5fd70efdfc9e5517caf41a930a6f97d4 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTRawToLogicalHitsTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx @@ -1,37 +1,37 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTInput/HTTRawToLogicalHitsTool.h" -#include "TrigHTTSGInput/TrigHTTInputUtils.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" +#include "FPGATrackSimSGInput/FPGATrackSimInputUtils.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTTowerInputHeader.h" -#include "TrigHTTObjects/HTTEventInfo.h" -#include "TrigHTTObjects/HTTOptionalEventInfo.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" -#include "TrigHTTObjects/HTTOfflineHit.h" -#include "TrigHTTObjects/HTTTruthTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" -#include "TrigHTTMaps/HTTRegionMap.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" -HTTRawToLogicalHitsTool::HTTRawToLogicalHitsTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimRawToLogicalHitsTool::FPGATrackSimRawToLogicalHitsTool(const std::string& algname, const std::string &name, const IInterface *ifc) : AthAlgTool(algname,name,ifc){} -StatusCode HTTRawToLogicalHitsTool::initialize(){ - ATH_CHECK(m_HTTMapping.retrieve()); +StatusCode FPGATrackSimRawToLogicalHitsTool::initialize(){ + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); ATH_CHECK(m_EvtSel.retrieve()); ATH_MSG_INFO("SaveOptional="<<m_saveOptional); // remove deferensed m_towersToMap.value() in newer releases! if( m_towersToMap.value().empty() ){ - int maxNtowers = m_HTTMapping->RegionMap_2nd()->getNRegions(); + int maxNtowers = m_FPGATrackSimMapping->RegionMap_2nd()->getNRegions(); for (int ireg=0;ireg!=maxNtowers;++ireg) m_towers.push_back(ireg); }else{ m_towers = m_towersToMap.value(); @@ -47,25 +47,25 @@ StatusCode HTTRawToLogicalHitsTool::initialize(){ } -StatusCode HTTRawToLogicalHitsTool::convert(unsigned stage, const HTTEventInputHeader& eventHeader, HTTLogicalEventInputHeader& logicEventHeader){ +StatusCode FPGATrackSimRawToLogicalHitsTool::convert(unsigned stage, const FPGATrackSimEventInputHeader& eventHeader, FPGATrackSimLogicalEventInputHeader& logicEventHeader){ ATH_MSG_DEBUG ("Mapping " << eventHeader.nHits() << " hits using stage " << stage); - HTTEventInfo eventinfo = eventHeader.event(); + FPGATrackSimEventInfo eventinfo = eventHeader.event(); ATH_MSG_DEBUG ("Getting Event " << eventinfo); logicEventHeader.newEvent(eventinfo);//this also reset all varaibles // Get correct maps - const HTTPlaneMap *pmap = nullptr; - const HTTRegionMap *rmap = nullptr; + const FPGATrackSimPlaneMap *pmap = nullptr; + const FPGATrackSimRegionMap *rmap = nullptr; if (stage == 1) { - pmap = m_HTTMapping->PlaneMap_1st(); - rmap = m_HTTMapping->RegionMap_1st(); + pmap = m_FPGATrackSimMapping->PlaneMap_1st(); + rmap = m_FPGATrackSimMapping->RegionMap_1st(); } else if (stage == 2) { - pmap = m_HTTMapping->PlaneMap_2nd(); - rmap = m_HTTMapping->RegionMap_2nd(); + pmap = m_FPGATrackSimMapping->PlaneMap_2nd(); + rmap = m_FPGATrackSimMapping->RegionMap_2nd(); } else { @@ -74,7 +74,7 @@ StatusCode HTTRawToLogicalHitsTool::convert(unsigned stage, const HTTEventInputH logicEventHeader.reserveTowers(m_towers.size()); for (int ireg: m_towers){ - HTTTowerInputHeader tower = HTTTowerInputHeader(ireg);//default header, can eventually set eta/phi/deta/dphi + FPGATrackSimTowerInputHeader tower = FPGATrackSimTowerInputHeader(ireg);//default header, can eventually set eta/phi/deta/dphi logicEventHeader.addTower( tower); } @@ -91,7 +91,7 @@ StatusCode HTTRawToLogicalHitsTool::convert(unsigned stage, const HTTEventInputH // In the ITk geometry, some of the plane IDs are -1 if the layers are not yet being used. // This causes the code in this hit loop to crash. As a workaround for the moment, we currently - // skip over hits in layers that are not included in the HTT geometry, with plane = -1 + // skip over hits in layers that are not included in the FPGATrackSim geometry, with plane = -1 if (pmap->getLayerSection(hit.getDetType(), hit.getDetectorZone(), hit.getPhysLayer()).layer == -1) { // m_missing_hits.push_back(hit); // comment this out so hits in unused layers aren't considered "unmapped" @@ -129,17 +129,17 @@ StatusCode HTTRawToLogicalHitsTool::convert(unsigned stage, const HTTEventInputH } if (stage == 1) { - HTTOptionalEventInfo op = eventHeader.optional(); + FPGATrackSimOptionalEventInfo op = eventHeader.optional(); if (m_saveOptional == 2) { logicEventHeader.setOptional(op); } else if (m_saveOptional == 1) { // save offline tracks - HTTOptionalEventInfo newop; + FPGATrackSimOptionalEventInfo newop; newop.reserveOfflineTracks(op.nOfflineTracks()); - for (HTTOfflineTrack const & offline_t : op.getOfflineTracks()) newop.addOfflineTrack(offline_t); + for (FPGATrackSimOfflineTrack const & offline_t : op.getOfflineTracks()) newop.addOfflineTrack(offline_t); // save truth in region - for (HTTTruthTrack const & truth_t : op.getTruthTracks()) { + for (FPGATrackSimTruthTrack const & truth_t : op.getTruthTracks()) { if (m_EvtSel->passMatching(truth_t)) newop.addTruthTrack(truth_t); } ATH_MSG_DEBUG("Selected " << newop.nTruthTracks() << " truth tracks"); @@ -150,12 +150,12 @@ StatusCode HTTRawToLogicalHitsTool::convert(unsigned stage, const HTTEventInputH return StatusCode::SUCCESS; } -StatusCode HTTRawToLogicalHitsTool::getUnmapped(std::vector<HTTHit>& missing_hits) { +StatusCode FPGATrackSimRawToLogicalHitsTool::getUnmapped(std::vector<FPGATrackSimHit>& missing_hits) { std::copy(m_missing_hits.begin(), m_missing_hits.end(), back_inserter(missing_hits)); return StatusCode::SUCCESS; } -const HTTPlaneMap* HTTRawToLogicalHitsTool::getPlaneMap_1st() { - return m_HTTMapping->PlaneMap_1st(); +const FPGATrackSimPlaneMap* FPGATrackSimRawToLogicalHitsTool::getPlaneMap_1st() { + return m_FPGATrackSimMapping->PlaneMap_1st(); } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadLogicalHitsAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadLogicalHitsAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ecba5cfb3704f60758278db94b790ec627300f13 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadLogicalHitsAlg.cxx @@ -0,0 +1,31 @@ +#include "FPGATrackSimReadLogicalHitsAlg.h" +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" + + +FPGATrackSimReadLogicalHitsAlg::FPGATrackSimReadLogicalHitsAlg (const std::string& name, ISvcLocator* pSvcLocator) : + AthAlgorithm(name, pSvcLocator){} + +StatusCode FPGATrackSimReadLogicalHitsAlg::initialize() +{ + ATH_CHECK( m_readOutputTool.retrieve()); + m_event=0; + return StatusCode::SUCCESS; +} + + +StatusCode FPGATrackSimReadLogicalHitsAlg::execute() +{ + FPGATrackSimLogicalEventInputHeader eventInputHeader_1st; + FPGATrackSimLogicalEventInputHeader eventInputHeader_2nd; + FPGATrackSimLogicalEventOutputHeader eventOutputHeader; + bool last = false; + ATH_CHECK(m_readOutputTool->readData(&eventInputHeader_1st, &eventInputHeader_2nd, &eventOutputHeader, last) ); + if (last) return StatusCode::SUCCESS; + ATH_MSG_DEBUG (eventInputHeader_1st); + m_event++; + + return StatusCode::SUCCESS; +} + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadLogicalHitsAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadLogicalHitsAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..817d62d0d95533ecbbe72e4aa51bafd0b96e3c57 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadLogicalHitsAlg.h @@ -0,0 +1,29 @@ +#ifndef FPGATrackSim_READLOGICALHITS_H +#define FPGATrackSim_READLOGICALHITS_H + + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" + +#include "FPGATrackSimInput/IFPGATrackSimEventOutputHeaderTool.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" + + +class FPGATrackSimReadLogicalHitsAlg : public AthAlgorithm { +public: + FPGATrackSimReadLogicalHitsAlg (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FPGATrackSimReadLogicalHitsAlg () = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + + +private: + + ToolHandle<IFPGATrackSimEventOutputHeaderTool> m_readOutputTool {this, "InputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool"}; + + unsigned int m_event = 0U; + +}; + +#endif // FPGATrackSimREADLOGICALHITS_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadRawRandomHitsTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadRawRandomHitsTool.cxx similarity index 65% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadRawRandomHitsTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadRawRandomHitsTool.cxx index 1db512548a5f61dcc75384be10636daf853f115a..687f537d94c9b05959cd226afb497e146e42820e 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTInput/src/HTTReadRawRandomHitsTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadRawRandomHitsTool.cxx @@ -1,17 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTInput/HTTReadRawRandomHitsTool.h" -#include "TrigHTTObjects/HTTEventInputHeader.h" +#include "FPGATrackSimInput/FPGATrackSimReadRawRandomHitsTool.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" - HTTReadRawRandomHitsTool::HTTReadRawRandomHitsTool(const std::string& algname, const std::string &name, const IInterface *ifc) : + FPGATrackSimReadRawRandomHitsTool::FPGATrackSimReadRawRandomHitsTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname,name,ifc) {} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTReadRawRandomHitsTool::initialize(){ +StatusCode FPGATrackSimReadRawRandomHitsTool::initialize(){ // open input file ATH_MSG_INFO ( "Opening input file: " << m_inpath.value() ); @@ -21,15 +21,14 @@ StatusCode HTTReadRawRandomHitsTool::initialize(){ return StatusCode::FAILURE; } - //get the tree - m_EventTree = (TTree*) m_infile->Get("HTTEventTree"); + //get the tree, try old and new versions for backwards compatability + m_EventTree = (TTree*) m_infile->Get("FPGATrackSimEventTree"); if (m_EventTree == nullptr || m_EventTree->GetEntries() == -1 ){ ATH_MSG_FATAL ("Input file: " << m_inpath << " has no entries"); return StatusCode::FAILURE; } - m_nEntries = m_EventTree->GetEntries(); - std::string branchName="HTTEventInputHeader"; + std::string branchName="FPGATrackSimEventInputHeader"; if(!m_EventTree->GetListOfBranches()->FindObject(branchName.c_str())){ ATH_MSG_FATAL ("Branch: " << branchName << " not found!"); return StatusCode::FAILURE; @@ -38,7 +37,7 @@ StatusCode HTTReadRawRandomHitsTool::initialize(){ TBranch *branch = m_EventTree->GetBranch(branchName.c_str()); branch->Print(); - m_eventHeader = new HTTEventInputHeader(); + m_eventHeader = new FPGATrackSimEventInputHeader(); branch->SetAddress(&m_eventHeader); return StatusCode::SUCCESS; @@ -46,12 +45,12 @@ StatusCode HTTReadRawRandomHitsTool::initialize(){ -StatusCode HTTReadRawRandomHitsTool::readData(HTTEventInputHeader* header, bool &last) +StatusCode FPGATrackSimReadRawRandomHitsTool::readData(FPGATrackSimEventInputHeader* header, bool &last) { return readData(header, last, false); // by default with this tool don't reset data } -StatusCode HTTReadRawRandomHitsTool::readData(HTTEventInputHeader* header, bool &last, bool doReset) +StatusCode FPGATrackSimReadRawRandomHitsTool::readData(FPGATrackSimEventInputHeader* header, bool &last, bool doReset) { last = false; @@ -59,7 +58,7 @@ StatusCode HTTReadRawRandomHitsTool::readData(HTTEventInputHeader* header, bool m_EventTree->GetEntry(m_entry++); // Truth Info - HTTOptionalEventInfo optional; + FPGATrackSimOptionalEventInfo optional; int mbc = 0; // to scale up barcodes! // --- Copy old data @@ -101,12 +100,12 @@ StatusCode HTTReadRawRandomHitsTool::readData(HTTEventInputHeader* header, bool { if (rawhit.getBarcode() >= 0) { - HTTMultiTruth origtruth = rawhit.getTruth(); - HTTMultiTruth mt; - HTTMultiTruth::Barcode uniquecode(rawhit.getEventIndex(),rawhit.getBarcode()+mbc); - mt.maximize(uniquecode, rawhit.getBarcodePt()); - rawhit.setBarcode(rawhit.getBarcode() + mbc); - rawhit.setTruth(mt); + FPGATrackSimMultiTruth origtruth = rawhit.getTruth(); + FPGATrackSimMultiTruth mt; + FPGATrackSimMultiTruth::Barcode uniquecode(rawhit.getEventIndex(),rawhit.getBarcode()+mbc); + mt.maximize(uniquecode, rawhit.getBarcodePt()); + rawhit.setBarcode(rawhit.getBarcode() + mbc); + rawhit.setTruth(mt); } header->addHit(rawhit); } @@ -115,13 +114,13 @@ StatusCode HTTReadRawRandomHitsTool::readData(HTTEventInputHeader* header, bool } -StatusCode HTTReadRawRandomHitsTool::writeData(HTTEventInputHeader* /*header*/) { +StatusCode FPGATrackSimReadRawRandomHitsTool::writeData(FPGATrackSimEventInputHeader* /*header*/) { ATH_MSG_FATAL("This tool is being forced to write things. But it is only designed to read things. Don't worry, everything is fine"); return StatusCode::FAILURE;// this tool is not designed to write things } -StatusCode HTTReadRawRandomHitsTool::finalize(){ +StatusCode FPGATrackSimReadRawRandomHitsTool::finalize(){ delete m_eventHeader; return StatusCode::SUCCESS; } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadRawRandomHitsTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadRawRandomHitsTool.h new file mode 100644 index 0000000000000000000000000000000000000000..dcc3825a03d5f715ad45305ef327f6fb0c577c5a --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimReadRawRandomHitsTool.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimREADRAWRANDOMHITSTOOL_H +#define FPGATrackSimREADRAWRANDOMHITSTOOL_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimInput/IFPGATrackSimEventInputHeaderTool.h" + +#include "TFile.h" +#include "TTree.h" + + + +class FPGATrackSimReadRawRandomHitsTool : public extends<AthAlgTool, IFPGATrackSimEventInputHeaderTool> +{ + public: + + FPGATrackSimReadRawRandomHitsTool(const std::string&, const std::string&, const IInterface*); + virtual ~FPGATrackSimReadRawRandomHitsTool() = default; + virtual StatusCode initialize() override; + virtual StatusCode readData(FPGATrackSimEventInputHeader* header, bool &last) override; + virtual StatusCode writeData(FPGATrackSimEventInputHeader* header) override; + virtual StatusCode finalize() override; + + StatusCode readData(FPGATrackSimEventInputHeader* header, bool &last, bool doReset); + + private: + // JO configuration + StringProperty m_inpath {this, "InFileName", "httsim_smartwrapper.root", "input path"}; + + // Internal pointers + unsigned int m_nEntries = 0U; + unsigned m_entry = 0; +}; + +#endif // FPGATrackSimREADRAWRANDOMHINPUTTOOL_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/components/FPGATrackSimInput_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/components/FPGATrackSimInput_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7e8faf4f993a8388602ea660c9aa866be5604c56 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/components/FPGATrackSimInput_entries.cxx @@ -0,0 +1,26 @@ +#include "../FPGATrackSimRawHitsWrapperAlg.h" +#include "../FPGATrackSimRawNtupleWrapperAlg.h" +#include "../FPGATrackSimReadLogicalHitsAlg.h" +#include "../FPGATrackSimLogicalHitsWrapperAlg.h" +#include "../FPGATrackSimReadRawRandomHitsTool.h" +#include "../FPGATrackSimInputHeaderTool.h" +#include "FPGATrackSimInput/FPGATrackSimRawToLogicalHitsTool.h" +#include "../FPGATrackSimDetectorTool.h" +#include "../FPGATrackSimDumpDetStatusAlgo.h" +#include "../FPGATrackSimOutputHeaderTool.h" +#include "../FPGATrackSimDumpOutputStatAlg.h" + + +DECLARE_COMPONENT( FPGATrackSimDetectorTool ) +DECLARE_COMPONENT( FPGATrackSimReadRawRandomHitsTool ) +DECLARE_COMPONENT( FPGATrackSimInputHeaderTool ) +DECLARE_COMPONENT( FPGATrackSimRawToLogicalHitsTool ) +DECLARE_COMPONENT( FPGATrackSimOutputHeaderTool ) + +DECLARE_COMPONENT( FPGATrackSimDumpDetStatusAlgo ) +DECLARE_COMPONENT( FPGATrackSimRawHitsWrapperAlg ) +DECLARE_COMPONENT( FPGATrackSimRawNtupleWrapperAlg ) +DECLARE_COMPONENT( FPGATrackSimReadLogicalHitsAlg) +DECLARE_COMPONENT( FPGATrackSimLogicalHitsWrapperAlg) +DECLARE_COMPONENT( FPGATrackSimDumpOutputStatAlg ) + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimRawToLogicalHitsWrapperAlg_jobOptions.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimRawToLogicalHitsWrapperAlg_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..d6097b8d063883e98604a44322a62b8e5e613e7e --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimRawToLogicalHitsWrapperAlg_jobOptions.py @@ -0,0 +1,99 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +############################################################### +# +# FPGATrackSimWrapper job options file +# +#============================================================== + + +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + +from PyJobTransformsCore.runargs import RunArguments +runArgs = RunArguments() + +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon.Logging import logging +from AthenaCommon.Constants import DEBUG + +import os +import glob + +#-------------------------------------------------------------- +# FPGATrackSim Includes +#-------------------------------------------------------------- + +import FPGATrackSimConfTools.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig + +tags = FPGATrackSimTagConfig.getTags(stage='map') +map_tag = tags['map'] +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) + +#-------------------------------------------------------------- +# Arguments +#-------------------------------------------------------------- + +InputFPGATrackSimRawHitFile = [] +if 'InputFPGATrackSimRawHitFile' in os.environ: + for ex in os.environ['InputFPGATrackSimRawHitFile'].split(','): + files = glob.glob(ex) + if files: + InputFPGATrackSimRawHitFile += files + else: + InputFPGATrackSimRawHitFile += [ex] +else: + InputFPGATrackSimRawHitFile = ["httsim_rawhits_wrap.root"] + + #output +OutputFPGATrackSimRawHitFile = [] +if 'OutputFPGATrackSimRawHitFile' in os.environ : + for ex in os.environ['OutputFPGATrackSimRawHitFile'].split(','): + files = glob.glob(ex) + if files: + OutputFPGATrackSimRawHitFile += files + else: + OutputFPGATrackSimRawHitFile += [ex] +else : + OutputFPGATrackSimRawHitFile = ["httsim_rawhits_wrap.OUT.root"] +msg = logging.getLogger('FPGATrackSimRawToLogicalHitsWrapperAlg') +msg.info("OutFPGATrackSim file %r ", OutputFPGATrackSimRawHitFile) + + + +#-------------------------------------------------------------- +# Create the components +#-------------------------------------------------------------- + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimInputHeaderTool, FPGATrackSimOutputHeaderTool +FPGATrackSimReadInput = FPGATrackSimInputHeaderTool(OutputLevel = DEBUG) +FPGATrackSimReadInput.InFileName=InputFPGATrackSimRawHitFile +FPGATrackSimReadInput.RWstatus="READ" +#FPGATrackSimReadInput.ReadTruthTracks = True +ToolSvc += FPGATrackSimReadInput + +FPGATrackSimWriteOutput = FPGATrackSimOutputHeaderTool("FPGATrackSimWriteOutput", OutputLevel = DEBUG) +FPGATrackSimWriteOutput.InFileName=OutputFPGATrackSimRawHitFile +FPGATrackSimWriteOutput.RWstatus="RECREATE" +ToolSvc += FPGATrackSimWriteOutput + + + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimRawToLogicalHitsTool +FPGATrackSimRawLogic = FPGATrackSimRawToLogicalHitsTool(OutputLevel = DEBUG) +FPGATrackSimRawLogic.SaveOptional = 2 +ToolSvc += FPGATrackSimRawLogic + + + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimLogicalHitsWrapperAlg +wrapper = FPGATrackSimLogicalHitsWrapperAlg(OutputLevel = DEBUG) + +wrapper.InputTool = FPGATrackSimReadInput +wrapper.OutputTool = FPGATrackSimWriteOutput +wrapper.RawToLogicalHitsTool = FPGATrackSimRawLogic +wrapper.Clustering = True +theJob += wrapper + +############################################################### diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimReadLogicalHitsAlg_jobOptions.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimReadLogicalHitsAlg_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..b9217d65209afdafcd2ed57c2776dc37f5c56b83 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimReadLogicalHitsAlg_jobOptions.py @@ -0,0 +1,55 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +############################################################### +# +# FPGATrackSimWrapper job options file +# +#============================================================== + + +from AthenaCommon.AppMgr import ToolSvc +import FPGATrackSimConfTools.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig + +tags = FPGATrackSimTagConfig.getTags(stage='map') +map_tag = tags['map'] +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) + +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + + +import glob +import os +from AthenaCommon.Logging import logging +from AthenaCommon.Constants import DEBUG + +#input +InputFPGATrackSimLogHitFile = [] +if 'InputFPGATrackSimLogHitFile' in os.environ: + for ex in os.environ['InputFPGATrackSimLogHitFile'].split(','): + files = glob.glob(ex) + if files: + InputFPGATrackSimLogHitFile += files + else: + InputFPGATrackSimLogHitFile += [ex] +else : + InputFPGATrackSimLogHitFile = ["httsim_loghits_wrap.OUT.root"] + +msg = logging.getLogger('FPGATrackSimReadLogicalHitsAlg') +msg.info("Input file %r", InputFPGATrackSimLogHitFile) + + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimOutputHeaderTool +FPGATrackSimReadInput = FPGATrackSimOutputHeaderTool("FPGATrackSimReadInput", OutputLevel = DEBUG) +FPGATrackSimReadInput.InFileName=InputFPGATrackSimLogHitFile +FPGATrackSimReadInput.RWstatus="READ" +ToolSvc += FPGATrackSimReadInput + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimReadLogicalHitsAlg +wrapper = FPGATrackSimReadLogicalHitsAlg(OutputLevel = DEBUG) +wrapper.InputTool = FPGATrackSimReadInput + +theJob += wrapper + +############################################################### diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimReadRawHitsWrapperAlg_jobOptions.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimReadRawHitsWrapperAlg_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..dc8ba1f45c667047609d7b864b32ba76893dc0d1 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/FPGATrackSimReadRawHitsWrapperAlg_jobOptions.py @@ -0,0 +1,76 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +############################################################### +# +# FPGATrackSimWrapper job options file +# +#============================================================== +import os +import glob + +import FPGATrackSimConfTools.FPGATrackSimTagConfig as FPGATrackSimTagConfig +import FPGATrackSimMaps.FPGATrackSimMapConfig as FPGATrackSimMapConfig + +tags = FPGATrackSimTagConfig.getTags(stage='map') +map_tag = tags['map'] +MapSvc = FPGATrackSimMapConfig.addMapSvc(map_tag) + +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon.Logging import logging +from AthenaCommon.Constants import DEBUG + + +#input +InputFPGATrackSimRawHitFile = [] +if 'InputFPGATrackSimRawHitFile' in os.environ: + for ex in os.environ['InputFPGATrackSimRawHitFile'].split(','): + files = glob.glob(ex) + if files: + InputFPGATrackSimRawHitFile += files + else: + InputFPGATrackSimRawHitFile += [ex] +else : + InputFPGATrackSimRawHitFile = ["httsim_rawhits_wrap.root"] + +msg = logging.getLogger('FPGATrackSimReadRawHitsWrapperAlg') +msg.info("Input file %r", InputFPGATrackSimRawHitFile) + +#output +OutputFPGATrackSimRawHitFile = [] +if 'OutputFPGATrackSimRawHitFile' in os.environ : + for ex in os.environ['OutputFPGATrackSimRawHitFile'].split(','): + files = glob.glob(ex) + if files: + OutputFPGATrackSimRawHitFile += files + else: + OutputFPGATrackSimRawHitFile += [ex] +else : + OutputFPGATrackSimRawHitFile = ["httsim_rawhits_wrap.OUT.root"] +msg.info("OutFPGATrackSim file %r", OutputFPGATrackSimRawHitFile) + + + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimInputHeaderTool +FPGATrackSimReadInput = FPGATrackSimInputHeaderTool("FPGATrackSimReadInput", OutputLevel = DEBUG) +FPGATrackSimReadInput.InFileName=InputFPGATrackSimRawHitFile +FPGATrackSimReadInput.RWstatus="READ" +#FPGATrackSimReadInput.ReadTruthTracks = True +ToolSvc += FPGATrackSimReadInput + +FPGATrackSimWriteOutput = FPGATrackSimInputHeaderTool("FPGATrackSimWriteInput", OutputLevel = DEBUG) +FPGATrackSimWriteOutput.InFileName=OutputFPGATrackSimRawHitFile +FPGATrackSimWriteOutput.RWstatus="RECREATE" +ToolSvc += FPGATrackSimWriteOutput + +from FPGATrackSimInput.FPGATrackSimInputConf import FPGATrackSimRawHitsWrapperAlg +wrapper = FPGATrackSimRawHitsWrapperAlg(OutputLevel = DEBUG) + +wrapper.InputTool = FPGATrackSimReadInput +wrapper.OutputTool = FPGATrackSimWriteOutput + +theJob += wrapper + +############################################################### diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/test_FPGATrackSimRawToLogicalWrapperAlg.sh b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/test_FPGATrackSimRawToLogicalWrapperAlg.sh new file mode 100755 index 0000000000000000000000000000000000000000..33928b2f4a2c191289f2eeeb8f69ad027cad17a7 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/test_FPGATrackSimRawToLogicalWrapperAlg.sh @@ -0,0 +1,16 @@ +#!/bin/sh +source `which FPGATrackSimInputTestSetup.sh` + +export InputFPGATrackSimRawHitFile=$FPGATrackSimRawHitFile +export OutputFPGATrackSimRawHitFile="fpgatracksim_loghits_wrap.OUT.root" + +athena --evtMax=5 FPGATrackSimInput/FPGATrackSimRawToLogicalHitsWrapperAlg_jobOptions.py + +echo "Produced file $OutputFPGATrackSimRawHitFile, now read it back" + +export InputFPGATrackSimLogHitFile=$OutputFPGATrackSimRawHitFile +athena --evtMax=5 FPGATrackSimInput/FPGATrackSimReadLogicalHitsAlg_jobOptions.py + + + + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/test_FPGATrackSimReadRawHitsWrapperAlg.sh b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/test_FPGATrackSimReadRawHitsWrapperAlg.sh new file mode 100755 index 0000000000000000000000000000000000000000..3d31e647dab6ed4f8993cfe2251f48bd3e5e6cd9 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/test/test_FPGATrackSimReadRawHitsWrapperAlg.sh @@ -0,0 +1,7 @@ +#!/bin/sh +source `which FPGATrackSimInputTestSetup.sh` + +export InputFPGATrackSimRawHitFile=$FPGATrackSimRawHitFile +export OutputFPGATrackSimRawHitFile="httsim_rawhits_wrap.OUT.root" +athena --evtMax=5 FPGATrackSimInput/FPGATrackSimReadRawHitsWrapperAlg_jobOptions.py + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..450c4a86064dff51b5a2580057193510c6064543 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( FPGATrackSimLRT ) + +# External dependencies: +find_package( ROOT COMPONENTS Core Hist RIO ) + +# Component(s) in the package: +atlas_add_library( FPGATrackSimLRTLib + src/*.cxx FPGATrackSimLRT/*.h + PUBLIC_HEADERS FPGATrackSimLRT + LINK_LIBRARIES AthenaBaseComps GaudiKernel FPGATrackSimBanksLib FPGATrackSimHoughLib FPGATrackSimObjectsLib + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} FPGATrackSimMapsLib +) + +atlas_add_component( FPGATrackSimLRT + src/components/*.cxx + LINK_LIBRARIES FPGATrackSimLRTLib +) + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..602296021e1268c1953054faadac7bd2d81e61ee --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimLRT/ diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/HTTLLPRoadFilterTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/FPGATrackSimLLPRoadFilterTool.h similarity index 54% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/HTTLLPRoadFilterTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/FPGATrackSimLLPRoadFilterTool.h index 9cb58d9ad3748fbc00bf564f8b1987c328fb3e6e..ecd1ea26f956777f9999e022dc705954d0aa6d24 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/TrigHTTLRT/HTTLLPRoadFilterTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/FPGATrackSimLLPRoadFilterTool.h @@ -1,33 +1,33 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTRoadFilterTool.h + * @file FPGATrackSimRoadFilterTool.h * @author Tomasz Bold - toold to filter rods & hits for LLP * @date 2021 - * @brief Declares a concrete class that is directly used the HTT main algorithm to filter hits belonging to already found roads + * @brief Declares a concrete class that is directly used the FPGATrackSim main algorithm to filter hits belonging to already found roads */ -#ifndef HTT_LLPROADFILTERTOOL_H -#define HTT_LLPROADFILTERTOOL_H +#ifndef FPGATrackSim_LLPROADFILTERTOOL_H +#define FPGATrackSim_LLPROADFILTERTOOL_H #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" #include <string> #include <vector> -class HTTLLPRoadFilterTool : public AthAlgTool { +class FPGATrackSimLLPRoadFilterTool : public AthAlgTool { public: - HTTLLPRoadFilterTool (const std::string& algname, const std::string& name, const IInterface* ifc); + FPGATrackSimLLPRoadFilterTool (const std::string& algname, const std::string& name, const IInterface* ifc); - StatusCode filterUsedHits(std::vector<HTTTrack> &tracks, - const std::vector<const HTTHit*>& allHits, - std::vector<const HTTHit*>& unusedHits ); + StatusCode filterUsedHits(std::vector<FPGATrackSimTrack> &tracks, + const std::vector<const FPGATrackSimHit*>& allHits, + std::vector<const FPGATrackSimHit*>& unusedHits ); private: // Make a list of all hits used in any track struct HitCompare { - bool operator()(const HTTHit* a, const HTTHit* b) const { + bool operator()(const FPGATrackSimHit* a, const FPGATrackSimHit* b) const { auto hash_a = a->getIdentifierHash(); auto hash_b = b->getIdentifierHash(); if ( hash_a == hash_b ) { diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/IFPGATrackSimRoadFilterTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/IFPGATrackSimRoadFilterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..c4ec2d0909b284cdeb430503e271e56681734250 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/IFPGATrackSimRoadFilterTool.h @@ -0,0 +1,39 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimROADFILTERI_H +#define FPGATrackSimROADFILTERI_H + +/** + * @file IFPGATrackSimRoadFilterTool.h + * @author Elliot Lipeles lipeles@cern.ch + * @date 03/25/21 + * @brief Interface declaration for road filter tools + * + * This class is implemented by + * - FPGATrackSimEtaPatternFilterTool + */ + +#include "GaudiKernel/IAlgTool.h" + +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" + +#include <vector> + + +/** + * A road filter returns a vector of roads given a vector of roads. + * + * Note that the postfilter_roads are owned by the tool, and are cleared at each successive + * call of filterRoads(). + */ + +class IFPGATrackSimRoadFilterTool : virtual public IAlgTool +{ + public: + DeclareInterfaceID(IFPGATrackSimRoadFilterTool, 1, 0); + virtual StatusCode filterRoads(const std::vector<FPGATrackSimRoad*> & prefilter_roads, std::vector<FPGATrackSimRoad*> & postfilter_roads) = 0; +}; + + +#endif diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/IFPGATrackSimRoadFinderTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/IFPGATrackSimRoadFinderTool.h new file mode 100644 index 0000000000000000000000000000000000000000..ad7b825c9f1e038f75936d19f2157b7acd7ae10e --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/FPGATrackSimLRT/IFPGATrackSimRoadFinderTool.h @@ -0,0 +1,46 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimROADFINDERI_H +#define FPGATrackSimROADFINDERI_H + +/** + * @file IFPGATrackSimRoadFinderTool.h + * @author Riley Xu - rixu@cern.ch + * @date 10/23/19 + * @brief Interface declaration for road finder tools + * + * This class is implemented by + * - FPGATrackSimRoadUnionTool + * - FPGATrackSimPatternMatchTool + * - FPGATrackSimSectorMatchTool + * - FPGATrackSimHoughTransformTool + * - FPGATrackSimHough1DShiftTool + */ + +#include "GaudiKernel/IAlgTool.h" + +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" + +#include <vector> + +class FPGATrackSimHit; + + +/** + * A road finder returns a vector of roads given a vector of hits. + * + * Note that the roads are owned by the tool, and are cleared at each successive + * call of getRoads(). + */ + + +class IFPGATrackSimRoadFinderTool : virtual public IAlgTool +{ + public: + DeclareInterfaceID(IFPGATrackSimRoadFinderTool, 1, 0); + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) = 0; +}; + + +#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTHoughTransform_d0phi0_Tool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimHoughTransform_d0phi0_Tool.cxx similarity index 77% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTHoughTransform_d0phi0_Tool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimHoughTransform_d0phi0_Tool.cxx index 5337c1dc2489d5621ec3caa7e887b1b28c675965..6b0f05994512e866ffd91a661d9a49a11ba7681d 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTHoughTransform_d0phi0_Tool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimHoughTransform_d0phi0_Tool.cxx @@ -1,21 +1,21 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTHoughTransform_d0phi0_Tool.cxx + * @file FPGATrackSimHoughTransform_d0phi0_Tool.cxx * @author Riley Xu - riley.xu@cern.ch * @date October 31st, 2020 * @brief See header file. */ -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" -#include "TrigHTTMaps/HTTRegionMap.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTBanks/HTTSectorBank.h" -#include "HTTHoughTransform_d0phi0_Tool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimBanks/FPGATrackSimSectorBank.h" +#include "FPGATrackSimHoughTransform_d0phi0_Tool.h" #include "TH2.h" @@ -34,16 +34,16 @@ static inline std::string instance_name(std::string const & s); /////////////////////////////////////////////////////////////////////////////// // AthAlgTool -HTTHoughTransform_d0phi0_Tool::HTTHoughTransform_d0phi0_Tool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimHoughTransform_d0phi0_Tool::FPGATrackSimHoughTransform_d0phi0_Tool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc), m_name(instance_name(name)), m_monitorFile((m_name + ".root").c_str(), "RECREATE") { - declareInterface<IHTTRoadFinderTool>(this); + declareInterface<IFPGATrackSimRoadFinderTool>(this); } -StatusCode HTTHoughTransform_d0phi0_Tool::initialize() +StatusCode FPGATrackSimHoughTransform_d0phi0_Tool::initialize() { // Move temp variables over from properties to struct m_parMin.phi = m_tempMin_phi; @@ -58,9 +58,9 @@ StatusCode HTTHoughTransform_d0phi0_Tool::initialize() ATH_MSG_INFO("Hit Extend: " << to_string(const_cast<std::vector<unsigned>&>(m_hitExtend_x.value()))); // Retrieve info - ATH_CHECK(m_HTTBankSvc.retrieve()); - ATH_CHECK(m_HTTMapping.retrieve()); - m_nLayers = m_HTTMapping->PlaneMap_1st()->getNLogiLayers(); + ATH_CHECK(m_FPGATrackSimBankSvc.retrieve()); + ATH_CHECK(m_FPGATrackSimMapping.retrieve()); + m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); // Error checking bool ok = false; @@ -92,7 +92,7 @@ StatusCode HTTHoughTransform_d0phi0_Tool::initialize() if (m_idealGeoRoads) { if (m_useSectors) { - ATH_MSG_WARNING("initialize() idealGeoRoads conflicts with useSectors, switching off HTT sector matching"); + ATH_MSG_WARNING("initialize() idealGeoRoads conflicts with useSectors, switching off FPGATrackSim sector matching"); m_useSectors = false; } @@ -137,7 +137,7 @@ StatusCode HTTHoughTransform_d0phi0_Tool::initialize() } -StatusCode HTTHoughTransform_d0phi0_Tool::finalize() +StatusCode FPGATrackSimHoughTransform_d0phi0_Tool::finalize() { m_monitorFile.Write(); return StatusCode::SUCCESS; @@ -147,7 +147,7 @@ StatusCode HTTHoughTransform_d0phi0_Tool::finalize() /////////////////////////////////////////////////////////////////////////////// // Main Algorithm -StatusCode HTTHoughTransform_d0phi0_Tool::getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) +StatusCode FPGATrackSimHoughTransform_d0phi0_Tool::getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) { ATH_MSG_DEBUG("Event: " << m_event << ", # hits: " << hits.size()); roads.clear(); @@ -166,7 +166,7 @@ StatusCode HTTHoughTransform_d0phi0_Tool::getRoads(const std::vector<const HTTHi } roads.reserve(m_roads.size()); - for (HTTRoad_Hough & r : m_roads) roads.push_back(&r); + for (FPGATrackSimRoad_Hough & r : m_roads) roads.push_back(&r); if (roads.empty() && m_event >= 5 && m_event < 200) drawImage(image, m_name + "_" + std::to_string(m_event)); @@ -176,12 +176,12 @@ StatusCode HTTHoughTransform_d0phi0_Tool::getRoads(const std::vector<const HTTHi } -HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<HTTHit const *> const & hits, unsigned const scale) const +FPGATrackSimHoughTransform_d0phi0_Tool::Image FPGATrackSimHoughTransform_d0phi0_Tool::createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<FPGATrackSimHit const *> const & hits, unsigned const scale) const { Image image(m_imageSize_y, m_imageSize_x); - for (HTTHit const * hit : hits) { + for (FPGATrackSimHit const * hit : hits) { bool belong1 = false, belong2 = false; for (auto layer : combine_layers) { @@ -193,7 +193,7 @@ HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::createLayerI } if ((!belong1 && !m_stereo) || - (m_subRegion >= 0 && !m_HTTMapping->SubRegionMap()->isInRegion(m_subRegion, *hit))) { + (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit))) { continue; } else if (m_stereo && belong1) { /* Intentionally blank */ } @@ -224,7 +224,7 @@ HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::createLayerI return image; } -HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::createImage(std::vector<HTTHit const *> const & hits) const +FPGATrackSimHoughTransform_d0phi0_Tool::Image FPGATrackSimHoughTransform_d0phi0_Tool::createImage(std::vector<FPGATrackSimHit const *> const & hits) const { Image image(m_imageSize_y, m_imageSize_x); @@ -244,7 +244,7 @@ HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::createImage( return image; } -HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::convolute(Image const & image) const +FPGATrackSimHoughTransform_d0phi0_Tool::Image FPGATrackSimHoughTransform_d0phi0_Tool::convolute(Image const & image) const { Image out(m_imageSize_y, m_imageSize_x); @@ -270,7 +270,7 @@ HTTHoughTransform_d0phi0_Tool::Image HTTHoughTransform_d0phi0_Tool::convolute(Im return out; } -bool HTTHoughTransform_d0phi0_Tool::passThreshold(Image const & image, unsigned x, unsigned y) const +bool FPGATrackSimHoughTransform_d0phi0_Tool::passThreshold(Image const & image, unsigned x, unsigned y) const { // Pass window threshold unsigned width = m_threshold.size() / 2; @@ -333,11 +333,11 @@ static inline std::string instance_name(std::string const & s) return s; } -double HTTHoughTransform_d0phi0_Tool::yToX(double y, HTTHit const * hit) const +double FPGATrackSimHoughTransform_d0phi0_Tool::yToX(double y, FPGATrackSimHit const * hit) const { double x = 0; - if (m_par_x == HTTTrackPars::IPHI && m_par_y == HTTTrackPars::ID0) { + if (m_par_x == FPGATrackSimTrackPars::IPHI && m_par_y == FPGATrackSimTrackPars::ID0) { double r = hit->getR(); // TODO check this, and units double phi_hit = hit->getGPhi(); // TODO check this, and units x = -y/r + phi_hit; @@ -351,7 +351,7 @@ double HTTHoughTransform_d0phi0_Tool::yToX(double y, HTTHit const * hit) const // Find the min/max x bins of the hit's line, in each y bin. Max is exclusive. // Note this assumes yToX is monotonic. Returns {0, 0} if hit lies out of bounds. -std::pair<unsigned, unsigned> HTTHoughTransform_d0phi0_Tool::yToXBins(size_t yBin_min, size_t yBin_max, HTTHit const * hit) const +std::pair<unsigned, unsigned> FPGATrackSimHoughTransform_d0phi0_Tool::yToXBins(size_t yBin_min, size_t yBin_max, FPGATrackSimHit const * hit) const { // Get float values double x_min = yToX(m_bins_y[yBin_min], hit); @@ -375,7 +375,7 @@ std::pair<unsigned, unsigned> HTTHoughTransform_d0phi0_Tool::yToXBins(size_t yBi return { x_bin_min, x_bin_max }; } -void HTTHoughTransform_d0phi0_Tool::matchIdealGeoSector(HTTRoad_Hough & r) const +void FPGATrackSimHoughTransform_d0phi0_Tool::matchIdealGeoSector(FPGATrackSimRoad_Hough & r) const { float pt = r.getY()*0.001; // convert to MeV auto bounds = std::equal_range(htt::QOVERPT_BINS.begin(),htt::QOVERPT_BINS.end(),pt); @@ -393,26 +393,26 @@ void HTTHoughTransform_d0phi0_Tool::matchIdealGeoSector(HTTRoad_Hough & r) const wc_layers |= (0x1 << il); r.setWCLayers(wc_layers); - std::unique_ptr<HTTHit> wcHit = std::unique_ptr<HTTHit>(new HTTHit()); + std::unique_ptr<FPGATrackSimHit> wcHit = std::unique_ptr<FPGATrackSimHit>(new FPGATrackSimHit()); wcHit->setHitType(HitType::wildcard); wcHit->setLayer(il); - wcHit->setDetType(m_HTTMapping->PlaneMap_1st()->getDetType(il)); - r.setHits(il,std::vector<const HTTHit*>({wcHit.get()})); + wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_1st()->getDetType(il)); + r.setHits(il,std::vector<const FPGATrackSimHit*>({wcHit.get()})); } else modules.push_back(sectorbin); } - const HTTSectorBank* sectorbank = m_HTTBankSvc->SectorBank_1st(); + const FPGATrackSimSectorBank* sectorbank = m_FPGATrackSimBankSvc->SectorBank_1st(); r.setSector(sectorbank->findSector(modules)); } // Create road via hits only -HTTRoad_Hough HTTHoughTransform_d0phi0_Tool::createRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y) const { +FPGATrackSimRoad_Hough FPGATrackSimHoughTransform_d0phi0_Tool::createRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) const { // Get the road hits - std::vector<const HTTHit*> road_hits; + std::vector<const FPGATrackSimHit*> road_hits; layer_bitmask_t hitLayers = 0; - for (const HTTHit * hit : hits) { + for (const FPGATrackSimHit * hit : hits) { road_hits.push_back(hit); hitLayers |= 1 << hit->getLayer(); } @@ -420,7 +420,7 @@ HTTRoad_Hough HTTHoughTransform_d0phi0_Tool::createRoad(std::unordered_set<const auto sorted_hits = ::sortByLayer(road_hits); sorted_hits.resize(m_nLayers); // If no hits in last layer, return from sortByLayer will be too short - HTTRoad_Hough r; + FPGATrackSimRoad_Hough r; r.setRoadID(m_roads.size()); r.setPID(y * m_imageSize_y + x); if (m_idealGeoRoads) matchIdealGeoSector(r); @@ -433,12 +433,12 @@ HTTRoad_Hough HTTHoughTransform_d0phi0_Tool::createRoad(std::unordered_set<const } // Creates a road from hits that pass through the given bin (x, y), and pushes it onto m_roads -HTTRoad_Hough HTTHoughTransform_d0phi0_Tool::createRoad(std::vector<std::vector<const HTTHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) const +FPGATrackSimRoad_Hough FPGATrackSimHoughTransform_d0phi0_Tool::createRoad(std::vector<std::vector<const FPGATrackSimHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) const { - HTTRoad_Hough r; + FPGATrackSimRoad_Hough r; r.setRoadID(m_roads.size()); r.setPID(y * m_imageSize_y + x); - if (m_useSectors) r.setSector(m_HTTBankSvc->SectorBank_1st()->findSector(hits)); + if (m_useSectors) r.setSector(m_FPGATrackSimBankSvc->SectorBank_1st()->findSector(hits)); else if (m_idealGeoRoads) matchIdealGeoSector(r); r.setHitLayers(hitLayers); r.setHits(hits); @@ -451,10 +451,10 @@ HTTRoad_Hough HTTHoughTransform_d0phi0_Tool::createRoad(std::vector<std::vector< // Creates a road from hits that pass through the given bin (x, y), and pushes it onto m_roads -void HTTHoughTransform_d0phi0_Tool::addRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y) +void FPGATrackSimHoughTransform_d0phi0_Tool::addRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) { layer_bitmask_t hitLayers = 0; - for (HTTHit const * hit : hits) { + for (FPGATrackSimHit const * hit : hits) { hitLayers |= 1 << hit->getLayer(); } @@ -464,13 +464,13 @@ void HTTHoughTransform_d0phi0_Tool::addRoad(std::unordered_set<const HTTHit*> co } // Use this version of addRoad when hit tracing is turned off -void HTTHoughTransform_d0phi0_Tool::addRoad(std::vector<const HTTHit*> const & hits, unsigned x, unsigned y) +void FPGATrackSimHoughTransform_d0phi0_Tool::addRoad(std::vector<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) { // Get the road hits - std::vector<HTTHit const *> road_hits; + std::vector<FPGATrackSimHit const *> road_hits; layer_bitmask_t hitLayers = 0; - for (const HTTHit * hit : hits) { - if (m_subRegion >= 0 && !m_HTTMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; + for (const FPGATrackSimHit * hit : hits) { + if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; // get bin scaling for the hit unsigned bin_scale = 0; @@ -503,7 +503,7 @@ void HTTHoughTransform_d0phi0_Tool::addRoad(std::vector<const HTTHit*> const & h // For debug use -void HTTHoughTransform_d0phi0_Tool::drawImage(Image const & image, std::string const & name) +void FPGATrackSimHoughTransform_d0phi0_Tool::drawImage(Image const & image, std::string const & name) { m_monitorFile.cd(); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTHoughTransform_d0phi0_Tool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimHoughTransform_d0phi0_Tool.h similarity index 64% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTHoughTransform_d0phi0_Tool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimHoughTransform_d0phi0_Tool.h index 334f332748ccb0d252032d30bdadac7ee5cebf8c..475ba3f095f7ae68a53b6be59cfdb4a5f9968a6d 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTHoughTransform_d0phi0_Tool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimHoughTransform_d0phi0_Tool.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTHOUGHTRANSFORM_D0PHI0_TOOL_H -#define HTTHOUGHTRANSFORM_D0PHI0_TOOL_H +#ifndef FPGATrackSimHOUGHTRANSFORM_D0PHI0_TOOL_H +#define FPGATrackSimHOUGHTRANSFORM_D0PHI0_TOOL_H /** - * @file HTTHoughTransform_d0phi0_Tool.h + * @file FPGATrackSimHoughTransform_d0phi0_Tool.h * @brief Implements road finding using a Hough transform in d0 vs phi0, assuming q/pt = 0 * (i.e. a straight track). * @@ -14,14 +14,14 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTHough/IHTTRoadFinderTool.h" -#include "TrigHTTBanks/ITrigHTTBankSvc.h" -#include "TrigHTTMaps/ITrigHTTMappingSvc.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" +#include "FPGATrackSimBanks/IFPGATrackSimBankSvc.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" #include "TFile.h" @@ -30,34 +30,34 @@ #include <utility> #include <unordered_set> -class ITrigHTTBankSvc; -class ITrigHTTMappingSvc; +class IFPGATrackSimBankSvc; +class IFPGATrackSimMappingSvc; -class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinderTool> +class FPGATrackSimHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IFPGATrackSimRoadFinderTool> { public: /////////////////////////////////////////////////////////////////////// // AthAlgTool - HTTHoughTransform_d0phi0_Tool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimHoughTransform_d0phi0_Tool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; virtual StatusCode finalize() override; /////////////////////////////////////////////////////////////////////// - // IHTTRoadFinderTool + // IFPGATrackSimRoadFinderTool - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) override; + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) override; private: /////////////////////////////////////////////////////////////////////// // Handles - ServiceHandle<ITrigHTTBankSvc> m_HTTBankSvc {this, "TrigHTTBankSvc", "TrigHTTBankSvc"}; - ServiceHandle<ITrigHTTMappingSvc> m_HTTMapping {this, "TrigHTTMappingSvc", "TrigHTTMappingSvc"}; + ServiceHandle<IFPGATrackSimBankSvc> m_FPGATrackSimBankSvc {this, "FPGATrackSimBankSvc", "FPGATrackSimBankSvc"}; + ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}; /////////////////////////////////////////////////////////////////////// @@ -83,11 +83,11 @@ class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinder Gaudi::Property <bool> m_useSectors { this, "useSectors", false, "Will reverse calculate the sector for track-fitting purposes"}; Gaudi::Property <bool> m_idealGeoRoads { this, "IdealGeoRoads", false, "Set sectors to use ideal geometry fit constants"}; - HTTTrackPars::pars_index m_par_x = HTTTrackPars::IPHI; // sets phi as the x variable - HTTTrackPars::pars_index m_par_y = HTTTrackPars::ID0; // sets d0 as the y variable + FPGATrackSimTrackPars::pars_index m_par_x = FPGATrackSimTrackPars::IPHI; // sets phi as the x variable + FPGATrackSimTrackPars::pars_index m_par_y = FPGATrackSimTrackPars::ID0; // sets d0 as the y variable - HTTTrackPars m_parMin; // These are the bounds of the image, i.e. the region of interest - HTTTrackPars m_parMax; // Only the two parameters chosen above are used + FPGATrackSimTrackPars m_parMin; // These are the bounds of the image, i.e. the region of interest + FPGATrackSimTrackPars m_parMax; // Only the two parameters chosen above are used unsigned m_nCombineLayers = 0U; // number of layers after combined std::vector< std::vector<unsigned> > m_combineLayer2D; // 2d array of combined layers i.e. [[1,2,3],[0,4,5],[6,7]] will combine (L1, L2, L3), (L0, L4, L5), (L6, L7) @@ -95,7 +95,7 @@ class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinder /////////////////////////////////////////////////////////////////////// // Convenience - unsigned m_nLayers = 0U; // alias to m_HTTMapping->PlaneMap1stStage()->getNLogiLayers(); + unsigned m_nLayers = 0U; // alias to m_FPGATrackSimMapping->PlaneMap1stStage()->getNLogiLayers(); double m_step_x = 0; // step size of the bin boundaries in x double m_step_y = 0; // step size of the bin boundaries in y @@ -105,7 +105,7 @@ class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinder // These are calculated from m_parMin/Max. std::unordered_map<int, std::vector<size_t>> m_yBins_scaled; // saved all scaled binnings - typedef vector2D<std::pair<int, std::unordered_set<const HTTHit*>>> Image; + typedef vector2D<std::pair<int, std::unordered_set<const FPGATrackSimHit*>>> Image; // An image is a 2d array of points, where each point has a value. // This starts as the number of hits (or hit layers), but will // change after the convolution. Also stored are all hits that @@ -115,7 +115,7 @@ class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinder /////////////////////////////////////////////////////////////////////// // Event Storage - std::vector<HTTRoad_Hough> m_roads; + std::vector<FPGATrackSimRoad_Hough> m_roads; /////////////////////////////////////////////////////////////////////// // Metadata and Monitoring @@ -127,22 +127,22 @@ class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinder /////////////////////////////////////////////////////////////////////// // Core - // std::vector<HTTHit const *> filterHits(std::vector<HTTHit const *> const & hits) const; - Image createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<HTTHit const *> const & hits, unsigned const scale) const; - Image createImage(std::vector<HTTHit const *> const & hits) const; + // std::vector<FPGATrackSimHit const *> filterHits(std::vector<FPGATrackSimHit const *> const & hits) const; + Image createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<FPGATrackSimHit const *> const & hits, unsigned const scale) const; + Image createImage(std::vector<FPGATrackSimHit const *> const & hits) const; Image convolute(Image const & image) const; /////////////////////////////////////////////////////////////////////// // Helpers - double yToX(double y, HTTHit const * h) const; - std::pair<unsigned, unsigned> yToXBins(size_t yBin_min, size_t yBin_max, HTTHit const * hit) const; + double yToX(double y, FPGATrackSimHit const * h) const; + std::pair<unsigned, unsigned> yToXBins(size_t yBin_min, size_t yBin_max, FPGATrackSimHit const * hit) const; bool passThreshold(Image const & image, unsigned x, unsigned y) const; - void matchIdealGeoSector(HTTRoad_Hough & r) const; - HTTRoad_Hough createRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y) const; - HTTRoad_Hough createRoad(std::vector<std::vector<const HTTHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) const; - void addRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y); - void addRoad(std::vector<const HTTHit*> const & hits, unsigned x, unsigned y); + void matchIdealGeoSector(FPGATrackSimRoad_Hough & r) const; + FPGATrackSimRoad_Hough createRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) const; + FPGATrackSimRoad_Hough createRoad(std::vector<std::vector<const FPGATrackSimHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) const; + void addRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y); + void addRoad(std::vector<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y); int conv(unsigned y, unsigned x) { return m_conv[y * m_convSize_x + x]; } // NOTE: y index is first void drawImage(Image const & image, std::string const & name); @@ -150,4 +150,4 @@ class HTTHoughTransform_d0phi0_Tool : public extends <AthAlgTool, IHTTRoadFinder -#endif // HTTHOUGHTRANSFORM_D0PHI0_TOOL_H +#endif // FPGATrackSimHOUGHTRANSFORM_D0PHI0_TOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPDoubletHoughTransformTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPDoubletHoughTransformTool.cxx similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPDoubletHoughTransformTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPDoubletHoughTransformTool.cxx index 34e7069e0d0096264c5806ef90c8da14e195c939..6ccac9a6b7f7cee33c5f8c2abff4a076e846334e 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPDoubletHoughTransformTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPDoubletHoughTransformTool.cxx @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #include "TH2.h" -#include "HTTLLPDoubletHoughTransformTool.h" +#include "FPGATrackSimLLPDoubletHoughTransformTool.h" // simple 2D vector with basic arithmetics typedef double fp_t; // floating point type alias, can change it to float from double @@ -36,14 +36,14 @@ double crossProduct( const pvec& a, const pvec& b ) { } -HTTLLPDoubletHoughTransformTool::HTTLLPDoubletHoughTransformTool(const std::string& algname, const std::string& name , const IInterface* ifc) +FPGATrackSimLLPDoubletHoughTransformTool::FPGATrackSimLLPDoubletHoughTransformTool(const std::string& algname, const std::string& name , const IInterface* ifc) : base_class(algname, name, ifc) { - declareInterface<IHTTRoadFinderTool>(this); + declareInterface<IFPGATrackSimRoadFinderTool>(this); } -StatusCode HTTLLPDoubletHoughTransformTool::initialize() { +StatusCode FPGATrackSimLLPDoubletHoughTransformTool::initialize() { if (m_imageSize_y %2 == 1) { ATH_MSG_ERROR("Can not have odd number " << m_imageSize_y << " of bins in q/pT - will result in division by 0"); return StatusCode::FAILURE; @@ -54,20 +54,20 @@ StatusCode HTTLLPDoubletHoughTransformTool::initialize() { return StatusCode::SUCCESS; } -StatusCode HTTLLPDoubletHoughTransformTool::finalize() { - ATH_MSG_INFO("Number of events procesed by the HTTLLPDoubletHoughTransformTool " << m_eventsProcessed << " roads " << m_roadsGenerated); +StatusCode FPGATrackSimLLPDoubletHoughTransformTool::finalize() { + ATH_MSG_INFO("Number of events procesed by the FPGATrackSimLLPDoubletHoughTransformTool " << m_eventsProcessed << " roads " << m_roadsGenerated); return StatusCode::SUCCESS; } -StatusCode HTTLLPDoubletHoughTransformTool::getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) { +StatusCode FPGATrackSimLLPDoubletHoughTransformTool::getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) { roads.clear(); m_roads.clear(); m_eventsProcessed++; Image image(m_imageSize_x, m_imageSize_y); // not quite optimal to allocate this memory in evey event, but following nominal HT for (unsigned ihit1 = 0; ihit1 < hits.size(); ihit1++) { - const HTTHit *hit1 = hits[ihit1]; + const FPGATrackSimHit *hit1 = hits[ihit1]; for (unsigned ihit2 = ihit1+1; ihit2 < hits.size(); ihit2++) { - const HTTHit *hit2 = hits[ihit2]; + const FPGATrackSimHit *hit2 = hits[ihit2]; ATH_MSG_DEBUG("Hits pair R: " << hit1->getR() << " " << hit2->getR()); //TODO: replace with qualification by layer IDs const double radiusDifference = hit2->getR() - hit1->getR(); @@ -93,13 +93,13 @@ StatusCode HTTLLPDoubletHoughTransformTool::getRoads(const std::vector<const HTT } } roads.reserve(m_roads.size()); - for (HTTRoad_Hough & r : m_roads) roads.push_back(&r); + for (FPGATrackSimRoad_Hough & r : m_roads) roads.push_back(&r); m_event++; return StatusCode::SUCCESS; } -StatusCode HTTLLPDoubletHoughTransformTool::fillImage(const HTTHit *hit1, const HTTHit *hit2, Image& image) const { +StatusCode FPGATrackSimLLPDoubletHoughTransformTool::fillImage(const FPGATrackSimHit *hit1, const FPGATrackSimHit *hit2, Image& image) const { const pvec p1 {{hit1->getX(), hit1->getY()}}; const pvec p2 {{hit2->getX(), hit2->getY()}}; const pvec halfDiff = (p2 - p1)*0.5; @@ -139,11 +139,11 @@ StatusCode HTTLLPDoubletHoughTransformTool::fillImage(const HTTHit *hit1, const return StatusCode::SUCCESS; } -HTTRoad_Hough HTTLLPDoubletHoughTransformTool::createRoad(std::unordered_set<const HTTHit*> const & hits, unsigned /*x*/, unsigned /*y*/) const { +FPGATrackSimRoad_Hough FPGATrackSimLLPDoubletHoughTransformTool::createRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned /*x*/, unsigned /*y*/) const { // Get the road hits - std::vector<const HTTHit*> road_hits; + std::vector<const FPGATrackSimHit*> road_hits; layer_bitmask_t hitLayers = 0; - for (const HTTHit * hit : hits) + for (const FPGATrackSimHit * hit : hits) { road_hits.push_back(hit); hitLayers |= 1 << hit->getLayer(); @@ -152,14 +152,14 @@ HTTRoad_Hough HTTLLPDoubletHoughTransformTool::createRoad(std::unordered_set<con auto sorted_hits = ::sortByLayer(road_hits); sorted_hits.resize(8); // If no hits in last layer, return from sortByLayer will be too short - HTTRoad_Hough r; + FPGATrackSimRoad_Hough r; r.setHitLayers(hitLayers); r.setHits(sorted_hits); return r; } -bool HTTLLPDoubletHoughTransformTool::passThreshold(Image const & image, int x, int y) const { +bool FPGATrackSimLLPDoubletHoughTransformTool::passThreshold(Image const & image, int x, int y) const { const int count = image(x,y).first; const float d0 = xtod0(x); if ( std::abs(d0) < 50.0 && count >= m_threshold50 ) return true; @@ -168,7 +168,7 @@ bool HTTLLPDoubletHoughTransformTool::passThreshold(Image const & image, int x, return false; } -bool HTTLLPDoubletHoughTransformTool::isLocalMaxima(Image const & image, int x, int y) const { +bool FPGATrackSimLLPDoubletHoughTransformTool::isLocalMaxima(Image const & image, int x, int y) const { const auto centerValue = image(x,y).first; for ( int xaround = std::min(x-1, 0); xaround <= std::max((int)m_imageSize_x-1, x+1); xaround++ ) { for ( int yaround = std::min(y-1, 0); yaround <= std::max((int)m_imageSize_y-1, y+1); yaround++ ) { @@ -179,7 +179,7 @@ bool HTTLLPDoubletHoughTransformTool::isLocalMaxima(Image const & image, int x, return true; } -void HTTLLPDoubletHoughTransformTool::drawImage(Image const & image) const { +void FPGATrackSimLLPDoubletHoughTransformTool::drawImage(Image const & image) const { TH2I h(("event"+std::to_string( m_event )).c_str(), "LLP Doublet Hough space;d_{0}[mm];q/pT [e/GeV]", m_imageSize_x, -m_d0_range, m_d0_range, diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPDoubletHoughTransformTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPDoubletHoughTransformTool.h similarity index 62% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPDoubletHoughTransformTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPDoubletHoughTransformTool.h index aef3a2cb5396f83db47ebde9d7dbf93520600b37..b8004d88cdfc4c758ecbeaf121f57f75978e4d73 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPDoubletHoughTransformTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPDoubletHoughTransformTool.h @@ -1,7 +1,7 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTLLPDOUBLETHOUGHTRANSFORMTOOL_H -#define HTTLLPDOUBLETHOUGHTRANSFORMTOOL_H +#ifndef FPGATrackSimLLPDOUBLETHOUGHTRANSFORMTOOL_H +#define FPGATrackSimLLPDOUBLETHOUGHTRANSFORMTOOL_H #include "TFile.h" @@ -9,12 +9,12 @@ #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTVectors.h" -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTTrackPars.h" -#include "TrigHTTHough/IHTTRoadFinderTool.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimVectors.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" +#include "FPGATrackSimHough/IFPGATrackSimRoadFinderTool.h" /* @@ -22,16 +22,16 @@ Implments HoughT for d0, q/pt using hit doublets Hough space x -> d0 , y -> q/pt */ -class HTTLLPDoubletHoughTransformTool : public extends <AthAlgTool, IHTTRoadFinderTool > +class FPGATrackSimLLPDoubletHoughTransformTool : public extends <AthAlgTool, IFPGATrackSimRoadFinderTool > { public: - HTTLLPDoubletHoughTransformTool(const std::string&, const std::string&, const IInterface*); + FPGATrackSimLLPDoubletHoughTransformTool(const std::string&, const std::string&, const IInterface*); virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode getRoads(const std::vector<const HTTHit*> & hits, std::vector<HTTRoad*> & roads) override; + virtual StatusCode getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads) override; private: @@ -46,8 +46,8 @@ private: Gaudi::Property <bool> m_continuous { this, "continuous", true, "assure that there is continuity of the line (i.e. middle bins in d0 are filled when one q/pT step would result in a hole)"}; - typedef vector2D<std::pair<int, std::unordered_set<const HTTHit*>>> Image; - std::vector<HTTRoad_Hough> m_roads; + typedef vector2D<std::pair<int, std::unordered_set<const FPGATrackSimHit*>>> Image; + std::vector<FPGATrackSimRoad_Hough> m_roads; const double m_acceptedDistanceBetweenLayersMin = 200; // min R disstance for hits pair filtering const double m_acceptedDistanceBetweenLayersMax = 600; @@ -55,11 +55,11 @@ private: double m_step_x = 0; // helpers (accumulator granularity) double m_step_y = 0; - StatusCode fillImage(const HTTHit *hit1, const HTTHit *hit2, Image& image) const; + StatusCode fillImage(const FPGATrackSimHit *hit1, const FPGATrackSimHit *hit2, Image& image) const; bool passThreshold(Image const & image, int x, int y) const; bool isLocalMaxima(Image const & image, int x, int y) const; - HTTRoad_Hough createRoad(std::unordered_set<const HTTHit*> const & hits, unsigned x, unsigned y) const; + FPGATrackSimRoad_Hough createRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) const; unsigned m_event = 0; void drawImage(Image const & image) const; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPRoadFilterTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPRoadFilterTool.cxx similarity index 58% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPRoadFilterTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPRoadFilterTool.cxx index 122e9383784ba9957a200ba24dca8e3fba4c7898..9a5f4a968cdffbfaaa35a5668f63309ce9067e2c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTLRT/src/HTTLLPRoadFilterTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/FPGATrackSimLLPRoadFilterTool.cxx @@ -1,30 +1,30 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "TrigHTTLRT/HTTLLPRoadFilterTool.h" +#include "FPGATrackSimLRT/FPGATrackSimLLPRoadFilterTool.h" -HTTLLPRoadFilterTool::HTTLLPRoadFilterTool (const std::string& algname, const std::string& name, const IInterface* ifc) +FPGATrackSimLLPRoadFilterTool::FPGATrackSimLLPRoadFilterTool (const std::string& algname, const std::string& name, const IInterface* ifc) : AthAlgTool(algname, name, ifc) {} -StatusCode HTTLLPRoadFilterTool::filterUsedHits( std::vector<HTTTrack> &tracks, - const std::vector<const HTTHit*>& allHits, - std::vector<const HTTHit*>& unusedHits ) { - std::vector<HTTHit> hitsInTracksVec; +StatusCode FPGATrackSimLLPRoadFilterTool::filterUsedHits( std::vector<FPGATrackSimTrack> &tracks, + const std::vector<const FPGATrackSimHit*>& allHits, + std::vector<const FPGATrackSimHit*>& unusedHits ) { + std::vector<FPGATrackSimHit> hitsInTracksVec; for (const auto& track : tracks) { - for (const HTTHit& hit : track.getHTTHits()) { + for (const FPGATrackSimHit& hit : track.getFPGATrackSimHits()) { if (hit.isReal()) { hitsInTracksVec.push_back(hit); } } } - std::set<const HTTHit*, HitCompare > hitsInTracks; + std::set<const FPGATrackSimHit*, HitCompare > hitsInTracks; for ( auto& hit : hitsInTracksVec) { hitsInTracks.insert(&hit); } ATH_MSG_DEBUG("Number of hits from tracks " << hitsInTracks.size()); - std::set<const HTTHit*, HitCompare> orderedHits; + std::set<const FPGATrackSimHit*, HitCompare> orderedHits; for ( auto hit: allHits){ if ( hit->isReal()) { orderedHits.insert(hit); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/components/FPGATrackSimLRT_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/components/FPGATrackSimLRT_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3eaf8c8c48de34daaba23c72e706716164e782b --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimLRT/src/components/FPGATrackSimLRT_entries.cxx @@ -0,0 +1,7 @@ +#include "../FPGATrackSimHoughTransform_d0phi0_Tool.h" +#include "../FPGATrackSimLLPDoubletHoughTransformTool.h" +#include "FPGATrackSimLRT/FPGATrackSimLLPRoadFilterTool.h" + +DECLARE_COMPONENT( FPGATrackSimHoughTransform_d0phi0_Tool ) +DECLARE_COMPONENT( FPGATrackSimLLPDoubletHoughTransformTool ) +DECLARE_COMPONENT( FPGATrackSimLLPRoadFilterTool ) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..27f021534d67d5774d5bdb11e21eb250ac816a7f --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/CMakeLists.txt @@ -0,0 +1,44 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( FPGATrackSimMaps ) + +# External dependencies: +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) +find_package( Boost ) +find_package( lwtnn ) + +# Component(s) in the package: +atlas_add_library( + FPGATrackSimMapsLib src/*.cxx FPGATrackSimMaps/*.h + PUBLIC_HEADERS FPGATrackSimMaps + INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} + LINK_LIBRARIES ${LWTNN_LIBRARIES} GaudiKernel FPGATrackSimConfToolsLib FPGATrackSimObjectsLib + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AsgMessagingLib AthenaBaseComps PathResolver +) + +atlas_add_component( + FPGATrackSimMaps src/components/*.cxx + LINK_LIBRARIES FPGATrackSimMapsLib FPGATrackSimConfToolsLib +) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) + +# Tests in the package: +atlas_add_test( FPGATrackSimPlaneMap + SOURCES test/FPGATrackSimPlaneMap_test.cxx + LINK_LIBRARIES AthenaKernel FPGATrackSimMapsLib TestTools + PROPERTIES + TIMEOUT 120 +) + +atlas_add_test( FPGATrackSimRegionMap + SOURCES test/FPGATrackSimRegionMap_test.cxx + LINK_LIBRARIES AthenaKernel FPGATrackSimMapsLib TestTools + PROPERTIES + TIMEOUT 120 +) + + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..00435fbf30ebd89173eabc9d9832cb59d2c54a48 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimMaps/ diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimClusteringToolI.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimClusteringToolI.h new file mode 100644 index 0000000000000000000000000000000000000000..de031fe7f45198d846127b63a3d13277349e740d --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimClusteringToolI.h @@ -0,0 +1,31 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimCLUSTERINGTOOLI_H +#define FPGATrackSimCLUSTERINGTOOLI_H + +/** + * @file FPGATrackSimClusteringToolI.h + * @author Alex Martyniuk - martyniu@cern.ch + * @date 04/12/19 + * @brief Declares an abstract class that implements an interface for pixel clustering. + * This class is implemented in + * FPGATrackSimClusteringTool.h + * FPGATrackSimClusteringFTKTool.h + * FPGATrackSimClusteringOfflineTool.h + */ + +#include "GaudiKernel/IAlgTool.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" + +class FPGATrackSimClusteringToolI : virtual public ::IAlgTool +{ + public: + DeclareInterfaceID( FPGATrackSimClusteringToolI, 1, 0); + virtual ~FPGATrackSimClusteringToolI() = default; + + virtual StatusCode DoClustering(FPGATrackSimLogicalEventInputHeader &, std::vector<FPGATrackSimCluster> &) const = 0; +}; + +#endif //FPGATrackSimCLUSTERINGTOOLI_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTNNMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimNNMap.h similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTNNMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimNNMap.h index 7324af8fe8aecbca278fc9b32a95d1e3ae97db11..5e79d7a88099d7ad8377193a5b68b43d64b36479 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTNNMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimNNMap.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTNNMAP_H -#define HTTNNMAP_H +#ifndef FPGATrackSimNNMAP_H +#define FPGATrackSimNNMAP_H /** - * @file HTTNNMap.h + * @file FPGATrackSimNNMap.h * @author Elliott Cheu * @date April 28, 2021 * @brief Map for NN tracking @@ -23,13 +23,13 @@ #include <fstream> #include <string> -class HTTNNMap +class FPGATrackSimNNMap { public: /////////////////////////////////////////////////////////////////////// // Constructor/Destructor - HTTNNMap(const std::string & filepath); + FPGATrackSimNNMap(const std::string & filepath); /////////////////////////////////////////////////////////////////////// // Simple Getters/Setters @@ -53,4 +53,4 @@ class HTTNNMap }; -#endif // HTTNNMAP_H +#endif // FPGATrackSimNNMAP_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTPlaneMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimPlaneMap.h similarity index 93% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTPlaneMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimPlaneMap.h index f1465979084c758d58c7ef297434961f565a3b2b..9039ba2a59afe78b3c1fa7f0234fd0fe3156d79c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTPlaneMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimPlaneMap.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTPLANEMAP_H -#define HTTPLANEMAP_H +#ifndef FPGATrackSimPLANEMAP_H +#define FPGATrackSimPLANEMAP_H /** - * @file HTTPlaneMap.h + * @file FPGATrackSimPlaneMap.h * @author Riley Xu - riley.xu@cern.ch (rewrite from FTK) * @date Janurary 7th, 2020 * @brief Maps physical layers to logical layers @@ -19,13 +19,13 @@ * * NB: There are a bunch of different layers floating around. My understanding is that * - detLayer: A detector element, i.e. a unique line in the plane map file - * - physLayer: A layer index used in HTT, a different 0-indexed series for each (pixel/strip) X (barrel/endcap) combination. + * - physLayer: A layer index used in FPGATrackSim, a different 0-indexed series for each (pixel/strip) X (barrel/endcap) combination. * Total number of physical layers = number of detector layers. The physLayer basically just breaks the detLayers into * different series for each hit type and detector region. * - logiLayer: A logical layer corresponding to an AM bus, In general, `layer` with no other specifiers refers to a logical layer. */ -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" #include <vector> #include <string> @@ -56,7 +56,7 @@ struct LayerInfo }; -class HTTPlaneMap +class FPGATrackSimPlaneMap { public: @@ -65,7 +65,7 @@ class HTTPlaneMap /////////////////////////////////////////////////////////////////////// // See doc on m_layerOverrides for info on argument layerOverrides - HTTPlaneMap(const std::string & filepath, unsigned region, unsigned stage, + FPGATrackSimPlaneMap(const std::string & filepath, unsigned region, unsigned stage, std::vector<int> layerOverrides = std::vector<int>()); /////////////////////////////////////////////////////////////////////// @@ -143,7 +143,7 @@ class HTTPlaneMap // Mapping Hits /////////////////////////////////////////////////////////////////////// - void map(HTTHit & hit) const; + void map(FPGATrackSimHit & hit) const; private: @@ -181,4 +181,4 @@ class HTTPlaneMap -#endif // HTTPLANEMAP_H +#endif // FPGATrackSimPLANEMAP_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTRegionMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimRegionMap.h similarity index 71% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTRegionMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimRegionMap.h index 8ec281621f27fedc64c7d3f6eb85f8d661fe2e8c..5ffe8c33d78565699fe74dea85f45e90710925c3 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTRegionMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimRegionMap.h @@ -1,12 +1,12 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTRegionMap.h + * @file FPGATrackSimRegionMap.h * @author Riley Xu - riley.xu@cern.ch (rewrite from FTK) * @date Janurary 7th, 2020 - * @brief Maps ITK module indices to HTT regions. + * @brief Maps ITK module indices to FPGATrackSim regions. * - * The region map is a text configuration file that defines the regions in HTT. + * The region map is a text configuration file that defines the regions in FPGATrackSim. * A region is roughly an eta/phi slice that handled by the same TP board (??? not quite sure if this is right). * The region map delineates the modules in each region based on InDetIdentifier ids. * @@ -18,13 +18,13 @@ * * Region definition format: * 1. A line with the region number. - * 2. A line for each detector layer (see HTTPlaneMap), which is a space-separated list + * 2. A line for each detector layer (see FPGATrackSimPlaneMap), which is a space-separated list * with the below values. * * Line values (i.e. columns): * 1. isPixel (1/0) | * 2. isEndcap (1/0) } -- These identify the detector layer - * 3. physical layer (see HTTPlaneMap) | + * 3. physical layer (see FPGATrackSimPlaneMap) | * 4. minimum phi id ] -- in this detector layer in this region * 5. maximum phi id ] * 6. total phi modules -- in this detector layer among all regions @@ -37,19 +37,19 @@ * TODO there is no reason to store total phi/eta module in each region. */ -#ifndef HTTREGIONMAP_H -#define HTTREGIONMAP_H +#ifndef FPGATrackSimREGIONMAP_H +#define FPGATrackSimREGIONMAP_H -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include <vector> #include <map> #include <fstream> -class HTTHit; +class FPGATrackSimHit; -struct HTTRegionBoundaries +struct FPGATrackSimRegionBoundaries { int phi_min; // minimum phi ID int phi_max; // maximum phi ID @@ -58,21 +58,21 @@ struct HTTRegionBoundaries }; -class HTTRegionMap +class FPGATrackSimRegionMap { public: /////////////////////////////////////////////////////////////////////// // Constructors/Initialization - HTTRegionMap(HTTPlaneMap const * pmap, std::string const & filepath); + FPGATrackSimRegionMap(FPGATrackSimPlaneMap const * pmap, std::string const & filepath); void loadModuleIDLUT(std::string const & filepath); /////////////////////////////////////////////////////////////////////// // Simple Getters/Setters - const HTTPlaneMap* getPlaneMap() const { return m_pmap; } + const FPGATrackSimPlaneMap* getPlaneMap() const { return m_pmap; } int getNRegions() const { return m_nregions; } @@ -81,16 +81,16 @@ class HTTRegionMap /////////////////////////////////////////////////////////////////////// // Main Interface Functions - const HTTRegionBoundaries & getRegionBoundaries(int region, int layer, int section) const + const FPGATrackSimRegionBoundaries & getRegionBoundaries(int region, int layer, int section) const { return m_map.at(region).at(layer).at(section); } - bool isInRegion(uint32_t region, const HTTHit &hit) const; + bool isInRegion(uint32_t region, const FPGATrackSimHit &hit) const; bool isInRegion(uint32_t region, uint32_t plane, uint32_t section, int eta, int phi) const; // Returns a list of regions that hit belongs to - std::vector<uint32_t> getRegions(const HTTHit &hit) const; + std::vector<uint32_t> getRegions(const FPGATrackSimHit &hit) const; - uint32_t getUnmappedID(uint32_t region, const HTTHit &hit) const; + uint32_t getUnmappedID(uint32_t region, const FPGATrackSimHit &hit) const; // These require the module LUT file to be loaded uint32_t getLocalID(uint32_t region, uint32_t layer, uint32_t globalModuleID) const; @@ -98,10 +98,10 @@ class HTTRegionMap private: - const HTTPlaneMap *m_pmap = nullptr; + const FPGATrackSimPlaneMap *m_pmap = nullptr; int m_nregions = 0; - std::vector<std::vector<std::vector<HTTRegionBoundaries>>> m_map; + std::vector<std::vector<std::vector<FPGATrackSimRegionBoundaries>>> m_map; // Index by region, logical layer, section std::vector<std::vector<std::map<uint32_t, uint32_t>>> m_global_local_map; @@ -114,4 +114,4 @@ class HTTRegionMap void readRegion(std::ifstream & fin, int expected_region); }; -#endif // HTTREGIONMAP_H +#endif // FPGATrackSimREGIONMAP_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSectorMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimSectorMap.h similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSectorMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimSectorMap.h index e67e2cc3826eb29958babea4902e91e9d763bad6..e81e95580d5285f55932fdbfb46d7a0f9627c87b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSectorMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimSectorMap.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTSECTORMAP_H -#define HTTSECTORMAP_H +#ifndef FPGATrackSimSECTORMAP_H +#define FPGATrackSimSECTORMAP_H #include <vector> #include <map> @@ -11,15 +11,15 @@ /* A simple map that links sectors in different cases with different layers */ -class HTTSectorMap { +class FPGATrackSimSectorMap { typedef std::map<int,int> mapint; typedef std::map<int,mapint> mapint2; private: mapint2 m_data; public: - HTTSectorMap() = default; - HTTSectorMap(const char *fname) { LoadFromFile(fname); } - ~HTTSectorMap() = default; + FPGATrackSimSectorMap() = default; + FPGATrackSimSectorMap(const char *fname) { LoadFromFile(fname); } + ~FPGATrackSimSectorMap() = default; void SetSector(int, int, int); int GetSector(int, int); void LoadFromFile(const char *); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimSpacePointsToolI.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimSpacePointsToolI.h new file mode 100644 index 0000000000000000000000000000000000000000..59aca8bf72bbadad295a3273dc1bc31bfc091d37 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/FPGATrackSimSpacePointsToolI.h @@ -0,0 +1,29 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef FPGATrackSimSPACEPOINTSTOOLI_H +#define FPGATrackSimSPACEPOINTSTOOLI_H + +/** + * @file FPGATrackSimSpacePointsToolI.h + * @author Julian Wollrath - wollrath@cern.ch + * @date 2021 + * @brief Declares an abstract class that implements an interface for spacepoint formation. + * This class is implemented in + * FPGATrackSimSpacePointsTool.h + */ + +#include "GaudiKernel/IAlgTool.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" + +const InterfaceID IID_FPGATrackSimSpacePointsToolI("FPGATrackSimSpacePointsToolI", 1, 0); + +class FPGATrackSimSpacePointsToolI : virtual public ::IAlgTool { + public: + DeclareInterfaceID(FPGATrackSimSpacePointsToolI, 1, 0); + virtual ~FPGATrackSimSpacePointsToolI() = default; + + virtual StatusCode DoSpacePoints(FPGATrackSimLogicalEventInputHeader &, std::vector<FPGATrackSimCluster> &) = 0; +}; + +#endif // FPGATrackSimSPACEPOINTSTOOLI_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/IFPGATrackSimHitFilteringTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/IFPGATrackSimHitFilteringTool.h new file mode 100644 index 0000000000000000000000000000000000000000..75711f538fa1e03dae86f5b4079ae3b31edd94ea --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/IFPGATrackSimHitFilteringTool.h @@ -0,0 +1,33 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef IFPGATrackSimHITFILTERINGTOOL_H +#define IFPGATrackSimHITFILTERINGTOOL_H + +/** + * @file IFPGATrackSimHitFilteringTool.h + * @author Will Kalderon - willam.kalderon@cern.ch, Julian Wollrath - wollrath@cern.ch + * @date 2021 + * @brief Declares an abstract class that implements an interface for hit/cluster filtering. + * This class is implemented in + * FPGATrackSimHitFilteringTool.h + */ + +#include "GaudiKernel/IAlgTool.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimPlaneMap.h" + +class IFPGATrackSimHitFilteringTool : virtual public ::IAlgTool { + public: + DeclareInterfaceID(IFPGATrackSimHitFilteringTool, 1, 0); + virtual ~IFPGATrackSimHitFilteringTool() = default; + + virtual StatusCode DoRandomRemoval(FPGATrackSimLogicalEventInputHeader &, bool) = 0; + virtual StatusCode GetPairedStripPhysLayers(const FPGATrackSimPlaneMap*, std::vector<int> &) = 0; + virtual StatusCode DoHitFiltering(FPGATrackSimLogicalEventInputHeader &, + std::vector<int>, std::vector<int>, + std::vector<FPGATrackSimCluster> &) = 0; + +}; + +#endif // IFPGATrackSimHITFILTERINGTOOL_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/IFPGATrackSimMappingSvc.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/IFPGATrackSimMappingSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..fa86f926c4155d4f14ca8b89a7af73aeededc831 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/FPGATrackSimMaps/IFPGATrackSimMappingSvc.h @@ -0,0 +1,31 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + + +#ifndef ITRIGFPGATrackSimMAPPINGSVC_H +#define ITRIGFPGATrackSimMAPPINGSVC_H + +#include "GaudiKernel/IService.h" +#include "GaudiKernel/IInterface.h" + +// Forward declarations +class FPGATrackSimRegionMap; +class FPGATrackSimPlaneMap; +class FPGATrackSimNNMap; + + +class IFPGATrackSimMappingSvc: virtual public IService +{ + public: + DeclareInterfaceID(IFPGATrackSimMappingSvc, 1, 0); + + virtual const FPGATrackSimPlaneMap* PlaneMap_1st() const = 0; + virtual const FPGATrackSimPlaneMap* PlaneMap_2nd() const = 0; + virtual const FPGATrackSimRegionMap* RegionMap_1st() const = 0; + virtual const FPGATrackSimRegionMap* RegionMap_2nd() const = 0; + virtual const FPGATrackSimRegionMap* SubRegionMap() const = 0; + virtual const FPGATrackSimNNMap* NNMap() const = 0; +}; + + + +#endif // ITRIGFPGATrackSimMAPPINGSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/README.md b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/README.md similarity index 90% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/README.md rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/README.md index b6125554a3394b8eef3416d034a0aec335b5bffc..dfe231f322ac1cbf095335fb4807c300b68d505f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/README.md +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/README.md @@ -1,8 +1,8 @@ -# TrigHTTMaps +# FPGATrackSimMaps -This package manages mapping and other geometry-related tasks for HTT. -The primary purpose is to read files that map detector geometry to HTT geometry. -Almost all functionality on the C side is handled by a single service, `TrigHTTMappingSvc`. +This package manages mapping and other geometry-related tasks for FPGATrackSim. +The primary purpose is to read files that map detector geometry to FPGATrackSim geometry. +Almost all functionality on the C side is handled by a single service, `FPGATrackSimMappingSvc`. ## Map Files @@ -15,7 +15,7 @@ More documentation can be found in the header files of each class. Note the following definitions of different 'layers': - detector layer: Equivalent to the **FILLME** variable in InDet, and identifies portions of the detector with similar geometry. -- physical layer: A layer index used in HTT, a different 0-indexed series for each (pixel/strip) X (barrel/endcap) combination. +- physical layer: A layer index used in FPGATrackSim, a different 0-indexed series for each (pixel/strip) X (barrel/endcap) combination. Each detector layer can be uniquely identified by pixel/strip, barrel/encap, and the physical layer number. TODO this should probably be renamed, and is questionable if we really need this (why not just use detector layer?). - logical layer: The layers used in pattern matching. Note that a logical layer can be made up of @@ -24,7 +24,7 @@ Note the following definitions of different 'layers': help distinguish them (this should count from 0 for each logical layer). TODO rename this? -Throughout HTT, 'layer' with no other specifiers typically refers to a logical layer. +Throughout FPGATrackSim, 'layer' with no other specifiers typically refers to a logical layer. ### Plane Map @@ -72,7 +72,7 @@ After the region ID, there is a row for each detector layer, each with up to 14 1. **Silicon**: pixel or strip layer 2. **Barrel/Encap**: 0 identifies the barrel, 1 the positive endcap, and 2 the negative endcap 3. **physical disk number**: Not really sure what this is... -4. **Physical layer ID**: HTT physical layer index +4. **Physical layer ID**: FPGATrackSim physical layer index 5. **stereo keyword**: unique to strip layers - the keyword `stereo` 6. **stereo side**: unique to strip layers - 1 denotes the side closer to the beamline, 0 is the opposite side. 7. **plane1 keyword**: the word `plane1` @@ -104,7 +104,7 @@ Region definition format: Line values (i.e. columns): 1. isPixel (1/0) 2. isEndcap (1/0) -3. physical layer (see HTTPlaneMap) +3. physical layer (see FPGATrackSimPlaneMap) 4. minimum phi id ] -- in this detector layer in this region 5. maximum phi id ] 6. total phi modules -- in this detector layer among all regions @@ -142,8 +142,8 @@ towers 96 phi 16 ## Mapping Service -The interface to the mapping service is defined by `ITrigHTTMappingSvc.h`, and is implemented by `TrigHTTMappingSvc`. -The service can be configured at python-level using the tag system (see HTT readme) via `HTTMapConfig.py`. +The interface to the mapping service is defined by `IFPGATrackSimMappingSvc.h`, and is implemented by `FPGATrackSimMappingSvc`. +The service can be configured at python-level using the tag system (see FPGATrackSim readme) via `FPGATrackSimMapConfig.py`. The service handles reading all the map files at initialization, and exposes pointers to the map object classes. diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/python/HTTMapConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/python/FPGATrackSimMapConfig.py similarity index 62% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/python/HTTMapConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/python/FPGATrackSimMapConfig.py index a94bfa3e0dd016167ee4aaf317b696457c7afe8e..7608f474dfd301c6d3c46ef500ce8c9f103f9cc2 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/python/HTTMapConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/python/FPGATrackSimMapConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration ''' @author Riley Xu - rixu@cern.ch @date March 3rd 2020 @@ -10,8 +10,8 @@ import os from PyJobTransforms.trfUtils import findFile from PyJobTransforms.trfLogger import msg -from TrigHTTMaps.TrigHTTMapsConf import TrigHTTMappingSvc, HTTHitFilteringTool -import TrigHTTConfTools.HTTConfigCompInit as HTTConfig +from FPGATrackSimMaps.FPGATrackSimMapsConf import FPGATrackSimMappingSvc, FPGATrackSimHitFilteringTool +import FPGATrackSimConfTools.FPGATrackSimConfigCompInit as FPGATrackSimConfig def findFileWithTest(datapath,filename): retv = findFile(datapath,filename) @@ -22,14 +22,14 @@ def findFileWithTest(datapath,filename): def addMapSvc(tag): ''' - Creates and returns a TrigHTTMapSvc object, configured with the specified tag. + Creates and returns a FPGATrackSimMapSvc object, configured with the specified tag. This function adds the returned map service instance to SvcMgr, and ALSO ADDS the EventSelectionSvc, which the map svc depends on ''' - HTTConfig.addEvtSelSvc(tag) + FPGATrackSimConfig.addEvtSelSvc(tag) - HTTMappingSvc = TrigHTTMappingSvc() + MyFPGATrackSimMappingSvc = FPGATrackSimMappingSvc() filepaths = [ 'pmap', @@ -40,8 +40,8 @@ def addMapSvc(tag): ] formats = { - 'region': HTTConfig.getRegionIndex(tag), - 'regionName': HTTConfig.getRegionName(tag), + 'region': FPGATrackSimConfig.getRegionIndex(tag), + 'regionName': FPGATrackSimConfig.getRegionName(tag), } for param in filepaths: @@ -49,15 +49,15 @@ def addMapSvc(tag): path = tag[param].format(**formats) else: path = tag[param] - setattr(HTTMappingSvc, param, findFileWithTest(os.environ['DATAPATH'], path)) + setattr(MyFPGATrackSimMappingSvc, param, findFileWithTest(os.environ['DATAPATH'], path)) - HTTMappingSvc.mappingType = tag['mappingType'] - HTTMappingSvc.layerOverride = tag['layerOverride'] + MyFPGATrackSimMappingSvc.mappingType = tag['mappingType'] + MyFPGATrackSimMappingSvc.layerOverride = tag['layerOverride'] from AthenaCommon.AppMgr import ServiceMgr - ServiceMgr += HTTMappingSvc + ServiceMgr += MyFPGATrackSimMappingSvc - return HTTMappingSvc + return MyFPGATrackSimMappingSvc @@ -66,7 +66,7 @@ def addHitFilteringTool(tag): Creates and adds the hit filtering tool to the tool svc ''' - HitFilteringTool = HTTHitFilteringTool() + HitFilteringTool = FPGATrackSimHitFilteringTool() for param in HitFilteringTool.__slots__: if param in tag: @@ -81,8 +81,8 @@ def addHitFilteringTool(tag): def getNSubregions(tag): formats = { - 'region': HTTConfig.getRegionIndex(tag), - 'regionName': HTTConfig.getRegionName(tag), + 'region': FPGATrackSimConfig.getRegionIndex(tag), + 'regionName': FPGATrackSimConfig.getRegionName(tag), } if tag['formatted']: @@ -97,7 +97,7 @@ def getNSubregions(tag): return int(fields[1]) -def _applyTag(HTTMappingSvc, tag): +def _applyTag(MyFPGATrackSimMappingSvc, tag): ''' Helper function that sets the filepaths of the MapSvc using the supplied tag ''' diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/MakeSliceSet.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/MakeSliceSet.py similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/MakeSliceSet.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/MakeSliceSet.py diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/keylayer_zslicemap.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/keylayer_zslicemap.py similarity index 98% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/keylayer_zslicemap.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/keylayer_zslicemap.py index f468c78492ad0700507c5c7ec69c2bc9c0c6cee1..63f9ef06bbb4384f168fe33d5726a4b5f09266d7 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/keylayer_zslicemap.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/keylayer_zslicemap.py @@ -8,7 +8,7 @@ # Extrapolation Engine files are stored on eos: # /eos/atlas/atlascerngroupdisk/det-htt/HTTsim/user/abkahn/ExtrapolationEngine/ -# For information on map configuration files see the README in TrigHTTMaps +# For information on map configuration files see the README in FPGATrackSimMaps import argparse import numpy as np @@ -21,7 +21,7 @@ from PyJobTransforms.trfLogger import msg parser = argparse.ArgumentParser(description='Flattens Wrapper Files') parser.add_argument('inname', metavar='inputfile', type=str, - help='input file name (should be HTT Wrapper File)') + help='input file name (should be FPGATrackSim Wrapper File)') args = parser.parse_args() # initialize empty sets and lists @@ -150,7 +150,7 @@ for i in range(6): # loop over slices s[dic_idx]["eta"] = trk.SensitiveEtaModule[hit] strip = trk.SensitivePhiIndex[hit] # calculate row from strip - if trk.SensitiveIsPixel[hit] == 0 and layer <= 3: #First four sct HTT layers have 4 rows per module + if trk.SensitiveIsPixel[hit] == 0 and layer <= 3: #First four sct FPGATrackSim layers have 4 rows per module if strip >= 0 and strip < 1280: row = 0 elif strip >= 1280 and strip < 2560: diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/module_driven_slicing.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/module_driven_slicing.py similarity index 99% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/module_driven_slicing.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/module_driven_slicing.py index ce51ae5f3c06683f8e51a63250617d906785383b..ba4e56a0a3e5792c534e7d524d067ed728afbf7c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/scripts/module_driven_slicing.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/scripts/module_driven_slicing.py @@ -6,7 +6,7 @@ import argparse parser = argparse.ArgumentParser(description='Flattens Wrapper Files') parser.add_argument('inname', metavar='inputfile', type=str, nargs='+', - help='input file name (should be HTT Wrapper File)') + help='input file name (should be FPGATrackSim Wrapper File)') parser.add_argument('--evts', action='store', type=int, help='number of events to process', default=(1<<30)) # default is large integer parser.add_argument('--trim', action='store', type=float, @@ -508,7 +508,7 @@ def printOccupancies(slice_modules): occupancies_per_module[det]['endcap']=[0 for i in range(layers[det][reg])] - layer_options = { "HTTlike" : { "pixel" : [4], "strip":[0,2,3,4,5,6,7]}, + layer_options = { "FPGATrackSimlike" : { "pixel" : [4], "strip":[0,2,3,4,5,6,7]}, "Outer5" : { "pixel" : [4], "strip":[0,2,4,6]}, "Inner5" : { "pixel" : [0,1,2,4,5], "strip":[]}, "Mid5" : { "pixel" : [2,4,5], "strip":[0,2]}} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/share/HTTPlaneMap.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/share/FPGATrackSimPlaneMap.ref similarity index 81% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/share/HTTPlaneMap.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/share/FPGATrackSimPlaneMap.ref index 94c07a882339a37050e629095dbe38c630fa7ce0..5a3471fa620c56b3b81ac2c1e41613c865ec41c7 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/share/HTTPlaneMap.ref +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/share/FPGATrackSimPlaneMap.ref @@ -3,14 +3,14 @@ Initializing Gaudi ApplicationMgr using job opts ../share/ ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v36r5) - running on pt3int0.nicadd.niu.edu on Fri Apr 29 15:57:55 2022 + Welcome to ApplicationMgr (GaudiCoreSvc v36r13) + running on lxplus775.cern.ch on Mon Jun 12 17:32:14 2023 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/step3_01eta03_03phi05.pmap +Package.UserCode INFO Reading /cvmfs/atlas.cern.ch/repo/sw/database/GroupData//HTT/TrigHTTMaps/V1/map_file/step3_01eta03_03phi05.pmap Package.UserCode INFO Allocating map for geometry ATLAS-P2-ITK-23-00-01 diskIndex size=8 Package.UserCode INFO Using 8 logical layers and 9 coordinates diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/share/HTTRegionMap.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/share/FPGATrackSimRegionMap.ref similarity index 89% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/share/HTTRegionMap.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/share/FPGATrackSimRegionMap.ref index 966c66e4543e047a8ccc4fb6b69784114e19183a..520dfb4840a588577b368af1f2775f9cdd2ac3b7 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/share/HTTRegionMap.ref +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/share/FPGATrackSimRegionMap.ref @@ -3,8 +3,8 @@ Initializing Gaudi ApplicationMgr using job opts ../share/ ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v36r5) - running on pt3int0.nicadd.niu.edu on Fri Apr 29 15:57:55 2022 + Welcome to ApplicationMgr (GaudiCoreSvc v36r13) + running on lxplus775.cern.ch on Mon Jun 12 17:21:23 2023 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully EventLoopMgr WARNING Unable to locate service "EventSelector" diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringOfflineTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringOfflineTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a6f237dc34bd630af26a3f0323e80e993178f757 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringOfflineTool.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimClusteringOfflineTool.h" + +FPGATrackSimClusteringOfflineTool::FPGATrackSimClusteringOfflineTool(const std::string& algname, const std::string &name, const IInterface *ifc) : + base_class(algname, name, ifc) +{ +} + + +StatusCode FPGATrackSimClusteringOfflineTool::DoClustering(FPGATrackSimLogicalEventInputHeader &header, std::vector<FPGATrackSimCluster> &clusters) const +{ + + clusters = header.optional().getOfflineClusters(); + //fill the multitruth + for( auto& cluster:clusters){ + FPGATrackSimHit clusterEquiv = cluster.getClusterEquiv(); + FPGATrackSimMultiTruth mt; + FPGATrackSimMultiTruth::Barcode uniquecode(clusterEquiv.getEventIndex(),clusterEquiv.getBarcode()); + mt.maximize(uniquecode,clusterEquiv.getBarcodePt()); + clusterEquiv.setTruth(mt); + cluster.setClusterEquiv(clusterEquiv); + } + return StatusCode::SUCCESS; +} diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringOfflineTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringOfflineTool.h new file mode 100644 index 0000000000000000000000000000000000000000..e44bbb41a06d60a90806981fa1285e806edd3ead --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringOfflineTool.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimCLUSTERINGOFFLINETOOL_H +#define FPGATrackSimCLUSTERINGOFFLINETOOL_H + +/* + * httClustering + * --------------- + * + * Routines to perform clustering in the pixels, based on FPGATrackSim + * + */ + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimMaps/FPGATrackSimClusteringToolI.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include <cmath> +#include <cassert> +#include <iostream> +#include <iomanip> +#include <stack> +#include <queue> + +class FPGATrackSimClusteringOfflineTool : public extends <AthAlgTool,FPGATrackSimClusteringToolI> { +public: + + FPGATrackSimClusteringOfflineTool(const std::string&, const std::string&, const IInterface*); + + virtual ~FPGATrackSimClusteringOfflineTool() = default; + + virtual StatusCode DoClustering(FPGATrackSimLogicalEventInputHeader &, std::vector<FPGATrackSimCluster> &) const override; + + private: + +}; + +#endif // FPGATrackSimCLUSTERINGOFFLINETOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringTool.cxx similarity index 70% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringTool.cxx index 0162b700a59a80f566233536a9f7169706cbfe4f..73c0433593107d6840d2b9579533973086bfb681 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTClusteringTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringTool.cxx @@ -1,42 +1,36 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "HTTClusteringTool.h" -#include "TrigHTTObjects/HTTMultiTruth.h" -#include "TrigHTTObjects/HTTConstants.h" -#include <map> -#include <memory> -#include <vector> +#include "FPGATrackSimClusteringTool.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" #include <algorithm> #include <cmath> -#include <cassert> -#include <iostream> -#include <iomanip> -#include <stack> -#include <queue> -//For deciding eta || phi columns in modules -const unsigned int ETA = 1; -const unsigned int PHI = 0; +namespace{ + //For deciding eta || phi columns in modules + constexpr unsigned int ETA = 1; + constexpr unsigned int PHI = 0; +} -HTTClusteringTool::HTTClusteringTool(const std::string& algname, const std::string &name, const IInterface *ifc) : +FPGATrackSimClusteringTool::FPGATrackSimClusteringTool(const std::string& algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc) { } -StatusCode HTTClusteringTool::DoClustering(HTTLogicalEventInputHeader &header, std::vector<HTTCluster> &clusters) const +StatusCode FPGATrackSimClusteringTool::DoClustering(FPGATrackSimLogicalEventInputHeader &header, std::vector<FPGATrackSimCluster> &clusters) const { for (int i = 0; i<header.nTowers(); i++) { // Retreive the hits from the tower - HTTTowerInputHeader& tower = *header.getTower(i); - std::vector<HTTHit> hits = tower.hits(); + FPGATrackSimTowerInputHeader& tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits = tower.hits(); - std::vector<std::vector<HTTHit>> hitsPerModule; - std::vector<HTTCluster> towerClusters; + std::vector<std::vector<FPGATrackSimHit>> hitsPerModule; + std::vector<FPGATrackSimCluster> towerClusters; splitAndSortHits(hits, hitsPerModule); SortedClustering(hitsPerModule, towerClusters); normaliseClusters(towerClusters); @@ -50,10 +44,10 @@ StatusCode HTTClusteringTool::DoClustering(HTTLogicalEventInputHeader &header, s ATH_MSG_WARNING("more than one tower, m_clusters is only going to contain those from the last one"); unsigned cluster_count = 0; for ( auto &cluster: towerClusters){ - HTTHit cluster_as_HTThit = cluster.getClusterEquiv(); - cluster_as_HTThit.setHitType(HitType::clustered); - cluster_as_HTThit.setParentageMask(cluster_count); // making use of unused m_parentageMask to keep track of cluster index - tower.addHit(cluster_as_HTThit); + FPGATrackSimHit cluster_as_FPGATrackSimhit = cluster.getClusterEquiv(); + cluster_as_FPGATrackSimhit.setHitType(HitType::clustered); + cluster_as_FPGATrackSimhit.setParentageMask(cluster_count); // making use of unused m_parentageMask to keep track of cluster index + tower.addHit(cluster_as_FPGATrackSimhit); //send back a copy for monitoring and to check when writing out hits in each road clusters.push_back(cluster); cluster_count++; @@ -63,9 +57,9 @@ StatusCode HTTClusteringTool::DoClustering(HTTLogicalEventInputHeader &header, s return StatusCode::SUCCESS; } -//Attempt to implement clustering using HTTSim objects. -void HTTClusteringTool::SortedClustering(const std::vector<std::vector<HTTHit> >& sorted_hits, std::vector<HTTCluster> &clusters) const { - std::vector<HTTCluster> moduleClusters; +//Attempt to implement clustering using FPGATrackSim objects. +void FPGATrackSimClusteringTool::SortedClustering(const std::vector<std::vector<FPGATrackSimHit> >& sorted_hits, std::vector<FPGATrackSimCluster> &clusters) const { + std::vector<FPGATrackSimCluster> moduleClusters; //Loop over the sorted modules that we have for( auto& moduleHits:sorted_hits){ //Make the clusters for this module @@ -77,7 +71,7 @@ void HTTClusteringTool::SortedClustering(const std::vector<std::vector<HTTHit> > } } -void HTTClusteringTool::Clustering(std::vector<HTTHit> moduleHits, std::vector<HTTCluster> &moduleClusters) const { +void FPGATrackSimClusteringTool::Clustering(std::vector<FPGATrackSimHit> moduleHits, std::vector<FPGATrackSimCluster> &moduleClusters) const { //To hold the current cluster vars for comparison //loop over the hits that we have been passed for this module for( auto& hit: moduleHits){ @@ -86,20 +80,19 @@ void HTTClusteringTool::Clustering(std::vector<HTTHit> moduleHits, std::vector<H //Loop over the clusters we have already made, check if this hit should be added to them? for( auto& cluster: moduleClusters){ if(hit.isPixel()){ - is_clustered_hit = HTTCLUSTERING::updatePixelCluster(cluster, hit, false); + is_clustered_hit = FPGATrackSimCLUSTERING::updatePixelCluster(cluster, hit, false); } if(hit.isStrip()){ - is_clustered_hit = HTTCLUSTERING::updateStripCluster(cluster, hit, false); + is_clustered_hit = FPGATrackSimCLUSTERING::updateStripCluster(cluster, hit, false); } } //If it is the first hit or a not clustered hit, then start a new cluster and add it to the output vector if((is_clustered_hit==0) or (moduleClusters.size()==0)){ - HTTCluster cluster; + FPGATrackSimCluster cluster; if(hit.isPixel()){ - is_clustered_hit = HTTCLUSTERING::updatePixelCluster(cluster, hit, true); - } - if(hit.isStrip()){ - is_clustered_hit = HTTCLUSTERING::updateStripCluster(cluster, hit, true); + is_clustered_hit = FPGATrackSimCLUSTERING::updatePixelCluster(cluster, hit, true); + } else if(hit.isStrip()){ + is_clustered_hit = FPGATrackSimCLUSTERING::updateStripCluster(cluster, hit, true); } //Put this cluster into the output hits. Will update it in place. moduleClusters.push_back(cluster); @@ -107,33 +100,33 @@ void HTTClusteringTool::Clustering(std::vector<HTTHit> moduleHits, std::vector<H } } -void HTTClusteringTool::splitAndSortHits(std::vector<HTTHit> &hits, std::vector<std::vector<HTTHit> > &hitsPerModule, int &eta_phi) const { +void FPGATrackSimClusteringTool::splitAndSortHits(std::vector<FPGATrackSimHit> &hits, std::vector<std::vector<FPGATrackSimHit> > &hitsPerModule, int &eta_phi) const { splitHitsToModules(hits, hitsPerModule); sortHitsOnModules(hitsPerModule, eta_phi); } -void HTTClusteringTool::splitAndSortHits(std::vector<HTTHit> &hits, std::vector<std::vector<HTTHit> > &hitsPerModule) const{ +void FPGATrackSimClusteringTool::splitAndSortHits(std::vector<FPGATrackSimHit> &hits, std::vector<std::vector<FPGATrackSimHit> > &hitsPerModule) const{ splitHitsToModules(hits, hitsPerModule); sortHitsOnModules(hitsPerModule); } /*Temporarilly sort the hits into module by module packets */ -void HTTClusteringTool::splitHitsToModules(std::vector<HTTHit> &hits, std::vector<std::vector<HTTHit> > &hitsPerModule) const{ +void FPGATrackSimClusteringTool::splitHitsToModules(std::vector<FPGATrackSimHit> &hits, std::vector<std::vector<FPGATrackSimHit> > &hitsPerModule) const{ //To hold the current module - std::vector<HTTHit> currentModule; + std::vector<FPGATrackSimHit> currentModule; uint hashing = 0; //Split the incoming hits into hits by module for ( auto& hit:hits){ if(hashing == 0){ currentModule.push_back(hit); - hashing = hit.getHTTIdentifierHash(); - } else if (hit.getHTTIdentifierHash() == hashing) { + hashing = hit.getFPGATrackSimIdentifierHash(); + } else if (hit.getFPGATrackSimIdentifierHash() == hashing) { currentModule.push_back(hit); } else { hitsPerModule.push_back(currentModule); currentModule.clear(); - hashing = hit.getHTTIdentifierHash(); + hashing = hit.getFPGATrackSimIdentifierHash(); currentModule.push_back(hit); } } @@ -142,39 +135,39 @@ void HTTClusteringTool::splitHitsToModules(std::vector<HTTHit> &hits, std::vecto if (currentModule.size() > 0) hitsPerModule.push_back(currentModule); } -void HTTClusteringTool::sortHitsOnModules(std::vector<std::vector<HTTHit> > &hitsPerModule, int &eta_phi) const{ +void FPGATrackSimClusteringTool::sortHitsOnModules(std::vector<std::vector<FPGATrackSimHit> > &hitsPerModule, int &eta_phi) const{ //Loop over the module separated hits for ( auto& module:hitsPerModule){ //Work out if columns are ETA (1) || PHI (0) if(etaOrPhi(module.at(0)) == true){ //Sort by ETA first eta_phi = ETA; - if (module.size() > 1) std::stable_sort(module.begin(), module.end(), HTTCLUSTERING::sortITkInputEta); - if (module.size() > 1) std::stable_sort(module.begin(), module.end(), HTTCLUSTERING::sortITkInputPhi); + if (module.size() > 1) std::stable_sort(module.begin(), module.end(), FPGATrackSimCLUSTERING::sortITkInputEta); + if (module.size() > 1) std::stable_sort(module.begin(), module.end(), FPGATrackSimCLUSTERING::sortITkInputPhi); } else { //Sort by PHI first eta_phi = PHI; - if (module.size() > 1) std::stable_sort(module.begin(), module.end(), HTTCLUSTERING::sortITkInputPhi); - if (module.size() > 1) std::stable_sort(module.begin(), module.end(), HTTCLUSTERING::sortITkInputEta); + if (module.size() > 1) std::stable_sort(module.begin(), module.end(), FPGATrackSimCLUSTERING::sortITkInputPhi); + if (module.size() > 1) std::stable_sort(module.begin(), module.end(), FPGATrackSimCLUSTERING::sortITkInputEta); } } } -void HTTClusteringTool::sortHitsOnModules(std::vector<std::vector<HTTHit> > &hitsPerModule) const{ +void FPGATrackSimClusteringTool::sortHitsOnModules(std::vector<std::vector<FPGATrackSimHit> > &hitsPerModule) const{ //Loop over the module separated hits for ( auto& module:hitsPerModule){ - if (module.size() > 1) std::stable_sort(module.begin(), module.end(), HTTCLUSTERING::sortITkInputEta); - if (module.size() > 1) std::stable_sort(module.begin(), module.end(), HTTCLUSTERING::sortITkInputPhi); + if (module.size() > 1) std::stable_sort(module.begin(), module.end(), FPGATrackSimCLUSTERING::sortITkInputEta); + if (module.size() > 1) std::stable_sort(module.begin(), module.end(), FPGATrackSimCLUSTERING::sortITkInputPhi); } } //Need to remove the htt::scaleHitFactor and normalise the widths -void HTTClusteringTool::normaliseClusters(std::vector<HTTCluster> &clusters) const { +void FPGATrackSimClusteringTool::normaliseClusters(std::vector<FPGATrackSimCluster> &clusters) const { for( auto &cluster:clusters){ //Grab the cluster equiv - HTTHit clusterEquiv = cluster.getClusterEquiv(); + FPGATrackSimHit clusterEquiv = cluster.getClusterEquiv(); //Update the clusterEquiv's position and width if(clusterEquiv.isStrip()){ //Clear the groupsize, set this to be one as we are only clustering one row. @@ -196,7 +189,7 @@ void HTTClusteringTool::normaliseClusters(std::vector<HTTCluster> &clusters) con *Depends on the position and orientation of the module in the detector. * Currently backwards engineered from the MC. Need to ask ITk people to confirm. */ -bool HTTClusteringTool::etaOrPhi(const HTTHit& hit) const { +bool FPGATrackSimClusteringTool::etaOrPhi(const FPGATrackSimHit& hit) const { /*This currently might get complicated as eta/phi ordering varies depending on the position in the detector. * For ITK-20-00-00 Step 2.2 inclined duals layout, worked out by Naoki. @@ -229,25 +222,25 @@ bool HTTClusteringTool::etaOrPhi(const HTTHit& hit) const { else { //Start by looking at what layer it is in if (hit.getPhysLayer() == 0 || hit.getPhysLayer() == 1) { - if (std::abs(hit.getHTTEtaModule()) <=6) { + if (std::abs(hit.getFPGATrackSimEtaModule()) <=6) { return ETA; } else { return PHI; } } else if (hit.getPhysLayer() == 2) { - if (std::abs(hit.getHTTEtaModule()) <=11) { + if (std::abs(hit.getFPGATrackSimEtaModule()) <=11) { return ETA; } else { return PHI; } } else if (hit.getPhysLayer() == 3) { - if (std::abs(hit.getHTTEtaModule()) <=12) { + if (std::abs(hit.getFPGATrackSimEtaModule()) <=12) { return ETA; } else { return PHI; } } else if (hit.getPhysLayer() == 4) { - if (std::abs(hit.getHTTEtaModule()) <=13) { + if (std::abs(hit.getFPGATrackSimEtaModule()) <=13) { return ETA; } else { return PHI; @@ -260,15 +253,15 @@ bool HTTClusteringTool::etaOrPhi(const HTTHit& hit) const { -void HTTCLUSTERING::attachTruth(std::vector<HTTHit> &hits){ +void FPGATrackSimCLUSTERING::attachTruth(std::vector<FPGATrackSimHit> &hits){ for( auto& hit : hits) { - HTTMultiTruth mt; + FPGATrackSimMultiTruth mt; // record highest pt contribution to the combination (cluster if(!hit.getTruth().isEmpty()) { mt.add(hit.getTruth()); hit.setTruth(mt); } else { - HTTMultiTruth::Barcode uniquecode(hit.getEventIndex(), hit.getBarcode()); + FPGATrackSimMultiTruth::Barcode uniquecode(hit.getEventIndex(), hit.getBarcode()); mt.maximize(uniquecode, hit.getBarcodePt()); hit.setTruth(mt); } @@ -276,13 +269,13 @@ void HTTCLUSTERING::attachTruth(std::vector<HTTHit> &hits){ } //record truth for each raw channel in the cluster /* - * This function is used in the HTTClusteringTools to see if a new hit should be added to the current cluster under construction. It assumes double precision hits. + * This function is used in the FPGATrackSimClusteringTools to see if a new hit should be added to the current cluster under construction. It assumes double precision hits. * It checks if the hit is in a number of positions w.r.t. the cluster being formed: up/right, down/right, above, right, or inside a cluster that has formed a horseshoe. */ -bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incomingHit, bool newCluster){ +bool FPGATrackSimCLUSTERING::updatePixelCluster(FPGATrackSimCluster ¤tCluster, FPGATrackSimHit &incomingHit, bool newCluster){ if(newCluster){ - HTTHit newHit = incomingHit; + FPGATrackSimHit newHit = incomingHit; //Double the precision on the positions //By doing this the hardware is able to handle clusters where the centre of the cluster is on a boundary between two clusters without needing a float newHit.setEtaIndex(incomingHit.getEtaIndex()*htt::scaleHitFactor); @@ -297,7 +290,7 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom int hitRow = incomingHit.getEtaIndex(); int hitCol = incomingHit.getPhiIndex(); - HTTHit clusterEquiv = currentCluster.getClusterEquiv(); + FPGATrackSimHit clusterEquiv = currentCluster.getClusterEquiv(); int clusterRow = clusterEquiv.getEtaIndex(); int clusterRowWidth = clusterEquiv.getEtaWidth(); int clusterCol = clusterEquiv.getPhiIndex(); @@ -310,7 +303,7 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom clusterRowWidth++; clusterCol++; clusterColWidth++; - HTTCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); + FPGATrackSimCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); return true; } @@ -321,7 +314,7 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom clusterRowWidth++; clusterCol++; clusterColWidth++; - HTTCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); + FPGATrackSimCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); return true; } @@ -330,7 +323,7 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom (hitCol*htt::scaleHitFactor == clusterCol+clusterColWidth) ){ clusterRow++; clusterRowWidth++; - HTTCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); + FPGATrackSimCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); return true; } @@ -339,7 +332,7 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom (hitCol*htt::scaleHitFactor == clusterCol+clusterColWidth+htt::scaleHitFactor) ){ clusterCol++; clusterColWidth++; - HTTCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); + FPGATrackSimCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); return true; } @@ -348,7 +341,7 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom (hitRow*htt::scaleHitFactor < clusterRow+clusterRowWidth+htt::scaleHitFactor) && (hitCol*htt::scaleHitFactor < clusterCol+clusterColWidth+htt::scaleHitFactor) ){ //We still want to do this as we are not changing the position of the cluster, but we are adding to its hitlist - HTTCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); + FPGATrackSimCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); return true; } //if we made it here then this cluster then start again @@ -357,10 +350,10 @@ bool HTTCLUSTERING::updatePixelCluster(HTTCluster ¤tCluster, HTTHit &incom } /* - * This function is used in the HTTClusteringTools to see if a new hit should be added to the current cluster under construction. It assumes double precision hits. + * This function is used in the FPGATrackSimClusteringTools to see if a new hit should be added to the current cluster under construction. It assumes double precision hits. * It checks if the hit is in a number of positions w.r.t. the cluster being formed: up/right, down/right, above, right, or inside a cluster that has formed a horseshoe. */ -bool HTTCLUSTERING::updateStripCluster(HTTCluster ¤tCluster, HTTHit &incomingHit, bool newCluster){ +bool FPGATrackSimCLUSTERING::updateStripCluster(FPGATrackSimCluster ¤tCluster, FPGATrackSimHit &incomingHit, bool newCluster){ // Shift initial widths 1->0, 2->2, 3->4, 4->6 etc... //The groupSize is stored in the EtaWidth @@ -368,7 +361,7 @@ bool HTTCLUSTERING::updateStripCluster(HTTCluster ¤tCluster, HTTHit &incom // Now shift to pixel width equivalents, 0->0, 2->1, 4->2, 6->3 etc... if(tempWidth > 0) tempWidth = tempWidth/htt::scaleHitFactor; if(newCluster){ - HTTHit newHit = incomingHit; + FPGATrackSimHit newHit = incomingHit; //Double the precision of the strip positions. int tempCentroid = incomingHit.getPhiCoord()*htt::scaleHitFactor; // Now shift the centroid phi+phiWidth, and store the width (put it back in the PhiWidth) @@ -385,7 +378,7 @@ bool HTTCLUSTERING::updateStripCluster(HTTCluster ¤tCluster, HTTHit &incom int hitRow = incomingHit.getEtaCoord(); int hitCol = incomingHit.getPhiCoord()*htt::scaleHitFactor; - HTTHit clusterEquiv = currentCluster.getClusterEquiv(); + FPGATrackSimHit clusterEquiv = currentCluster.getClusterEquiv(); int clusterRow = clusterEquiv.getEtaCoord(); int clusterRowWidth = clusterEquiv.getEtaWidth(); int clusterCol = clusterEquiv.getPhiCoord(); @@ -400,16 +393,16 @@ bool HTTCLUSTERING::updateStripCluster(HTTCluster ¤tCluster, HTTHit &incom clusterColWidth = clusterColWidth+tempWidth+1; //And add on the new width clusterCol = clusterCol + clusterColWidth; - HTTCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); + FPGATrackSimCLUSTERING::updateClusterContents(currentCluster, clusterRow, clusterRowWidth, clusterCol, clusterColWidth, incomingHit); return true; } else return false; } } -void HTTCLUSTERING::updateClusterContents(HTTCluster ¤tCluster, int &clusterRow, int &clusterRowWidth, int &clusterCol, int &clusterColWidth, HTTHit &incomingHit) { +void FPGATrackSimCLUSTERING::updateClusterContents(FPGATrackSimCluster ¤tCluster, int &clusterRow, int &clusterRowWidth, int &clusterCol, int &clusterColWidth, FPGATrackSimHit &incomingHit) { //Grab the cluster equiv - HTTHit clusterEquiv = currentCluster.getClusterEquiv(); + FPGATrackSimHit clusterEquiv = currentCluster.getClusterEquiv(); //Update the clusterEquiv's position and width clusterEquiv.setEtaIndex(clusterRow); @@ -450,14 +443,14 @@ void HTTCLUSTERING::updateClusterContents(HTTCluster ¤tCluster, int &clust /* Sort for the ordering of ITk modules: Sort by ETA. */ -bool HTTCLUSTERING::sortITkInputEta(const HTTHit& hitA, const HTTHit& hitB) +bool FPGATrackSimCLUSTERING::sortITkInputEta(const FPGATrackSimHit& hitA, const FPGATrackSimHit& hitB) { return hitA.getEtaIndex() < hitB.getEtaIndex(); } /* Sort for the ordering of ITk modules: Sort by PHI. */ -bool HTTCLUSTERING::sortITkInputPhi(const HTTHit& hitA, const HTTHit& hitB) +bool FPGATrackSimCLUSTERING::sortITkInputPhi(const FPGATrackSimHit& hitA, const FPGATrackSimHit& hitB) { return hitA.getPhiIndex() < hitB.getPhiIndex(); } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f864a6ad80f5a8f6bc9d284e3f563a96c389bd52 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimClusteringTool.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimCLUSTERINGTOOL_H +#define FPGATrackSimCLUSTERINGTOOL_H + +/* + * httClustering + * --------------- + * + * Routines to perform clustering in the pixels, based on FPGATrackSim + * + */ + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimMaps/FPGATrackSimClusteringToolI.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include <vector> +#include <memory> + +namespace FPGATrackSimCLUSTERING { + void attachTruth(std::vector<FPGATrackSimHit> &); + bool updatePixelCluster(FPGATrackSimCluster ¤tCluster, FPGATrackSimHit &incomingHit, bool newCluster); + bool updateStripCluster(FPGATrackSimCluster ¤tCluster, FPGATrackSimHit &incomingHit, bool newCluster); + void updateClusterContents(FPGATrackSimCluster ¤tCluster, int &clusterRow, int &clusterRowWidth, int &clusterCol, int &clusterColWidth, FPGATrackSimHit &incomingHit); + bool sortITkInputEta(const FPGATrackSimHit& hitA, const FPGATrackSimHit& hitB); + bool sortITkInputPhi(const FPGATrackSimHit& hitA, const FPGATrackSimHit& HitB); +} + +class FPGATrackSimClusteringTool : public extends <AthAlgTool,FPGATrackSimClusteringToolI> { +public: + + FPGATrackSimClusteringTool(const std::string&, const std::string&, const IInterface*); + + virtual ~FPGATrackSimClusteringTool() = default; + + virtual StatusCode DoClustering(FPGATrackSimLogicalEventInputHeader &, std::vector<FPGATrackSimCluster> &) const override; + + private: + + //FPGATrackSim pixel clustering using the FPGATrackSim objects + void SortedClustering(const std::vector<std::vector<FPGATrackSimHit> >& sorted_hits, std::vector<FPGATrackSimCluster> &) const; + void Clustering(std::vector<FPGATrackSimHit>, std::vector<FPGATrackSimCluster> &) const ; + + // Other helper functions + void splitAndSortHits(std::vector<FPGATrackSimHit>& hits, std::vector<std::vector<FPGATrackSimHit> >& hitsPerModule, int& eta_phi) const; + void splitAndSortHits(std::vector<FPGATrackSimHit>& hits, std::vector<std::vector<FPGATrackSimHit> >& hitsPerModule) const; + void splitHitsToModules(std::vector<FPGATrackSimHit>& hits, std::vector<std::vector<FPGATrackSimHit> >& hitsPerModule) const; + void normaliseClusters(std::vector<FPGATrackSimCluster> &clusters) const; + void sortHitsOnModules(std::vector<std::vector<FPGATrackSimHit> >& hitsPerModule, int& eta_phi) const; + void sortHitsOnModules(std::vector<std::vector<FPGATrackSimHit> >& hitsPerModule) const; + bool etaOrPhi(const FPGATrackSimHit& hit) const; + bool sortIBLInput(const std::unique_ptr<FPGATrackSimHit>& i, const std::unique_ptr<FPGATrackSimHit>& j) const; + bool sortPixelInput(const std::unique_ptr<FPGATrackSimHit>& i, const std::unique_ptr<FPGATrackSimHit>& j) const; + + + +}; + +#endif // FPGATrackSimCLUSTERINGTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTHitFilteringTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimHitFilteringTool.cxx similarity index 80% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTHitFilteringTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimHitFilteringTool.cxx index 8867a2f6ef72e30b041c8bc15ca27e4c8c848b3d..ef6c28c4f3b14aebf19285b0913c24c3e87a625d 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTHitFilteringTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimHitFilteringTool.cxx @@ -1,13 +1,13 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "HTTHitFilteringTool.h" +#include "FPGATrackSimHitFilteringTool.h" #include "PathResolver/PathResolver.h" #include "geometry_constants.h" -#include "TrigHTTObjects/HTTMultiTruth.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "HTTClusteringTool.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimClusteringTool.h" #include <AsgMessaging/MessageCheck.h> #include <vector> @@ -19,17 +19,17 @@ using namespace asg::msgUserCode; -void fill_nearby_hits(const HTTHit&, std::vector<std::pair<HTTHit,unsigned>> &, std::vector<std::pair<HTTHit,unsigned>> &); -int countHitsFromHeader(HTTLogicalEventInputHeader &); -void printHitsFromHeader(HTTLogicalEventInputHeader &); +void fill_nearby_hits(const FPGATrackSimHit&, std::vector<std::pair<FPGATrackSimHit,unsigned>> &, std::vector<std::pair<FPGATrackSimHit,unsigned>> &); +int countHitsFromHeader(FPGATrackSimLogicalEventInputHeader &); +void printHitsFromHeader(FPGATrackSimLogicalEventInputHeader &); -HTTHitFilteringTool::HTTHitFilteringTool(const std::string &algname, const std::string &name, const IInterface *ifc) +FPGATrackSimHitFilteringTool::FPGATrackSimHitFilteringTool(const std::string &algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc) { } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTHitFilteringTool::initialize() +StatusCode FPGATrackSimHitFilteringTool::initialize() { // random removal @@ -124,7 +124,7 @@ StatusCode HTTHitFilteringTool::initialize() } -StatusCode HTTHitFilteringTool::DoRandomRemoval(HTTLogicalEventInputHeader &header, bool hit_or_cluster) +StatusCode FPGATrackSimHitFilteringTool::DoRandomRemoval(FPGATrackSimLogicalEventInputHeader &header, bool hit_or_cluster) { if(!m_doRandomRemoval) return StatusCode::SUCCESS; @@ -136,12 +136,12 @@ StatusCode HTTHitFilteringTool::DoRandomRemoval(HTTLogicalEventInputHeader &head return StatusCode::SUCCESS; for (int i = 0; i < header.nTowers(); ++i) { - HTTTowerInputHeader &tower = *header.getTower(i); - std::vector<HTTHit> hits; + FPGATrackSimTowerInputHeader &tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits; hits = tower.hits(); - HTTCLUSTERING::attachTruth(hits); + FPGATrackSimCLUSTERING::attachTruth(hits); - std::vector<HTTHit> filteredHits; + std::vector<FPGATrackSimHit> filteredHits; for(const auto & hit : hits) { if(hit.isStrip()) { if(m_random.Rndm() >= stripFrac) @@ -167,7 +167,7 @@ StatusCode HTTHitFilteringTool::DoRandomRemoval(HTTLogicalEventInputHeader &head -StatusCode HTTHitFilteringTool::GetPairedStripPhysLayers(const HTTPlaneMap *planeMap, std::vector<int> &paired_strip_layers) +StatusCode FPGATrackSimHitFilteringTool::GetPairedStripPhysLayers(const FPGATrackSimPlaneMap *planeMap, std::vector<int> &paired_strip_layers) { std::vector<int> all_strip_layers; @@ -212,34 +212,34 @@ StatusCode HTTHitFilteringTool::GetPairedStripPhysLayers(const HTTPlaneMap *plan } -StatusCode HTTHitFilteringTool::DoHitFiltering(HTTLogicalEventInputHeader &header, +StatusCode FPGATrackSimHitFilteringTool::DoHitFiltering(FPGATrackSimLogicalEventInputHeader &header, std::vector<int> filter_pixel_physLayers, std::vector<int> filter_strip_physLayers, - std::vector<HTTCluster> &filteredClusters) + std::vector<FPGATrackSimCluster> &filteredClusters) { int nHits_preFilt = countHitsFromHeader(header); for (int i = 0; i < header.nTowers(); ++i) { - HTTTowerInputHeader &tower = *header.getTower(i); - std::vector<HTTHit> hits; + FPGATrackSimTowerInputHeader &tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits; hits = tower.hits(); - HTTCLUSTERING::attachTruth(hits); + FPGATrackSimCLUSTERING::attachTruth(hits); - std::vector<HTTHit> filteredHits; + std::vector<FPGATrackSimHit> filteredHits; FilterHits(hits, filter_pixel_physLayers, filter_strip_physLayers, filteredHits); // replace old clusters with new ones (the things called hits here are actually clusters) tower.clearHits(); for (auto& hit : filteredHits) { tower.addHit(hit); - // make HTTCluster for monitoring - HTTCluster cluster; + // make FPGATrackSimCluster for monitoring + FPGATrackSimCluster cluster; if(hit.isPixel()){ - HTTCLUSTERING::updatePixelCluster(cluster, hit, true); + FPGATrackSimCLUSTERING::updatePixelCluster(cluster, hit, true); } if(hit.isStrip()){ - HTTCLUSTERING::updateStripCluster(cluster, hit, true); + FPGATrackSimCLUSTERING::updateStripCluster(cluster, hit, true); } filteredClusters.push_back(cluster); } @@ -264,10 +264,10 @@ StatusCode HTTHitFilteringTool::DoHitFiltering(HTTLogicalEventInputHeader &heade } -void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, +void FPGATrackSimHitFilteringTool::FilterHits(std::vector<FPGATrackSimHit> &hits, std::vector<int> &filter_pixel_physLayers, std::vector<int> &filter_strip_physLayers, - std::vector<HTTHit> &filteredHits) + std::vector<FPGATrackSimHit> &filteredHits) { // there are two types of clusters @@ -276,18 +276,18 @@ void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, // for stub-type filtering, I want to compare all hits on one side to all hits on the other side // don't want to duplicate by doing this twice - // use pair<HTTHit,ID> to deal with duplicates + // use pair<FPGATrackSimHit,ID> to deal with duplicates filteredHits.clear(); if(m_doStubs) { // step 1: make a vector of just the hits I am going to try and filter, add the others straight to the passed list. Also give each hit an ID - std::vector< std::pair<HTTHit,unsigned> > filteredHits_ID, hits_to_filter; + std::vector< std::pair<FPGATrackSimHit,unsigned> > filteredHits_ID, hits_to_filter; unsigned counter = 0; for (const auto &hit : hits) { // assign hit ID - std::pair<HTTHit,unsigned> hit_ID; + std::pair<FPGATrackSimHit,unsigned> hit_ID; hit_ID.first = hit; hit_ID.second = counter; counter ++; @@ -311,7 +311,7 @@ void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, } // step 2: split into two lists: inner and outer side modules - std::vector< std::pair<HTTHit,unsigned> > hits_to_filter_inner, hits_to_filter_outer; + std::vector< std::pair<FPGATrackSimHit,unsigned> > hits_to_filter_inner, hits_to_filter_outer; // ideally use hit.GetSide(), but since this doesn't exist and can't be added // (until I add a friend class, coming soon hopefully) // have to use the hit physLayer @@ -324,9 +324,9 @@ void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, } // step 3: do the stub filtering - std::vector< std::pair<HTTHit,unsigned> > passed_inner_hits, passed_outer_hits; + std::vector< std::pair<FPGATrackSimHit,unsigned> > passed_inner_hits, passed_outer_hits; for (const auto &innerHit : hits_to_filter_inner) { - std::vector<std::pair<HTTHit,unsigned>> nearby_outer_hits; + std::vector<std::pair<FPGATrackSimHit,unsigned>> nearby_outer_hits; fill_nearby_hits(innerHit.first, hits_to_filter_outer, nearby_outer_hits); // get cut values to apply @@ -344,18 +344,18 @@ void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, } // step 4: remove duplicates among the passed hits - std::vector< std::pair<HTTHit,unsigned> > passed_outer_hits_unique; + std::vector< std::pair<FPGATrackSimHit,unsigned> > passed_outer_hits_unique; for (const auto &hit : passed_outer_hits) { auto it = std::find_if(passed_outer_hits_unique.begin(), passed_outer_hits_unique.end(), - [&hit](const std::pair<HTTHit,unsigned>& h) {return h.second == hit.second;} ); + [&hit](const std::pair<FPGATrackSimHit,unsigned>& h) {return h.second == hit.second;} ); if(it == passed_outer_hits_unique.end()) { passed_outer_hits_unique.push_back(hit); } } - std::vector< std::pair<HTTHit,unsigned> > passed_inner_hits_unique; + std::vector< std::pair<FPGATrackSimHit,unsigned> > passed_inner_hits_unique; for (const auto &hit : passed_inner_hits) { auto it = std::find_if(passed_inner_hits_unique.begin(), passed_inner_hits_unique.end(), - [&hit](const std::pair<HTTHit,unsigned>& h) {return h.second == hit.second;} ); + [&hit](const std::pair<FPGATrackSimHit,unsigned>& h) {return h.second == hit.second;} ); if(it == passed_inner_hits_unique.end()) { passed_inner_hits_unique.push_back(hit); } @@ -372,7 +372,7 @@ void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, if(true) { // can sort by the hit ID std::sort(filteredHits_ID.begin(), filteredHits_ID.end(), - [](const std::pair<HTTHit,unsigned> & hit1, const std::pair<HTTHit,unsigned> & hit2){ + [](const std::pair<FPGATrackSimHit,unsigned> & hit1, const std::pair<FPGATrackSimHit,unsigned> & hit2){ return hit1.second < hit2.second; }); for (const auto &hit_ID : filteredHits_ID) { @@ -389,7 +389,7 @@ void HTTHitFilteringTool::FilterHits(std::vector<HTTHit> &hits, } -void HTTHitFilteringTool::fill_cut_values(const HTTHit& hit, float &cut_m, float &cut_p) +void FPGATrackSimHitFilteringTool::fill_cut_values(const FPGATrackSimHit& hit, float &cut_m, float &cut_p) { // if we're doing this globally, then no need to use map // but probably best to for consistency @@ -436,7 +436,7 @@ void HTTHitFilteringTool::fill_cut_values(const HTTHit& hit, float &cut_m, float } -bool HTTHitFilteringTool::check_hit_stub(const HTTHit& innerHit, const HTTHit& outerHit, float cut_m, float cut_p) +bool FPGATrackSimHitFilteringTool::check_hit_stub(const FPGATrackSimHit& innerHit, const FPGATrackSimHit& outerHit, float cut_m, float cut_p) { float val; @@ -464,7 +464,7 @@ bool HTTHitFilteringTool::check_hit_stub(const HTTHit& innerHit, const HTTHit& o -void fill_nearby_hits(const HTTHit& innerHit, std::vector< std::pair<HTTHit,unsigned> > & outerHits, std::vector< std::pair<HTTHit,unsigned> > & nearby_outer_hits) +void fill_nearby_hits(const FPGATrackSimHit& innerHit, std::vector< std::pair<FPGATrackSimHit,unsigned> > & outerHits, std::vector< std::pair<FPGATrackSimHit,unsigned> > & nearby_outer_hits) { for (const auto& outerHit : outerHits) { // layer needs to be inner hit physLayer + 1 @@ -498,26 +498,26 @@ void fill_nearby_hits(const HTTHit& innerHit, std::vector< std::pair<HTTHit,unsi } -int countHitsFromHeader(HTTLogicalEventInputHeader &header) +int countHitsFromHeader(FPGATrackSimLogicalEventInputHeader &header) { int nHits = 0; for (int i = 0; i < header.nTowers(); ++i) { - HTTTowerInputHeader &tower = *header.getTower(i); - std::vector<HTTHit> hits = tower.hits(); + FPGATrackSimTowerInputHeader &tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits = tower.hits(); nHits += hits.size(); } return nHits; } -void printHitsFromHeader(HTTLogicalEventInputHeader &header) +void printHitsFromHeader(FPGATrackSimLogicalEventInputHeader &header) { for (int i = 0; i < header.nTowers(); ++i) { - HTTTowerInputHeader &tower = *header.getTower(i); - std::vector<HTTHit> hits = tower.hits(); + FPGATrackSimTowerInputHeader &tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits = tower.hits(); ANA_MSG_DEBUG("tower " << i << " with " << hits.size() << " hits:"); for(const auto& hit : hits) { - ANA_MSG_DEBUG(" isStrip, side, x, y, z, rho, phi, physLayer, layer, section, phiM, etaM = " << hit.isStrip() << ", " << hit.getPhysLayer()%2 << ", " << hit.getX() << ", " << hit.getY() << ", " << hit.getZ() << ", " << hit.getR() << ", " << hit.getGPhi() << ", " << hit.getPhysLayer() << ", " << hit.getLayer() << ", " << hit.getSection() << ", " << hit.getPhiModule() << ", " << hit.getHTTEtaModule()); + ANA_MSG_DEBUG(" isStrip, side, x, y, z, rho, phi, physLayer, layer, section, phiM, etaM = " << hit.isStrip() << ", " << hit.getPhysLayer()%2 << ", " << hit.getX() << ", " << hit.getY() << ", " << hit.getZ() << ", " << hit.getR() << ", " << hit.getGPhi() << ", " << hit.getPhysLayer() << ", " << hit.getLayer() << ", " << hit.getSection() << ", " << hit.getPhiModule() << ", " << hit.getFPGATrackSimEtaModule()); } } } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTHitFilteringTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimHitFilteringTool.h similarity index 54% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTHitFilteringTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimHitFilteringTool.h index dd9faab9ba5cb225fb0178010a0f87ac04de225d..2b2044f68358420697755a5603dff2f4d3cc97cf 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTHitFilteringTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimHitFilteringTool.h @@ -1,51 +1,51 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTHITFILTERINGTOOL_H -#define HTTHITFILTERINGTOOL_H +#ifndef FPGATrackSimHITFILTERINGTOOL_H +#define FPGATrackSimHITFILTERINGTOOL_H /* * httHitFiltering * --------------- * - * Routines to filter hits/clusters, based on TrigHTTSim + * Routines to filter hits/clusters, based on FPGATrackSim * */ #include "AthenaBaseComps/AthAlgTool.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" -#include "TrigHTTMaps/IHTTHitFilteringTool.h" +#include "FPGATrackSimMaps/IFPGATrackSimHitFilteringTool.h" #include "TRandom3.h" #include <unordered_map> -class ITrigHTTMappingSvc; +class IFPGATrackSimMappingSvc; -class HTTHitFilteringTool : public extends<AthAlgTool, IHTTHitFilteringTool> { +class FPGATrackSimHitFilteringTool : public extends<AthAlgTool, IFPGATrackSimHitFilteringTool> { public: - HTTHitFilteringTool(const std::string &, const std::string &, const IInterface *); + FPGATrackSimHitFilteringTool(const std::string &, const std::string &, const IInterface *); - virtual ~HTTHitFilteringTool() = default; + virtual ~FPGATrackSimHitFilteringTool() = default; virtual StatusCode initialize() override; - virtual StatusCode DoRandomRemoval(HTTLogicalEventInputHeader &, bool) override; - virtual StatusCode GetPairedStripPhysLayers(const HTTPlaneMap*, std::vector<int> &) override; - virtual StatusCode DoHitFiltering(HTTLogicalEventInputHeader &, + virtual StatusCode DoRandomRemoval(FPGATrackSimLogicalEventInputHeader &, bool) override; + virtual StatusCode GetPairedStripPhysLayers(const FPGATrackSimPlaneMap*, std::vector<int> &) override; + virtual StatusCode DoHitFiltering(FPGATrackSimLogicalEventInputHeader &, std::vector<int>, std::vector<int>, - std::vector<HTTCluster> &) override; + std::vector<FPGATrackSimCluster> &) override; private: - void FilterHits(std::vector<HTTHit> &, std::vector<int> &, std::vector<int> &, std::vector<HTTHit> &); + void FilterHits(std::vector<FPGATrackSimHit> &, std::vector<int> &, std::vector<int> &, std::vector<FPGATrackSimHit> &); - bool check_hit_stub(const HTTHit&, const HTTHit&, float, float); - void fill_cut_values(const HTTHit&, float &, float &); + bool check_hit_stub(const FPGATrackSimHit&, const FPGATrackSimHit&, float, float); + void fill_cut_values(const FPGATrackSimHit&, float &, float &); // configuration Gaudi::Property<bool> m_doRandomRemoval {this, "doRandomRemoval", false, "remove hits/clusters at random"}; @@ -65,4 +65,4 @@ class HTTHitFilteringTool : public extends<AthAlgTool, IHTTHitFilteringTool> { }; -#endif // HTTHITFILTERINGTOOL_H +#endif // FPGATrackSimHITFILTERINGTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/TrigHTTMappingSvc.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimMappingSvc.cxx similarity index 57% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/TrigHTTMappingSvc.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimMappingSvc.cxx index d4e36a137482e8fa4c09b0be893f39cc6e75459e..6fa7f8b112a15ee47ca5d6618736c2964fa7894f 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/TrigHTTMappingSvc.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimMappingSvc.cxx @@ -1,21 +1,21 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "TrigHTTMappingSvc.h" -#include "TrigHTTConfTools/IHTTEventSelectionSvc.h" +#include "FPGATrackSimMappingSvc.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" -TrigHTTMappingSvc::TrigHTTMappingSvc(const std::string& name, ISvcLocator*svc) : +FPGATrackSimMappingSvc::FPGATrackSimMappingSvc(const std::string& name, ISvcLocator*svc) : AthService(name, svc), - m_EvtSel("HTTEventSelectionSvc", name) + m_EvtSel("FPGATrackSimEventSelectionSvc", name) { } -StatusCode TrigHTTMappingSvc::queryInterface(const InterfaceID& riid, void** ppvIf) +StatusCode FPGATrackSimMappingSvc::queryInterface(const InterfaceID& riid, void** ppvIf) { if (interfaceID() == riid) - *ppvIf = dynamic_cast< TrigHTTMappingSvc* > (this); - else if (ITrigHTTMappingSvc::interfaceID() == riid) - *ppvIf = dynamic_cast<ITrigHTTMappingSvc*> (this); + *ppvIf = dynamic_cast< FPGATrackSimMappingSvc* > (this); + else if (IFPGATrackSimMappingSvc::interfaceID() == riid) + *ppvIf = dynamic_cast<IFPGATrackSimMappingSvc*> (this); else return AthService::queryInterface(riid, ppvIf); @@ -24,7 +24,7 @@ StatusCode TrigHTTMappingSvc::queryInterface(const InterfaceID& riid, void** ppv } -StatusCode TrigHTTMappingSvc::checkInputs() +StatusCode FPGATrackSimMappingSvc::checkInputs() { if (m_pmap_path.value().empty()) ATH_MSG_FATAL("Main plane map definition missing"); @@ -41,7 +41,7 @@ StatusCode TrigHTTMappingSvc::checkInputs() } -StatusCode TrigHTTMappingSvc::checkAllocs() +StatusCode FPGATrackSimMappingSvc::checkAllocs() { if (!m_pmap_1st) ATH_MSG_FATAL("Error using 1st stage plane map: " << m_pmap_path); @@ -60,7 +60,7 @@ StatusCode TrigHTTMappingSvc::checkAllocs() } -StatusCode TrigHTTMappingSvc::initialize() +StatusCode FPGATrackSimMappingSvc::initialize() { ATH_CHECK(m_EvtSel.retrieve()); ATH_CHECK(checkInputs()); @@ -68,26 +68,26 @@ StatusCode TrigHTTMappingSvc::initialize() if (m_mappingType.value() == "FILE") { ATH_MSG_DEBUG("Creating the 1st stage plane map"); - m_pmap_1st = std::unique_ptr<HTTPlaneMap>(new HTTPlaneMap(m_pmap_path.value(), m_EvtSel->getRegionID(), 1, m_layerOverrides)); + m_pmap_1st = std::unique_ptr<FPGATrackSimPlaneMap>(new FPGATrackSimPlaneMap(m_pmap_path.value(), m_EvtSel->getRegionID(), 1, m_layerOverrides)); ATH_MSG_DEBUG("Creating the 2nd stage plane map"); - m_pmap_2nd = std::unique_ptr<HTTPlaneMap>(new HTTPlaneMap(m_pmap_path.value(), m_EvtSel->getRegionID(), 2)); + m_pmap_2nd = std::unique_ptr<FPGATrackSimPlaneMap>(new FPGATrackSimPlaneMap(m_pmap_path.value(), m_EvtSel->getRegionID(), 2)); ATH_MSG_DEBUG("Creating the 1st stage region map"); - m_rmap_1st = std::unique_ptr<HTTRegionMap>(new HTTRegionMap(m_pmap_1st.get(), m_rmap_path.value())); + m_rmap_1st = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_1st.get(), m_rmap_path.value())); ATH_MSG_DEBUG("Creating the 2nd stage region map"); - m_rmap_2nd = std::unique_ptr<HTTRegionMap>(new HTTRegionMap(m_pmap_2nd.get(), m_rmap_path.value())); + m_rmap_2nd = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_2nd.get(), m_rmap_path.value())); ATH_MSG_DEBUG("Creating the sub-region map"); - m_subrmap = std::unique_ptr<HTTRegionMap>(new HTTRegionMap(m_pmap_1st.get(), m_subrmap_path.value())); + m_subrmap = std::unique_ptr<FPGATrackSimRegionMap>(new FPGATrackSimRegionMap(m_pmap_1st.get(), m_subrmap_path.value())); ATH_MSG_DEBUG("Setting the Module LUT for Region Maps"); m_rmap_1st->loadModuleIDLUT(m_modulelut_path.value().c_str()); m_rmap_2nd->loadModuleIDLUT(m_modulelut_path.value().c_str()); ATH_MSG_DEBUG("Creating NN weighting map"); - m_NNmap = std::unique_ptr<HTTNNMap>(new HTTNNMap(m_NNmap_path.value())); + m_NNmap = std::unique_ptr<FPGATrackSimNNMap>(new FPGATrackSimNNMap(m_NNmap_path.value())); } ATH_CHECK(checkAllocs()); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimMappingSvc.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimMappingSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..05a20c47e2b97a1aff6996e1f34ee9d466e7bb65 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimMappingSvc.h @@ -0,0 +1,69 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef TRIGFPGATrackSimMAPPINGSVC_H +#define TRIGFPGATrackSimMAPPINGSVC_H + +#include "AthenaBaseComps/AthService.h" + +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" +#include "FPGATrackSimMaps/FPGATrackSimNNMap.h" +#include "FPGATrackSimMaps/IFPGATrackSimMappingSvc.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" +#include "FPGATrackSimConfTools/IFPGATrackSimEventSelectionSvc.h" + +class IFPGATrackSimEventSelectionSvc; + +class FPGATrackSimMappingSvc : public AthService, virtual public IFPGATrackSimMappingSvc +{ + public: + + FPGATrackSimMappingSvc(const std::string& name, ISvcLocator* svc); + virtual ~FPGATrackSimMappingSvc() = default; + + virtual StatusCode initialize() override; + + virtual const FPGATrackSimPlaneMap* PlaneMap_1st() const override { return m_pmap_1st.get(); } + virtual const FPGATrackSimPlaneMap* PlaneMap_2nd() const override { return m_pmap_2nd.get(); } + virtual const FPGATrackSimRegionMap* RegionMap_1st() const override { return m_rmap_1st.get(); } + virtual const FPGATrackSimRegionMap* RegionMap_2nd() const override { return m_rmap_2nd.get(); } + virtual const FPGATrackSimRegionMap* SubRegionMap() const override { return m_subrmap.get(); } + virtual const FPGATrackSimNNMap* NNMap() const override { return m_NNmap.get(); } + + static const InterfaceID& interfaceID(); + virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIf) override; + + private: + + // Handles + ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel; + + // Configuration + + Gaudi::Property<std::string> m_mappingType {this, "mappingType", "FILE", "for now should be FILE only, DB for the future"}; + Gaudi::Property<std::string> m_rmap_path {this, "rmap", "", "path of the region-map file"}; + Gaudi::Property<std::string> m_subrmap_path {this, "subrmap", "", "path of the region-map file for subregions"}; + Gaudi::Property<std::string> m_pmap_path {this, "pmap", "", "path of the PMAP file"}; + Gaudi::Property<std::string> m_modulelut_path {this, "modulemap", "", "path of the ModuleLUT file"}; + Gaudi::Property<std::string> m_NNmap_path {this, "NNmap", "", "path of the NN weighting file"}; + Gaudi::Property<std::vector <int> > m_layerOverrides {this, "layerOverride", {}, "Overrides the selection of the 1st stage logical layers in the plane map. Each entry declares a detector layer to use as a logical layer. Specify a detector layer with { SiliconTech * 1000 + DetectorZone * 100 + PhysicalLayer }"}; + + // Map unique pointers + std::unique_ptr<FPGATrackSimPlaneMap> m_pmap_1st = nullptr; // pointer to the pmap object for 1st stage + std::unique_ptr<FPGATrackSimPlaneMap> m_pmap_2nd = nullptr; // pointer to the pmap object for 2nd stage + std::unique_ptr<FPGATrackSimRegionMap> m_rmap_1st = nullptr; // pointer to the RMAP object using 1st stage plane map + std::unique_ptr<FPGATrackSimRegionMap> m_rmap_2nd = nullptr; // pointer to the RMAP object using 2nd stage plane map + std::unique_ptr<FPGATrackSimRegionMap> m_subrmap = nullptr; + std::unique_ptr<FPGATrackSimNNMap> m_NNmap = nullptr; + + // Helpers + StatusCode checkInputs(); + StatusCode checkAllocs(); +}; + +inline const InterfaceID& FPGATrackSimMappingSvc::interfaceID() +{ + static const InterfaceID IID_FPGATrackSimMappingSvc("FPGATrackSimMappingSvc", 1, 0); + return IID_FPGATrackSimMappingSvc; +} + +#endif // TRIGFPGATrackSimMAPPINGSVC_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTNNMap.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimNNMap.cxx similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTNNMap.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimNNMap.cxx index 31250d3f9c7e11ccdcc99a836259cc026856c1f4..1bb31c288dbf4a37130ef5249ec9e3f91065a35b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTNNMap.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimNNMap.cxx @@ -1,13 +1,13 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTNNMap.cxx + * @file FPGATrackSimNNMap.cxx * @author Elliott Cheu * @date April 27, 2021 - * @brief See HTTNNMap.h + * @brief See FPGATrackSimNNMap.h */ -#include "TrigHTTMaps/HTTNNMap.h" +#include "FPGATrackSimMaps/FPGATrackSimNNMap.h" #include <string> #include <sstream> @@ -23,7 +23,7 @@ using namespace asg::msgUserCode; -HTTNNMap::HTTNNMap(const std::string & filepath) +FPGATrackSimNNMap::FPGATrackSimNNMap(const std::string & filepath) { // Open file with NN weights @@ -33,7 +33,7 @@ HTTNNMap::HTTNNMap(const std::string & filepath) ANA_MSG_INFO("Opened file: " << weightsFileName); else { ANA_MSG_FATAL("Unable to open file: " << weightsFileName); - throw ("HTTNNMap could not open " + weightsFileName); + throw ("FPGATrackSimNNMap could not open " + weightsFileName); } auto cfg = lwt::parse_json_graph( input_cfg ); @@ -42,5 +42,5 @@ HTTNNMap::HTTNNMap(const std::string & filepath) // Returns pointer to NN weighting map -std::shared_ptr<lwt::LightweightGraph> HTTNNMap::getNNMap() const {return m_lwnn_map;} +std::shared_ptr<lwt::LightweightGraph> FPGATrackSimNNMap::getNNMap() const {return m_lwnn_map;} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTNNMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimNNMap.h similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTNNMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimNNMap.h index 7324af8fe8aecbca278fc9b32a95d1e3ae97db11..5e79d7a88099d7ad8377193a5b68b43d64b36479 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTNNMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimNNMap.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef HTTNNMAP_H -#define HTTNNMAP_H +#ifndef FPGATrackSimNNMAP_H +#define FPGATrackSimNNMAP_H /** - * @file HTTNNMap.h + * @file FPGATrackSimNNMap.h * @author Elliott Cheu * @date April 28, 2021 * @brief Map for NN tracking @@ -23,13 +23,13 @@ #include <fstream> #include <string> -class HTTNNMap +class FPGATrackSimNNMap { public: /////////////////////////////////////////////////////////////////////// // Constructor/Destructor - HTTNNMap(const std::string & filepath); + FPGATrackSimNNMap(const std::string & filepath); /////////////////////////////////////////////////////////////////////// // Simple Getters/Setters @@ -53,4 +53,4 @@ class HTTNNMap }; -#endif // HTTNNMAP_H +#endif // FPGATrackSimNNMAP_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTPlaneMap.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx similarity index 88% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTPlaneMap.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx index 8e75108bddefd884e17ff8f7169a6a02fa8c5295..e4a93aab368d3411edbafc46445ab26308fe27be 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTPlaneMap.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimPlaneMap.cxx @@ -1,15 +1,15 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTPlaneMap.h + * @file FPGATrackSimPlaneMap.h * @author Riley Xu - rixu@cern.ch (rewrite from FTK) * @date Janurary 7th, 2020 * @brief See header. */ -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include <AsgMessaging/MessageCheck.h> #include <numeric> @@ -24,7 +24,7 @@ using namespace std; /////////////////////////////////////////////////////////////////////////////// -HTTPlaneMap::HTTPlaneMap(const std::string & filepath, unsigned region, unsigned stage, std::vector<int> layerOverrides) : +FPGATrackSimPlaneMap::FPGATrackSimPlaneMap(const std::string & filepath, unsigned region, unsigned stage, std::vector<int> layerOverrides) : m_map(static_cast<int>(SiliconTech::nTechs), vector<vector<LayerSection>>(static_cast<int>(DetectorZone::nZones)) ), @@ -35,7 +35,7 @@ HTTPlaneMap::HTTPlaneMap(const std::string & filepath, unsigned region, unsigned if (!fin.is_open()) { ANA_MSG_FATAL("Couldn't open " << filepath); - throw ("HTTPlaneMap Couldn't open " + filepath); + throw ("FPGATrackSimPlaneMap Couldn't open " + filepath); } // Reads the header of the file to resize all the vector members @@ -61,7 +61,7 @@ HTTPlaneMap::HTTPlaneMap(const std::string & filepath, unsigned region, unsigned // Reads the header of the file to resize all the vector members -void HTTPlaneMap::allocateMap(ifstream & fin, uint32_t stage) +void FPGATrackSimPlaneMap::allocateMap(ifstream & fin, uint32_t stage) { // Initialize read variables vector<int> layerCounts((int)SiliconTech::nTechs * static_cast<int>(DetectorZone::nZones)); // pixel_barrel, pixel_EC, SCT_barrel, SCT_EC @@ -134,7 +134,7 @@ void HTTPlaneMap::allocateMap(ifstream & fin, uint32_t stage) } // Seeks to the selected region -void HTTPlaneMap::seek(ifstream & fin, unsigned region) +void FPGATrackSimPlaneMap::seek(ifstream & fin, unsigned region) { std::string line, key; unsigned region_read = -1; @@ -154,10 +154,10 @@ void HTTPlaneMap::seek(ifstream & fin, unsigned region) // Reads the rest of the file to populate all the member vectors -void HTTPlaneMap::readLayers(ifstream & fin, uint32_t stage) +void FPGATrackSimPlaneMap::readLayers(ifstream & fin, uint32_t stage) { // Initialize read variables - int BEC, physLayer, physDisk, logiLayer = 0, logiLayer1, logiLayer2, stereo, nDim = 0; + int BEC{}, physLayer{}, physDisk{}, logiLayer{}, logiLayer1{}, logiLayer2{}, stereo{}, nDim{}; string line, silicon, planeKey1, planeKey2, stereoKey; bool ok = true; @@ -234,18 +234,18 @@ void HTTPlaneMap::readLayers(ifstream & fin, uint32_t stage) /////////////////////////////////////////////////////////////////////////////// -void HTTPlaneMap::map(HTTHit & hit) const +void FPGATrackSimPlaneMap::map(FPGATrackSimHit & hit) const { if (hit.isMapped()) return; // re-assign layers in the pixel endcap to be each individual disk - unsigned HTTlayer = hit.getPhysLayer(); + unsigned FPGATrackSimlayer = hit.getPhysLayer(); if (hit.isPixel() && !hit.isBarrel()) { if (hit.getPhysLayer()< m_diskIndex.size()) - HTTlayer = hit.getHTTEtaModule() + m_diskIndex[hit.getPhysLayer()]; + FPGATrackSimlayer = hit.getFPGATrackSimEtaModule() + m_diskIndex[hit.getPhysLayer()]; else ANA_MSG_ERROR("Error: requesting "<< hit.getPhysLayer() <<" element in m_diskIndex which is of size "<< m_diskIndex.size() ); } - hit.setPhysLayer(HTTlayer); + hit.setPhysLayer(FPGATrackSimlayer); const LayerSection &pinfo = getLayerSection(hit.getDetType(), hit.getDetectorZone(), hit.getPhysLayer()); hit.setSection(pinfo.section); @@ -260,7 +260,7 @@ void HTTPlaneMap::map(HTTHit & hit) const /////////////////////////////////////////////////////////////////////////////// // Gets the logical layer number based on the override list -int HTTPlaneMap::getOverrideLayer(SiliconTech si, DetectorZone dz, int physLayer) // TODO does dz need edit for negEndcap? +int FPGATrackSimPlaneMap::getOverrideLayer(SiliconTech si, DetectorZone dz, int physLayer) // TODO does dz need edit for negEndcap? { int code = static_cast<int>(si) * 1000 + static_cast<int>(dz) * 100 + physLayer; for (unsigned i = 0; i < m_layerOverrides.size(); i++) @@ -268,7 +268,7 @@ int HTTPlaneMap::getOverrideLayer(SiliconTech si, DetectorZone dz, int physLayer return -1; } -std::string HTTPlaneMap::layerName(uint32_t layer, uint32_t section) const +std::string FPGATrackSimPlaneMap::layerName(uint32_t layer, uint32_t section) const { std::string out; out += (isPixel(layer) ? "PIX" : "SCT"); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTRegionMap.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimRegionMap.cxx similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTRegionMap.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimRegionMap.cxx index df922377d264787889a22c721237d4a5bd0fb33c..4274f2ea9d3d3aec2a904e64bdbed3ffcd5ce385 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTRegionMap.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimRegionMap.cxx @@ -1,15 +1,15 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTRegionMap.h + * @file FPGATrackSimRegionMap.h * @author Riley Xu - riley.xu@cern.ch (rewrite from FTK) * @date Janurary 7th, 2020 - * @brief Maps ITK module indices to HTT regions. + * @brief Maps ITK module indices to FPGATrackSim regions. * * See header. */ -#include "TrigHTTMaps/HTTRegionMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" #include <AsgMessaging/MessageCheck.h> #include <cstdlib> @@ -26,7 +26,7 @@ using namespace asg::msgUserCode; /////////////////////////////////////////////////////////////////////////////// -HTTRegionMap::HTTRegionMap(const HTTPlaneMap *pmap, std::string const & filepath) : +FPGATrackSimRegionMap::FPGATrackSimRegionMap(const FPGATrackSimPlaneMap *pmap, std::string const & filepath) : m_pmap(pmap) { // Open the file @@ -35,7 +35,7 @@ HTTRegionMap::HTTRegionMap(const HTTPlaneMap *pmap, std::string const & filepath if (!fin.is_open()) { ANA_MSG_FATAL("Couldn't open " << filepath); - throw ("HTTRegionMap Couldn't open " + filepath); + throw ("FPGATrackSimRegionMap Couldn't open " + filepath); } // Reads the header of the file to resize all the vector members @@ -47,7 +47,7 @@ HTTRegionMap::HTTRegionMap(const HTTPlaneMap *pmap, std::string const & filepath // Reads the header of the file to resize all the vector members -void HTTRegionMap::allocateMap(ifstream & fin) +void FPGATrackSimRegionMap::allocateMap(ifstream & fin) { string line, towerKey; bool ok = true; @@ -71,7 +71,7 @@ void HTTRegionMap::allocateMap(ifstream & fin) // Reads one region from file. -void HTTRegionMap::readRegion(ifstream & fin, int expected_region) +void FPGATrackSimRegionMap::readRegion(ifstream & fin, int expected_region) { string line, dummy; bool ok = true; @@ -109,20 +109,20 @@ void HTTRegionMap::readRegion(ifstream & fin, int expected_region) if (!ok) { ANA_MSG_FATAL("Found error reading file at line: " << line); - throw "HTTRegionMap read error"; + throw "FPGATrackSimRegionMap read error"; } } // Read module id LUT (defining global -> tower-local module IDs) -void HTTRegionMap::loadModuleIDLUT(std::string const & filepath) +void FPGATrackSimRegionMap::loadModuleIDLUT(std::string const & filepath) { ANA_MSG_INFO("Reading module LUT" << filepath); ifstream fin(filepath); if (!fin.is_open()) { ANA_MSG_ERROR("Couldn't open " << filepath); - throw ("HTTRegionMap Couldn't open " + filepath); + throw ("FPGATrackSimRegionMap Couldn't open " + filepath); } m_global_local_map.clear(); @@ -149,13 +149,13 @@ void HTTRegionMap::loadModuleIDLUT(std::string const & filepath) // Interface Functions /////////////////////////////////////////////////////////////////////////////// -bool HTTRegionMap::isInRegion(uint32_t region, const HTTHit &hit) const +bool FPGATrackSimRegionMap::isInRegion(uint32_t region, const FPGATrackSimHit &hit) const { - return isInRegion(region, hit.getLayer(), hit.getSection(), hit.getHTTEtaModule(), hit.getPhiModule()); + return isInRegion(region, hit.getLayer(), hit.getSection(), hit.getFPGATrackSimEtaModule(), hit.getPhiModule()); } -bool HTTRegionMap::isInRegion(uint32_t region, uint32_t layer, uint32_t section, int eta, int phi) const +bool FPGATrackSimRegionMap::isInRegion(uint32_t region, uint32_t layer, uint32_t section, int eta, int phi) const { if ( region >= m_map.size() || layer >= m_map[region].size() @@ -185,7 +185,7 @@ bool HTTRegionMap::isInRegion(uint32_t region, uint32_t layer, uint32_t section, return true; } -std::vector<uint32_t> HTTRegionMap::getRegions(const HTTHit &hit) const +std::vector<uint32_t> FPGATrackSimRegionMap::getRegions(const FPGATrackSimHit &hit) const { std::vector<uint32_t> regions; for (uint32_t region = 0; region < m_map.size(); region++) @@ -194,7 +194,7 @@ std::vector<uint32_t> HTTRegionMap::getRegions(const HTTHit &hit) const return regions; } -uint32_t HTTRegionMap::getUnmappedID(uint32_t region, const HTTHit &hit) const +uint32_t FPGATrackSimRegionMap::getUnmappedID(uint32_t region, const FPGATrackSimHit &hit) const { /* Todo: Does this handle EC hits correctly? @@ -212,7 +212,7 @@ uint32_t HTTRegionMap::getUnmappedID(uint32_t region, const HTTHit &hit) const uint32_t layer = hit.getLayer(); uint32_t section = hit.getSection(); - int eta = hit.getHTTEtaModule(); + int eta = hit.getFPGATrackSimEtaModule(); int phi = hit.getPhiModule(); int err[] = {1,1,1,1,1,1}; @@ -248,7 +248,7 @@ uint32_t HTTRegionMap::getUnmappedID(uint32_t region, const HTTHit &hit) const } -uint32_t HTTRegionMap::getLocalID(uint32_t region, uint32_t layer, uint32_t globalModuleID) const +uint32_t FPGATrackSimRegionMap::getLocalID(uint32_t region, uint32_t layer, uint32_t globalModuleID) const { // TEMPORARY UNTIL WE HAVE A MODULE LUT (void) region; @@ -257,7 +257,7 @@ uint32_t HTTRegionMap::getLocalID(uint32_t region, uint32_t layer, uint32_t glob } -uint32_t HTTRegionMap::getGlobalID(uint32_t region, uint32_t layer, uint32_t localModuleID) const +uint32_t FPGATrackSimRegionMap::getGlobalID(uint32_t region, uint32_t layer, uint32_t localModuleID) const { if (region >= m_global_local_map.size() || layer >= m_pmap->getNLogiLayers()) { diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTRegionMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimRegionMap.h similarity index 71% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTRegionMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimRegionMap.h index 8ec281621f27fedc64c7d3f6eb85f8d661fe2e8c..5ffe8c33d78565699fe74dea85f45e90710925c3 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTRegionMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimRegionMap.h @@ -1,12 +1,12 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration /** - * @file HTTRegionMap.h + * @file FPGATrackSimRegionMap.h * @author Riley Xu - riley.xu@cern.ch (rewrite from FTK) * @date Janurary 7th, 2020 - * @brief Maps ITK module indices to HTT regions. + * @brief Maps ITK module indices to FPGATrackSim regions. * - * The region map is a text configuration file that defines the regions in HTT. + * The region map is a text configuration file that defines the regions in FPGATrackSim. * A region is roughly an eta/phi slice that handled by the same TP board (??? not quite sure if this is right). * The region map delineates the modules in each region based on InDetIdentifier ids. * @@ -18,13 +18,13 @@ * * Region definition format: * 1. A line with the region number. - * 2. A line for each detector layer (see HTTPlaneMap), which is a space-separated list + * 2. A line for each detector layer (see FPGATrackSimPlaneMap), which is a space-separated list * with the below values. * * Line values (i.e. columns): * 1. isPixel (1/0) | * 2. isEndcap (1/0) } -- These identify the detector layer - * 3. physical layer (see HTTPlaneMap) | + * 3. physical layer (see FPGATrackSimPlaneMap) | * 4. minimum phi id ] -- in this detector layer in this region * 5. maximum phi id ] * 6. total phi modules -- in this detector layer among all regions @@ -37,19 +37,19 @@ * TODO there is no reason to store total phi/eta module in each region. */ -#ifndef HTTREGIONMAP_H -#define HTTREGIONMAP_H +#ifndef FPGATrackSimREGIONMAP_H +#define FPGATrackSimREGIONMAP_H -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" #include <vector> #include <map> #include <fstream> -class HTTHit; +class FPGATrackSimHit; -struct HTTRegionBoundaries +struct FPGATrackSimRegionBoundaries { int phi_min; // minimum phi ID int phi_max; // maximum phi ID @@ -58,21 +58,21 @@ struct HTTRegionBoundaries }; -class HTTRegionMap +class FPGATrackSimRegionMap { public: /////////////////////////////////////////////////////////////////////// // Constructors/Initialization - HTTRegionMap(HTTPlaneMap const * pmap, std::string const & filepath); + FPGATrackSimRegionMap(FPGATrackSimPlaneMap const * pmap, std::string const & filepath); void loadModuleIDLUT(std::string const & filepath); /////////////////////////////////////////////////////////////////////// // Simple Getters/Setters - const HTTPlaneMap* getPlaneMap() const { return m_pmap; } + const FPGATrackSimPlaneMap* getPlaneMap() const { return m_pmap; } int getNRegions() const { return m_nregions; } @@ -81,16 +81,16 @@ class HTTRegionMap /////////////////////////////////////////////////////////////////////// // Main Interface Functions - const HTTRegionBoundaries & getRegionBoundaries(int region, int layer, int section) const + const FPGATrackSimRegionBoundaries & getRegionBoundaries(int region, int layer, int section) const { return m_map.at(region).at(layer).at(section); } - bool isInRegion(uint32_t region, const HTTHit &hit) const; + bool isInRegion(uint32_t region, const FPGATrackSimHit &hit) const; bool isInRegion(uint32_t region, uint32_t plane, uint32_t section, int eta, int phi) const; // Returns a list of regions that hit belongs to - std::vector<uint32_t> getRegions(const HTTHit &hit) const; + std::vector<uint32_t> getRegions(const FPGATrackSimHit &hit) const; - uint32_t getUnmappedID(uint32_t region, const HTTHit &hit) const; + uint32_t getUnmappedID(uint32_t region, const FPGATrackSimHit &hit) const; // These require the module LUT file to be loaded uint32_t getLocalID(uint32_t region, uint32_t layer, uint32_t globalModuleID) const; @@ -98,10 +98,10 @@ class HTTRegionMap private: - const HTTPlaneMap *m_pmap = nullptr; + const FPGATrackSimPlaneMap *m_pmap = nullptr; int m_nregions = 0; - std::vector<std::vector<std::vector<HTTRegionBoundaries>>> m_map; + std::vector<std::vector<std::vector<FPGATrackSimRegionBoundaries>>> m_map; // Index by region, logical layer, section std::vector<std::vector<std::map<uint32_t, uint32_t>>> m_global_local_map; @@ -114,4 +114,4 @@ class HTTRegionMap void readRegion(std::ifstream & fin, int expected_region); }; -#endif // HTTREGIONMAP_H +#endif // FPGATrackSimREGIONMAP_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSectorMap.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSectorMap.cxx similarity index 69% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSectorMap.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSectorMap.cxx index 62423d983ede027d3f3374fe5ee7782c89542e84..6620e7113d4fac09d1e6cb05fa4396e643156b78 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSectorMap.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSectorMap.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTMaps/HTTSectorMap.h" +#include "FPGATrackSimMaps/FPGATrackSimSectorMap.h" #include <iostream> #include <fstream> @@ -12,7 +12,7 @@ using namespace std; using namespace asg::msgUserCode; -std::map<int,int> HTTSectorMap::makeLookup(const char* fname) +std::map<int,int> FPGATrackSimSectorMap::makeLookup(const char* fname) { std::map<int,int> secLookup; ifstream inFile(fname); @@ -29,19 +29,19 @@ std::map<int,int> HTTSectorMap::makeLookup(const char* fname) return secLookup; } -void HTTSectorMap::SetSector(int sec1, int sec2, int sec) { +void FPGATrackSimSectorMap::SetSector(int sec1, int sec2, int sec) { if (m_data.find(sec1)==m_data.end()) m_data[sec1] = mapint(); m_data[sec1][sec2]=sec; } -int HTTSectorMap::GetSector(int sec1, int sec2) { +int FPGATrackSimSectorMap::GetSector(int sec1, int sec2) { if (m_data.find(sec1)!=m_data.end()) if (m_data[sec1].find(sec2)!=m_data[sec1].end()) return m_data[sec1][sec2]; return -1; } -void HTTSectorMap::LoadFromFile(const char *fname) { +void FPGATrackSimSectorMap::LoadFromFile(const char *fname) { ifstream inFile(fname); if (inFile.is_open()) { @@ -54,9 +54,9 @@ void HTTSectorMap::LoadFromFile(const char *fname) { inFile.close(); } -void HTTSectorMap::CreateFile(const char *fname4,const char *fname8, const char *fname11) { - std::map<int,int> map4=HTTSectorMap::makeLookup(fname4); - std::map<int,int> map8=HTTSectorMap::makeLookup(fname8); +void FPGATrackSimSectorMap::CreateFile(const char *fname4,const char *fname8, const char *fname11) { + std::map<int,int> map4=FPGATrackSimSectorMap::makeLookup(fname4); + std::map<int,int> map8=FPGATrackSimSectorMap::makeLookup(fname8); ifstream inFile(fname11); if (inFile.is_open()) { @@ -71,7 +71,7 @@ void HTTSectorMap::CreateFile(const char *fname4,const char *fname8, const char inFile.close(); } -void HTTSectorMap::Dump() { +void FPGATrackSimSectorMap::Dump() { for (mapint2::iterator i = m_data.begin(); i != m_data.end();++i) { for (mapint::iterator j = (*i).second.begin(); j != (*i).second.end();++j) { ANA_MSG_DEBUG((*i).first << " " << (*j).first << " " << (*j).second); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTSectorMap.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSectorMap.h similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTSectorMap.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSectorMap.h index e67e2cc3826eb29958babea4902e91e9d763bad6..e81e95580d5285f55932fdbfb46d7a0f9627c87b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/TrigHTTMaps/HTTSectorMap.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSectorMap.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTSECTORMAP_H -#define HTTSECTORMAP_H +#ifndef FPGATrackSimSECTORMAP_H +#define FPGATrackSimSECTORMAP_H #include <vector> #include <map> @@ -11,15 +11,15 @@ /* A simple map that links sectors in different cases with different layers */ -class HTTSectorMap { +class FPGATrackSimSectorMap { typedef std::map<int,int> mapint; typedef std::map<int,mapint> mapint2; private: mapint2 m_data; public: - HTTSectorMap() = default; - HTTSectorMap(const char *fname) { LoadFromFile(fname); } - ~HTTSectorMap() = default; + FPGATrackSimSectorMap() = default; + FPGATrackSimSectorMap(const char *fname) { LoadFromFile(fname); } + ~FPGATrackSimSectorMap() = default; void SetSector(int, int, int); int GetSector(int, int); void LoadFromFile(const char *); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool.cxx similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool.cxx index 30d98d43e7d82bab5ed4b2f3d3c5ff684d7efe08..81ac5e3ae444f48d0a718e43bf512c20bc9b5618 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool.cxx @@ -1,33 +1,33 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include <array> #include <vector> #include <cmath> -#include "HTTSpacePointsTool.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTConstants.h" -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimSpacePointsTool.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #define PIXELCLUSTER ((int)-2) #define SINGLELAYER ((int)-1) -int updateIndices(const std::vector<HTTHit> &hits, int inner, int outer, const int old); -void calcPosition(const std::vector<HTTHit> &hits, int inner, int outer, float &x, float &y, float &z); +int updateIndices(const std::vector<FPGATrackSimHit> &hits, int inner, int outer, const int old); +void calcPosition(const std::vector<FPGATrackSimHit> &hits, int inner, int outer, float &x, float &y, float &z); -HTTSpacePointsTool::HTTSpacePointsTool(const std::string &algname, const std::string &name, const IInterface *ifc) +FPGATrackSimSpacePointsTool::FPGATrackSimSpacePointsTool(const std::string &algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc) { - declareInterface<HTTSpacePointsToolI>(this); + declareInterface<FPGATrackSimSpacePointsToolI>(this); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTSpacePointsTool::initialize() +StatusCode FPGATrackSimSpacePointsTool::initialize() { if (m_duplicate) ATH_MSG_INFO("Duplicating spacepoint to layer on the other side of the stave"); if (m_filter) ATH_MSG_INFO("Filtering out incomplete spacepoints"); @@ -36,11 +36,11 @@ StatusCode HTTSpacePointsTool::initialize() } -StatusCode HTTSpacePointsTool::DoSpacePoints(HTTLogicalEventInputHeader &header, std::vector<HTTCluster> &spacepoints) +StatusCode FPGATrackSimSpacePointsTool::DoSpacePoints(FPGATrackSimLogicalEventInputHeader &header, std::vector<FPGATrackSimCluster> &spacepoints) { for (int i = 0; i < header.nTowers(); ++i) { - HTTTowerInputHeader &tower = *header.getTower(i); - std::vector<HTTHit> hits = tower.hits(); + FPGATrackSimTowerInputHeader &tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits = tower.hits(); std::vector<std::array<int, 2>> indices; size_t cap; @@ -59,7 +59,7 @@ StatusCode HTTSpacePointsTool::DoSpacePoints(HTTLogicalEventInputHeader &header, spacepoints.reserve(cap); // make spacepoints and store them in the tower for (size_t j = 0; j < cap; ++j) { - HTTCluster sp; + FPGATrackSimCluster sp; // filter out, if there is not spacepoint in stave if (m_filter) { @@ -73,7 +73,7 @@ StatusCode HTTSpacePointsTool::DoSpacePoints(HTTLogicalEventInputHeader &header, if (indices[j][1] > SINGLELAYER) { float x, y, z; - HTTHit h = hits[indices[j][0]]; + FPGATrackSimHit h = hits[indices[j][0]]; sp.push_backHitList(hits[indices[j][1]]); @@ -120,7 +120,7 @@ StatusCode HTTSpacePointsTool::DoSpacePoints(HTTLogicalEventInputHeader &header, return StatusCode::SUCCESS; } -void HTTSpacePointsTool::SpacePointFinder(const std::vector<HTTHit> &hits, std::vector<std::array<int, 2>> &indices) +void FPGATrackSimSpacePointsTool::SpacePointFinder(const std::vector<FPGATrackSimHit> &hits, std::vector<std::array<int, 2>> &indices) { ATH_MSG_DEBUG("\nIncoming hit 0\n" << hits[0] << "\tx = " << hits[0].getX() << "\ty = " << hits[0].getY() << "\tz = " << hits[0].getZ()); @@ -180,7 +180,7 @@ void HTTSpacePointsTool::SpacePointFinder(const std::vector<HTTHit> &hits, std:: } -int updateIndices(const std::vector<HTTHit> &hits, int inner, int outer, int old) +int updateIndices(const std::vector<FPGATrackSimHit> &hits, int inner, int outer, int old) { // global coordinates of the two clusters const float a[] = {hits[inner].getX(), hits[inner].getY(), hits[inner].getZ()}; @@ -201,7 +201,7 @@ int updateIndices(const std::vector<HTTHit> &hits, int inner, int outer, int old return 1; } -void calcPosition(const std::vector<HTTHit> &hits, int inner, int outer, float &x, float &y, float &z) +void calcPosition(const std::vector<FPGATrackSimHit> &hits, int inner, int outer, float &x, float &y, float &z) { float phi_sp = (hits[inner].getGPhi() + hits[outer].getGPhi()) / 2.0; float r_sp = (hits[inner].getR() + hits[outer].getR()) / 2.0;; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool.h new file mode 100644 index 0000000000000000000000000000000000000000..62a7cb0eebb409669ae4a28a17af741c768e8ee1 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimSPACEPOINTSTOOL_H +#define FPGATrackSimSPACEPOINTSTOOL_H + +#include <array> +#include <vector> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimMaps/FPGATrackSimSpacePointsToolI.h" + +class FPGATrackSimSpacePointsTool : public extends<AthAlgTool, FPGATrackSimSpacePointsToolI> { + public: + FPGATrackSimSpacePointsTool(const std::string &, const std::string &, const IInterface *); + virtual ~FPGATrackSimSpacePointsTool() = default; + + virtual StatusCode initialize() override; + + virtual StatusCode DoSpacePoints(FPGATrackSimLogicalEventInputHeader &, std::vector<FPGATrackSimCluster> &) override; + + private: + void SpacePointFinder(const std::vector<FPGATrackSimHit> &, std::vector<std::array<int, 2>> &); + + + Gaudi::Property<bool> m_duplicate {this, "Duplication", false, "Duplicate spacepoint to layer on the other side of the stave"}; + Gaudi::Property<bool> m_filter {this, "Filtering", false, "Filter out incomplete spacepoints"}; + Gaudi::Property<bool> m_filterClose {this, "FilteringClosePoints", false, "Filter out single hits close to spacepoints"}; +}; + +#endif // FPGATrackSimSPACEPOINTSTOOL_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool_v2.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool_v2.cxx similarity index 70% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool_v2.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool_v2.cxx index 6f5863146b1fb4a4cb443a759dbaf966d60dcab2..66642e8fe3f9a4b0b36c5c920a83eb4bc0054ce8 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/HTTSpacePointsTool_v2.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool_v2.cxx @@ -1,24 +1,24 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include <array> #include <vector> -#include "HTTSpacePointsTool_v2.h" -#include "TrigHTTObjects/HTTCluster.h" -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimSpacePointsTool_v2.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" #include "TH1.h" -HTTSpacePointsTool_v2::HTTSpacePointsTool_v2(const std::string &algname, const std::string &name, const IInterface *ifc) +FPGATrackSimSpacePointsTool_v2::FPGATrackSimSpacePointsTool_v2(const std::string &algname, const std::string &name, const IInterface *ifc) : base_class(algname, name, ifc) { - declareInterface<HTTSpacePointsToolI>(this); + declareInterface<FPGATrackSimSpacePointsToolI>(this); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -StatusCode HTTSpacePointsTool_v2::initialize() +StatusCode FPGATrackSimSpacePointsTool_v2::initialize() { if (m_duplicate) ATH_MSG_INFO("Duplicating spacepoint to layer on the other side of the stave"); if (m_filter) ATH_MSG_INFO("Filtering out incomplete spacepoints"); @@ -29,7 +29,7 @@ StatusCode HTTSpacePointsTool_v2::initialize() return StatusCode::SUCCESS; } -StatusCode HTTSpacePointsTool_v2::finalize() +StatusCode FPGATrackSimSpacePointsTool_v2::finalize() { ATH_MSG_INFO("Spacepoints_v2 report"); ATH_MSG_INFO("-----------------------------------------"); @@ -42,12 +42,12 @@ StatusCode HTTSpacePointsTool_v2::finalize() return StatusCode::SUCCESS; } -StatusCode HTTSpacePointsTool_v2::DoSpacePoints(HTTLogicalEventInputHeader &header, std::vector<HTTCluster> &spacepoints) +StatusCode FPGATrackSimSpacePointsTool_v2::DoSpacePoints(FPGATrackSimLogicalEventInputHeader &header, std::vector<FPGATrackSimCluster> &spacepoints) { for (int i = 0; i < header.nTowers(); ++i) { - HTTTowerInputHeader &tower = *header.getTower(i); - std::vector<HTTHit> hits = tower.hits(); + FPGATrackSimTowerInputHeader &tower = *header.getTower(i); + std::vector<FPGATrackSimHit> hits = tower.hits(); if (hits.empty()) continue; m_inputhits += hits.size(); @@ -59,7 +59,7 @@ StatusCode HTTSpacePointsTool_v2::DoSpacePoints(HTTLogicalEventInputHeader &head } -StatusCode HTTSpacePointsTool_v2::fillMaps(std::vector<HTTHit>& hits) +StatusCode FPGATrackSimSpacePointsTool_v2::fillMaps(std::vector<FPGATrackSimHit>& hits) { m_map.clear(); m_pixel.clear(); @@ -78,7 +78,7 @@ StatusCode HTTSpacePointsTool_v2::fillMaps(std::vector<HTTHit>& hits) module_desc[1] = hit.getPhysLayer()/2; //div 2 gives layer as part of pair unsigned side = hit.getPhysLayer()%2; // even/odd layer module_desc[2] = hit.getPhiModule(); - module_desc[3] = hit.getHTTEtaModule(); + module_desc[3] = hit.getFPGATrackSimEtaModule(); if (side==0) m_map[module_desc].first.push_back(hit); @@ -89,7 +89,7 @@ StatusCode HTTSpacePointsTool_v2::fillMaps(std::vector<HTTHit>& hits) return StatusCode::SUCCESS; } -StatusCode HTTSpacePointsTool_v2::makeSpacePoints(HTTTowerInputHeader &tower, std::vector<HTTCluster> &spacepoints) +StatusCode FPGATrackSimSpacePointsTool_v2::makeSpacePoints(FPGATrackSimTowerInputHeader &tower, std::vector<FPGATrackSimCluster> &spacepoints) { // delete the old clusters, this will be replaced by the spacepoints @@ -98,8 +98,8 @@ StatusCode HTTSpacePointsTool_v2::makeSpacePoints(HTTTowerInputHeader &tower, st for (auto entry : m_map) { // std::vector<int> const & module_desc = entry.first; - std::vector<HTTHit>& hits_inner = entry.second.first; - std::vector<HTTHit>& hits_outer = entry.second.second; + std::vector<FPGATrackSimHit>& hits_inner = entry.second.first; + std::vector<FPGATrackSimHit>& hits_outer = entry.second.second; for (auto hit_in : hits_inner) { int startsize = spacepoints.size(); @@ -166,7 +166,7 @@ StatusCode HTTSpacePointsTool_v2::makeSpacePoints(HTTTowerInputHeader &tower, st } -bool HTTSpacePointsTool_v2::searchForMatch(HTTHit& hit_in,std::vector<HTTHit>& hits_outer,HTTTowerInputHeader &tower, std::vector<HTTCluster> &spacepoints) +bool FPGATrackSimSpacePointsTool_v2::searchForMatch(FPGATrackSimHit& hit_in,std::vector<FPGATrackSimHit>& hits_outer,FPGATrackSimTowerInputHeader &tower, std::vector<FPGATrackSimCluster> &spacepoints) { bool foundPair = false; for (auto hit_out : hits_outer) @@ -180,7 +180,7 @@ bool HTTSpacePointsTool_v2::searchForMatch(HTTHit& hit_in,std::vector<HTTHit>& h return foundPair; } -void HTTSpacePointsTool_v2::addSpacePoints(HTTHit& hit_in, HTTHit& hit_out ,HTTTowerInputHeader &tower, std::vector<HTTCluster> &spacepoints) +void FPGATrackSimSpacePointsTool_v2::addSpacePoints(FPGATrackSimHit& hit_in, FPGATrackSimHit& hit_out ,FPGATrackSimTowerInputHeader &tower, std::vector<FPGATrackSimCluster> &spacepoints) { // Make a spacepoint //------------------ @@ -204,7 +204,7 @@ void HTTSpacePointsTool_v2::addSpacePoints(HTTHit& hit_in, HTTHit& hit_out ,HTTT } // push back a copy for monitoring - HTTCluster sp; + FPGATrackSimCluster sp; sp.setClusterEquiv(hit_in); sp.push_backHitList(hit_in); sp.push_backHitList(hit_out); @@ -214,7 +214,7 @@ void HTTSpacePointsTool_v2::addSpacePoints(HTTHit& hit_in, HTTHit& hit_out ,HTTT -void HTTSpacePointsTool_v2::calcPosition(HTTHit &hit_in, HTTHit &hit_out, float &x, float &y, float &z) +void FPGATrackSimSpacePointsTool_v2::calcPosition(FPGATrackSimHit &hit_in, FPGATrackSimHit &hit_out, float &x, float &y, float &z) { float phi_sp = (hit_in.getGPhi() + hit_out.getGPhi()) / 2.0; float r_sp = (hit_in.getR() + hit_out.getR()) / 2.0;; @@ -235,21 +235,21 @@ void HTTSpacePointsTool_v2::calcPosition(HTTHit &hit_in, HTTHit &hit_out, float // don't let r_sp out of range of edge of module TODO fix hardcode float r_bounds[19] = {394.0, 415.5, 442.0, 472.4, 498.85, 521.45, 547.05, 566.65, 591.0, 621.8, 654.7, 683.9, 710.2, 739.4, 784.2, 838.8, 887.6, 937.7, 967.8}; - if (hit_in.getHTTEtaModule()==hit_in.getHTTEtaModule()){ - float r_limited = std::max(r_sp,r_bounds[hit_in.getHTTEtaModule()]); - r_limited = std::min(r_sp,r_bounds[hit_in.getHTTEtaModule()+1]); + if (hit_in.getFPGATrackSimEtaModule()==hit_in.getFPGATrackSimEtaModule()){ + float r_limited = std::max(r_sp,r_bounds[hit_in.getFPGATrackSimEtaModule()]); + r_limited = std::min(r_sp,r_bounds[hit_in.getFPGATrackSimEtaModule()+1]); if (r_sp!=r_limited) { ATH_MSG_WARNING("Spacepoint location not in module boundary: r_sp=" << r_sp - << " not in [" << r_bounds[hit_in.getHTTEtaModule()] << "," << r_bounds[hit_in.getHTTEtaModule()+1] << "]"); + << " not in [" << r_bounds[hit_in.getFPGATrackSimEtaModule()] << "," << r_bounds[hit_in.getFPGATrackSimEtaModule()+1] << "]"); r_sp=r_limited; } - } else if (hit_in.getHTTEtaModule()==hit_in.getHTTEtaModule()+1) { + } else if (hit_in.getFPGATrackSimEtaModule()==hit_in.getFPGATrackSimEtaModule()+1) { float window = 3; //mm, max possible distance between hits from same track with reasonable incline to module - float r_limited = std::max(r_sp,r_bounds[hit_in.getHTTEtaModule()+1]-window); - r_limited = std::min(r_sp,r_bounds[hit_in.getHTTEtaModule()+1]+window); + float r_limited = std::max(r_sp,r_bounds[hit_in.getFPGATrackSimEtaModule()+1]-window); + r_limited = std::min(r_sp,r_bounds[hit_in.getFPGATrackSimEtaModule()+1]+window); if (r_sp!=r_limited) { ATH_MSG_WARNING("Crossing spacepoint location too far from module boundary: r_sp=" << r_sp - << " not in [" << r_bounds[hit_in.getHTTEtaModule()+1]-window << "," << r_bounds[hit_in.getHTTEtaModule()+1]+window << "]"); + << " not in [" << r_bounds[hit_in.getFPGATrackSimEtaModule()+1]-window << "," << r_bounds[hit_in.getFPGATrackSimEtaModule()+1]+window << "]"); r_sp=r_limited; } } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool_v2.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool_v2.h new file mode 100644 index 0000000000000000000000000000000000000000..28eb86fc98823d519cf89b9c996343ffe92d3331 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/FPGATrackSimSpacePointsTool_v2.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimSPACEPOINTSTOOLV2_H +#define FPGATrackSimSPACEPOINTSTOOLV2_H + +#include <array> +#include <vector> +#include <map> + +#include "AthenaBaseComps/AthAlgTool.h" +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimMaps/FPGATrackSimSpacePointsToolI.h" + +class TH1I; + +class FPGATrackSimSpacePointsTool_v2 : public extends<AthAlgTool, FPGATrackSimSpacePointsToolI> { + public: + FPGATrackSimSpacePointsTool_v2(const std::string &, const std::string &, const IInterface *); + virtual ~FPGATrackSimSpacePointsTool_v2() = default; + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + virtual StatusCode DoSpacePoints(FPGATrackSimLogicalEventInputHeader &, std::vector<FPGATrackSimCluster> &) override; + + private: + StatusCode fillMaps(std::vector<FPGATrackSimHit>& hits); + StatusCode makeSpacePoints(FPGATrackSimTowerInputHeader &tower, std::vector<FPGATrackSimCluster> &spacepoints); + void calcPosition(FPGATrackSimHit &hit_in, FPGATrackSimHit &hit_out, float &x, float &y, float &z); + bool searchForMatch(FPGATrackSimHit& hit_in,std::vector<FPGATrackSimHit>& hits_outer,FPGATrackSimTowerInputHeader &tower, std::vector<FPGATrackSimCluster> &spacepoints); + void addSpacePoints(FPGATrackSimHit& hit_in, FPGATrackSimHit& hit_out ,FPGATrackSimTowerInputHeader &tower, std::vector<FPGATrackSimCluster> &spacepoints); + + //---------------------- + // Working Memory + std::map<std::vector<int>,std::pair<std::vector<FPGATrackSimHit>,std::vector<FPGATrackSimHit>>> m_map; + std::vector<FPGATrackSimHit> m_pixel; + + Gaudi::Property<float> m_phiwindow {this, "PhiWindow", 0.008, "Distance in phi (radians) to consider two hits for making a space-point"}; + Gaudi::Property<bool> m_duplicate {this, "Duplication", false, "Duplicate spacepoint to layer on the other side of the stave"}; + Gaudi::Property<bool> m_filter {this, "Filtering", false, "Filter out incomplete spacepoints"}; + Gaudi::Property<bool> m_filterClose {this, "FilteringClosePoints", false, "Filter out single hits close to spacepoints"}; + + // self monitoring + unsigned m_inputhits = 0; + unsigned m_spacepts = 0; + unsigned m_filteredhits = 0; + unsigned m_diffmodule = 0; + TH1I* m_spacepts_per_hit = nullptr; + +}; + +#endif // FPGATrackSimSPACEPOINTSTOOLV2_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/components/FPGATrackSimMaps_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/components/FPGATrackSimMaps_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8120f9662a2ff8a418a2241613201b536c8b6278 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/components/FPGATrackSimMaps_entries.cxx @@ -0,0 +1,14 @@ +#include "../FPGATrackSimMappingSvc.h" +#include "../FPGATrackSimSpacePointsTool.h" +#include "../FPGATrackSimSpacePointsTool_v2.h" +#include "../FPGATrackSimHitFilteringTool.h" +#include "../FPGATrackSimClusteringTool.h" +#include "../FPGATrackSimClusteringOfflineTool.h" + +DECLARE_COMPONENT(FPGATrackSimMappingSvc) +DECLARE_COMPONENT( FPGATrackSimClusteringTool ) +DECLARE_COMPONENT( FPGATrackSimClusteringOfflineTool ) +DECLARE_COMPONENT(FPGATrackSimSpacePointsTool) +DECLARE_COMPONENT(FPGATrackSimSpacePointsTool_v2) +DECLARE_COMPONENT(FPGATrackSimHitFilteringTool) +DECLARE_COMPONENT(FPGATrackSimMappingSvc) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/geometry_constants.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/geometry_constants.h similarity index 91% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/geometry_constants.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/geometry_constants.h index 630822ccba0b473bfe7f24db641cc5ba10ac5875..7d6d6e69bc9fbe9c5d1bc248103c67da809bcdf4 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/src/geometry_constants.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/src/geometry_constants.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #ifndef GEOMETRY_CONSTANTS_H #define GEOMETRY_CONSTANTS_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/test/HTTPlaneMap_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/test/FPGATrackSimPlaneMap_test.cxx similarity index 80% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/test/HTTPlaneMap_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/test/FPGATrackSimPlaneMap_test.cxx index f0803758e5f159b92baa5351ca9b3326f6236b32..1f3163a563cf19e1ebd587584946de84d0f78837 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/test/HTTPlaneMap_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/test/FPGATrackSimPlaneMap_test.cxx @@ -1,6 +1,6 @@ /** - * @file HTTSSMap_test.cxx - * @brief Unit tests for HTTSSMap + * @file FPGATrackSimSSMap_test.cxx + * @brief Unit tests for FPGATrackSimSSMap * @author Riley Xu - rixu@cern.ch * @date 2020-01-15 */ @@ -14,7 +14,7 @@ #include "TestTools/initGaudi.h" #include "AthenaKernel/getMessageSvc.h" -#include "TrigHTTMaps/HTTPlaneMap.h" +#include "FPGATrackSimMaps/FPGATrackSimPlaneMap.h" using namespace std; @@ -22,7 +22,7 @@ using namespace std; // Hard-coded values from step3_01eta03_03phi05.pmap // Make sure to change these if the file is changed -void test(HTTPlaneMap & pmap) +void test(FPGATrackSimPlaneMap & pmap) { //assert(pmap.getNDetLayers() == 227); assert(pmap.getNLogiLayers() == 8); @@ -50,8 +50,8 @@ int main(int, char**) return 1; } - string pmap_path="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/step3_01eta03_03phi05.pmap"; - HTTPlaneMap pmap(pmap_path, 0, 1); + string pmap_path="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData//HTT/TrigHTTMaps/V1/map_file/step3_01eta03_03phi05.pmap"; + FPGATrackSimPlaneMap pmap(pmap_path, 0, 1); test(pmap); diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/test/HTTRegionMap_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/test/FPGATrackSimRegionMap_test.cxx similarity index 77% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/test/HTTRegionMap_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/test/FPGATrackSimRegionMap_test.cxx index d35922ddddee2cc95f80aa658f3adee82d50e6fb..bdc8acb59ca5a050a8b5c6343bee8c3c9133b6e1 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTMaps/test/HTTRegionMap_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimMaps/test/FPGATrackSimRegionMap_test.cxx @@ -1,6 +1,6 @@ /** - * @file HTTRegionMap_test.cxx - * @brief Unit tests for HTTRegionMap + * @file FPGATrackSimRegionMap_test.cxx + * @brief Unit tests for FPGATrackSimRegionMap * @author Riley Xu - rixu@cern.ch * @date 2020-01-15 */ @@ -13,14 +13,14 @@ #include "TestTools/initGaudi.h" #include "AthenaKernel/getMessageSvc.h" -#include "TrigHTTMaps/HTTRegionMap.h" +#include "FPGATrackSimMaps/FPGATrackSimRegionMap.h" using namespace std; -void test(HTTRegionMap & rmap) +void test(FPGATrackSimRegionMap & rmap) { // Hard-coded values from above files. // Make sure to change these if those files are changed @@ -30,7 +30,7 @@ void test(HTTRegionMap & rmap) } -void test_LUT(HTTRegionMap & rmap) +void test_LUT(FPGATrackSimRegionMap & rmap) { (void)rmap; // TODO } @@ -48,8 +48,8 @@ int main(int, char**) string pmap_path="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/step3_01eta03_03phi05.pmap"; string rmap_path="/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/HTT/TrigHTTMaps/V1/map_file/rmaps/eta0103phi0305_ATLAS-P2-ITK-23-00-01.rmap"; - HTTPlaneMap pmap(pmap_path, 0, 1); - HTTRegionMap rmap(&pmap, rmap_path); + FPGATrackSimPlaneMap pmap(pmap_path, 0, 1); + FPGATrackSimRegionMap rmap(&pmap, rmap_path); test(rmap); test_LUT(rmap); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..aef08ee2b91a6f40c158a2bcee150d7dbbc12464 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( FPGATrackSimObjects ) + +# External dependencies: +find_package( ROOT COMPONENTS Core MathCore Hist ) + +# Component(s) in the package: +atlas_add_root_dictionary( FPGATrackSimObjectsLib + FPGATrackSimObjectsLibDictSource + ROOT_HEADERS FPGATrackSimObjects/*.h + EXTERNAL_PACKAGES ROOT +) + +atlas_add_library( FPGATrackSimObjectsLib + src/*.cxx FPGATrackSimObjects/*.h src/*.h ${FPGATrackSimObjectsLibDictSource} + PUBLIC_HEADERS FPGATrackSimObjects + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} +) + +# Tests in the package: +atlas_add_test( FPGATrackSimRoad_test + SOURCES test/FPGATrackSimRoad_test.cxx + LINK_LIBRARIES FPGATrackSimObjectsLib +) + +atlas_add_test( FPGATrackSimTrack_test + SOURCES test/FPGATrackSimTrack_test.cxx + LINK_LIBRARIES FPGATrackSimObjectsLib +) + +atlas_add_test( FPGATrackSimLogicalEventInputHeader_test + SOURCES test/FPGATrackSimLogicalEventInputHeader_test.cxx + LINK_LIBRARIES FPGATrackSimObjectsLib +) + +atlas_add_test( FPGATrackSimLogicalEventOutputHeader_test + SOURCES test/FPGATrackSimLogicalEventOutputHeader_test.cxx + LINK_LIBRARIES FPGATrackSimObjectsLib +) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..c93056c5b51693cc104c3c8d06ea80af7e8bb8b8 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimObjects/ diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimCluster.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimCluster.h new file mode 100644 index 0000000000000000000000000000000000000000..4b74045e2ab85e9d29ba2e650fa7ba2b97106dec --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimCluster.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimCLUSTER_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimCLUSTER_H + +/* + * FPGATrackSimCluster.h: This file declares the class used to represent clusters. + * Declarations in this file: + * class FPGATrackSimCluster + * Author: Alex Martyniuk + * Email: martyniu@cern.ch + */ + +#include <TObject.h> +#include "FPGATrackSimObjects/FPGATrackSimHit.h" + + /* + * Clusters resulting from FPGATrackSim clustering algorithms as stored in m_clusterEquiv as a FPGATrackSimHit + * The raw hits used to form this cluster are stored in the m_hitlist, the first entry is the seed that initiated this cluster. + */ +typedef std::vector<FPGATrackSimHit> hitVector; +class FPGATrackSimCluster : public TObject +{ +public: + virtual ~FPGATrackSimCluster() = default; + + // get private members + hitVector const& getHitList() const { return m_hitlist; } + FPGATrackSimHit const& getClusterEquiv() const { return m_clusterEquiv; } + + // set private members + void setHitList(const hitVector& input) { m_hitlist = input; } + void setClusterEquiv(const FPGATrackSimHit& input) { m_clusterEquiv = input; } + + // filling functions + void push_backHitList(const FPGATrackSimHit& input) { m_hitlist.push_back(input); } + +private: + hitVector m_hitlist; // list of hits that make the cluster, the seed of the cluster will be the first entry in this list. + FPGATrackSimHit m_clusterEquiv; // This is the cluster + + ClassDef(FPGATrackSimCluster, 3); +}; + +std::ostream& operator<<(std::ostream& o, const FPGATrackSimCluster& cluster); + + +#endif // FPGATrackSimCLUSTER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTConstants.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimConstants.h similarity index 73% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTConstants.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimConstants.h index 340b7ec066e12713cd126a2cc95e3eac2f45bde8..9da5f22aa27858196096ea76114d06d850fdc8b3 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTConstants.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimConstants.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_CONSTANTS_H -#define TRIGHTTOBJECTS_CONSTANTS_H +#ifndef TRIGFPGATrackSimOBJECTS_CONSTANTS_H +#define TRIGFPGATrackSimOBJECTS_CONSTANTS_H #include <vector> @@ -17,7 +17,7 @@ namespace htt { const std::vector< double > QOVERPT_BINS = { -0.001, -0.0009, -0.00075, -0.0006, -0.00045, -0.0003, -0.00015, -0.000075, 0.000075, 0.00015, 0.0003, 0.00045, 0.0006, 0.00075, 0.0009, 0.001}; - // --- This is the current HTTCluster to HTTHit scaling factor --- // + // --- This is the current FPGATrackSimCluster to FPGATrackSimHit scaling factor --- // constexpr float scaleHitFactor = 2; constexpr float DEG_TO_RAD = 0.017453292519943295; @@ -25,4 +25,4 @@ namespace htt { } -#endif // TRIGHTTOBJECTS_CONSTANTS_H +#endif // TRIGFPGATrackSimOBJECTS_CONSTANTS_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTDataFlowInfo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h similarity index 85% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTDataFlowInfo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h index 8d504f14c56861da98fb1cea248ce35b65c020a5..344d624c954a07915ecc1638fb929b2f5a92725b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTDataFlowInfo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h @@ -1,20 +1,20 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef TRIGHTTOBJECTS_HTTDATAFLOWINFO_H -#define TRIGHTTOBJECTS_HTTDATAFLOWINFO_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimDATAFLOWINFO_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimDATAFLOWINFO_H /** - * @file HTTDataFlowInfo.h + * @file FPGATrackSimDataFlowInfo.h * @author Yumeng Cao - yumeng.cao@cern.ch * @date July 17th, 2021 * @brief Structs that store the data flow information per event */ - //#include "TrigHTTObjects/HTTTypes.h" + //#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <iostream> #include <vector> -class HTTDataFlowInfo +class FPGATrackSimDataFlowInfo { public: std::vector<size_t> nMappedHits_1st_layer; // Number of 1st stage mapped hits for each layer. Size = Number of 1st stage layers @@ -56,11 +56,11 @@ public: float nTracks_1st_over_nOfflineTracks; // Ratio between number of 1st stage tracks and number of offline reconstructed tracks float nTracks_2nd_over_nOfflineTracks; // Ratio between number of 2nd stage tracks and number of offline reconstructed tracks - HTTDataFlowInfo() { reset(); } + FPGATrackSimDataFlowInfo() { reset(); } void reset(); - friend std::ostream& operator<<(std::ostream& s, HTTDataFlowInfo const& info); + friend std::ostream& operator<<(std::ostream& s, FPGATrackSimDataFlowInfo const& info); }; -#endif // HTTDATAFLOWINFO_H +#endif // FPGATrackSimDATAFLOWINFO_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTEventInfo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimEventInfo.h similarity index 80% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTEventInfo.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimEventInfo.h index 12c3ab7d5ba53457c058c86a01ed424bd1504888..7225feb9c70c7bc4bb60f17f15dc8dd4ad592806 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTEventInfo.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimEventInfo.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTEVENTINFO_H -#define TRIGHTTOBJECTS_HTTEVENTINFO_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimEVENTINFO_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimEVENTINFO_H #include <TObject.h> #include <vector> @@ -11,11 +11,11 @@ #include <sstream> -class HTTEventInfo : public TObject { +class FPGATrackSimEventInfo : public TObject { public: - HTTEventInfo() : m_run_number(0), + FPGATrackSimEventInfo() : m_run_number(0), m_event_number(0), m_averageInteractionsPerCrossing(0), m_actualInteractionsPerCrossing(0), @@ -25,7 +25,7 @@ public: m_level1TriggerType(0) {}; - HTTEventInfo(unsigned long runNumber, int eventNumber, int bcid) : + FPGATrackSimEventInfo(unsigned long runNumber, int eventNumber, int bcid) : m_run_number(runNumber), m_event_number(eventNumber), m_averageInteractionsPerCrossing(0), @@ -36,7 +36,7 @@ public: m_level1TriggerType(0) {}; - virtual ~HTTEventInfo(); + virtual ~FPGATrackSimEventInfo(); void reset(); //event info @@ -74,8 +74,8 @@ protected: unsigned int m_level1TriggerType; std::vector<unsigned int> m_level1TriggerInfo; - ClassDef(HTTEventInfo, 1) + ClassDef(FPGATrackSimEventInfo, 1) }; -std::ostream& operator<<(std::ostream&, const HTTEventInfo&); -#endif // HTTEVENTINPUTHEADER_H +std::ostream& operator<<(std::ostream&, const FPGATrackSimEventInfo&); +#endif // FPGATrackSimEVENTINPUTHEADER_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimEventInputHeader.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimEventInputHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..1d49a4c78340b902b731349fee93cbd4dcf85571 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimEventInputHeader.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimEVENTINPUTHEADER_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimEVENTINPUTHEADER_H + +#include <TObject.h> +#include <vector> +#include <iostream> +#include <sstream> + +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h" + + +class FPGATrackSimEventInfo; +class FPGATrackSimOptionalEventInfo; + +class FPGATrackSimEventInputHeader : public TObject +{ +public: + + virtual ~FPGATrackSimEventInputHeader(); + + void newEvent(FPGATrackSimEventInfo const& event) { reset(); m_event = event; } + void setOptional(FPGATrackSimOptionalEventInfo const& optional) { m_optional = optional; } + void reset();//reset per event variables + + + FPGATrackSimEventInfo const& event() const { return m_event; } + FPGATrackSimOptionalEventInfo const& optional() const { return m_optional; } + + // handling hits + const std::vector<FPGATrackSimHit>& hits() const { return m_Hits; } + int nHits() const { return m_Hits.size(); } + void addHit(FPGATrackSimHit const& s) { m_Hits.push_back(s); } + void clearHits() { m_Hits.clear(); } + void reserveHits(size_t size) { m_Hits.reserve(size); } + + +private: + FPGATrackSimEventInfo m_event; + FPGATrackSimOptionalEventInfo m_optional; + std::vector<FPGATrackSimHit> m_Hits; + + + ClassDef(FPGATrackSimEventInputHeader, 3); +}; + +std::ostream& operator<<(std::ostream&, const FPGATrackSimEventInputHeader&); +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimEVENTINPUTHEADER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTFunctions.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimFunctions.h similarity index 94% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTFunctions.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimFunctions.h index cce5af707503f17370fe308419d0042eb2becb01..beec9ff129fc61eca0bea5268fccfb6f1171eee5 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTFunctions.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimFunctions.h @@ -3,13 +3,13 @@ */ /* - * HTTFunctions.h + * FPGATrackSimFunctions.h * * Declares several generic utility functions. */ -#ifndef HTTFUNCTIONS_H -#define HTTFUNCTIONS_H +#ifndef FPGATrackSimFUNCTIONS_H +#define FPGATrackSimFUNCTIONS_H #include <TString.h> @@ -19,7 +19,7 @@ #include <TTreeReader.h> #include <TTreeReaderValue.h> -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" #include <cmath> #include <vector> @@ -121,4 +121,4 @@ double rms95(TH1 const * h); -#endif // HTTFUNCTIONS_H +#endif // FPGATrackSimFUNCTIONS_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTHit.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimHit.h similarity index 81% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTHit.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimHit.h index ad32d24d2c4248fd5fc27e4395e340fa10c79d38..9ecaf36d9c12c6301ea642c8df4296fe11d31998 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTHit.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimHit.h @@ -1,18 +1,18 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef TRIGHTTOBJECTS_HTTHIT_H -#define TRIGHTTOBJECTS_HTTHIT_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimHIT_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimHIT_H /** - * @file: HTTHit.h + * @file: FPGATrackSimHit.h * @author: Lots of peeps * @date: Lightyears ago - * @brief: HTT-specific class to represent an hit in the detector. + * @brief: FPGATrackSim-specific class to represent an hit in the detector. * * Declarations in this file: * enum class HitType - * class HTTHit - * vector<vector<const HTTHit*>> sortByLayer(vector<const HTTHit*> const & hits); + * class FPGATrackSimHit + * vector<vector<const FPGATrackSimHit*>> sortByLayer(vector<const FPGATrackSimHit*> const & hits); * ostream & operator<<(ostream & os, HitType t); * * @@ -25,8 +25,8 @@ #include <vector> #include <ostream> -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" #include <Rtypes.h> #include "TMath.h" @@ -34,15 +34,15 @@ // Some types are inclusive of others. For example, clustered implies mapped. enum class HitType { unmapped, mapped, clustered, wildcard, guessed, undefined, extrapolated, spacepoint }; -class HTTHit +class FPGATrackSimHit { public: /////////////////////////////////////////////////////////////////////// // Constructors - HTTHit() = default; - virtual ~HTTHit() = default; + FPGATrackSimHit() = default; + virtual ~FPGATrackSimHit() = default; /////////////////////////////////////////////////////////////////////// // Getters/Setters @@ -67,20 +67,20 @@ public: void setIdentifierHash(unsigned v) { m_identifierHash = v; } void setLayerDisk(unsigned v) { m_layer_disk = v; } // ITk layer number void setSide(unsigned v) { m_side = v; } - void setPhysLayer(unsigned v); // Sets using the HTT-defined physical layer index (see HTTPlaneMap.h) + void setPhysLayer(unsigned v); // Sets using the FPGATrackSim-defined physical layer index (see FPGATrackSimPlaneMap.h) void setEtaModule(int v) { m_etaModule = v; } void setPhiModule(unsigned v) { m_phiModule = v; } void setEtaWidth(unsigned v) { m_etaWidth = v; } void setPhiWidth(unsigned v) { m_phiWidth = v; } unsigned getIdentifierHash() const { return m_identifierHash; } // TODO note this might break things in the same way as getSide() a few lines below. If so, recomment. - unsigned getHTTIdentifierHash() const; // TODO UPDATE THIS FOR REL22 + unsigned getFPGATrackSimIdentifierHash() const; // TODO UPDATE THIS FOR REL22 unsigned getLayerDisk() const { return m_layer_disk; } // ITk layer number unsigned getSide() const { return m_side; } // strip side TODO note this has been uncommented on 4/20/21. If wrappers suddenly break, recomment this. Same for getIdentifierHash above. - unsigned getPhysLayer() const; // Returns the HTT-defined physical layer index (see HTTPlaneMap.h) + unsigned getPhysLayer() const; // Returns the FPGATrackSim-defined physical layer index (see FPGATrackSimPlaneMap.h) unsigned getEtaWidth() const { return m_etaWidth; } unsigned getPhiWidth() const { return m_phiWidth; } //unsigned getEtaModule() const { return m_etaModule; } - int getHTTEtaModule() const; // TODO UPDATE THIS FOR REL22 + int getFPGATrackSimEtaModule() const; // TODO UPDATE THIS FOR REL22 unsigned getPhiModule() const { return m_phiModule; } // --- Mapped Location --- @@ -120,17 +120,17 @@ public: void setBarcodePt(float v) { m_barcode_pt = v; } void setEventIndex(long v) { m_eventindex = v; } void setParentageMask(unsigned long v) { m_parentage_mask = v; } - void setTruth(const HTTMultiTruth& v) { m_truth = v; } + void setTruth(const FPGATrackSimMultiTruth& v) { m_truth = v; } long getBarcode() const { return m_barcode; } long getEventIndex() const { return m_eventindex; } float getBarcodePt() const { return m_barcode_pt; } unsigned long getParentageMask() const { return m_parentage_mask; } - const HTTMultiTruth& getTruth() const { return m_truth; } + const FPGATrackSimMultiTruth& getTruth() const { return m_truth; } /////////////////////////////////////////////////////////////////////// // Other Interface - friend std::ostream& operator<<(std::ostream&, const HTTHit&); + friend std::ostream& operator<<(std::ostream&, const FPGATrackSimHit&); protected: @@ -151,7 +151,7 @@ protected: // --- Mapped Location --- // isMapped() should return true to access these members int m_layer = -1; // Logical layer this hit is on - int m_section = -1; // Index of detector element in the logical layer (see HTTPlaneMap.h) + int m_section = -1; // Index of detector element in the logical layer (see FPGATrackSimPlaneMap.h) // --- Local Coordinates --- int m_phiIndex = -1; // phi index for pixel, strip for strip @@ -163,7 +163,7 @@ protected: float m_z = 0; // --- Truth and Other --- - unsigned m_hw_word = 0; // store Strip and Pixel cluster positions as integers using the same HTT_IM HW definition + unsigned m_hw_word = 0; // store Strip and Pixel cluster positions as integers using the same FPGATrackSim_IM HW definition unsigned m_ToT = 0; // time over Threshold long m_eventindex = 0; // athena event index assigned to this channel long m_barcode = 0; // geant particle barcode assigned to this channel @@ -171,19 +171,19 @@ protected: // corresponds to the particle with m_barcode unsigned long m_parentage_mask = 0; // ancestor information of this channel - HTTMultiTruth m_truth; + FPGATrackSimMultiTruth m_truth; // geant truth data (clusters only). filled during clustering using the m_barcode and // m_barcode_frac data for each raw hit in the cluster. - ClassDef(HTTHit, 5); + ClassDef(FPGATrackSimHit, 5); }; -// Container of <HTTHit const *> +// Container of <FPGATrackSimHit const *> template <class Container> -std::vector<std::vector<const HTTHit*>> sortByLayer(Container const& hits) +std::vector<std::vector<const FPGATrackSimHit*>> sortByLayer(Container const& hits) { - std::vector<std::vector<const HTTHit*>> out; - for (HTTHit const* hit : hits) + std::vector<std::vector<const FPGATrackSimHit*>> out; + for (FPGATrackSimHit const* hit : hits) { size_t layer = hit->getLayer(); if (layer >= out.size()) out.resize(layer + 1); @@ -196,4 +196,4 @@ std::vector<std::vector<const HTTHit*>> sortByLayer(Container const& hits) std::ostream& operator<<(std::ostream& os, HitType t); std::string to_string(HitType t); -#endif // HTTHIT_H +#endif // FPGATrackSimHIT_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..88a43076410bfb6d502af1c2a51ae55ed97cf8c1 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h @@ -0,0 +1,56 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimLOGICALEVENTINPUTHEADER_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimLOGICALEVENTINPUTHEADER_H + +#include <TObject.h> + +#include <vector> +#include <iostream> +#include <sstream> + +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h" + + +class FPGATrackSimEventInfo; +class FPGATrackSimOptionalEventInfo; + +class FPGATrackSimLogicalEventInputHeader : public TObject +{ +public: + + FPGATrackSimLogicalEventInputHeader() = default; + virtual ~FPGATrackSimLogicalEventInputHeader() = default; + + void reset(); //reset per event variables + + void newEvent(FPGATrackSimEventInfo& event) { reset(); m_event = event; } + FPGATrackSimEventInfo const& event() const { return m_event; } + + FPGATrackSimOptionalEventInfo const& optional() const { return m_optional; } + void setOptional(FPGATrackSimOptionalEventInfo o) { m_optional = o; } + + // handling towers + const std::vector<FPGATrackSimTowerInputHeader>& towers() const { return m_towers; } + int nTowers() const { return m_towers.size(); } + void addTower(FPGATrackSimTowerInputHeader s) { m_towers.push_back(s); } + FPGATrackSimTowerInputHeader* getTower(size_t index) { return &m_towers[index]; } //get the pointer + void reserveTowers(size_t size) { m_towers.reserve(size); } + void addTowers(const std::vector<FPGATrackSimTowerInputHeader>& towers) { m_towers = towers; } + +private: + FPGATrackSimEventInfo m_event; + FPGATrackSimOptionalEventInfo m_optional; // This is only available for 1st stage + std::vector<FPGATrackSimTowerInputHeader> m_towers; + + ClassDef(FPGATrackSimLogicalEventInputHeader, 1) +}; + + +std::ostream& operator<<(std::ostream&, const FPGATrackSimLogicalEventInputHeader&); + + + +#endif // FPGATrackSimEVENTINPUTHEADER_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..1dfedcf947f2915ac2aa9b5cdbb1a22d23096ecd --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h @@ -0,0 +1,62 @@ +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimLOGICALEVENTOUTPUTHEADER_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimLOGICALEVENTOUTPUTHEADER_H + +#include "FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include <TObject.h> + +class FPGATrackSimLogicalEventOutputHeader : public TObject { +public: + + FPGATrackSimLogicalEventOutputHeader() {}; + virtual ~FPGATrackSimLogicalEventOutputHeader(); + + void reset(); //reset per event variables + + // First Stage FPGATrackSim Roads + void getFPGATrackSimRoads_1st(std::vector<FPGATrackSimRoad*>& roads_1st) { roads_1st.reserve(m_FPGATrackSimRoads_1st.size()); for ( auto& r : m_FPGATrackSimRoads_1st) roads_1st.push_back(&r); } + size_t nFPGATrackSimRoads_1st() const { return m_FPGATrackSimRoads_1st.size(); } + void reserveFPGATrackSimRoads_1st(size_t size) { m_FPGATrackSimRoads_1st.reserve(size); } + void addFPGATrackSimRoads_1st(std::vector<FPGATrackSimRoad*> const& roads_1st) { for ( auto& r : roads_1st) m_FPGATrackSimRoads_1st.push_back(*r); } + + // Second Stage FPGATrackSim Roads + void getFPGATrackSimRoads_2nd(std::vector<FPGATrackSimRoad*>& roads_2nd) { roads_2nd.reserve(m_FPGATrackSimRoads_2nd.size()); for ( auto& r : m_FPGATrackSimRoads_2nd) roads_2nd.push_back(&r); } + size_t nFPGATrackSimRoads_2nd() const { return m_FPGATrackSimRoads_2nd.size(); } + void reserveFPGATrackSimRoads_2nd(size_t size) { m_FPGATrackSimRoads_2nd.reserve(size); } + void addFPGATrackSimRoads_2nd(std::vector<FPGATrackSimRoad*> const& roads_2nd) { for ( auto& r : roads_2nd) m_FPGATrackSimRoads_2nd.push_back(*r); } + + // First Stage FPGATrackSim Tracks + std::vector<FPGATrackSimTrack> const& getFPGATrackSimTracks_1st() const { return m_FPGATrackSimTracks_1st; } + size_t nFPGATrackSimTracks_1st() const { return m_FPGATrackSimTracks_1st.size(); } + void reserveFPGATrackSimTracks_1st(size_t size) { m_FPGATrackSimTracks_1st.reserve(size); } + void addFPGATrackSimTracks_1st(std::vector<FPGATrackSimTrack> const& tracks_1st) { m_FPGATrackSimTracks_1st = tracks_1st; } + + // Second Stage FPGATrackSim Tracks + std::vector<FPGATrackSimTrack> const& getFPGATrackSimTracks_2nd() const { return m_FPGATrackSimTracks_2nd; } + size_t nFPGATrackSimTracks_2nd() const { return m_FPGATrackSimTracks_2nd.size(); } + void reserveFPGATrackSimTracks_2nd(size_t size) { m_FPGATrackSimTracks_2nd.reserve(size); } + void addFPGATrackSimTracks_2nd(std::vector<FPGATrackSimTrack> const& tracks_2nd) { m_FPGATrackSimTracks_2nd = tracks_2nd; } + + // Data Flow Information + FPGATrackSimDataFlowInfo const& getDataFlowInfo() const { return m_dataflowInfo; } + void setDataFlowInfo(FPGATrackSimDataFlowInfo const& info) { m_dataflowInfo = info; } + +private: + + std::vector<FPGATrackSimRoad> m_FPGATrackSimRoads_1st; + std::vector<FPGATrackSimRoad> m_FPGATrackSimRoads_2nd; + std::vector<FPGATrackSimTrack> m_FPGATrackSimTracks_1st; + std::vector<FPGATrackSimTrack> m_FPGATrackSimTracks_2nd; + + FPGATrackSimDataFlowInfo m_dataflowInfo; + + ClassDef(FPGATrackSimLogicalEventOutputHeader, 4) +}; + +std::ostream& operator<<(std::ostream& s, FPGATrackSimLogicalEventOutputHeader const& h); + +#endif // FPGATrackSimEVENTOUTPUTHEADER_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimMatchInfo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimMatchInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..b50b59abc0f533a7413b5d5476a1f03632d674db --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimMatchInfo.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimMATCHINFO_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimMATCHINFO_H + +#include <TObject.h> + +class FPGATrackSimMatchInfo : public TObject { +public: + FPGATrackSimMatchInfo() : m_barcode(0), m_evtindex(-1) { ; } + FPGATrackSimMatchInfo(int v1, int v2) : m_barcode(v1), m_evtindex(v2) { ; } + + int barcode() const { return m_barcode; } + int evtindex() const { return m_evtindex; } + + bool operator==(const FPGATrackSimMatchInfo& o) const { return (m_barcode == o.m_barcode) && (m_evtindex == o.m_evtindex); } + bool operator<(const FPGATrackSimMatchInfo& o) const { if (m_evtindex != o.m_evtindex) return (m_evtindex < o.m_evtindex); else return m_barcode < o.m_barcode; } + + +private: + int m_barcode; + int m_evtindex; + + + ClassDef(FPGATrackSimMatchInfo, 1) +}; + +std::ostream& operator<<(std::ostream&, const FPGATrackSimMatchInfo&); +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimMATCHINFO_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTMultiTruth.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimMultiTruth.h similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTMultiTruth.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimMultiTruth.h index ca412e0cbab1d86eb25693dbadeb8f207b1660f8..fbda01e1ab357f90d8328010da21eaf4fa7dabe3 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTMultiTruth.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimMultiTruth.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_MULTITRUTH_H -#define TRIGHTTOBJECTS_MULTITRUTH_H +#ifndef TRIGFPGATrackSimOBJECTS_MULTITRUTH_H +#define TRIGFPGATrackSimOBJECTS_MULTITRUTH_H #include <TObject.h> @@ -19,7 +19,7 @@ #include <utility> #include <vector> -// HTTMultiTruth +// FPGATrackSimMultiTruth // ================================================================ // code to match clusters and tracks to GEANT charge deposition information // ================================================================ @@ -43,23 +43,23 @@ // then returns that barcode. // -class HTTMultiTruth : public TObject { +class FPGATrackSimMultiTruth : public TObject { public: typedef std::pair<long, long> Barcode; // = (event index, barcode) typedef float Weight; typedef std::map<Barcode, Weight> TruthMap; - HTTMultiTruth() = default; - HTTMultiTruth(const HTTMultiTruth::Barcode& code, const HTTMultiTruth::Weight weight = 1.) { m_truth[code] = weight; } - virtual ~HTTMultiTruth() = default; + FPGATrackSimMultiTruth() = default; + FPGATrackSimMultiTruth(const FPGATrackSimMultiTruth::Barcode& code, const FPGATrackSimMultiTruth::Weight weight = 1.) { m_truth[code] = weight; } + virtual ~FPGATrackSimMultiTruth() = default; struct AddAccumulator { - auto operator()(const HTTMultiTruth& result, const HTTMultiTruth& a) const { return result.add(a); } + auto operator()(const FPGATrackSimMultiTruth& result, const FPGATrackSimMultiTruth& a) const { return result.add(a); } }; struct MaxAccumulator { - auto operator()(const HTTMultiTruth& result, const HTTMultiTruth& a) const { return result.maximize(a); } + auto operator()(const FPGATrackSimMultiTruth& result, const FPGATrackSimMultiTruth& a) const { return result.maximize(a); } }; auto begin() { return m_truth.begin(); } @@ -71,11 +71,11 @@ public: long best_barcode() const; - void add(const HTTMultiTruth::Barcode& code, const HTTMultiTruth::Weight& weight); - void add(const HTTMultiTruth& rval); + void add(const FPGATrackSimMultiTruth::Barcode& code, const FPGATrackSimMultiTruth::Weight& weight); + void add(const FPGATrackSimMultiTruth& rval); - void maximize(const HTTMultiTruth::Barcode& code, const HTTMultiTruth::Weight& weight); - void maximize(const HTTMultiTruth& rval); + void maximize(const FPGATrackSimMultiTruth::Barcode& code, const FPGATrackSimMultiTruth::Weight& weight); + void maximize(const FPGATrackSimMultiTruth& rval); void assign_equal_normalization(); @@ -83,7 +83,7 @@ public: // Finds the best barcode and its normalized weight, returning them by reference. // Returns true on success. - inline bool best(HTTMultiTruth::Barcode& code, HTTMultiTruth::Weight& weight) const + inline bool best(FPGATrackSimMultiTruth::Barcode& code, FPGATrackSimMultiTruth::Weight& weight) const { if (m_truth.empty()) return false; auto i = std::max_element(m_truth.begin(), m_truth.end(), TruthMapWeightLt()); @@ -96,7 +96,7 @@ public: private: struct TruthMapWeightAcc { - auto operator()(const HTTMultiTruth::Weight& result, const TruthMap::value_type& a) const { return result + a.second; } + auto operator()(const FPGATrackSimMultiTruth::Weight& result, const TruthMap::value_type& a) const { return result + a.second; } }; struct TruthMapWeightLt { @@ -108,22 +108,22 @@ private: }; // add and mult for std::accumulate - const HTTMultiTruth add(const HTTMultiTruth& rval) const; - const HTTMultiTruth maximize(const HTTMultiTruth& rval) const; + const FPGATrackSimMultiTruth add(const FPGATrackSimMultiTruth& rval) const; + const FPGATrackSimMultiTruth maximize(const FPGATrackSimMultiTruth& rval) const; // matching probability definition and maximization logic - inline HTTMultiTruth::Weight total_weight() const { return std::accumulate(m_truth.begin(), m_truth.end(), 0., TruthMapWeightAcc()); } + inline FPGATrackSimMultiTruth::Weight total_weight() const { return std::accumulate(m_truth.begin(), m_truth.end(), 0., TruthMapWeightAcc()); } - inline HTTMultiTruth::Weight weight(const HTTMultiTruth::Barcode& code) const { + inline FPGATrackSimMultiTruth::Weight weight(const FPGATrackSimMultiTruth::Barcode& code) const { return m_truth.empty() || (m_truth.find(code) == m_truth.end()) ? 0. : ((m_truth.find(code))->second) / total_weight(); } TruthMap m_truth; - ClassDef(HTTMultiTruth, 2) // this is a TObject to be stored in the TrigHTTSim ROOT output streams + ClassDef(FPGATrackSimMultiTruth, 2) // this is a TObject to be stored in the FPGATrackSim ROOT output streams }; -std::ostream& operator<<(std::ostream& o, const HTTMultiTruth& mt); +std::ostream& operator<<(std::ostream& o, const FPGATrackSimMultiTruth& mt); -#endif // TRIGHTTOBJECTS_MULTITRUTH_H +#endif // TRIGFPGATrackSimOBJECTS_MULTITRUTH_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOfflineHit.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOfflineHit.h similarity index 62% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOfflineHit.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOfflineHit.h index 9dc908bca57ffdf52a4de5b586c7e7a26c1941dd..5a2155114d541ccc0e7407d5fd1e2141a639e07c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOfflineHit.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOfflineHit.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTOFFLINEHIT_H -#define TRIGHTTOBJECTS_HTTOFFLINEHIT_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimOFFLINEHIT_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimOFFLINEHIT_H #include <TObject.h> -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" -class HTTOfflineHit : public TObject { +class FPGATrackSimOfflineHit : public TObject { public: - HTTOfflineHit() {m_locX=0; m_locY=0; m_isPixel = false; m_isBarrel = false; m_layer = -1; m_clustID = -1; m_trackNumber = -1; m_hitType = OfflineHitType::Other;} + FPGATrackSimOfflineHit() {m_locX=0; m_locY=0; m_isPixel = false; m_isBarrel = false; m_layer = -1; m_clustID = -1; m_trackNumber = -1; m_hitType = OfflineHitType::Other;} void setLocX(float locx) { m_locX = locx; } void setLocY(float locy) { m_locY = locy; } @@ -41,9 +41,9 @@ private: int m_trackNumber; OfflineHitType m_hitType; - ClassDef(HTTOfflineHit, 2) + ClassDef(FPGATrackSimOfflineHit, 2) }; -std::ostream& operator<<(std::ostream&, const HTTOfflineHit&); -#endif // TRIGHTTOBJECTS_HTTOFFLINETRACK_H +std::ostream& operator<<(std::ostream&, const FPGATrackSimOfflineHit&); +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimOFFLINETRACK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOfflineTrack.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOfflineTrack.h similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOfflineTrack.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOfflineTrack.h index 233829c38db0aea7817d48f481d79130d12e331d..714ccb350209e4cfc4cb641db50bd2bf25abb87a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTOfflineTrack.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOfflineTrack.h @@ -1,17 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTOFFLINETRACK_H -#define TRIGHTTOBJECTS_HTTOFFLINETRACK_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimOFFLINETRACK_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimOFFLINETRACK_H -#include "TrigHTTObjects/HTTOfflineHit.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineHit.h" #include <cmath> #include <TObject.h> -class HTTOfflineTrack : public TObject { +class FPGATrackSimOfflineTrack : public TObject { public: - HTTOfflineTrack(); + FPGATrackSimOfflineTrack(); void setQOverPt(double v) { m_qoverpt = v; } void setEta(double v) { m_eta = v; } @@ -31,9 +31,9 @@ public: double getBarcodeFrac() const { return m_barcode_frac; } // handling hits - const std::vector<HTTOfflineHit>& getOfflineHits() const { return m_hits; } + const std::vector<FPGATrackSimOfflineHit>& getOfflineHits() const { return m_hits; } int nHits() const { return m_hits.size(); } - void addHit(HTTOfflineHit s) { m_hits.push_back(s); } + void addHit(FPGATrackSimOfflineHit s) { m_hits.push_back(s); } private: @@ -51,11 +51,11 @@ private: // geant particle, corresponding to the // particle with m_barcode - std::vector<HTTOfflineHit> m_hits; + std::vector<FPGATrackSimOfflineHit> m_hits; - ClassDef(HTTOfflineTrack, 4) + ClassDef(FPGATrackSimOfflineTrack, 4) }; -std::ostream& operator<<(std::ostream&, const HTTOfflineTrack&); -#endif // TRIGHTTOBJECTS_HTTOFFLINETRACK_H +std::ostream& operator<<(std::ostream&, const FPGATrackSimOfflineTrack&); +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimOFFLINETRACK_H diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..4b82d3f9dc329681952d5ad8296779fab898cc71 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimOPTIONALEVENTINFO_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimOPTIONALEVENTINFO_H + +#include <TObject.h> +#include <vector> +#include <iostream> +#include <sstream> + +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" + +class FPGATrackSimOptionalEventInfo : public TObject { + +public: + + FPGATrackSimOptionalEventInfo() {}; + virtual ~FPGATrackSimOptionalEventInfo(); + + void reset(); + + // Offline Clusters + const std::vector<FPGATrackSimCluster>& getOfflineClusters() const { return m_OfflineClusters; } + size_t nOfflineClusters() const { return m_OfflineClusters.size(); } + void addOfflineCluster(const FPGATrackSimCluster& c) { m_OfflineClusters.push_back(c); } + + // Offline Tracks + const std::vector<FPGATrackSimOfflineTrack>& getOfflineTracks() const { return m_OfflineTracks; } + size_t nOfflineTracks() const { return m_OfflineTracks.size(); } + void addOfflineTrack(const FPGATrackSimOfflineTrack& t) { m_OfflineTracks.push_back(t); }; + + // Truth Tracks + const std::vector<FPGATrackSimTruthTrack>& getTruthTracks() const { return m_TruthTracks; } + size_t nTruthTracks() const { return m_TruthTracks.size(); } + void addTruthTrack(const FPGATrackSimTruthTrack& t) { m_TruthTracks.push_back(t); }; + + + //reserve sizes + void reserveOfflineClusters(size_t size) { m_OfflineClusters.reserve(size); } + void reserveOfflineTracks(size_t size) { m_OfflineTracks.reserve(size); } + void reserveTruthTracks(size_t size) { m_TruthTracks.reserve(size); } + + +private: + + std::vector<FPGATrackSimCluster> m_OfflineClusters; + std::vector<FPGATrackSimOfflineTrack> m_OfflineTracks; + std::vector<FPGATrackSimTruthTrack> m_TruthTracks; + + + ClassDef(FPGATrackSimOptionalEventInfo, 2) +}; + +std::ostream& operator<<(std::ostream&, const FPGATrackSimOptionalEventInfo&); +#endif \ No newline at end of file diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTRoad.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimRoad.h similarity index 71% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTRoad.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimRoad.h index 58c3e6e4ab921e57cfd8efbfdaddf278d358274d..b44c6537b9ba20bcfab46e3299141fe030b08f96 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTRoad.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimRoad.h @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#ifndef TRIGHTTOBJECTS_HTTROAD_H -#define TRIGHTTOBJECTS_HTTROAD_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimROAD_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimROAD_H /** - * @file HTTRoad.h + * @file FPGATrackSimRoad.h * @author Riley Xu - riley.xu@cern.ch * @date Janurary 13th, 2020 * @brief Defines a class for roads. @@ -20,24 +20,24 @@ #include "TObject.h" -#include "TrigHTTObjects/HTTTypes.h" -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" -class HTTRoad : public TObject +class FPGATrackSimRoad : public TObject { public: /////////////////////////////////////////////////////////////////////// // Constructors - HTTRoad() = default; + FPGATrackSimRoad() = default; - HTTRoad(unsigned nLayers) : m_hits(nLayers) { } + FPGATrackSimRoad(unsigned nLayers) : m_hits(nLayers) { } - HTTRoad(int roadID, pid_t pid, sector_t sector, layer_bitmask_t hit_layers, - layer_bitmask_t wildcard_layers, std::vector<std::vector<const HTTHit*>> const& hits) + FPGATrackSimRoad(int roadID, pid_t pid, sector_t sector, layer_bitmask_t hit_layers, + layer_bitmask_t wildcard_layers, std::vector<std::vector<const FPGATrackSimHit*>> const& hits) : m_roadID(roadID), m_pid(pid), m_sector(sector), m_hit_layers(hit_layers), m_wildcard_layers(wildcard_layers), m_hits(hits) { } @@ -53,8 +53,8 @@ public: void setWCLayers(layer_bitmask_t wc_layers) { m_wildcard_layers = wc_layers; } void setNLayers(unsigned layers) { m_hits.resize(layers); } - void setHits(std::vector<std::vector<const HTTHit*>> const& hits) { m_hits = hits; } - void setHits(unsigned layer, std::vector<const HTTHit*> const& hits) { m_hits.at(layer) = hits; } // ensure setNLayers is called first + void setHits(std::vector<std::vector<const FPGATrackSimHit*>> const& hits) { m_hits = hits; } + void setHits(unsigned layer, std::vector<const FPGATrackSimHit*> const& hits) { m_hits.at(layer) = hits; } // ensure setNLayers is called first /////////////////////////////////////////////////////////////////////// // Getters @@ -66,10 +66,10 @@ public: layer_bitmask_t getHitLayers() const { return m_hit_layers; } layer_bitmask_t getWCLayers() const { return m_wildcard_layers; } - std::vector<const HTTHit*> const& getHits(size_t layer) const { return m_hits.at(layer); } - std::unordered_set<const HTTHit*> getHits_flat() const + std::vector<const FPGATrackSimHit*> const& getHits(size_t layer) const { return m_hits.at(layer); } + std::unordered_set<const FPGATrackSimHit*> getHits_flat() const { - std::unordered_set<const HTTHit*> hits; + std::unordered_set<const FPGATrackSimHit*> hits; for (const auto& x : m_hits) hits.insert(x.begin(), x.end()); return hits; } @@ -88,7 +88,7 @@ public: // Weight of each barcode is the fraction of layers with corresponding hits // where pixels are weighted twice as much - HTTMultiTruth getTruth() const; + FPGATrackSimMultiTruth getTruth() const; private: @@ -99,7 +99,7 @@ private: layer_bitmask_t m_hit_layers = 0; // Layers that had hits match the pattern, not including wildcards layer_bitmask_t m_wildcard_layers = 0; // Layers that matched because of a wildcard in the pattern - std::vector<std::vector<const HTTHit*>> m_hits; // [layer, hit#] + std::vector<std::vector<const FPGATrackSimHit*>> m_hits; // [layer, hit#] // A list of hits in the road for each layer. // These pointers are not owned by the road. @@ -107,13 +107,13 @@ private: /////////////////////////////////////////////////////////////////////// // Misc - friend std::ostream& operator<<(std::ostream& os, const HTTRoad& road); - ClassDef(HTTRoad, 2); + friend std::ostream& operator<<(std::ostream& os, const FPGATrackSimRoad& road); + ClassDef(FPGATrackSimRoad, 2); }; -class HTTRoad_Hough : public HTTRoad +class FPGATrackSimRoad_Hough : public FPGATrackSimRoad { public: @@ -139,5 +139,5 @@ private: }; -#endif // HTTROAD_H +#endif // FPGATrackSimROAD_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTowerInputHeader.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h similarity index 52% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTowerInputHeader.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h index a7bbe6acbdc039b270c358c1dc27fc42a9111773..ee03935233518cd4659f12ae7e385381e9469f25 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTowerInputHeader.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h @@ -1,26 +1,26 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTOBJECT_HTTTOWERINPUTHEADER_H -#define HTTOBJECT_HTTTOWERINPUTHEADER_H +#ifndef FPGATrackSimOBJECT_FPGATrackSimTOWERINPUTHEADER_H +#define FPGATrackSimOBJECT_FPGATrackSimTOWERINPUTHEADER_H #include <TObject.h> #include <vector> #include <iostream> -#include "TrigHTTObjects/HTTTruthTrack.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" -class HTTTowerInputHeader : public TObject +class FPGATrackSimTowerInputHeader : public TObject { public: - HTTTowerInputHeader() { reset(); } - HTTTowerInputHeader(int id) { reset(); m_id = id; } - HTTTowerInputHeader(int id, double eta, double phi, double deta = 0, double dphi = 0); + FPGATrackSimTowerInputHeader() { reset(); } + FPGATrackSimTowerInputHeader(int id) { reset(); m_id = id; } + FPGATrackSimTowerInputHeader(int id, double eta, double phi, double deta = 0, double dphi = 0); void reset(); @@ -41,9 +41,9 @@ public: // handling hits - const std::vector<HTTHit>& hits() const { return m_Hits; } + const std::vector<FPGATrackSimHit>& hits() const { return m_Hits; } int nHits() const { return m_Hits.size(); } - void addHit(HTTHit s) { m_Hits.push_back(s); } + void addHit(FPGATrackSimHit s) { m_Hits.push_back(s); } void clearHits() { m_Hits.clear(); } void reserveHits(size_t size) { m_Hits.reserve(size); } @@ -57,13 +57,13 @@ private: double m_DeltaEta; // delta eta of the tower double m_DeltaPhi; // delta phi of the tower - std::vector<HTTHit> m_Hits; // variables related to the HTTHit storage + std::vector<FPGATrackSimHit> m_Hits; // variables related to the FPGATrackSimHit storage - ClassDef(HTTTowerInputHeader, 1) + ClassDef(FPGATrackSimTowerInputHeader, 1) }; -std::ostream& operator<<(std::ostream&, const HTTTowerInputHeader&); +std::ostream& operator<<(std::ostream&, const FPGATrackSimTowerInputHeader&); -#endif // HTTOBJECT_HTTTOWERINPUTHEADER_H +#endif // FPGATrackSimOBJECT_FPGATrackSimTOWERINPUTHEADER_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrack.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrack.h similarity index 63% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrack.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrack.h index 4acf713f700e71c00305f3096d1826a4661308d3..2eed40f579a35f0ba6fc6d5929bb5a4c84ca7ae3 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrack.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrack.h @@ -1,21 +1,22 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTTRACK_H -#define TRIGHTTOBJECTS_HTTTRACK_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACK_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACK_H -#include "TrigHTTObjects/HTTHit.h" -#include "TrigHTTObjects/HTTMultiTruth.h" -#include "TrigHTTObjects/HTTTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" #include <vector> #include <TObject.h> +#include <iosfwd> -class HTTTrack : public TObject { +class FPGATrackSimTrack : public TObject { public: - HTTTrack(); - virtual ~HTTTrack(); + FPGATrackSimTrack(); + virtual ~FPGATrackSimTrack(); TrackCorrType getTrackCorrType() const { return m_trackCorrType; } TrackStage getTrackStage() const { return m_trackStage; } @@ -49,7 +50,7 @@ public: signed long getBarcode() const { return m_barcode; } float getBarcodeFrac() const { return m_barcode_frac; } //Should be passed as const ref to avoid excessive copying. - const std::vector <HTTHit>& getHTTHits() const { return m_hits; } + const std::vector <FPGATrackSimHit>& getFPGATrackSimHits() const { return m_hits; } std::vector<float> getCoords(unsigned ilayer) const; // helper function to calculate coordinates for the methods based in idealized detector geometry. See https://cds.cern.ch/record/2633242 // in the delta global phis method, the coordinates are the ideal z, and the delta global phis. @@ -89,8 +90,8 @@ public: void calculateTruth(); // this will calculate the above quantities based on the hits void setNLayers(int); //Reset/resize the track hits vector - void setHTTHit(unsigned i, const HTTHit& hit); - void setPars(HTTTrackPars const& pars) + void setFPGATrackSimHit(unsigned i, const FPGATrackSimHit& hit); + void setPars(FPGATrackSimTrackPars const& pars) { setQOverPt(pars.qOverPt); setPhi(pars.phi, false); @@ -103,52 +104,52 @@ public: unsigned int passedOR() const { return m_ORcode; } void setPassedOR(unsigned int); - friend std::ostream& operator<<(std::ostream&, const HTTTrack&); + friend std::ostream& operator<<(std::ostream&, const FPGATrackSimTrack&); private: - TrackCorrType m_trackCorrType; // type of correction to make for track coordinates - TrackStage m_trackStage; // Is this a 1st stage or second stage track? - bool m_doDeltaGPhis; // if it uses the delta phis method for fitting + TrackCorrType m_trackCorrType = TrackCorrType::None; // type of correction to make for track coordinates + TrackStage m_trackStage = TrackStage::FIRST; // Is this a 1st stage or second stage track? + bool m_doDeltaGPhis = false; // if it uses the delta phis method for fitting - int m_bankID; // Bank ID of the road related to this track - int m_patternID; // TODO add documentation - int m_firstSectorID; // Sector identifier in the first stage tracking - int m_secondSectorID; // Sector identifier in thesecond stage tracking - int m_trackID; // Unique track ID in this bank + int m_bankID = -1; // Bank ID of the road related to this track + int m_patternID = 0; // TODO add documentation + int m_firstSectorID = -1; // Sector identifier in the first stage tracking + int m_secondSectorID = -1; // Sector identifier in thesecond stage tracking + int m_trackID = -1; // Unique track ID in this bank int m_IdealGeoCorr = 0; // - float m_houghX = 0.0F; // phi0 from HTTRoad_Hough - float m_houghY = 0.0F; // QOverPt from HTTRoad_Hough - float m_qoverpt; // charge over pT - float m_d0; // impact paramter in the ATLAS reference system - float m_phi; // phi of the track - float m_z0; // z0 in standard ATLAS reference system - float m_eta; // eta of the track - float m_chi2; // chi2 of the track - float m_origchi2; // In the case of majority recovery, this is the chi2 of + float m_houghX = 0.0F; // phi0 from FPGATrackSimRoad_Hough + float m_houghY = 0.0F; // QOverPt from FPGATrackSimRoad_Hough + float m_qoverpt = 0.0F; // charge over pT + float m_d0 = 0.0F; // impact paramter in the ATLAS reference system + float m_phi = 0.0F; // phi of the track + float m_z0 = 0.0F; // z0 in standard ATLAS reference system + float m_eta = 0.0F; // eta of the track + float m_chi2 = 0.0F; // chi2 of the track + float m_origchi2 = 0.0F; // In the case of majority recovery, this is the chi2 of //TODO: Switch to matchedhits mask - unsigned int m_nmissing; // number of missing coordinates - unsigned int m_typemask; // set on in bits related to the step recovery were used, ex.: 0 no recovery, 01, rec 1st step, 11, recovery in the 1st and the 2nd stage - unsigned int m_hitmap; + unsigned int m_nmissing = 0; // number of missing coordinates + unsigned int m_typemask = 0; // set on in bits related to the step recovery were used, ex.: 0 no recovery, 01, rec 1st step, 11, recovery in the 1st and the 2nd stage + unsigned int m_hitmap = 0; - std::vector<HTTHit> m_hits; //[m_nlayers] hits associated to the track + std::vector<FPGATrackSimHit> m_hits; //[m_nlayers] hits associated to the track - signed long m_eventindex; // matched particle event index - signed long m_barcode; // matched geant particle barcode - float m_barcode_frac; // largest "matching fraction" with any "good" + signed long m_eventindex = -1; // matched particle event index + signed long m_barcode = -1; // matched geant particle barcode + float m_barcode_frac = 0.0F; // largest "matching fraction" with any "good" // geant particle, corresponding to the // particle with m_barcode // Overlap removal member // There is currently only one algorithm - unsigned int m_ORcode; // Each digit should represent pass/fail(1/0) result from a specific OR algorithm + unsigned int m_ORcode = 1; // Each digit should represent pass/fail(1/0) result from a specific OR algorithm - ClassDef(HTTTrack, 2) + ClassDef(FPGATrackSimTrack, 2) }; -#endif // TRIGHTTOBJECTS_HTTTRACK_H +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrackPars.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrackPars.h similarity index 66% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrackPars.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrackPars.h index 5ebcd8f25cac94178f30f479c90a33c3f213f816..3d019d6255e66628b208dc4134ab2267464c034d 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrackPars.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrackPars.h @@ -1,13 +1,13 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTTRACKPARS_H -#define TRIGHTTOBJECTS_HTTTRACKPARS_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACKPARS_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACKPARS_H /** - * @file HTTTrackPars.h + * @file FPGATrackSimTrackPars.h * @author Riley Xu - riley.xu@cern.ch * @date March 27th, 2020 * @brief Structs that store the 5 track parameters @@ -18,7 +18,7 @@ #include <iostream> #include <cmath> -class HTTTrackPars +class FPGATrackSimTrackPars { public: double phi; @@ -30,7 +30,7 @@ public: //////////////////////////////////////////////////////////////// // Methods - HTTTrackPars(double init = std::nan("")) : + FPGATrackSimTrackPars(double init = std::nan("")) : phi(init), qOverPt(init), d0(init), @@ -44,7 +44,7 @@ public: //////////////////////////////////////////////////////////////// // Statics - friend std::ostream& operator<<(std::ostream& os, const HTTTrackPars& pars); + friend std::ostream& operator<<(std::ostream& os, const FPGATrackSimTrackPars& pars); enum pars_index { IPHI, IHIP, ID0, IZ0, IETA, NPARS }; static std::string parName(unsigned i); @@ -52,7 +52,7 @@ public: // Useful to store bin numbers, i.e. -class HTTTrackParsI +class FPGATrackSimTrackParsI { public: int phi; @@ -64,9 +64,9 @@ public: const int& operator[](unsigned i) const; int& operator[](unsigned i); - friend std::ostream& operator<<(std::ostream& os, const HTTTrackParsI& pars); + friend std::ostream& operator<<(std::ostream& os, const FPGATrackSimTrackParsI& pars); - HTTTrackParsI(int init = 0) : + FPGATrackSimTrackParsI(int init = 0) : phi(init), qOverPt(init), d0(init), diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrackStream.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrackStream.h similarity index 87% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrackStream.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrackStream.h index ac5b98dd07cdc2fd072e82c067891c5d909c7c6b..c3fad64a0ed73fd57452a9f269fb55e005e43587 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTrackStream.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTrackStream.h @@ -1,38 +1,38 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTTRACKSTREAM_H -#define TRIGHTTOBJECTS_HTTTRACKSTREAM_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACKSTREAM_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACKSTREAM_H -#include "HTTTrack.h" +#include "FPGATrackSimTrack.h" #include <TClonesArray.h> #include <iostream> #include <utility> -class HTTTrackStream { +class FPGATrackSimTrackStream { public: - HTTTrackStream(); - HTTTrackStream(const HTTTrackStream &in); - virtual ~HTTTrackStream(); - HTTTrackStream & operator = (const HTTTrackStream &s); + FPGATrackSimTrackStream(); + FPGATrackSimTrackStream(const FPGATrackSimTrackStream &in); + virtual ~FPGATrackSimTrackStream(); + FPGATrackSimTrackStream & operator = (const FPGATrackSimTrackStream &s); const unsigned long& runNumber() const { return m_run_number; } const unsigned long& eventNumber() const { return m_event_number; } void setRunNumber(const unsigned long& val) { m_run_number = val; } void setEventNumber(const unsigned long& val) { m_event_number = val; } - void addTrack(const HTTTrack&); - HTTTrack* getTrack(int) const; + void addTrack(const FPGATrackSimTrack&); + FPGATrackSimTrack* getTrack(int) const; int findTrack(int trackid, int bankid); int getNTracks() const { return m_ntracks; } void buildTrackMap(); - void addTrackI(const HTTTrack&); - HTTTrack* getTrackI(int) const; + void addTrackI(const FPGATrackSimTrack&); + FPGATrackSimTrack* getTrackI(int) const; int getNTracksI() const { return m_ntracksI; } int getNConn() const { return m_nconn; } @@ -137,8 +137,8 @@ private: std::map< std::pair<int, int>, int > m_trackIdMap; //! Not saved on disk. // Used to optimize the findTrack function. - ClassDef(HTTTrackStream, 1) + ClassDef(FPGATrackSimTrackStream, 1) }; -#endif // TRIGHTTOBJECTS_HTTTRACKSTREAM_H +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACKSTREAM_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTruthTrack.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTruthTrack.h similarity index 82% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTruthTrack.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTruthTrack.h index d6ca0cd1861a7310ce83b45677cebc37d93c18c4..b637fb8131d5f4cdc99b91a63cf9a091e47465d5 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTruthTrack.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTruthTrack.h @@ -1,18 +1,18 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTTRUTHTRACK_H -#define TRIGHTTOBJECTS_HTTTRUTHTRACK_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimTRUTHTRACK_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimTRUTHTRACK_H #include <TObject.h> #include <TMath.h> -#include "TrigHTTObjects/HTTTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" -class HTTTruthTrack : public TObject { +class FPGATrackSimTruthTrack : public TObject { public: - HTTTruthTrack(); + FPGATrackSimTruthTrack(); void setD0(double v) { m_d0 = v; } void setZ0(double v) { m_z0 = v; } @@ -56,8 +56,8 @@ public: double getBarcodeFracOffline() const { return m_barcode_frac_offline; } - HTTTrackPars getPars() const { - HTTTrackPars pars; + FPGATrackSimTrackPars getPars() const { + FPGATrackSimTrackPars pars; pars.qOverPt = getQ() / getPt(); pars.eta = getEta(); pars.phi = getPhi(); @@ -89,7 +89,7 @@ private: // particle with m_barcode - ClassDef(HTTTruthTrack, 3) + ClassDef(FPGATrackSimTruthTrack, 3) }; -#endif // TRIGHTTOBJECTS_HTTTRUTHTRACK_H +#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimTRUTHTRACK_H diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTypes.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTypes.h similarity index 84% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTypes.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTypes.h index 7206b2cac65a3c39b0757fa2b45d0768ef57cfa8..49251b47d92aa58e5f4a8f90a0801e4af189f73a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTTypes.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimTypes.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGHTTOBJECTS_HTTTYPES_H -#define TRIGHTTOBJECTS_HTTTYPES_H +#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimTYPES_H +#define TRIGFPGATrackSimOBJECTS_FPGATrackSimTYPES_H #include <iostream> #include <cmath> @@ -21,13 +21,13 @@ typedef int32_t module_t; // module id typedef int32_t sector_t; // sector number typedef uint32_t layer_bitmask_t; // bitmask that stores at least as many bits as layers -//To label the origin of HTTHits +//To label the origin of FPGATrackSimHits enum class SiliconTech { strip, pixel, nTechs, undefined }; -//The detector zone that the HTTHit was in +//The detector zone that the FPGATrackSimHit was in enum class DetectorZone { barrel, posEndcap, negEndcap, nZones, undefined }; -// Enum to hold the different types of hits in HTTOfflineHit +// Enum to hold the different types of hits in FPGATrackSimOfflineHit enum class OfflineHitType { Measurement, InertMaterial, BremPoint, Scatterer, Perigee, Outlier, Hole, Other }; // An Enum to hold the stage of the track diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTVectors.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimVectors.h similarity index 88% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTVectors.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimVectors.h index 5ff4e8fe7f863c1eaa4fc43e023aeb280f77f0b8..bfaaa82cdb375edf196c014169596593d097ae3c 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/TrigHTTObjects/HTTVectors.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/FPGATrackSimVectors.h @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef HTTVECTORS_H -#define HTTVECTORS_H +#ifndef FPGATrackSimVECTORS_H +#define FPGATrackSimVECTORS_H /** - * @file HTTVectors.h + * @file FPGATrackSimVectors.h * @author Riley Xu - rixu@cern.ch * @date Jan 27 2020 * @brief Defines several vector wrappers for homogenous multi-dimensional vectors, declared as 1D arrays for locality. @@ -16,9 +16,9 @@ #include <vector> #include <stdexcept> -// #define DEBUG_HTTVECTORS +// #define DEBUG_FPGATrackSimVECTORS -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS #include <sstream> #endif @@ -57,7 +57,7 @@ class vector2D T & operator()(size_t i, size_t j) { -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS if (i >= m_d1 || j >= m_d2) { std::stringstream s; @@ -70,7 +70,7 @@ class vector2D T const & operator()(size_t i, size_t j) const { -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS if (i >= m_d1 || j >= m_d2) { std::stringstream s; @@ -83,7 +83,7 @@ class vector2D T* operator[](size_t i) { -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS if (i >= m_d1) { std::stringstream s; @@ -96,7 +96,7 @@ class vector2D const T* operator[](size_t i) const { -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS if (i >= m_d1) { std::stringstream s; @@ -139,7 +139,7 @@ class vector3D T & operator()(size_t i, size_t j, size_t k) { -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS if (i >= m_d1 || j >= m_d2 || k >= m_d3) { std::stringstream s; @@ -152,7 +152,7 @@ class vector3D T const & operator()(size_t i, size_t j, size_t k) const { -#ifdef DEBUG_HTTVECTORS +#ifdef DEBUG_FPGATrackSimVECTORS if (i >= m_d1 || j >= m_d2 || k >= m_d3) { std::stringstream s; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/LinkDef.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/LinkDef.h new file mode 100644 index 0000000000000000000000000000000000000000..f2dbdca3c06f76ca30d026f8049eb76f25c8e859 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/FPGATrackSimObjects/LinkDef.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include <vector> +#include <map> +#include <utility> + + +#ifdef __CINT__ +#ifndef FPGATrackSimOBJECTS_FPGATrackSim_STANDALONE +#define FPGATrackSimOBJECTS_FPGATrackSim_STANDALONE +#endif +// unimplemented in rel 22 +// #pragma link off globals; +// #pragma link off classes; +// #pragma link off functions; + + +#pragma link C++ class FPGATrackSimEventInfo+; +#pragma link C++ class FPGATrackSimOptionalEventInfo+; +#pragma link C++ class FPGATrackSimEventInputHeader+; +#pragma link C++ class FPGATrackSimLogicalEventInputHeader+; +#pragma link C++ class FPGATrackSimLogicalEventOutputHeader+; +#pragma link C++ class FPGATrackSimTowerInputHeader+; +#pragma link C++ class std::vector<FPGATrackSimTowerInputHeader>+; +#pragma link C++ class FPGATrackSimDataFlowInfo+; + +#pragma link C++ class FPGATrackSimOfflineTrack+; +#pragma link C++ class std::vector<FPGATrackSimOfflineTrack>+; +#pragma link C++ class FPGATrackSimOfflineHit+; +#pragma link C++ class std::vector<FPGATrackSimOfflineHit>+; + +#pragma link C++ class FPGATrackSimCluster+; +#pragma link C++ class std::vector<FPGATrackSimCluster*>+; +#pragma link C++ class std::vector<FPGATrackSimCluster>+; + +#pragma link C++ class FPGATrackSimHit+; +#pragma link C++ class std::vector<FPGATrackSimHit>+; +#pragma link C++ class std::vector<FPGATrackSimHit*>+; +#pragma link C++ class std::vector<std::vector<const FPGATrackSimHit*>>+; + +#pragma link C++ class FPGATrackSimRoad+; +#pragma link C++ class FPGATrackSimMultiTruth+; +#pragma link C++ class FPGATrackSimMatchInfo+; + +#pragma link C++ class FPGATrackSimTrack+; +#pragma link C++ class std::vector<FPGATrackSimTrack>+; + +#pragma link C++ class FPGATrackSimTruthTrack+; +#pragma link C++ class std::vector<FPGATrackSimTruthTrack>+; + +#pragma link C++ class FPGATrackSimTrackStream+; +#endif diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTLogicalEventInputHeader_test.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimLogicalEventInputHeader_test.ref similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTLogicalEventInputHeader_test.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimLogicalEventInputHeader_test.ref diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTLogicalEventOutputHeader_test.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimLogicalEventOutputHeader_test.ref similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTLogicalEventOutputHeader_test.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimLogicalEventOutputHeader_test.ref diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTRoad_test.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimRoad_test.ref similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTRoad_test.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimRoad_test.ref diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTTrack_test.ref b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimTrack_test.ref similarity index 100% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/share/TrigHTTTrack_test.ref rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/share/FPGATrackSimTrack_test.ref diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimCluster.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimCluster.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bd2d490cb3abd984057da53c5c0e06a41921393e --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimCluster.cxx @@ -0,0 +1,10 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <iostream> +#include "FPGATrackSimObjects/FPGATrackSimCluster.h" + +std::ostream& operator<<(std::ostream& o, const FPGATrackSimCluster& cluster) +{ + return o << "Cluster formed from " << cluster.getHitList().size() << " hits"; +} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTDataFlowInfo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimDataFlowInfo.cxx similarity index 93% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTDataFlowInfo.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimDataFlowInfo.cxx index e12c0ba063ab3c8a4d05de95ad0b1108d575a11b..89104a64dad50b5d23a502b4594fe8c031b92e08 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTDataFlowInfo.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimDataFlowInfo.cxx @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTDataFlowInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimDataFlowInfo.h" #include <ostream> -void HTTDataFlowInfo::reset() +void FPGATrackSimDataFlowInfo::reset() { nMappedHits_1st_layer.clear(); nMappedHits_1st_total = 0; @@ -48,7 +48,7 @@ void HTTDataFlowInfo::reset() nTracks_2nd_over_nOfflineTracks = 0; } -std::ostream& operator<<(std::ostream& s, HTTDataFlowInfo const& info) +std::ostream& operator<<(std::ostream& s, FPGATrackSimDataFlowInfo const& info) { for (unsigned i = 0; i < info.nMappedHits_1st_layer.size(); i++) { s << "nMappedHits_1st_L" << i << " = " << info.nMappedHits_1st_layer[i] << ", "; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimEventInfo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimEventInfo.cxx new file mode 100644 index 0000000000000000000000000000000000000000..82664fe1349e2c47b31298632c9ac68957c09f3c --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimEventInfo.cxx @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimEventInfo.h" +#include <iostream> + +ClassImp(FPGATrackSimEventInfo) + + +FPGATrackSimEventInfo::~FPGATrackSimEventInfo() { + reset(); +} + + +void FPGATrackSimEventInfo::reset() { + m_level1TriggerInfo.clear(); +} + +std::ostream& operator<<(std::ostream& s, const FPGATrackSimEventInfo& h) { + s << "Event " << h.eventNumber() + << " \tRun " << h.runNumber(); + + return s; +} + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimEventInputHeader.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimEventInputHeader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a30b3106a495ece26c88c98d66081908774313be --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimEventInputHeader.cxx @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include <iostream> + +ClassImp(FPGATrackSimEventInputHeader) + +FPGATrackSimEventInputHeader::~FPGATrackSimEventInputHeader() +{ + reset(); +} + +void FPGATrackSimEventInputHeader::reset() +{ + m_event.reset(); + m_optional.reset(); + m_Hits.clear(); +} + + +std::ostream& operator<<(std::ostream& s, const FPGATrackSimEventInputHeader& h) { + s << "Event: " << h.event() << "\t" + << "Optional: " << h.optional() << "\t" + << "Nhits=" << h.nHits(); + + s << "\n"; + + const std::vector<FPGATrackSimHit>& hits = h.hits(); + for (int j = 0; j < h.nHits(); j++) { + s << " " << j << " " << hits[j] << "\n"; + // if ( (j+1)%5==0 ) s << "\n"; + } + //s <<"\n"; + + + return s; +} + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTFunctions.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimFunctions.cxx similarity index 98% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTFunctions.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimFunctions.cxx index 40f8874d6538ab6c7889ede745f615b08a5fff55..ea2e26e4ca43847cd7288b0f4a7f5d6c4e89a3ed 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTFunctions.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimFunctions.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTFunctions.h" +#include "FPGATrackSimObjects/FPGATrackSimFunctions.h" /** diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTHit.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimHit.cxx similarity index 74% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTHit.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimHit.cxx index bd293533452a04076977355d570437e01d6d5ea7..d91b616c73612e0c5d012a4c7ab335094a1644bf 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTHit.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimHit.cxx @@ -1,17 +1,17 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" #include <stdexcept> -ClassImp(HTTHit) +ClassImp(FPGATrackSimHit) -bool HTTHit::isMapped() const +bool FPGATrackSimHit::isMapped() const { switch (m_hitType) { @@ -23,7 +23,7 @@ bool HTTHit::isMapped() const } } -bool HTTHit::isClustered() const +bool FPGATrackSimHit::isClustered() const { switch (m_hitType) { @@ -35,7 +35,7 @@ bool HTTHit::isClustered() const } } -bool HTTHit::isReal() const +bool FPGATrackSimHit::isReal() const { switch (m_hitType) { @@ -49,8 +49,8 @@ bool HTTHit::isReal() const } } -// Sets using the physical layer index as defined by HTTPlaneMap -void HTTHit::setPhysLayer(unsigned v) +// Sets using the physical layer index as defined by FPGATrackSimPlaneMap +void FPGATrackSimHit::setPhysLayer(unsigned v) { if (m_detType == SiliconTech::strip) { @@ -63,8 +63,8 @@ void HTTHit::setPhysLayer(unsigned v) } } -// Returns the physical layer index as defined by HTTPlaneMap -unsigned HTTHit::getPhysLayer() const +// Returns the physical layer index as defined by FPGATrackSimPlaneMap +unsigned FPGATrackSimHit::getPhysLayer() const { if (m_detType == SiliconTech::strip) return 2 * m_layer_disk + m_side; @@ -72,16 +72,16 @@ unsigned HTTHit::getPhysLayer() const } -unsigned HTTHit::getLayer() const +unsigned FPGATrackSimHit::getLayer() const { if (isMapped()) return m_layer; - throw std::domain_error("HTTHit::getLayer() called on a hit with invalid type: " + to_string(m_hitType)); + throw std::domain_error("FPGATrackSimHit::getLayer() called on a hit with invalid type: " + to_string(m_hitType)); } -unsigned HTTHit::getSection() const +unsigned FPGATrackSimHit::getSection() const { if (isMapped()) return m_section; - throw std::domain_error("HTTHit::getSection() called on a hit with invalid type"); + throw std::domain_error("FPGATrackSimHit::getSection() called on a hit with invalid type"); } @@ -90,7 +90,7 @@ unsigned HTTHit::getSection() const // single hashID. In rel22 a unique hashID will be assigned to each row of strips // (4 or 2 per chip). This change fixes the 21.9 version to match the 22 version, // by adding the row index (eta coord) to the hashID. -unsigned HTTHit::getHTTIdentifierHash() const +unsigned FPGATrackSimHit::getFPGATrackSimIdentifierHash() const { if (m_detType == SiliconTech::strip) return (m_identifierHash << 2) + m_etaIndex; @@ -98,7 +98,7 @@ unsigned HTTHit::getHTTIdentifierHash() const } // TODO TODO TODO as above -int HTTHit::getHTTEtaModule() const +int FPGATrackSimHit::getFPGATrackSimEtaModule() const { if (m_detType == SiliconTech::strip) { @@ -122,12 +122,12 @@ int HTTHit::getHTTEtaModule() const } -std::ostream& operator<<(std::ostream& out, const HTTHit& hit) +std::ostream& operator<<(std::ostream& out, const FPGATrackSimHit& hit) { out << "type=" << hit.m_hitType << " tech=" << hit.m_detType << " zone=" << hit.m_detectorZone - << " etamod=" << hit.getHTTEtaModule() + << " etamod=" << hit.getFPGATrackSimEtaModule() << " phimod=" << hit.getPhiModule() << " physLayer=" << hit.getPhysLayer() << " eta=" << hit.getEtaCoord() diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimLogicalEventInputHeader.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimLogicalEventInputHeader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..12f56c0ad0a46b9357879ad966a829799e40cc16 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimLogicalEventInputHeader.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" + + +ClassImp(FPGATrackSimLogicalEventInputHeader) + + +void FPGATrackSimLogicalEventInputHeader::reset() +{ + m_event.reset(); + m_optional.reset(); + m_towers.clear(); +} + + +std::ostream& operator<<(std::ostream& s, const FPGATrackSimLogicalEventInputHeader& h) +{ + s << "Event: " << h.event() << "\t" + << "Optional: " << h.optional() << "\t" + << "NTowers: " << h.nTowers() << "\n"; + + const std::vector<FPGATrackSimTowerInputHeader>& towers = h.towers(); + for (int j = 0; j < h.nTowers(); j++) + { + s << " " << j << " " << towers[j] << "\n"; + } + s << std::endl; + + return s; +} + diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimLogicalEventOutputHeader.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimLogicalEventOutputHeader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fceba80ae2f89e2334b77f20ceb8377701b77fe2 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimLogicalEventOutputHeader.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" + +ClassImp(FPGATrackSimLogicalEventOutputHeader) + +FPGATrackSimLogicalEventOutputHeader::~FPGATrackSimLogicalEventOutputHeader() { + reset(); +} + +void FPGATrackSimLogicalEventOutputHeader::reset() { + m_FPGATrackSimRoads_1st.clear(); + m_FPGATrackSimRoads_2nd.clear(); + m_FPGATrackSimTracks_1st.clear(); + m_FPGATrackSimTracks_2nd.clear(); + m_dataflowInfo.reset(); +} + +std::ostream& operator<<(std::ostream& s, FPGATrackSimLogicalEventOutputHeader const& h) { + + s << "NFPGATrackSimRoads_1st = " << h.nFPGATrackSimRoads_1st() << ", " + << "NFPGATrackSimRoads_2nd = " << h.nFPGATrackSimRoads_2nd() << ", " + << "NFPGATrackSimTracks_1st = " << h.nFPGATrackSimTracks_1st() << ", " + << "NFPGATrackSimTracks_2nd = " << h.nFPGATrackSimTracks_2nd() << std::endl; + + return s; +} diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimMatchInfo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimMatchInfo.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d693ec6274ad545738d30eb8b15e2cc0bc177581 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimMatchInfo.cxx @@ -0,0 +1,16 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimMatchInfo.h" +#include <iostream> + +ClassImp(FPGATrackSimMatchInfo) + +std::ostream& operator<<(std::ostream& s, const FPGATrackSimMatchInfo& h) { + + s << "barcode: " << h.barcode() + << ", event index: " << h.evtindex() << std::endl; + + return s; +} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTMultiTruth.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimMultiTruth.cxx similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTMultiTruth.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimMultiTruth.cxx index db25178bef278deb04da1b748c6da9e68a47cbef..d5ba8d8206a63c31abff9f02627864b959f0a435 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTMultiTruth.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimMultiTruth.cxx @@ -1,31 +1,31 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include <iostream> #include <algorithm> -#include "TrigHTTObjects/HTTMultiTruth.h" +#include "FPGATrackSimObjects/FPGATrackSimMultiTruth.h" -ClassImp(HTTMultiTruth) +ClassImp(FPGATrackSimMultiTruth) -// HTTMultiTruth +// FPGATrackSimMultiTruth // ================================================================ // code to match clusters and tracks to GEANT charge deposition // information // ================================================================ // 20-04-2009 Antonio Boveia (boveia@hep.uchicago.edu) -long HTTMultiTruth::best_barcode() const { +long FPGATrackSimMultiTruth::best_barcode() const { Barcode code; Weight weight; return !best(code, weight) ? -999 : code.second; } -void HTTMultiTruth::add(const HTTMultiTruth::Barcode& code, const HTTMultiTruth::Weight& weight) { +void FPGATrackSimMultiTruth::add(const FPGATrackSimMultiTruth::Barcode& code, const FPGATrackSimMultiTruth::Weight& weight) { assert(weight >= 0.); m_truth[code] += weight; } -void HTTMultiTruth::add(const HTTMultiTruth& rval) { +void FPGATrackSimMultiTruth::add(const FPGATrackSimMultiTruth& rval) { for (auto& rval_truth : rval.m_truth) { m_truth[rval_truth.first] += rval_truth.second; } @@ -34,7 +34,7 @@ void HTTMultiTruth::add(const HTTMultiTruth& rval) { // if this doesn't have any truth info, assign maxweight_barcode to be the truth. // otherwise, this should only have the barcode of the largest weight seen so far; // compare with the input barcode and keep the best. -void HTTMultiTruth::maximize(const HTTMultiTruth::Barcode& code, const HTTMultiTruth::Weight& weight) +void FPGATrackSimMultiTruth::maximize(const FPGATrackSimMultiTruth::Barcode& code, const FPGATrackSimMultiTruth::Weight& weight) { if (m_truth.empty()) m_truth[code] = weight; else @@ -48,7 +48,7 @@ void HTTMultiTruth::maximize(const HTTMultiTruth::Barcode& code, const HTTMultiT } } -void HTTMultiTruth::maximize(const HTTMultiTruth& rval) +void FPGATrackSimMultiTruth::maximize(const FPGATrackSimMultiTruth& rval) { if (rval.m_truth.empty()) return; // if rval has no truth info, do nothing. @@ -67,15 +67,15 @@ void HTTMultiTruth::maximize(const HTTMultiTruth& rval) maximize(maxweight_barcode, maxweight); } -void HTTMultiTruth::assign_equal_normalization() +void FPGATrackSimMultiTruth::assign_equal_normalization() { for ( auto& truth : m_truth) truth.second = 1. / m_truth.size(); } -std::ostream& operator<<(std::ostream& o, const HTTMultiTruth& mt) +std::ostream& operator<<(std::ostream& o, const FPGATrackSimMultiTruth& mt) { size_t count = std::count_if(mt.begin(), mt.end(), [](auto){return true;}); - o << "HTTMultiTruth (event index,barcode) <=> weight, entries: " << count << "\n"; + o << "FPGATrackSimMultiTruth (event index,barcode) <=> weight, entries: " << count << "\n"; if (count == 0) return o; @@ -84,8 +84,8 @@ std::ostream& operator<<(std::ostream& o, const HTTMultiTruth& mt) o << " best: \n"; - HTTMultiTruth::Barcode code; - HTTMultiTruth::Weight weight(0); + FPGATrackSimMultiTruth::Barcode code; + FPGATrackSimMultiTruth::Weight weight(0); if (!mt.best(code, weight)) o << "N/A\n"; else o << code.first << "," << code.second << " " << weight << "\n"; @@ -93,16 +93,16 @@ std::ostream& operator<<(std::ostream& o, const HTTMultiTruth& mt) } -const HTTMultiTruth HTTMultiTruth::add(const HTTMultiTruth& rval) const +const FPGATrackSimMultiTruth FPGATrackSimMultiTruth::add(const FPGATrackSimMultiTruth& rval) const { - HTTMultiTruth result(*this); + FPGATrackSimMultiTruth result(*this); result.add(rval); return result; } -const HTTMultiTruth HTTMultiTruth::maximize(const HTTMultiTruth& rval) const +const FPGATrackSimMultiTruth FPGATrackSimMultiTruth::maximize(const FPGATrackSimMultiTruth& rval) const { - HTTMultiTruth result(*this); + FPGATrackSimMultiTruth result(*this); result.maximize(rval); return result; } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOfflineHit.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOfflineHit.cxx similarity index 59% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOfflineHit.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOfflineHit.cxx index 2a22136ba7347b7e56e36490b1f74665c3fc0363..4d2f860cba0fba3d925046389928db9462a600f8 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOfflineHit.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOfflineHit.cxx @@ -1,14 +1,14 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTOfflineHit.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineHit.h" #include <iostream> -ClassImp(HTTOfflineHit) +ClassImp(FPGATrackSimOfflineHit) -std::ostream& operator<<(std::ostream& s, const HTTOfflineHit& h) { +std::ostream& operator<<(std::ostream& s, const FPGATrackSimOfflineHit& h) { s << "locX " << h.getLocX() << " \t locY " << h.getLocY() diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOfflineTrack.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOfflineTrack.cxx similarity index 64% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOfflineTrack.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOfflineTrack.cxx index 87f32892adfc555294efe978a2c9417e7960a353..5064773e340774dbd2e937048cefe2331828bb61 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTOfflineTrack.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOfflineTrack.cxx @@ -1,18 +1,18 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" #include <iostream> -ClassImp(HTTOfflineTrack) +ClassImp(FPGATrackSimOfflineTrack) -HTTOfflineTrack::HTTOfflineTrack() : +FPGATrackSimOfflineTrack::FPGATrackSimOfflineTrack() : m_qoverpt(0.), m_eta(0.), m_phi(0.), m_d0(0.), m_z0(0.), m_barcode(-1), m_barcode_frac(0.) {} -std::ostream& operator<<(std::ostream& s, const HTTOfflineTrack& offline_t) { +std::ostream& operator<<(std::ostream& s, const FPGATrackSimOfflineTrack& offline_t) { s << "pt: " << offline_t.getPt() << ", " << "eta: " << offline_t.getEta() << ", " @@ -23,7 +23,7 @@ std::ostream& operator<<(std::ostream& s, const HTTOfflineTrack& offline_t) { << "barcode: " << offline_t.getBarcode() << ", " << "barcode fraction: " << offline_t.getBarcodeFrac() << std::endl; - std::vector<HTTOfflineHit> hits = offline_t.getOfflineHits(); + std::vector<FPGATrackSimOfflineHit> hits = offline_t.getOfflineHits(); for (int j = 0; j < offline_t.nHits(); j++) { s << " " << j << " " << hits[j] << "\n"; } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOptionalEventInfo.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOptionalEventInfo.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f4629ac38c22758e31d511ba5431b6d94fc0b271 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimOptionalEventInfo.cxx @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimOptionalEventInfo.h" +#include <iostream> + +ClassImp(FPGATrackSimOptionalEventInfo) + +FPGATrackSimOptionalEventInfo::~FPGATrackSimOptionalEventInfo() { + reset(); +} + +void FPGATrackSimOptionalEventInfo::reset() { + m_OfflineClusters.clear(); + m_OfflineTracks.clear(); + m_TruthTracks.clear(); +} + +std::ostream& operator<<(std::ostream& s, const FPGATrackSimOptionalEventInfo& info) { + s << "nOfflineClusters: " << info.nOfflineClusters() << ", " + << "nOfflineTracks: " << info.nOfflineTracks() << ", " + << "nTruthTracks: " << info.nTruthTracks() << std::endl; + return s; +} diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTRoad.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimRoad.cxx similarity index 81% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTRoad.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimRoad.cxx index 6f81968e334d669c620197095dbc95493c232e48..4b9d5f954ff2ce4b173f2f5acc579737080eec7b 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTRoad.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimRoad.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** - * @file HTTRoad.cxx + * @file FPGATrackSimRoad.cxx * @author Riley Xu - riley.xu@cern.ch * @date January 13th, 2020 * @brief Defines a class for roads. @@ -10,26 +10,26 @@ #include <vector> -#include "TrigHTTObjects/HTTRoad.h" -#include "TrigHTTObjects/HTTConstants.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" using namespace std; -size_t HTTRoad::getNHits() const +size_t FPGATrackSimRoad::getNHits() const { size_t n = 0; for (const auto& l : m_hits) n += l.size(); return n; } -std::vector<size_t> HTTRoad::getNHits_layer() const +std::vector<size_t> FPGATrackSimRoad::getNHits_layer() const { std::vector<size_t> out; for (const auto& l : m_hits) out.push_back(l.size()); return out; } -size_t HTTRoad::getNHitCombos() const +size_t FPGATrackSimRoad::getNHitCombos() const { size_t combos = 1; size_t l = m_hits.size(); @@ -70,7 +70,7 @@ size_t HTTRoad::getNHitCombos() const } -HTTMultiTruth HTTRoad::getTruth() const +FPGATrackSimMultiTruth FPGATrackSimRoad::getTruth() const { // get number of pixel layers from hits. Assumes strips follow pixels, // and all hits in a layer share the same det type @@ -79,14 +79,14 @@ HTTMultiTruth HTTRoad::getTruth() const if (!m_hits[nPixel].empty() && m_hits[nPixel].front()->isStrip()) break; - std::map<HTTMultiTruth::Barcode, layer_bitmask_t> layer_map; + std::map<FPGATrackSimMultiTruth::Barcode, layer_bitmask_t> layer_map; for (auto const& hits : m_hits) - for (HTTHit const* h : hits) + for (FPGATrackSimHit const* h : hits) for (auto const& x : h->getTruth()) layer_map[x.first] |= (1 << h->getLayer()); - HTTMultiTruth mt; + FPGATrackSimMultiTruth mt; for (auto const& x : layer_map) { int w = 0, n = 0; @@ -104,7 +104,7 @@ HTTMultiTruth HTTRoad::getTruth() const return mt; } -ostream& operator<<(ostream& os, const HTTRoad& road) +ostream& operator<<(ostream& os, const FPGATrackSimRoad& road) { os << "road " << road.m_roadID << ": PID " << road.m_pid @@ -115,7 +115,7 @@ ostream& operator<<(ostream& os, const HTTRoad& road) /* for (size_t l=0; l < road.m_hits.size(); l++) { - for (HTTHit const * hit : road.m_hits[l]) + for (FPGATrackSimHit const * hit : road.m_hits[l]) os << "\n\t" << *hit; } */ diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTowerInputHeader.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTowerInputHeader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..824e1b69db5d869378b19289b803d4787cc2ae79 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTowerInputHeader.cxx @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" +#include <iostream> + +ClassImp(FPGATrackSimTowerInputHeader) + +FPGATrackSimTowerInputHeader::FPGATrackSimTowerInputHeader(int id, double e, double p, double de, double dp) : + m_id(id), + m_Eta(e), m_Phi(p), + m_DeltaEta(de), m_DeltaPhi(dp) +{ + m_Hits.clear(); +} + +void FPGATrackSimTowerInputHeader::reset() +{ + m_id = 0; + m_Eta = 0.0; + m_Phi = 0.0; + m_DeltaEta = 0.0; + m_DeltaPhi = 0.0; + m_Hits.clear(); +} + + +std::ostream& operator<<(std::ostream& s, const FPGATrackSimTowerInputHeader& r) +{ + + s << "Tower: id=" << r.id() << "\t eta=" << r.eta() << "\t phi=" << r.phi() + << "\t Nhits=" << r.nHits(); + + return s; +} + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrack.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrack.cxx similarity index 78% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrack.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrack.cxx index 41d971f71e78f548692948644485ab7cbea471bd..7b12238ff95f0a4d8c2e57f3b1fb1b65bde1edbe 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrack.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrack.cxx @@ -1,42 +1,34 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ + + +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimConstants.h" #include <iostream> #include <iomanip> #include <TMath.h> - -#include "TrigHTTObjects/HTTTrack.h" -#include "TrigHTTObjects/HTTConstants.h" - using namespace std; -ClassImp(HTTTrack) +ClassImp(FPGATrackSimTrack) // first stage only -HTTTrack::HTTTrack() : - m_doDeltaGPhis(false), - m_bankID(-1), m_patternID(0), m_firstSectorID(-1), m_secondSectorID(-1), m_trackID(-1), - m_qoverpt(0), m_d0(0), m_phi(0), m_z0(0), - m_eta(0), m_chi2(0), m_origchi2(0), - m_nmissing(0), - m_typemask(0), m_hitmap(0), - m_hits(0x0), - m_eventindex(-1), m_barcode(-1), m_barcode_frac(0.), m_ORcode(1) +FPGATrackSimTrack::FPGATrackSimTrack() { // nothing to do here } -HTTTrack::~HTTTrack() +FPGATrackSimTrack::~FPGATrackSimTrack() { - if (m_hits.size() > 0) m_hits.clear(); + if (not m_hits.empty() ) m_hits.clear(); } -std::vector<float> HTTTrack::getCoords(unsigned ilayer) const +std::vector<float> FPGATrackSimTrack::getCoords(unsigned ilayer) const { std::vector<float> coords; if (ilayer >= m_hits.size()) - throw std::range_error("HTTTrack::getCoords() out of bounds"); + throw std::range_error("FPGATrackSimTrack::getCoords() out of bounds"); if (m_trackCorrType == TrackCorrType::None) { @@ -51,7 +43,7 @@ std::vector<float> HTTTrack::getCoords(unsigned ilayer) const return coords; } -std::vector<float> HTTTrack::computeIdealCoords(unsigned ilayer) const +std::vector<float> FPGATrackSimTrack::computeIdealCoords(unsigned ilayer) const { std::vector<float> coords; @@ -106,27 +98,27 @@ std::vector<float> HTTTrack::computeIdealCoords(unsigned ilayer) const return coords; } -float HTTTrack::getEtaCoord(int ilayer) const { +float FPGATrackSimTrack::getEtaCoord(int ilayer) const { auto coords = getCoords(ilayer); if (coords.size() > 0) { return coords.at(0); } else { - throw std::range_error("HTTTrack::getCoord(layer,coord) out of bounds"); + throw std::range_error("FPGATrackSimTrack::getCoord(layer,coord) out of bounds"); } } -float HTTTrack::getPhiCoord(int ilayer) const { +float FPGATrackSimTrack::getPhiCoord(int ilayer) const { auto coords = getCoords(ilayer); if (coords.size() > 1) { return coords.at(1); } else { - throw std::range_error("HTTTrack::getCoord(layer,coord) out of bounds"); + throw std::range_error("FPGATrackSimTrack::getCoord(layer,coord) out of bounds"); } } -int HTTTrack::getNCoords() const { +int FPGATrackSimTrack::getNCoords() const { int nCoords = 0; for (const auto& hit : m_hits) { nCoords += hit.getDim(); @@ -135,16 +127,16 @@ int HTTTrack::getNCoords() const { } //set a specific position in m_hits -void HTTTrack::setHTTHit(unsigned i, const HTTHit& hit) +void FPGATrackSimTrack::setFPGATrackSimHit(unsigned i, const FPGATrackSimHit& hit) { if (m_hits.size() > i) m_hits[i] = hit; else - throw std::range_error("HTTTrack::setHTTHit() out of bounds"); + throw std::range_error("FPGATrackSimTrack::setFPGATrackSimHit() out of bounds"); } /** set the number of layers in the track. =0 is used to clear the track */ -void HTTTrack::setNLayers(int dim) +void FPGATrackSimTrack::setNLayers(int dim) { if (m_hits.size() > 0) m_hits.clear(); m_hits.resize(dim); @@ -152,7 +144,7 @@ void HTTTrack::setNLayers(int dim) // if ForceRange==true, then phi = [-pi..pi) -void HTTTrack::setPhi(float phi, bool ForceRange) { +void FPGATrackSimTrack::setPhi(float phi, bool ForceRange) { if (ForceRange) { // when phi is ridiculously large, there is no point in adjusting it if (std::abs(phi) > 100) { @@ -168,7 +160,7 @@ void HTTTrack::setPhi(float phi, bool ForceRange) { m_phi = phi; } -float HTTTrack::getParameter(int ipar) const +float FPGATrackSimTrack::getParameter(int ipar) const { switch (ipar) { case 0: @@ -192,7 +184,7 @@ float HTTTrack::getParameter(int ipar) const } -void HTTTrack::setParameter(int ipar, float val) +void FPGATrackSimTrack::setParameter(int ipar, float val) { switch (ipar) { case 0: @@ -214,7 +206,7 @@ void HTTTrack::setParameter(int ipar, float val) } -ostream& operator<<(ostream& out, const HTTTrack& track) +ostream& operator<<(ostream& out, const FPGATrackSimTrack& track) { out << "TRACK: ID=" << std::left << setw(8) << track.m_trackID; @@ -257,9 +249,9 @@ ostream& operator<<(ostream& out, const HTTTrack& track) } -void HTTTrack::calculateTruth() +void FPGATrackSimTrack::calculateTruth() { - vector<HTTMultiTruth> mtv; + vector<FPGATrackSimMultiTruth> mtv; mtv.reserve(m_hits.size()); // don't loop over coordinates, since we only calculate truth *per hit* and not per coordinate, though hitmap is saved for coordinates, so be careful @@ -267,7 +259,7 @@ void HTTTrack::calculateTruth() { if (thishit.isReal()) { - HTTMultiTruth this_mt(thishit.getTruth()); + FPGATrackSimMultiTruth this_mt(thishit.getTruth()); this_mt.assign_equal_normalization(); if (thishit.isPixel()) for ( auto& x : this_mt) @@ -278,9 +270,9 @@ void HTTTrack::calculateTruth() // compute the best geant match, the barcode with the largest number of hits contributing to the track. // frac is then the fraction of the total number of hits on the track attributed to the barcode. - HTTMultiTruth mt(std::accumulate(mtv.begin(), mtv.end(), HTTMultiTruth(), HTTMultiTruth::AddAccumulator())); - HTTMultiTruth::Barcode tbarcode; - HTTMultiTruth::Weight tfrac; + FPGATrackSimMultiTruth mt(std::accumulate(mtv.begin(), mtv.end(), FPGATrackSimMultiTruth(), FPGATrackSimMultiTruth::AddAccumulator())); + FPGATrackSimMultiTruth::Barcode tbarcode; + FPGATrackSimMultiTruth::Weight tfrac; const bool ok = mt.best(tbarcode, tfrac); if (ok) { @@ -296,7 +288,7 @@ void HTTTrack::calculateTruth() } } -void HTTTrack::setPassedOR(unsigned int code) +void FPGATrackSimTrack::setPassedOR(unsigned int code) { m_ORcode = code; } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrackPars.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrackPars.cxx similarity index 56% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrackPars.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrackPars.cxx index f36e8ded31662a4ef0557d700c285116c974fc83..2965b9603cd20ea5c7d4e93202615594b1d14689 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrackPars.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrackPars.cxx @@ -1,19 +1,19 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** - * @file HTTTrackPars.h + * @file FPGATrackSimTrackPars.h * @author Riley Xu - riley.xu@cern.ch * @date March 27th, 2020 * @brief Structs that store the 5 track parameters */ -#include "TrigHTTObjects/HTTTrackPars.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h" #include <stdexcept> -const double& HTTTrackPars::operator[](unsigned i) const +const double& FPGATrackSimTrackPars::operator[](unsigned i) const { switch (i) { @@ -22,12 +22,12 @@ const double& HTTTrackPars::operator[](unsigned i) const case 2: return d0; case 3: return z0; case 4: return eta; - default: throw std::out_of_range("HTTTrackPars[] out of range"); + default: throw std::out_of_range("FPGATrackSimTrackPars[] out of range"); } } -double& HTTTrackPars::operator[](unsigned i) +double& FPGATrackSimTrackPars::operator[](unsigned i) { switch (i) { @@ -36,12 +36,12 @@ double& HTTTrackPars::operator[](unsigned i) case 2: return d0; case 3: return z0; case 4: return eta; - default: throw std::out_of_range("HTTTrackPars[] out of range"); + default: throw std::out_of_range("FPGATrackSimTrackPars[] out of range"); } } -const int& HTTTrackParsI::operator[](unsigned i) const +const int& FPGATrackSimTrackParsI::operator[](unsigned i) const { switch (i) { @@ -50,12 +50,12 @@ const int& HTTTrackParsI::operator[](unsigned i) const case 2: return d0; case 3: return z0; case 4: return eta; - default: throw std::out_of_range("HTTTrackPars[] out of range"); + default: throw std::out_of_range("FPGATrackSimTrackPars[] out of range"); } } -int& HTTTrackParsI::operator[](unsigned i) +int& FPGATrackSimTrackParsI::operator[](unsigned i) { switch (i) { @@ -64,12 +64,12 @@ int& HTTTrackParsI::operator[](unsigned i) case 2: return d0; case 3: return z0; case 4: return eta; - default: throw std::out_of_range("HTTTrackPars[] out of range"); + default: throw std::out_of_range("FPGATrackSimTrackPars[] out of range"); } } -std::string HTTTrackPars::parName(unsigned i) +std::string FPGATrackSimTrackPars::parName(unsigned i) { switch (i) { @@ -78,11 +78,11 @@ std::string HTTTrackPars::parName(unsigned i) case 2: return "d0"; case 3: return "z0"; case 4: return "eta"; - default: throw std::out_of_range("HTTTrackPars::parName out of range"); + default: throw std::out_of_range("FPGATrackSimTrackPars::parName out of range"); } } -std::ostream& operator<<(std::ostream& os, const HTTTrackPars& pars) +std::ostream& operator<<(std::ostream& os, const FPGATrackSimTrackPars& pars) { os << "phi:" << pars.phi << " q/pt:" << pars.qOverPt @@ -92,7 +92,7 @@ std::ostream& operator<<(std::ostream& os, const HTTTrackPars& pars) return os; } -std::ostream& operator<<(std::ostream& os, const HTTTrackParsI& pars) +std::ostream& operator<<(std::ostream& os, const FPGATrackSimTrackParsI& pars) { os << "phi:" << pars.phi << " q/pt:" << pars.qOverPt diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrackStream.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrackStream.cxx similarity index 73% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrackStream.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrackStream.cxx index bff4f9e21ade4071c9f9d2db03006fd91165d8fe..6d65d9ce1ac7e03c0908ecfdff668eb9afbd2ff0 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTrackStream.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTrackStream.cxx @@ -1,14 +1,14 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTTrackStream.h" +#include "FPGATrackSimObjects/FPGATrackSimTrackStream.h" #include <iostream> #include <iomanip> using namespace std; -HTTTrackStream::HTTTrackStream() : +FPGATrackSimTrackStream::FPGATrackSimTrackStream() : m_run_number(0ul), m_event_number(0ul), m_ntracks(0), m_ncombs(0), m_nfits(0), m_nfits_maj(0), m_nfits_maj_SCT(0), @@ -21,11 +21,11 @@ HTTTrackStream::HTTTrackStream() : m_nfits_recI(0), m_nfits_addrecI(0), m_nfits_badI(0), m_nfits_rejI(0), m_nfits_badmajI(0), m_nfits_rejmajI(0), m_nconn(0), m_nextrapolatedTracks(0) { - m_tracks = new TClonesArray("HTTTrack", 1000); - m_tracksI = new TClonesArray("HTTTrack", 1000); + m_tracks = new TClonesArray("FPGATrackSimTrack", 1000); + m_tracksI = new TClonesArray("FPGATrackSimTrack", 1000); } -HTTTrackStream & HTTTrackStream::operator = (const HTTTrackStream &in) +FPGATrackSimTrackStream & FPGATrackSimTrackStream::operator = (const FPGATrackSimTrackStream &in) { if (this != &in) { m_run_number = in.m_run_number; @@ -56,16 +56,16 @@ HTTTrackStream & HTTTrackStream::operator = (const HTTTrackStream &in) m_nfits_rejmajI = in.m_nfits_rejmajI; m_nconn = in.m_nconn; m_nextrapolatedTracks = in.m_nextrapolatedTracks; - m_tracks = new TClonesArray("HTTTrack", 1000); - m_tracksI = new TClonesArray("HTTTrack", 1000); + m_tracks = new TClonesArray("FPGATrackSimTrack", 1000); + m_tracksI = new TClonesArray("FPGATrackSimTrack", 1000); for (int i = 0; i < in.m_ntracks; i++) { - HTTTrack* trackP = in.getTrack(i); - const HTTTrack track = *trackP; + FPGATrackSimTrack* trackP = in.getTrack(i); + const FPGATrackSimTrack track = *trackP; addTrack(track); } for (int i = 0; i < in.m_ntracksI; i++) { - HTTTrack* trackP = in.getTrackI(i); - const HTTTrack track = *trackP; + FPGATrackSimTrack* trackP = in.getTrackI(i); + const FPGATrackSimTrack track = *trackP; addTrackI(track); } } @@ -73,7 +73,7 @@ HTTTrackStream & HTTTrackStream::operator = (const HTTTrackStream &in) return *this; } -HTTTrackStream::~HTTTrackStream() +FPGATrackSimTrackStream::~FPGATrackSimTrackStream() { m_tracks->Delete(); delete m_tracks; @@ -82,7 +82,7 @@ HTTTrackStream::~HTTTrackStream() } // copy constructor -HTTTrackStream::HTTTrackStream(const HTTTrackStream &in) { +FPGATrackSimTrackStream::FPGATrackSimTrackStream(const FPGATrackSimTrackStream &in) { m_run_number = in.m_run_number; m_event_number = in.m_event_number; m_ntracks = in.m_ntracks; @@ -111,40 +111,40 @@ HTTTrackStream::HTTTrackStream(const HTTTrackStream &in) { m_nfits_rejmajI = in.m_nfits_rejmajI; m_nconn = in.m_nconn; m_nextrapolatedTracks = in.m_nextrapolatedTracks; - m_tracks = new TClonesArray("HTTTrack", 1000); - m_tracksI = new TClonesArray("HTTTrack", 1000); + m_tracks = new TClonesArray("FPGATrackSimTrack", 1000); + m_tracksI = new TClonesArray("FPGATrackSimTrack", 1000); for (int i = 0; i < in.m_ntracks; i++) { - HTTTrack* trackP = in.getTrack(i); - const HTTTrack track = *trackP; + FPGATrackSimTrack* trackP = in.getTrack(i); + const FPGATrackSimTrack track = *trackP; addTrack(track); } for (int i = 0; i < in.m_ntracksI; i++) { - HTTTrack* trackP = in.getTrackI(i); - const HTTTrack track = *trackP; + FPGATrackSimTrack* trackP = in.getTrackI(i); + const FPGATrackSimTrack track = *trackP; addTrackI(track); } } /** add a track in the final list */ -void HTTTrackStream::addTrack(const HTTTrack& track) +void FPGATrackSimTrackStream::addTrack(const FPGATrackSimTrack& track) { - new ((*m_tracks)[m_ntracks++]) HTTTrack(track); + new ((*m_tracks)[m_ntracks++]) FPGATrackSimTrack(track); m_trackIdMap[std::make_pair(track.getTrackID(), track.getBankID())] = m_ntracks - 1; } /** return a given track, identified by its position in the list */ -HTTTrack* HTTTrackStream::getTrack(int ipos) const +FPGATrackSimTrack* FPGATrackSimTrackStream::getTrack(int ipos) const { if (ipos >= m_ntracks) return 0; - else return (HTTTrack*)m_tracks->At(ipos); + else return (FPGATrackSimTrack*)m_tracks->At(ipos); } /** this method, passing a track ID and a bank ID, return the ID of the corresponding track. If it doesn't exist return -1 */ -int HTTTrackStream::findTrack(int trackid, int bankid) +int FPGATrackSimTrackStream::findTrack(int trackid, int bankid) { if (!m_trackIdMap.size()) buildTrackMap(); @@ -158,23 +158,23 @@ int HTTTrackStream::findTrack(int trackid, int bankid) /** add a track in the final list */ -void HTTTrackStream::addTrackI(const HTTTrack& track) +void FPGATrackSimTrackStream::addTrackI(const FPGATrackSimTrack& track) { - new ((*m_tracksI)[m_ntracksI++]) HTTTrack(track); + new ((*m_tracksI)[m_ntracksI++]) FPGATrackSimTrack(track); } /** return a given track, identified by its position in the list */ -HTTTrack* HTTTrackStream::getTrackI(int ipos) const +FPGATrackSimTrack* FPGATrackSimTrackStream::getTrackI(int ipos) const { if (ipos >= m_ntracksI) return 0; - else return (HTTTrack*)m_tracksI->At(ipos); + else return (FPGATrackSimTrack*)m_tracksI->At(ipos); } /** reset the list of the tracks and the statistical informatino collected for this event */ -void HTTTrackStream::clear() +void FPGATrackSimTrackStream::clear() { m_run_number = 0ul; m_event_number = 0ul; @@ -219,14 +219,14 @@ void HTTTrackStream::clear() The level variable is used to choose the debug level of the output. */ -int HTTTrackStream::Print(int level, ostream& out) +int FPGATrackSimTrackStream::Print(int level, ostream& out) { int printed(0); out << "*** Run/Event " << m_run_number << "/" << m_event_number << " ***" << endl; out << "*** Tracks (lvl=" << level << "): ***" << endl; out << "*** mntracks: " << m_ntracks << endl; // for (int it=0;it<m_ntracks;++it) { - // HTTTrack *tmpt = getTrack(it); + // FPGATrackSimTrack *tmpt = getTrack(it); // } if (printed == 0) out << " [ NO TRACKS ] " << endl; out << endl; @@ -234,10 +234,10 @@ int HTTTrackStream::Print(int level, ostream& out) return printed; } -void HTTTrackStream::buildTrackMap() { +void FPGATrackSimTrackStream::buildTrackMap() { m_trackIdMap.clear(); for (int itrack = 0;itrack != m_ntracks;++itrack) { // loop over the tracks - HTTTrack* cur_track = getTrack(itrack); + FPGATrackSimTrack* cur_track = getTrack(itrack); if (!cur_track) continue; // a null pointer is possible m_trackIdMap[std::make_pair(cur_track->getTrackID(), cur_track->getBankID())] = itrack; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTruthTrack.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTruthTrack.cxx similarity index 56% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTruthTrack.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTruthTrack.cxx index a2bedcfe69ae5387ed92397de1d147352ac52254..ccf4ade34f0b70f781b537be77112a723ca75567 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTruthTrack.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTruthTrack.cxx @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTTruthTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" -HTTTruthTrack::HTTTruthTrack() : +FPGATrackSimTruthTrack::FPGATrackSimTruthTrack() : m_d0(0.), m_z0(0.), m_vtx_x(0.), m_vtx_y(0.), m_vtx_z(0.), m_px(0.), m_py(0.), m_pz(0.), m_q(0), diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTypes.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTypes.cxx similarity index 83% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTypes.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTypes.cxx index 8f1415220eebbd4c1fce0bcd6eaed9582a23cee5..24da954288d8320eeb47ea7058a130d688aca8ee 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/src/HTTTypes.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/src/FPGATrackSimTypes.cxx @@ -1,6 +1,6 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -#include "TrigHTTObjects/HTTTypes.h" +#include "FPGATrackSimObjects/FPGATrackSimTypes.h" std::ostream& operator<<(std::ostream& os, SiliconTech t) diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTLogicalEventInputHeader_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimLogicalEventInputHeader_test.cxx similarity index 80% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTLogicalEventInputHeader_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimLogicalEventInputHeader_test.cxx index 21f3ff3ce9ffd0a5616d108228c10980ba702bc8..ce1783526d4789aa9efddf9752e85acd701a8682 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTLogicalEventInputHeader_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimLogicalEventInputHeader_test.cxx @@ -1,15 +1,15 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /* - * HTTLogicalEventInputHeader_test.cxx: Unit tests for HTTLogicalEventInputHeader + * FPGATrackSimLogicalEventInputHeader_test.cxx: Unit tests for FPGATrackSimLogicalEventInputHeader */ #include <cstdio> #include <iostream> #include <cassert> -#include "TrigHTTObjects/HTTLogicalEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h" int main(int, char**) { @@ -23,22 +23,22 @@ int main(int, char**) const double px(100.), py(-200.), pz(300.); - HTTLogicalEventInputHeader header; - HTTTowerInputHeader tower; + FPGATrackSimLogicalEventInputHeader header; + FPGATrackSimTowerInputHeader tower; tower.setEta(eta); tower.setPhi(phi); header.addTower(tower); - HTTTowerInputHeader *towerOut = header.getTower(0); + FPGATrackSimTowerInputHeader *towerOut = header.getTower(0); std::cout << "Output tower eta = " << towerOut->eta() << " and phi = " << towerOut->phi() << std::endl; - HTTEventInfo event; + FPGATrackSimEventInfo event; event.setRunNumber(evtnum); header.newEvent(event); std::cout << "Event number = " << evtnum << std::endl; - HTTOptionalEventInfo optional; - HTTCluster cluster; - HTTHit hits[5]; + FPGATrackSimOptionalEventInfo optional; + FPGATrackSimCluster cluster; + FPGATrackSimHit hits[5]; for (unsigned i = 0; i < 5; i++) { hits[i].setPhiIndex(i*i); hits[i].setEtaIndex(i+1); @@ -48,12 +48,12 @@ int main(int, char**) }; optional.addOfflineCluster(cluster); - HTTOfflineTrack track; + FPGATrackSimOfflineTrack track; track.setQOverPt(qoverpt); track.setD0(d0); track.setZ0(z0); optional.addOfflineTrack(track); - HTTTruthTrack truth; + FPGATrackSimTruthTrack truth; truth.setPDGCode(pdgcode); truth.setBarcode(barcode); truth.setPX(px); diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimLogicalEventOutputHeader_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimLogicalEventOutputHeader_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..52eb267decbf7a75e6beacdd1f923ba29931ab1f --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimLogicalEventOutputHeader_test.cxx @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +/* + * FPGATrackSimLogicalEventOutputHeader_test.cxx: Unit tests for FPGATrackSimLogicalEventOutputHeader + */ + +#include <cstdio> +#include <iostream> +#include <cassert> +#include "FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h" + +int main(int, char**) +{ + // some random values for checking things, just put them all up here + const int roadid(8675309); + const double qoverpt(-0.123456), chi2(3.41159); + + FPGATrackSimLogicalEventOutputHeader header; + + FPGATrackSimTrack track; + track.setQOverPt(qoverpt); + track.setChi2(chi2); + std::vector<FPGATrackSimTrack> trackvec; + trackvec.push_back(track); + header.addFPGATrackSimTracks_1st(trackvec); + + FPGATrackSimRoad road; + road.setRoadID(roadid); + std::vector<FPGATrackSimRoad*> roadvec; + roadvec.push_back(&road); + + header.addFPGATrackSimTracks_1st(trackvec); + header.addFPGATrackSimRoads_1st(roadvec); + std::cout << "q/pt = " << header.getFPGATrackSimTracks_1st()[0].getQOverPt() << " and chi2 = " << + header.getFPGATrackSimTracks_1st()[0].getChi2() << std::endl; + + std::vector<FPGATrackSimRoad*> roads_1st; + header.getFPGATrackSimRoads_1st(roads_1st); + std::cout << "Road ID = " << roads_1st[0]->getRoadID() << std::endl; + + return 0; + +} + diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTRoad_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimRoad_test.cxx similarity index 60% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTRoad_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimRoad_test.cxx index 604013b0bcee8c1c536b2abac8bcd395376c104f..7702e3be7db0ce19da858c47ddf3fd3a0a1802a3 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTRoad_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimRoad_test.cxx @@ -1,40 +1,40 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /* - * HTTRoad_test.cxx: Unit tests for HTTRoad and HTTHit + * FPGATrackSimRoad_test.cxx: Unit tests for FPGATrackSimRoad and FPGATrackSimHit */ #include <cstdio> #include <iostream> #include <cassert> -#include "TrigHTTObjects/HTTRoad.h" +#include "FPGATrackSimObjects/FPGATrackSimRoad.h" int main(int, char**) { const int roadid(8675309); - std::vector<std::vector<const HTTHit*>> hitVec; - HTTHit hits[8]; + std::vector<std::vector<const FPGATrackSimHit*>> hitVec; + FPGATrackSimHit hits[8]; for (unsigned i = 0; i < 8; i++) { hits[i].setPhiIndex(i*i); hits[i].setEtaIndex(i+1); hits[i].setLayer(i); hits[i].setHitType(HitType::mapped); - const HTTHit* hitP = &hits[i]; - std::vector<const HTTHit*> hitPVec; + const FPGATrackSimHit* hitP = &hits[i]; + std::vector<const FPGATrackSimHit*> hitPVec; hitPVec.push_back(hitP); hitVec.push_back(hitPVec); } - HTTRoad road; + FPGATrackSimRoad road; road.setHits(hitVec); road.setRoadID(roadid); std::cout << "road id = " << road.getRoadID() << std::endl; for (unsigned i = 0; i < 8; i++) { - std::vector<const HTTHit*> returned_hits = road.getHits(i); + std::vector<const FPGATrackSimHit*> returned_hits = road.getHits(i); std::cout << "layer = " << returned_hits[0]->getLayer() << " and phi = " << returned_hits[0]->getPhiIndex() << " and eta = " << returned_hits[0]->getEtaIndex() << std::endl; } diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTTrack_test.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimTrack_test.cxx similarity index 68% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTTrack_test.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimTrack_test.cxx index c3d16fc413706eee9557648b4f4b05234d255648..2aade4876904b54715fd362500f2f994838ff368 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTObjects/test/HTTTrack_test.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimObjects/test/FPGATrackSimTrack_test.cxx @@ -1,22 +1,22 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /* - * HTTTrack_test.cxx: Unit tests for HTTTrack + * FPGATrackSimTrack_test.cxx: Unit tests for FPGATrackSimTrack */ #include <cstdio> #include <iostream> #include <cassert> -#include "TrigHTTObjects/HTTTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimTrack.h" int main(int, char**) { const double qoverpt(-0.123456), chi2(3.41159); - HTTTrack track; - HTTHit hits[8]; + FPGATrackSimTrack track; + FPGATrackSimHit hits[8]; track.setNLayers(8); for (unsigned i = 0; i < 8; i++) { @@ -24,14 +24,14 @@ int main(int, char**) hits[i].setEtaIndex(i+1); hits[i].setLayer(i); hits[i].setHitType(HitType::mapped); - track.setHTTHit(i,hits[i]); + track.setFPGATrackSimHit(i,hits[i]); } track.setQOverPt(qoverpt); track.setChi2(chi2); std::cout << "q/pt = " << track.getQOverPt() << std::endl; std::cout << "chi2 = " << track.getChi2() << std::endl; - const std::vector <HTTHit> returned_hits = track.getHTTHits(); + const std::vector <FPGATrackSimHit> returned_hits = track.getFPGATrackSimHits(); for (unsigned i = 0; i < 8; i++) { std::cout << "layer = " << returned_hits[i].getLayer() << " and phi = " << returned_hits[i].getPhiIndex() << " " << " and eta = " << returned_hits[i].getEtaIndex() << std::endl; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/CMakeLists.txt b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/CMakeLists.txt similarity index 65% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/CMakeLists.txt rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/CMakeLists.txt index e4ccd4d69ae23d77c24b2b4b493a5e1ae558f780..f1eda48e9ad52a55d08141d341268119b7973c39 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/CMakeLists.txt +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/CMakeLists.txt @@ -1,7 +1,7 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # Declare the package name: -atlas_subdir( TrigHTTSGInput ) +atlas_subdir( FPGATrackSimSGInput ) # External dependencies: find_package( HepPDT ) @@ -9,20 +9,20 @@ find_package( ROOT COMPONENTS Core Tree Hist RIO ) # Component(s) in the package: atlas_add_library( - TrigHTTSGInputLib src/*.cxx TrigHTTSGInput/*.h - PUBLIC_HEADERS TrigHTTSGInput + FPGATrackSimSGInputLib src/*.cxx FPGATrackSimSGInput/*.h + PUBLIC_HEADERS FPGATrackSimSGInput INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} - AthenaBaseComps GeneratorObjects InDetIdentifier InDetPrepRawData StoreGateLib TrigHTTObjectsLib TrkExInterfaces TrkToolInterfaces BeamSpotConditionsData InDetSimData AtlasHepMCLib + AthenaBaseComps GeneratorObjects InDetIdentifier InDetPrepRawData StoreGateLib FPGATrackSimObjectsLib TrkExInterfaces TrkToolInterfaces BeamSpotConditionsData InDetSimData AtlasHepMCLib PRIVATE_LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasDetDescr EventInfo EventPrimitives GaudiKernel IdDict IdDictDetDescr Identifier InDetRawData InDetReadoutGeometry InDetRIO_OnTrack ReadoutGeometryBase TileIdentifier TrkFitterInterfaces TrkRIO_OnTrack TrkSpacePoint VxVertex ) atlas_add_component( - TrigHTTSGInput src/components/*.cxx + FPGATrackSimSGInput src/components/*.cxx INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} TrigHTTSGInputLib + LINK_LIBRARIES ${HEPPDT_LIBRARIES} FPGATrackSimSGInputLib ) # Install files from the package: diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/ATLAS_CHECK_THREAD_SAFETY b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..daafbdc70b518b06c8fae55d6156cb1d66928ee9 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/FPGATrackSim/FPGATrackSim/FPGATrackSimSGInput diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/TrigHTTInputUtils.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/FPGATrackSimInputUtils.h similarity index 60% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/TrigHTTInputUtils.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/FPGATrackSimInputUtils.h index 5e5016cf0eedab460302248d7a2c6f23d214372f..61fb8f1e30e9a50560b26e2cd33a7f027d0f08e1 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/TrigHTTSGInput/TrigHTTInputUtils.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/FPGATrackSimInputUtils.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TrigHTTSGInput_TRIGHTTINPUTUTILS_H -#define TrigHTTSGInput_TRIGHTTINPUTUTILS_H +#ifndef FPGATrackSimSGInput_TRIGFPGATrackSimINPUTUTILS_H +#define FPGATrackSimSGInput_TRIGFPGATrackSimINPUTUTILS_H #include "AtlasHepMC/GenParticle_fwd.h" #include <bitset> -namespace TrigHTTInputUtils { +namespace FPGATrackSimInputUtils { typedef enum { TAU_PARENT_BIT , B_PARENT_BIT , PION_PARENT_BIT , PION_IMMEDIATE_PARENT_BIT , NBITS } Bits; typedef std::bitset<NBITS> ParentBitmask; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/IFPGATrackSimInputTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/IFPGATrackSimInputTool.h new file mode 100644 index 0000000000000000000000000000000000000000..c0d350e9a4b2bbb9451a2b9fd77d27f7697f1eef --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/FPGATrackSimSGInput/IFPGATrackSimInputTool.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimSGInput_IFPGATrackSimInputTool_h +#define FPGATrackSimSGInput_IFPGATrackSimInputTool_h + +#include "GaudiKernel/IAlgTool.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" + +class FPGATrackSimEventInputHeader; +/** + * @brief Interface of tools responsible for generation of the FPGATrackSim sim wrapper files + * + */ +class IFPGATrackSimInputTool : virtual public ::IAlgTool +{ + public: + + DeclareInterfaceID( IFPGATrackSimInputTool, 1, 0); + virtual ~IFPGATrackSimInputTool(){} + /** + * @brief Reads the data from outer word (Athena StoreGate) and fills the output object called header + * + * @param header object to update + * @return StatusCode + */ + virtual StatusCode readData(FPGATrackSimEventInputHeader* header, const EventContext& eventContext) = 0; + +}; + + +#endif // FPGATrackSimSGInput_IFPGATrackSimInputTool_h diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/README.md b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/README.md similarity index 64% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/README.md rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/README.md index b4422f774ecf036f9b1dad4026a04a4eb2d853ff..56732ce914f9a7c2915332558aa0de3ea1dd5e80 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/README.md +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/README.md @@ -1,8 +1,8 @@ -# TrigHTTSGInput -This package contains components necessary to generate HTT Simulation wrapper files +# FPGATrackSimSGInput +This package contains components necessary to generate FPGATrackSim Simulation wrapper files They work only in the RDO to ESD transform. That is they need both RDO input objects as well as the reconstructed objects. Example command: ```sh -Reco_tf.py --CA --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude" --inputRDOFile RUN4_muons.RDO.pool.root --outputESDFile ESD.test.root --steering doRAWtoALL --postInclude "TrigHTTSGInput.TrigHTTSGInputConfig.TrigHTTSGInputCfg" +Reco_tf.py --CA --preInclude "InDetConfig.ConfigurationHelpers.OnlyTrackingPreInclude" --inputRDOFile RUN4_muons.RDO.pool.root --outputESDFile ESD.test.root --steering doRAWtoALL --postInclude "FPGATrackSimSGInput.FPGATrackSimSGInputConfig.FPGATrackSimSGInputCfg" ``` diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/python/TrigHTTSGInputConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py similarity index 61% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/python/TrigHTTSGInputConfig.py rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py index 8508dc22e50c67b9698feb76ce993388495e4450..2c2071ff3d043325a8c07085784c68f94180dc04 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/python/TrigHTTSGInputConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py @@ -1,13 +1,14 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.SystemOfUnits import GeV -def TrigHTTSGInputCfg(flags): +def FPGATrackSimSGInputCfg(flags): """ - Configure HTT wrapers generation, outFile will be taken from flags in the future + Configure FPGATrackSim wrappers generation, outFile will be taken from flags in the future """ + acc = ComponentAccumulator() from PixelGeoModelXml.ITkPixelGeoModelConfig import ITkPixelReadoutGeometryCfg acc.merge(ITkPixelReadoutGeometryCfg(flags)) @@ -18,12 +19,12 @@ def TrigHTTSGInputCfg(flags): acc.addPublicTool(extrapolator) - HTTSGInputTool = CompFactory.TrigHTTSGToRawHitsTool(maxEta=3.2, minPt=0.8 * GeV, + FPGATrackSimSGInputTool = CompFactory.FPGATrackSimSGToRawHitsTool(maxEta=3.2, minPt=0.8 * GeV, Extrapolator = extrapolator ) - acc.addPublicTool(HTTSGInputTool) + acc.addPublicTool(FPGATrackSimSGInputTool) - wrapperAlg = CompFactory.TrigHTTRawHitsWrapperAlg( - InputTool=HTTSGInputTool, OutFileName=flags.Trigger.HTT.wrapperFileName + wrapperAlg = CompFactory.TrigFPGATrackSimRawHitsWrapperAlg( + InputTool=FPGATrackSimSGInputTool, OutFileName=flags.Trigger.FPGATrackSim.wrapperFileName ) acc.addEventAlgo(wrapperAlg) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/share/FPGATrackSimSGToRawHitsWrapperAlg_jobOptions.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/share/FPGATrackSimSGToRawHitsWrapperAlg_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..2926df567af00da2b771014c42da8280212be4ac --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/share/FPGATrackSimSGToRawHitsWrapperAlg_jobOptions.py @@ -0,0 +1,40 @@ +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +############################################################### +# +# FPGATrackSimWrapper job options file +# +#============================================================== + +from AthenaCommon.AlgSequence import AlgSequence +theJob = AlgSequence() + + + +if hasattr(runArgs,"outputNTUP_FPGATrackSimIPFile") : + OutputNTUP_FPGATrackSimIPFile = runArgs.outputNTUP_FPGATrackSimIPFile +else : + OutputNTUP_FPGATrackSimIPFile = "fpgatracksim_rawhits_wrap.root" +print "Output file", OutputNTUP_FPGATrackSimIPFile + +from AthenaCommon.AppMgr import ToolSvc +from FPGATrackSimSGInput.FPGATrackSimSGInputConf import FPGATrackSimSGToRawHitsTool +FPGATrackSimSGInput = FPGATrackSimSGToRawHitsTool( maxEta= 3.2, minPt= 0.8*GeV) +FPGATrackSimSGInput.OutputLevel = DEBUG +FPGATrackSimSGInput.ReadTruthTracks = True +ToolSvc += FPGATrackSimSGInput + +from FPGATrackSimSGInput.FPGATrackSimSGInputConf import TrigFPGATrackSimRawHitsWrapperAlg +wrapper = TrigFPGATrackSimRawHitsWrapperAlg(OutputLevel = DEBUG, + OutFileName = OutputNTUP_FPGATrackSimIPFile) + +wrapper.InputTool = FPGATrackSimSGInput +theJob += wrapper + +from AthenaCommon.AppMgr import ServiceMgr +from GaudiSvc.GaudiSvcConf import THistSvc +ServiceMgr += THistSvc() + + +print theJob +############################################################### diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTInputUtils.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimInputUtils.cxx similarity index 90% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTInputUtils.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimInputUtils.cxx index 2228f85fcaa176a5ab094509d58b4b519e3a6477..7cc2c2a58766e98fd5c761756edb9a3428e63741 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTInputUtils.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimInputUtils.cxx @@ -1,11 +1,11 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTSGInput/TrigHTTInputUtils.h" +#include "FPGATrackSimSGInput/FPGATrackSimInputUtils.h" #include "AtlasHepMC/GenVertex.h" #include "AtlasHepMC/GenParticle.h" -namespace TrigHTTInputUtils { +namespace FPGATrackSimInputUtils { const ParentBitmask construct_truth_bitmap(HepMC::ConstGenParticlePtr particle) { diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTSGToRawHitsTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx similarity index 89% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTSGToRawHitsTool.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx index 1cd3465abbbbc5af3b3694273009e4fe9dfc56e1..14964542175c3924d0aae655a10bf169ffc1ec05 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTSGToRawHitsTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx @@ -1,14 +1,14 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTEventInfo.h" -#include "TrigHTTObjects/HTTOfflineTrack.h" -#include "TrigHTTObjects/HTTOfflineHit.h" -#include "TrigHTTObjects/HTTTruthTrack.h" -#include "TrigHTTObjects/HTTHit.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInfo.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimOfflineHit.h" +#include "FPGATrackSimObjects/FPGATrackSimTruthTrack.h" +#include "FPGATrackSimObjects/FPGATrackSimHit.h" #include "StoreGate/DataHandle.h" @@ -35,21 +35,21 @@ #include "InDetRIO_OnTrack/SiClusterOnTrack.h" #include "GaudiKernel/IPartPropSvc.h" -#include "TrigHTTSGToRawHitsTool.h" +#include "FPGATrackSimSGToRawHitsTool.h" namespace { // A few constants for truth cuts - const float HTT_PT_TRUTHMIN = 400.; - const float HTT_Z_TRUTHMIN = 2300.; + const float FPGATrackSim_PT_TRUTHMIN = 400.; + const float FPGATrackSim_Z_TRUTHMIN = 2300.; } -TrigHTTSGToRawHitsTool::TrigHTTSGToRawHitsTool(const std::string& algname, const std::string& name, const IInterface* ifc) : +FPGATrackSimSGToRawHitsTool::FPGATrackSimSGToRawHitsTool(const std::string& algname, const std::string& name, const IInterface* ifc) : base_class(algname, name, ifc) {} -StatusCode TrigHTTSGToRawHitsTool::initialize() { +StatusCode FPGATrackSimSGToRawHitsTool::initialize() { - ATH_MSG_DEBUG("TrigHTTSGToRawHitsTool::initialize()"); + ATH_MSG_DEBUG("FPGATrackSimSGToRawHitsTool::initialize()"); ATH_CHECK(m_truthToTrack.retrieve()); ATH_CHECK(m_extrapolator.retrieve()); @@ -92,20 +92,20 @@ StatusCode TrigHTTSGToRawHitsTool::initialize() { } -StatusCode TrigHTTSGToRawHitsTool::finalize() { +StatusCode FPGATrackSimSGToRawHitsTool::finalize() { if (m_idHelper) { delete m_idHelper; } return StatusCode::SUCCESS; } /** This function get from the SG the inner detector raw hits - and prepares them for HTT simulation */ -StatusCode TrigHTTSGToRawHitsTool::readData(HTTEventInputHeader* header, const EventContext& eventContext) + and prepares them for FPGATrackSim simulation */ +StatusCode FPGATrackSimSGToRawHitsTool::readData(FPGATrackSimEventInputHeader* header, const EventContext& eventContext) { m_eventHeader = header; //take the external pointer auto eventInfo = SG::makeHandle(m_eventInfoKey, eventContext); //Filled to variable / start event - HTTEventInfo event_info; + FPGATrackSimEventInfo event_info; event_info.setRunNumber(eventInfo->runNumber()); event_info.setEventNumber(eventInfo->eventNumber()); event_info.setLB(eventInfo->lumiBlock()); @@ -129,26 +129,26 @@ StatusCode TrigHTTSGToRawHitsTool::readData(HTTEventInputHeader* header, const E ATH_CHECK(readRawSilicon(hitIndexMap, pixelClusterIndexMap, eventContext)); ATH_MSG_DEBUG("Found list of hits, size =" << m_eventHeader->nHits()); - HTTOptionalEventInfo optional; + FPGATrackSimOptionalEventInfo optional; if (m_readOfflineClusters) { - std::vector <HTTCluster> clusters; + std::vector <FPGATrackSimCluster> clusters; ATH_CHECK(readOfflineClusters(clusters, eventContext)); for (auto cluster : clusters) optional.addOfflineCluster(cluster); ATH_MSG_DEBUG("Saved " << optional.nOfflineClusters() << " offline clusters"); } if (m_readTruthTracks) { - std::vector <HTTTruthTrack> truth; + std::vector <FPGATrackSimTruthTrack> truth; ATH_CHECK(readTruthTracks(truth, eventContext)); - for (const HTTTruthTrack& trk : truth) optional.addTruthTrack(trk); + for (const FPGATrackSimTruthTrack& trk : truth) optional.addTruthTrack(trk); ATH_MSG_DEBUG("Saved " << optional.nTruthTracks() << " truth tracks"); } - std::vector <HTTOfflineTrack> offline; + std::vector <FPGATrackSimOfflineTrack> offline; if (m_readOfflineTracks) { ATH_CHECK(readOfflineTracks(offline, eventContext)); - for (const HTTOfflineTrack& trk : offline) optional.addOfflineTrack(trk); + for (const FPGATrackSimOfflineTrack& trk : offline) optional.addOfflineTrack(trk); ATH_MSG_DEBUG("Saved " << optional.nOfflineTracks() << " offline tracks"); } @@ -160,7 +160,7 @@ StatusCode TrigHTTSGToRawHitsTool::readData(HTTEventInputHeader* header, const E } -StatusCode TrigHTTSGToRawHitsTool::readOfflineTracks(std::vector<HTTOfflineTrack>& offline, const EventContext& eventContext) +StatusCode FPGATrackSimSGToRawHitsTool::readOfflineTracks(std::vector<FPGATrackSimOfflineTrack>& offline, const EventContext& eventContext) { auto offlineTracksHandle = SG::makeHandle(m_offlineTracksKey, eventContext); ATH_MSG_DEBUG("read Offline tracks, size= " << offlineTracksHandle->size()); @@ -168,7 +168,7 @@ StatusCode TrigHTTSGToRawHitsTool::readOfflineTracks(std::vector<HTTOfflineTrack int iTrk = -1; for (const xAOD::TrackParticle* trackParticle : *offlineTracksHandle) { iTrk++; - HTTOfflineTrack tmpOfflineTrack; + FPGATrackSimOfflineTrack tmpOfflineTrack; tmpOfflineTrack.setQOverPt(trackParticle->pt() > 0 ? trackParticle->charge() / trackParticle->pt() : 0); tmpOfflineTrack.setEta(trackParticle->eta()); tmpOfflineTrack.setPhi(trackParticle->phi()); @@ -188,7 +188,7 @@ StatusCode TrigHTTSGToRawHitsTool::readOfflineTracks(std::vector<HTTOfflineTrack ) { const Trk::RIO_OnTrack* hit = dynamic_cast <const Trk::RIO_OnTrack*>(measurement); const Identifier& hitId = hit->identify(); - HTTOfflineHit tmpOfflineHit; + FPGATrackSimOfflineHit tmpOfflineHit; if (m_idHelper->is_pixel(hitId)) { tmpOfflineHit.setIsPixel(true); tmpOfflineHit.setIsBarrel(m_pixelId->is_barrel(hitId)); @@ -225,7 +225,7 @@ StatusCode TrigHTTSGToRawHitsTool::readOfflineTracks(std::vector<HTTOfflineTrack // dump silicon channels with geant matching information. StatusCode -TrigHTTSGToRawHitsTool::readRawSilicon(HitIndexMap& hitIndexMap, HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext) // const cannot make variables push back to DataInput +FPGATrackSimSGToRawHitsTool::readRawSilicon(HitIndexMap& hitIndexMap, HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext) // const cannot make variables push back to DataInput { ATH_MSG_DEBUG("read silicon hits"); unsigned int hitIndex = 0u; @@ -239,7 +239,7 @@ TrigHTTSGToRawHitsTool::readRawSilicon(HitIndexMap& hitIndexMap, HitIndexMap& pi StatusCode -TrigHTTSGToRawHitsTool::readPixelSimulation(HitIndexMap& hitIndexMap, unsigned int& hitIndex, const EventContext& eventContext) { +FPGATrackSimSGToRawHitsTool::readPixelSimulation(HitIndexMap& hitIndexMap, unsigned int& hitIndex, const EventContext& eventContext) { auto pixelSDOHandle = SG::makeHandle(m_pixelSDOKey, eventContext); auto pixelRDOHandle = SG::makeHandle(m_pixelRDOKey, eventContext); @@ -269,7 +269,7 @@ TrigHTTSGToRawHitsTool::readPixelSimulation(HitIndexMap& hitIndexMap, unsigned i } // if there is simulation truth available, try to retrieve the "most likely" barcode for this pixel. HepMC::ConstGenParticlePtr bestParent = nullptr; - TrigHTTInputUtils::ParentBitmask parentMask; + FPGATrackSimInputUtils::ParentBitmask parentMask; HepMcParticleLink::ExtendedBarCode bestExtcode; if (!m_pixelSDOKey.empty()) { InDetSimDataCollection::const_iterator iter(pixelSDOHandle->find(rdoId)); @@ -285,7 +285,7 @@ TrigHTTSGToRawHitsTool::readPixelSimulation(HitIndexMap& hitIndexMap, unsigned i ++hitIndex; // push back the hit information to DataInput for HitList - HTTHit tmpSGhit; + FPGATrackSimHit tmpSGhit; tmpSGhit.setHitType(HitType::unmapped); tmpSGhit.setDetType(SiliconTech::pixel); tmpSGhit.setIdentifierHash(sielement->identifyHash()); @@ -320,8 +320,8 @@ TrigHTTSGToRawHitsTool::readPixelSimulation(HitIndexMap& hitIndexMap, unsigned i tmpSGhit.setParentageMask(parentMask.to_ulong()); // Add truth - HTTMultiTruth mt; - HTTMultiTruth::Barcode uniquecode(tmpSGhit.getEventIndex(), tmpSGhit.getBarcode()); + FPGATrackSimMultiTruth mt; + FPGATrackSimMultiTruth::Barcode uniquecode(tmpSGhit.getEventIndex(), tmpSGhit.getBarcode()); mt.maximize(uniquecode, tmpSGhit.getBarcodePt()); tmpSGhit.setTruth(mt); @@ -333,7 +333,7 @@ TrigHTTSGToRawHitsTool::readPixelSimulation(HitIndexMap& hitIndexMap, unsigned i } StatusCode -TrigHTTSGToRawHitsTool::readStripSimulation(HitIndexMap& hitIndexMap, unsigned int& hitIndex, const EventContext& eventContext) { +FPGATrackSimSGToRawHitsTool::readStripSimulation(HitIndexMap& hitIndexMap, unsigned int& hitIndex, const EventContext& eventContext) { auto stripSDOHandle = SG::makeHandle(m_stripSDOKey, eventContext); ATH_MSG_DEBUG("Found SCT SDO Map"); @@ -352,7 +352,7 @@ TrigHTTSGToRawHitsTool::readStripSimulation(HitIndexMap& hitIndexMap, unsigned i // if there is simulation truth available, try to retrieve the // "most likely" barcode for this strip. HepMC::ConstGenParticlePtr bestParent = nullptr; - TrigHTTInputUtils::ParentBitmask parentMask; + FPGATrackSimInputUtils::ParentBitmask parentMask; HepMcParticleLink::ExtendedBarCode bestExtcode; if (!m_stripSDOKey.empty()) { InDetSimDataCollection::const_iterator iter(stripSDOHandle->find(rdoId)); @@ -361,7 +361,7 @@ TrigHTTSGToRawHitsTool::readStripSimulation(HitIndexMap& hitIndexMap, unsigned i } // end if sct truth available // push back the hit information to DataInput for HitList , copy from RawInput.cxx - HTTHit tmpSGhit; + FPGATrackSimHit tmpSGhit; tmpSGhit.setHitType(HitType::unmapped); tmpSGhit.setDetType(SiliconTech::strip); tmpSGhit.setIdentifierHash(sielement->identifyHash()); @@ -397,8 +397,8 @@ TrigHTTSGToRawHitsTool::readStripSimulation(HitIndexMap& hitIndexMap, unsigned i tmpSGhit.setZ(0.5 * (endsOfStrip.first.z() + endsOfStrip.second.z())); // Add truth - HTTMultiTruth mt; - HTTMultiTruth::Barcode uniquecode(tmpSGhit.getEventIndex(), tmpSGhit.getBarcode()); + FPGATrackSimMultiTruth mt; + FPGATrackSimMultiTruth::Barcode uniquecode(tmpSGhit.getEventIndex(), tmpSGhit.getBarcode()); mt.maximize(uniquecode, tmpSGhit.getBarcodePt()); tmpSGhit.setTruth(mt); @@ -412,7 +412,7 @@ TrigHTTSGToRawHitsTool::readStripSimulation(HitIndexMap& hitIndexMap, unsigned i StatusCode -TrigHTTSGToRawHitsTool::dumpPixelClusters(HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext) { +FPGATrackSimSGToRawHitsTool::dumpPixelClusters(HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext) { unsigned int pixelClusterIndex = 0; auto pixelSDOHandle = SG::makeHandle(m_pixelSDOKey, eventContext); auto pixelClusterContainerHandle = SG::makeHandle(m_pixelClusterContainerKey, eventContext); @@ -427,7 +427,7 @@ TrigHTTSGToRawHitsTool::dumpPixelClusters(HitIndexMap& pixelClusterIndexMap, con Identifier theId = cluster->identify(); // if there is simulation truth available, try to retrieve the "most likely" barcode for this pixel cluster. HepMC::ConstGenParticlePtr bestParent = nullptr; - TrigHTTInputUtils::ParentBitmask parentMask; + FPGATrackSimInputUtils::ParentBitmask parentMask; HepMcParticleLink::ExtendedBarCode bestExtcode; if (!m_pixelSDOKey.empty()) { for (const Identifier& rdoId : cluster->rdoList()) { @@ -457,11 +457,11 @@ TrigHTTSGToRawHitsTool::dumpPixelClusters(HitIndexMap& pixelClusterIndexMap, con } StatusCode -TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, const EventContext& eventContext) +FPGATrackSimSGToRawHitsTool::readOfflineClusters(std::vector <FPGATrackSimCluster>& clusters, const EventContext& eventContext) { //Lets do the Pixel clusters first - //Loopover the pixel clusters and convert them into a HTTCluster for storage + //Loopover the pixel clusters and convert them into a FPGATrackSimCluster for storage // Dump pixel clusters. They're in m_pixelContainer auto pixelSDOHandle = SG::makeHandle(m_pixelSDOKey, eventContext); auto pixelClusterContainerHandler = SG::makeHandle(m_pixelClusterContainerKey, eventContext); @@ -476,7 +476,7 @@ TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, // if there is simulation truth available, try to retrieve the "most likely" barcode for this pixel cluster. HepMC::ConstGenParticlePtr bestParent = nullptr; - TrigHTTInputUtils::ParentBitmask parentMask; + FPGATrackSimInputUtils::ParentBitmask parentMask; HepMcParticleLink::ExtendedBarCode bestExtcode; if (!m_pixelSDOKey.empty()) { for (const Identifier& rdoId : cluster->rdoList()) { @@ -499,9 +499,9 @@ TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, Identifier theID = cluster->identify(); //cluster object to be written out - HTTCluster clusterOut; + FPGATrackSimCluster clusterOut; //Rawhit object to represent the cluster - HTTHit clusterEquiv; + FPGATrackSimHit clusterEquiv; //Lets get the information of this pixel cluster const InDetDD::SiDetectorElement* sielement = m_PIX_mgr->getDetectorElement(theID); assert(sielement); @@ -546,7 +546,7 @@ TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, } //Now lets do the strip clusters - //Loopover the pixel clusters and convert them into a HTTCluster for storage + //Loopover the pixel clusters and convert them into a FPGATrackSimCluster for storage // Dump pixel clusters. They're in m_pixelContainer auto stripSDOHandle = SG::makeHandle(m_stripSDOKey, eventContext); ATH_MSG_DEBUG("Found SCT SDO Map"); @@ -564,7 +564,7 @@ TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, // if there is simulation truth available, try to retrieve the // "most likely" barcode for this strip. HepMC::ConstGenParticlePtr bestParent = nullptr; - TrigHTTInputUtils::ParentBitmask parentMask; + FPGATrackSimInputUtils::ParentBitmask parentMask; HepMcParticleLink::ExtendedBarCode bestExtcode; if (!m_stripSDOKey.empty()) { InDetSimDataCollection::const_iterator iter(stripSDOHandle->find(rdoId)); @@ -573,8 +573,8 @@ TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, } // end if sct truth available // push back the hit information to DataInput for HitList , copy from RawInput.cxx - HTTCluster clusterOut; - HTTHit clusterEquiv; + FPGATrackSimCluster clusterOut; + FPGATrackSimHit clusterEquiv; clusterEquiv.setHitType(HitType::clustered); clusterEquiv.setX(gPos.x()); clusterEquiv.setY(gPos.y()); @@ -620,7 +620,7 @@ TrigHTTSGToRawHitsTool::readOfflineClusters(std::vector <HTTCluster>& clusters, } StatusCode -TrigHTTSGToRawHitsTool::readTruthTracks(std::vector <HTTTruthTrack>& truth, const EventContext& eventContext) +FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack>& truth, const EventContext& eventContext) { auto simTracksHandle = SG::makeHandle(m_mcCollectionKey, eventContext); ATH_MSG_DEBUG("Dump truth tracks, size " << simTracksHandle->size()); @@ -706,7 +706,7 @@ TrigHTTSGToRawHitsTool::readTruthTracks(std::vector <HTTTruthTrack>& truth, cons if (std::abs(startVertex.z() - truth_zvertex) > 100.) { isPrimary = false; } if (particle->end_vertex()) { HepGeom::Point3D<double> endVertex(particle->end_vertex()->position().x(), particle->end_vertex()->position().y(), particle->end_vertex()->position().z()); - if (endVertex.perp() < HTT_PT_TRUTHMIN && std::abs(endVertex.z()) < HTT_Z_TRUTHMIN) { isPrimary = false; } + if (endVertex.perp() < FPGATrackSim_PT_TRUTHMIN && std::abs(endVertex.z()) < FPGATrackSim_Z_TRUTHMIN) { isPrimary = false; } } } else { @@ -715,7 +715,7 @@ TrigHTTSGToRawHitsTool::readTruthTracks(std::vector <HTTTruthTrack>& truth, cons HepMcParticleLink::ExtendedBarCode extBarcode2(bc, ievt); - HTTTruthTrack tmpSGTrack; + FPGATrackSimTruthTrack tmpSGTrack; tmpSGTrack.setVtxX(track_truth_x0); tmpSGTrack.setVtxY(track_truth_y0); tmpSGTrack.setVtxZ(track_truth_z0); @@ -739,8 +739,8 @@ TrigHTTSGToRawHitsTool::readTruthTracks(std::vector <HTTTruthTrack>& truth, cons return StatusCode::SUCCESS; } -void TrigHTTSGToRawHitsTool::getTruthInformation(InDetSimDataCollection::const_iterator& iter, - TrigHTTInputUtils::ParentBitmask& parentMask, +void FPGATrackSimSGToRawHitsTool::getTruthInformation(InDetSimDataCollection::const_iterator& iter, + FPGATrackSimInputUtils::ParentBitmask& parentMask, HepMcParticleLink::ExtendedBarCode& bestExtcode, HepMC::ConstGenParticlePtr bestParent) { @@ -765,9 +765,9 @@ void TrigHTTSGToRawHitsTool::getTruthInformation(InDetSimDataCollection::const_i bestExtcode = HepMcParticleLink::ExtendedBarCode(particleLink.barcode(), particleLink.eventIndex()); } #ifdef HEPMC3 - parentMask |= TrigHTTInputUtils::construct_truth_bitmap(std::shared_ptr<const HepMC3::GenParticle>(particleLink.cptr())); + parentMask |= FPGATrackSimInputUtils::construct_truth_bitmap(std::shared_ptr<const HepMC3::GenParticle>(particleLink.cptr())); #else - parentMask |= TrigHTTInputUtils::construct_truth_bitmap(particleLink.cptr()); + parentMask |= FPGATrackSimInputUtils::construct_truth_bitmap(particleLink.cptr()); #endif // check SDO } // end for each contributing particle diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTSGToRawHitsTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h similarity index 77% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTSGToRawHitsTool.h rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h index 8243eddfac2d1016d4c7d525fbbcc9813824ec60..3c5d346e3f3ae06d02abe05fdd6291060ff4f135 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTSGToRawHitsTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef TrigHTTSGInput_TrigHTTSGTORAWHITSTOOL_H -#define TrigHTTSGInput_TrigHTTSGTORAWHITSTOOL_H +#ifndef FPGATrackSimSGInput_FPGATrackSimSGTORAWHITSTOOL_H +#define FPGATrackSimSGInput_FPGATrackSimSGTORAWHITSTOOL_H #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" @@ -20,9 +20,9 @@ #include "InDetReadoutGeometry/SiDetectorManager.h" #include "xAODTracking/TrackParticleContainer.h" -#include "TrigHTTSGInput/ITrigHTTInputTool.h" +#include "FPGATrackSimSGInput/IFPGATrackSimInputTool.h" #include "InDetSimData/InDetSimDataCollection.h" -#include "TrigHTTSGInput/TrigHTTInputUtils.h" +#include "FPGATrackSimSGInput/FPGATrackSimInputUtils.h" #include "xAODEventInfo/EventInfo.h" #include "GeneratorObjects/McEventCollection.h" @@ -30,10 +30,10 @@ #include "InDetRawData/SCT_RDO_Container.h" -class HTTEventInputHeader; -class HTTCluster; -class HTTTruthTrack; -class HTTOfflineTrack; +class FPGATrackSimEventInputHeader; +class FPGATrackSimCluster; +class FPGATrackSimTruthTrack; +class FPGATrackSimOfflineTrack; typedef unsigned int index_type; @@ -41,15 +41,15 @@ typedef unsigned int index_type; * @brief Extract the raw hists from info in SG * */ -class TrigHTTSGToRawHitsTool : public extends<AthAlgTool, ITrigHTTInputTool> { +class FPGATrackSimSGToRawHitsTool : public extends<AthAlgTool, IFPGATrackSimInputTool> { public: - TrigHTTSGToRawHitsTool(const std::string&, const std::string&, const IInterface*); - virtual ~TrigHTTSGToRawHitsTool() { ; } + FPGATrackSimSGToRawHitsTool(const std::string&, const std::string&, const IInterface*); + virtual ~FPGATrackSimSGToRawHitsTool() { ; } virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode readData(HTTEventInputHeader* header, const EventContext& eventContext) override; + virtual StatusCode readData(FPGATrackSimEventInputHeader* header, const EventContext& eventContext) override; private: @@ -94,16 +94,16 @@ private: typedef std::map<Identifier, int> HitIndexMap; StatusCode readRawSilicon(HitIndexMap& hitIndexMap, HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext); // dump raw silicon data to text file and populate hitIndexMap for rec. track processing - StatusCode readTruthTracks(std::vector<HTTTruthTrack>& truth, const EventContext& eventContext); - StatusCode readOfflineTracks(std::vector<HTTOfflineTrack>& Track, const EventContext& eventContext); - StatusCode readOfflineClusters(std::vector<HTTCluster>& Clusters, const EventContext& eventContext); + StatusCode readTruthTracks(std::vector<FPGATrackSimTruthTrack>& truth, const EventContext& eventContext); + StatusCode readOfflineTracks(std::vector<FPGATrackSimOfflineTrack>& Track, const EventContext& eventContext); + StatusCode readOfflineClusters(std::vector<FPGATrackSimCluster>& Clusters, const EventContext& eventContext); StatusCode readPixelSimulation(HitIndexMap& hitIndexMap, unsigned int& hitIndex, const EventContext& eventContext); StatusCode readStripSimulation(HitIndexMap& hitIndexMap, unsigned int& hitIndex, const EventContext& eventContext); StatusCode dumpPixelClusters(HitIndexMap& pixelClusterIndexMap, const EventContext& eventContext); // To get truth information from simulation - void getTruthInformation(InDetSimDataCollection::const_iterator& iter, TrigHTTInputUtils::ParentBitmask& parentMask, HepMcParticleLink::ExtendedBarCode& bestExtcode, HepMC::ConstGenParticlePtr bestParent); - HTTEventInputHeader* m_eventHeader = nullptr; + void getTruthInformation(InDetSimDataCollection::const_iterator& iter, FPGATrackSimInputUtils::ParentBitmask& parentMask, HepMcParticleLink::ExtendedBarCode& bestExtcode, HepMC::ConstGenParticlePtr bestParent); + FPGATrackSimEventInputHeader* m_eventHeader = nullptr; }; diff --git a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTRawHitsWrapperAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/TrigFPGATrackSimRawHitsWrapperAlg.cxx similarity index 51% rename from Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTRawHitsWrapperAlg.cxx rename to Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/TrigFPGATrackSimRawHitsWrapperAlg.cxx index af9a7673a50dfcdf12f879b81e4f788d9af71540..599130f8c1d7532818effaa1004c9f4256ee2e3a 100644 --- a/Trigger/EFTracking/EFTrackingSim/TrigHTTSGInput/src/TrigHTTRawHitsWrapperAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/TrigFPGATrackSimRawHitsWrapperAlg.cxx @@ -1,42 +1,42 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "TrigHTTObjects/HTTEventInputHeader.h" -#include "TrigHTTObjects/HTTTowerInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimEventInputHeader.h" +#include "FPGATrackSimObjects/FPGATrackSimTowerInputHeader.h" #include "GaudiKernel/ThreadLocalContext.h" #include "TFile.h" #include "TTree.h" #include "TH2F.h" -#include "TrigHTTRawHitsWrapperAlg.h" +#include "TrigFPGATrackSimRawHitsWrapperAlg.h" -TrigHTTRawHitsWrapperAlg::TrigHTTRawHitsWrapperAlg(const std::string& name, ISvcLocator* pSvcLocator) : +TrigFPGATrackSimRawHitsWrapperAlg::TrigFPGATrackSimRawHitsWrapperAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) {} -StatusCode TrigHTTRawHitsWrapperAlg::initialize() +StatusCode TrigFPGATrackSimRawHitsWrapperAlg::initialize() { - ATH_MSG_DEBUG("TrigHTTRawHitsWrapperAlg::initialize()"); + ATH_MSG_DEBUG("TrigFPGATrackSimRawHitsWrapperAlg::initialize()"); ATH_CHECK(m_hitInputTool.retrieve()); - ATH_MSG_DEBUG("Setting HTT_SGHitInput tool"); + ATH_MSG_DEBUG("Setting FPGATrackSim_SGHitInput tool"); ATH_MSG_INFO("Creating output file: " << m_outpath); m_outfile = TFile::Open(m_outpath.value().c_str(), "recreate"); - m_eventHeader = new HTTEventInputHeader(); + m_eventHeader = new FPGATrackSimEventInputHeader(); ATH_MSG_DEBUG("instantiaiting tree"); - m_EventTree = new TTree("HTTEventTree", "data"); + m_EventTree = new TTree("FPGATrackSimEventTree", "data"); ATH_MSG_DEBUG("Setting branch"); - m_EventTree->Branch("HTTEventInputHeader", - "HTTEventInputHeader", + m_EventTree->Branch("FPGATrackSimEventInputHeader", + "FPGATrackSimEventInputHeader", &m_eventHeader, 6400, 1); ATH_MSG_DEBUG("Finished initialize"); @@ -45,7 +45,7 @@ StatusCode TrigHTTRawHitsWrapperAlg::initialize() } -StatusCode TrigHTTRawHitsWrapperAlg::execute() { +StatusCode TrigFPGATrackSimRawHitsWrapperAlg::execute() { ATH_MSG_DEBUG("Running on event "); ATH_CHECK(m_eventHeader != nullptr); @@ -56,7 +56,7 @@ StatusCode TrigHTTRawHitsWrapperAlg::execute() { } -StatusCode TrigHTTRawHitsWrapperAlg::finalize() +StatusCode TrigFPGATrackSimRawHitsWrapperAlg::finalize() { // close the output files, but check that it exists (for athenaMP) if (m_outfile) { diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/TrigFPGATrackSimRawHitsWrapperAlg.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/TrigFPGATrackSimRawHitsWrapperAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..6face61776edf88eaecf3c6fe22e04b78287a917 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/TrigFPGATrackSimRawHitsWrapperAlg.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef FPGATrackSimSGInput_FPGATrackSimRawHistWrapperAlg_h +#define FPGATrackSimSGInput_FPGATrackSimRawHistWrapperAlg_h + + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" +#include "FPGATrackSimSGInput/IFPGATrackSimInputTool.h" + +class TFile; +class TTree; +class TH2F; +class FPGATrackSimEventInputHeader; +/** + * @brief Steering algorithm to run IFPGATrackSimInputTool and save the output in plain ROOT tree + * + */ +class TrigFPGATrackSimRawHitsWrapperAlg : public AthAlgorithm { +public: + TrigFPGATrackSimRawHitsWrapperAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~TrigFPGATrackSimRawHitsWrapperAlg() {}; + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + +private: + // configuration parameters + ToolHandle<IFPGATrackSimInputTool> m_hitInputTool { this, "InputTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimInputTool", "HitInput Tool" }; + Gaudi::Property<std::string> m_outpath { this, "OutFileName", "httsim_smartwrapper.root", "output path" }; + + // internal pointers + FPGATrackSimEventInputHeader* m_eventHeader = nullptr; + TFile* m_outfile = nullptr; + TTree* m_EventTree = nullptr; +}; + +#endif diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/components/FPGATrackSimSGInput_entries.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/components/FPGATrackSimSGInput_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e071b680054cb992cb7626d6d5741a3d442db668 --- /dev/null +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/components/FPGATrackSimSGInput_entries.cxx @@ -0,0 +1,5 @@ +#include "../FPGATrackSimSGToRawHitsTool.h" +#include "../TrigFPGATrackSimRawHitsWrapperAlg.h" + +DECLARE_COMPONENT( FPGATrackSimSGToRawHitsTool ) +DECLARE_COMPONENT( TrigFPGATrackSimRawHitsWrapperAlg ) diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/ITkFastTrackFinderStandaloneConfig.py b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/ITkFastTrackFinderStandaloneConfig.py index 3d43800b21316ddd28b6a9a1953caf0c14d8f31d..186dcbb5fdc8b6c84954410a9a0d8880c8048789 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/ITkFastTrackFinderStandaloneConfig.py +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/ITkFastTrackFinderStandaloneConfig.py @@ -49,7 +49,7 @@ def ITkFastTrackFinderStandaloneCfg(flags, SiSPSeededTrackCollectionKey = None): TracksName = SiSPSeededTrackCollectionKey, Triplet_D0Max = 4, Triplet_MaxBufferLength = 1, - Triplet_MinPtFrac = 0.7, + Triplet_MinPtFrac = 0.8, UseTrigSeedML = 1, doResMon = False, doSeedRedundancyCheck = True, @@ -57,6 +57,7 @@ def ITkFastTrackFinderStandaloneCfg(flags, SiSPSeededTrackCollectionKey = None): useNewLayerNumberScheme = True, MinHits = 3, ITkMode = True, # Allows ftf to use the new TrigTrackSeedGenerator for ITk + useGPU = False, StandaloneMode = True, # Allows ftf to be run as an offline algorithm with reco_tf doTrackRefit = False, FreeClustersCut = 1, diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx index aaed32d1249c0c643d750d98b278a7d8887d43e4..606b69f55d7d53d47ff3ec2cc7d8e973a79819b5 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx @@ -423,7 +423,7 @@ StatusCode TrigFastTrackFinder::execute(const EventContext& ctx) const { if (m_standaloneMode) { //the default fullscan TrigRoiDescriptor settings for beamspot width (z-range) are incorrect - const TrigRoiDescriptor internalRoI = TrigRoiDescriptor(0, -4.5, 4.5, 0, -M_PI, M_PI, 0, -168.0, 168.0); + const TrigRoiDescriptor internalRoI = TrigRoiDescriptor(0, -4.5, 4.5, 0, -M_PI, M_PI, 0, -150.0, 150.0); ATH_CHECK(findTracks(trackEventData, internalRoI, inputTracks, *outputTracks, ctx)); @@ -593,10 +593,20 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac seedGen.loadSpacePoints(convertedSpacePoints); if (m_doZFinder && m_doFastZVseeding) seedGen.createSeedsZv(); - else seedGen.createSeeds(tmpRoi.get()); - - seedGen.getSeeds(triplets); - + else { + + std::vector<GNN_TrigTracklet> vGNN_Tracks; + + seedGen.getTracklets(tmpRoi.get(), vGNN_Tracks); + + for(auto& track : vGNN_Tracks) { + for(auto& seed : track.m_seeds) { + triplets.emplace_back(seed); + } + ATH_MSG_DEBUG("GNN tracklet has " << track.m_track.size()<<" spacepoints"); + } + vGNN_Tracks.clear(); + } } else { TRIG_TRACK_SEED_GENERATOR seedGen(m_tcs); diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx index 67e1d7f196c14634b2930156cfb177b79c5c92f1..52d28e413d35f759d3b316a252dc49f7f8ddc27e 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/Calculator.cxx @@ -1023,6 +1023,29 @@ auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, return success; } +/// +/// One symmetric tetralepton trigger +/// +template<typename Trig4Lsym> +auto Calculator::globalEfficiency(const LeptonList& leptons, unsigned runNumber, const Trig4Lsym trig, Efficiencies& globalEfficiencies) + -> std::enable_if_t<Trig4Lsym::is4Lsym(), bool> +{ + ATH_MSG_DEBUG("Entered Calculator::globalEfficiency_One4L() at line " << __LINE__); + globalEfficiencies = {0.}; + Efficiencies singleInefficiencies{1.}, efficiencies2L{0.}, efficiencies3L{0.}; + bool success = true; + for(auto& lepton : leptons) + { + if(trig.irrelevantFor(lepton) || !aboveThreshold(lepton, trig())) continue; + auto efficiencies = getCachedTriggerLegEfficiencies(lepton, runNumber, trig(), success); + globalEfficiencies = ~efficiencies*globalEfficiencies + efficiencies*efficiencies3L; + efficiencies3L = ~efficiencies*efficiencies3L + efficiencies*efficiencies2L; + efficiencies2L = ~efficiencies*efficiencies2L + efficiencies*~singleInefficiencies; + singleInefficiencies *= ~efficiencies; + } + return success; +} + bool Calculator::globalEfficiency_Factorized2(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, Efficiencies& globalEfficiencies) { Efficiencies efficiencies[2]; @@ -1061,28 +1084,33 @@ bool Calculator::fillListOfLegsFor(const Lepton& lepton, const std::vector<TrigD bool Calculator::canTriggerBeFired(const TrigDef& trig, const std::vector<flat_set<std::size_t> >& firedLegs) const { - static_assert(std::tuple_size<decltype(trig.leg)>::value == 3, "extend Calculator::canTriggerBeFired() implementation to support triggers with >= 4 legs"); - int n0=0, n1=0, n0min = 1 + (trig.leg[1]!=0)*(trig.leg[0]!=trig.leg[1]?-5:1) + (trig.leg[2]!=0)*(trig.leg[0]!=trig.leg[2]?-9:1); - if(n0min>0 || !trig.leg[2]) + const int nLegs = static_cast<int>(std::count_if( + trig.leg.begin(), trig.leg.end(), [](auto x){ return x != 0ul; })); + const int sameLegs = static_cast<int>(std::count( + trig.leg.begin(), trig.leg.end(), trig.leg[0])); + if(sameLegs == nLegs) { + // single-lepton and symmetric multilepton triggers + return std::count_if( + firedLegs.cbegin(), + firedLegs.cend(), + [&](auto& legs) { return legs.count(trig.leg[0]); }) >= nLegs; + } + else if(nLegs == 2) + { + // asymmetric or mixed-flavour dilepton triggers + bool n0 = false, n1 = false; for(auto& legs : firedLegs) { - bool fire0 = legs.count(trig.leg[0]); - if(n0min <= 0) /// Asymmetric dilepton triggers - { - if(n1 && fire0) return true; - if(legs.count(trig.leg[1])) - { - if(n0) return true; - ++n1; - } - if(fire0) ++n0; - } - else if(fire0 && ++n0>=n0min) return true; /// Single-lepton and symmetric di/trilepton triggers + if(n0 && legs.count(trig.leg[1])) return true; + if(n1 && legs.count(trig.leg[0])) return true; + n0 = n0 || legs.count(trig.leg[0]); + n1 = n1 || legs.count(trig.leg[1]); } } - else /// Trilepton triggers (except fully-symmetric ones that are addressed above) + else if(nLegs == 3) { + // other trilepton triggers auto end = firedLegs.end(); for(auto legs0=firedLegs.begin();legs0!=end;++legs0) { @@ -1103,6 +1131,10 @@ bool Calculator::canTriggerBeFired(const TrigDef& trig, const std::vector<flat_s } } } + else + { + ATH_MSG_ERROR("incomplete support of 4-lepton triggers."); + } return false; } @@ -1261,23 +1293,27 @@ bool Calculator::Helper::findAndBindFunction() /// for combinations with a singl using A1L = flat_set<typename A::T_1>; using A_2sym = typename A::T_2sym; using A_2asym = typename A::T_2asym; - if(!m_n2L && !m_n3L) + if(m_n2L + m_n3L + m_n4L == 0) { return bindFunction<typename A::T_1>() || bindFunction<A1L>(); } - else if(m_n2L==1 && !m_n3L) + else if(m_n2L==1 && m_n3L + m_n4L == 0) { return bindFunction<A_2sym>() || bindFunction<A_2asym>() || bindFunction<A_2sym, A1L>() || bindFunction<A_2asym, A1L>(); } - else if(m_n2L==2 && !m_n3L) + else if(m_n2L==2 && m_n3L + m_n4L == 0) { return bindFunction<A_2sym, A_2sym, Optional<A1L>>() || bindFunction<A_2asym, A_2sym, Optional<A1L>>(); } - else if(m_n3L==1 && !m_n1L && !m_n2L) + else if(m_n3L==1 && m_n1L + m_n2L + m_n4L == 0) { return bindFunction<typename A::T_3sym>() || bindFunction<typename A::T_3halfsym>(); } + else if(m_n4L==1 && m_n1L + m_n2L + m_n3L == 0) + { + return bindFunction<typename A::T_4sym>(); + } return false; } @@ -1299,16 +1335,16 @@ bool Calculator::Helper::findAndBindFunction() /// for combinations with two fla using AB_1_1 = typename AB::T_1_1; /// checked if triggers can be factorized = no mixed trigger in the combination. - if(m_n1L>0 && !m_n2L && !m_n3L) + if(m_n1L>0 && m_n2L + m_n3L + m_n4L == 0) { return bindFunction<A_1, B_1>() || bindFunction<flat_set<A_1>, flat_set<B_1>>(); } - else if(m_n2L==1 && !m_n3L) /// one dilepton trigger (+ single-lepton triggers) - { + else if(m_n2L==1 && m_n3L + m_n4L == 0) + { // one dilepton trigger (+ single-lepton triggers) return bindFunction<AB_1_1>() || bindFunction<AB_1_1, flat_set<A_1>, flat_set<B_1>>(); } - else if(m_n2L>=2 && m_n2L<=6 && !m_n3L) /// several dilepton triggers (+ single-lepton triggers) - { + else if(m_n2L>=2 && m_n2L<=6 && m_n3L + m_n4L == 0) + { // several dilepton triggers (+ single-lepton triggers) return /// 2 dilepton triggers bindFunction<A_2sym, AB_1_1>() || bindFunction<A_2asym, AB_1_1>() @@ -1324,13 +1360,13 @@ bool Calculator::Helper::findAndBindFunction() /// for combinations with two fla || bindFunction<Optional<A_2sym>, Optional<A_2sym>, Optional<B_2asym>, Optional<B_2sym>, Optional<AB_1_1>, Optional<AB_1_1>, OA1L, OB1L>() || bindFunction<Optional<A_2asym>, Optional<A_2sym>, Optional<B_2asym>, Optional<B_2sym>, Optional<AB_1_1>, Optional<AB_1_1>, OA1L, OB1L>(); } - else if(m_n3L==1 && !m_n2L && !m_n1L) /// one mixed trilepton trigger - { + else if(m_n3L==1 && m_n1L + m_n2L + m_n4L == 0) + { // one mixed trilepton trigger return bindFunction<typename AB::T_2sym_1>() || bindFunction<typename AB::T_1_2sym>() || bindFunction<typename AB::T_2asym_1>() || bindFunction<typename AB::T_1_2asym>(); } - else if(m_n3L==2 && !m_n2L && !m_n1L) /// two mixed trilepton triggers - { + else if(m_n3L==2 && m_n1L + m_n2L + m_n4L == 0) + { // two mixed trilepton triggers return bindFunction<typename AB::T_2sym_1, typename AB::T_1_2sym>() || bindFunction<typename AB::T_2asym_1, typename AB::T_1_2sym>() || bindFunction<typename AB::T_2sym_1, typename AB::T_1_2asym>() @@ -1345,6 +1381,7 @@ bool Calculator::Helper::findAndBindFunction() /// top-level function m_n1L = countTriggers(TT_SINGLELEPTON_FLAG); m_n2L = countTriggers(TT_DILEPTON_FLAG); m_n3L = countTriggers(TT_TRILEPTON_FLAG); + m_n4L = countTriggers(TT_TETRALEPTON_FLAG); auto exclusively = [&](auto obj_flags) { return std::none_of(m_defs.cbegin(), m_defs.cend(), [=](auto& def){return def.type&TT_MASK_FLAVOUR&~obj_flags;}); }; /// First check if the trigger combination refers to a single object type diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx index ab39c119098afd27aebf14d35a88d5a529538b27..4aa4a96dac46a0f67dcccd93326b97b60ec8298d 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/ImportData.cxx @@ -114,7 +114,7 @@ bool ImportData::importTriggers() bool success = true; for(auto& line : config) { - ATH_MSG_DEBUG(line); + ATH_MSG_DEBUG(line); ss.clear(); ss.str(line); ss >> triggerName; @@ -181,7 +181,18 @@ bool ImportData::importTriggers() ++nm; } else if(flavour2 != xAOD::Type::Photon) success = false; - if(ne+nm==0 || ne==3 || nm==3) /// single-flavour trilepton triggers + if(def.leg[3]) + { + /// symmetric tetralepton triggers + if(std::count(def.leg.cbegin(), + def.leg.cend(), + def.leg[0]) == 4) + { + def.type = nm? TT_4MU_SYM : TT_4E_SYM; + } + else success = false; + } + else if(ne+nm==0 || ne==3 || nm==3) /// single-flavour trilepton triggers { setNonMixed3LType(def, (ne? TT_ELECTRON_FLAG : nm? TT_MUON_FLAG : TT_PHOTON_FLAG)); } diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx index c35903bad28df3fce84f45efe27bbb6d75d8a35a..f3aa15735ce02c239dae907415ba3d6742b0e1b6 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/Root/TrigGlobalEfficiencyCorrectionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // contact: jmaurer@cern.ch @@ -743,11 +743,6 @@ CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getEfficiency(unsigned ru ATH_MSG_DEBUG("Computing global trigger efficiency for this event with " << particles.size() << " lepton(s) as input; run number = " << runNumber); - if(runNumber<266904 || runNumber>364292) - { - ATH_MSG_WARNING("Suspicious run number provided " << runNumber << ", continuing anyway"); - } - #ifdef XAOD_STANDALONE if(!m_initialized) { @@ -778,8 +773,10 @@ CP::CorrectionCode TrigGlobalEfficiencyCorrectionTool::getEfficiency(unsigned ru } else { - m_cpCode.ignore(); - m_cpCode = CP::CorrectionCode::Error; + if(m_cpCode == CP::CorrectionCode::Ok) + { + m_cpCode = CP::CorrectionCode::Error; + } } return m_cpCode; } diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h index 3613d3dbaf92878223d038dcb41a52b79b9d138f..f2135bcb6cf287aa3937e189bc3bac3a3b98c809 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Calculator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // contact: jmaurer@cern.ch @@ -196,7 +196,11 @@ private: && Trig3Lmix1::object1() == Trig3Lmix2::object2() && Trig3Lmix1::object2() == Trig3Lmix2::object1(), bool>; - + /// One symmetric tetralepton trigger + template<typename Trig4Lsym> + auto globalEfficiency(const LeptonList&, unsigned, const Trig4Lsym, Efficiencies&) + -> std::enable_if_t<Trig4Lsym::is4Lsym(), bool>; + bool globalEfficiency_Factorized2(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, Efficiencies& globalEfficiencies); bool globalEfficiency_Factorized3(const LeptonList& leptons, unsigned runNumber, GlobEffFunc func1, GlobEffFunc func2, GlobEffFunc func3, Efficiencies& globalEfficiencies); @@ -216,7 +220,7 @@ private: protected: std::vector<TrigDef> m_defs; - unsigned m_n1L = 0, m_n2L = 0, m_n3L = 0; + unsigned m_n1L = 0, m_n2L = 0, m_n3L = 0, m_n4L = 0; template<TriggerType object_flag> bool findAndBindFunction(); template<TriggerType object1_flag, TriggerType object2_flag> bool findAndBindFunction(); diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h index 73e8bb084acf408fdc53003918be18764beeb4f8..2b6a73d2dbadf8de85503c5a2871c4a701b199bc 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/ImportData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // contact: jmaurer@cern.ch @@ -76,6 +76,12 @@ enum TriggerType TT_MU_2G_SYM = TT_2MU_G_SYM | TT_X2Y_FLAG, TT_2MU_G_ASYM = TT_TRILEPTON_ASYM | TT_MUON_FLAG | TT_PHOTON_FLAG, TT_MU_2G_ASYM = TT_2MU_G_ASYM | TT_X2Y_FLAG, + // tetralepton triggers + TT_TETRALEPTON_FLAG = 0x8000, + TT_TETRALEPTON_SYM = TT_TETRALEPTON_FLAG | TT_SYM, + TT_4E_SYM = TT_TETRALEPTON_SYM | TT_ELECTRON_FLAG, + TT_4MU_SYM = TT_TETRALEPTON_SYM | TT_MUON_FLAG, + TT_4G_SYM = TT_TETRALEPTON_SYM | TT_PHOTON_FLAG }; class ImportData : public asg::AsgMessaging @@ -87,9 +93,16 @@ public: { TriggerType type; std::size_t name; - std::array<std::size_t,3> leg; - bool used = false; /// auxiliary variable used by Calculator::Helper::extra() and bindFunction() - TrigDef(TriggerType type=TT_UNKNOWN, std::size_t name=0, std::size_t leg0=0, std::size_t leg1=0, std::size_t leg2=0) : type(type), name(name), leg{leg0,leg1,leg2} {} + std::array<std::size_t, 4> leg; + bool used = false; // auxiliary variable used by + // Calculator::Helper::extra() and bindFunction() + TrigDef(TriggerType type = TT_UNKNOWN, + std::size_t name = 0, + std::size_t leg0 = 0, + std::size_t leg1 = 0, + std::size_t leg2 = 0, + std::size_t leg3 = 0) : + type(type), name(name), leg{leg0, leg1, leg2, leg3} {} }; ImportData(); diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h index 9e80931ef55763ce624d4debb23b93e086b76f53..c5d462da832afaca5322a020a674f3a859b71a8c 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/TrigGlobalEfficiencyCorrection/Trigger.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // contact: jmaurer@cern.ch @@ -42,6 +42,7 @@ public: if(m_type&TT_SINGLELEPTON_FLAG) return 1; else if(m_type&TT_DILEPTON_FLAG) return 2 - 1*(x==TT_SYM); else if(m_type&TT_TRILEPTON_FLAG) return (x==TT_ASYM)? 3 : 1 + 1*(mixed()||(x!=TT_SYM)); + else if((m_type&TT_TETRALEPTON_FLAG) && x==TT_SYM) return 1; return 0; } constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj) const @@ -105,7 +106,7 @@ public: protected: TriggerType m_type; - std::array<std::size_t, 3> m_legs; + std::array<std::size_t, 4> m_legs; }; template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg> @@ -173,6 +174,7 @@ public: static constexpr bool is3Lhalfsym() { return ((tt&TT_MASK_TYPE)==TT_TRILEPTON_HALFSYM) && !mixed(); } static constexpr bool is2Lmix() { return (tt&TT_DILEPTON_FLAG) && mixed(); } static constexpr bool is3Lmix() { return (tt&TT_TRILEPTON_FLAG) && mixed(); } + static constexpr bool is4Lsym() { return ((tt&TT_MASK_TYPE) == TT_TETRALEPTON_SYM); } std::array<std::size_t, nDistinctLegs()> legs; @@ -319,6 +321,8 @@ struct TriggerClass<object_flag, TT_UNKNOWN> struct T_3sym : public Trigger<addObjFlag(TT_TRILEPTON_SYM)> {}; /// half-symmetric trilepton trigger (e17_lhloose_2e9_lhloose, mu6_2mu4, ...): struct T_3halfsym : public Trigger<addObjFlag(TT_TRILEPTON_HALFSYM), T_3sym> {}; + /// symmetric tetralepton trigger (4mu4, ...): + struct T_4sym : public Trigger<addObjFlag(TT_TETRALEPTON_SYM)> {}; }; template<TriggerType object1_flag, TriggerType object2_flag> diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg index 6dadf8561cb1b303a0df1f149ac1d413d8e2bd3e..0032e624b7d3c0b205452e3e621651c76a431b82 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Hierarchies.cfg @@ -33,7 +33,7 @@ loose2 := e17_lhloose > e12_lhloose > e9_lhloose [61-121 GeV] e60_lhmedium > e24_lhmedium_L1EM15VH > e20_lhmedium > e7_lhmedium > e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose > loose1 > loose2 [>121 GeV] e60_lhmedium > e24_lhmedium_L1EM15VH > e20_lhmedium > e7_lhmedium > loose1 > e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose > loose2 -## 2016+2017 electron trigger legs (always '_nod0' suffix) +## 2016-2018 electron trigger legs (always '_nod0' suffix) medium := e26_lhmedium_nod0_L1EM22VHI > e24_lhmedium_nod0_L1EM20VHI > e26_lhmedium_nod0 > e24_lhmedium_nod0_L1EM20VH > e60_lhmedium_nod0 > e24_lhmedium_nod0_L1EM15VH > e20_lhmedium_nod0 > e7_lhmedium_nod0 loose1 := e17_lhloose_nod0_L1EM15VH > e10_lhloose_nod0_L1EM8VH > e140_lhloose_nod0 loose2 := e17_lhloose_nod0 > e12_lhloose_nod0 > e9_lhloose_nod0 > e17_lhvloose_nod0_L1EM15VHI > e24_lhvloose_nod0_L1EM20VH > e15_lhvloose_nod0_L1EM13VH > e12_lhvloose_nod0_L1EM10VH > e17_lhvloose_nod0 @@ -45,10 +45,15 @@ loose2 := e17_lhloose_nod0 > e12_lhloose_nod0 > e9_lhloose_nod0 > e17_lhvloose_n ## electron triggers, Run 3, preliminary ## to do: check actual overlap of lhloose+VH and lhvloose+VHI looseRun3 := e17_lhloose_L1EM15VH > e12_lhloose_L1EM8VH > e12_lhloose > e24_lhvloose_L1EM20VH > e12_lhvloose_L1EM10VH > e9_lhvloose +looseRun3VHI := e17_lhvloose_L1EM15VHI > e24_lhvloose_L1EM20VH > e12_lhvloose_L1EM10VH > e9_lhvloose [-] e26_lhtight_ivarloose_L1EM22VHI > e60_lhmedium_L1EM22VHI > e26_lhmedium_L1EM22VHI > e140_lhloose_L1EM22VHI > looseRun3 [<141 GeV] e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI > e26_lhmedium_L1EM22VHI > looseRun3 [>141 GeV] e26_lhmedium_L1EM22VHI > e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI > looseRun3 [-] e26_dnntight_ivarloose_L1EM22VHI > e26_dnntight_ivarloose_L1EM22VHI_OR_e60_dnnmedium_nogsf_L1EM22VHI_OR_e140_dnnloose_nogsf_L1EM22VHI > looseRun3 +[-] e26_lhtight_ivarloose_L1EM22VHI > e60_lhmedium_L1EM22VHI > e26_lhmedium_L1EM22VHI > e140_lhloose_L1EM22VHI > looseRun3VHI +[<141 GeV] e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI > e26_lhmedium_L1EM22VHI > looseRun3VHI +[>141 GeV] e26_lhmedium_L1EM22VHI > e26_lhtight_ivarloose_L1EM22VHI_OR_e60_lhmedium_L1EM22VHI_OR_e140_lhloose_L1EM22VHI > looseRun3VHI +[-] e26_dnntight_ivarloose_L1EM22VHI > e26_dnntight_ivarloose_L1EM22VHI_OR_e60_dnnmedium_nogsf_L1EM22VHI_OR_e140_dnnloose_nogsf_L1EM22VHI > looseRun3VHI ## photon triggers [-] g35_tight_icalotight_L1EM24VHI > g20_tight_icalovloose_L1EM15VHI > g22_tight_L1EM15VHI > g22_tight > g20_tight > g35_medium_L1EM20VH > g25_medium_L1EM20VH > g25_medium > g35_loose_L1EM24VHI > g35_loose_L1EM22VHI > g50_loose_L1EM20VH > g140_loose > g120_loose > g35_loose > g25_loose > g20_loose > g15_loose > g12_loose > g10_loose > g35_loose_L1EM15 > g25_loose_L1EM15 diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg index ae94ff81fcb84bb80bec270caf3927abc8d08766..2f2cef8032b26a259b98bea6d2c1dcf190d58c47 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/data/Triggers.cfg @@ -54,7 +54,7 @@ mu6_2mu4 mu6 mu4 mu4 3mu6_L13MU5VF mu6_L1MU5VF mu6_L1MU5VF mu6_L1MU5VF mu18_2mu4noL1 mu18 mu4noL1 mu4noL1 mu20_2mu4noL1_L1MU14FCH mu20_L1MU14FCH mu4noL1 mu4noL1 -# 4mu4_L14MU3V mu4_L1MU3V mu4_L1MU3V mu4_L1MU3V mu4_L1MU3V +4mu4_L14MU3V mu4_L1MU3V mu4_L1MU3V mu4_L1MU3V mu4_L1MU3V ## Single electron triggers e15_lhvloose_nod0_L1EM13VH @@ -110,7 +110,7 @@ e12_lhloose_nod0_2mu10 e12_lhloose_nod0 mu10 mu10 2e12_lhloose_nod0_mu10 e12_lhloose_nod0 e12_lhloose_nod0 mu10 # Run 3 e7_lhmedium_mu24_L1MU14FCH e7_lhmedium mu24_L1MU14FCH -e17_lhloose_mu14_L1EM15VH_MU8F e17_lhloose_L1EM15VH mu14_L1MU8F +e17_lhloose_mu14_L1EM15VH_MU8F e17_lhvloose_L1EM15VHI mu14_L1MU8F e26_lhmedium_mu8noL1_L1EM22VHI e26_lhmedium_L1EM22VHI mu8noL1 2e12_lhloose_mu10_L12EM8VH_MU8F e12_lhloose_L1EM8VH e12_lhloose_L1EM8VH mu10_L1MU8F e9_lhvloose_mu20_mu8noL1_L1MU14FCH e9_lhvloose mu20_L1MU14FCH mu8noL1 @@ -160,4 +160,4 @@ g35_loose_L1EM22VHI_mu15noL1_mu2noL1 g35_loose_L1EM22VHI mu15noL1 mu2noL g25_medium_mu24_L1MU14FCH g25_medium mu24_L1MU14FCH g35_loose_mu18_L1EM24VHI g35_loose_L1EM24VHI mu18 2g10_loose_mu20_L1MU14FCH g10_loose g10_loose mu20_L1MU14FCH -g35_loose_mu15_mu2noL1_L1EM24VHI g35_loose_L1EM24VHI mu15 mu2noL1 \ No newline at end of file +g35_loose_mu15_mu2noL1_L1EM24VHI g35_loose_L1EM24VHI mu15 mu2noL1 diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf index dbaae17f399d512767a3536b11308c9bf22bae6d..ed451e9229e023d483a4f7fb39c5ec4300f737b8 100644 Binary files a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf and b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.pdf differ diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex index 78b8cf1e9fd973be5fe5c58ac3add69d2407498c..e4f3e93e209c3c8e0c7da71fee789f54b64e3953 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/doc/formulas.tex @@ -172,7 +172,7 @@ Superscripts 1 and 2 will respectively correspond to the single lepton trigger l + \delta_2^{\lambda_n}\pro(S_{n-1}^1\vee S_{n-1}^2)[\pro(\ell_n^2)-\pro(\ell_n^1)]\notag \end{align} -The expression for $\pro(S_{n-1}^1\vee S_{n-1}^2)$ is given by~\ref{e:1O1}. +The expression for $\pro(S_{n-1}^1\vee S_{n-1}^2)$ is given by~\ref{e:x1l}. For more than one single-lepton trigger, we denote $Z_n:=S_n^{1,1}\vee\ldots\vee S_n^{1,k}$ the union of the $k$ single-lepton triggers. We also denote by the superscript $1$ the loosest single-lepton trigger for the lepton $n$. @@ -190,7 +190,7 @@ Then: \subsection{One asymmetric $\ell\ell$ + one or more same-flavour $\ell$ trigger, $n$ leptons} -Uperscripts $2$ and $3$ indicate the two legs of the dilepton trigger, while $1$ indicates the loosest of the single-lepton trigger legs +Superscripts $2$ and $3$ indicate the two legs of the dilepton trigger, while $1$ indicates the loosest of the single-lepton trigger legs for the lepton $n$ (i.e. equivalent to $\lambda_n^1$ in the previous section). However, $S_{n-1}^1$ still represents the event of triggering with any of the single-lepton triggers for one of the first $n-1$ leptons. \begin{align} @@ -464,6 +464,7 @@ By induction: \begin{align} \pro(T_n) &= \pro(T_{n-1} \vee (D_{n-1}\wedge \ell_n))\notag\\ &= \pro(T_{n-1})(1-\pro(\ell_n)) + \pro(\ell_n)\pro(D_{n-1}) +\label{e:3s} \end{align} with $\pro(D_{n-1})$ given by~\ref{e:2s}. @@ -514,6 +515,13 @@ Complementary = two electrons+1 muon for one trigger, and two muons+1 electron f with $\pro(S)$ given by~\ref{e:1}, $\pro(D)$ by either~\ref{e:2s} or~\ref{e:2a} and $\pro(D\vee S)$ by~\ref{e:2sO1} or~\ref{e:2aO1}. +\section{Tetralepton triggers} +\subsection{Fully symmetric $4e/4\mu$ trigger, $n$ leptons} +Similarly as for the trilepton case: +\begin{align} +\pro(T_n) = \pro(T_{n-1})(1-\pro(\ell_n)) + \pro(\ell_n)\pro(M_{n-1}) +\end{align} +with $\pro(M_{n-1})$ given by~\ref{e:3s}. \end{document} \ No newline at end of file diff --git a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx index 69cf7814f5a809ea7e0c35eb0ec413828278eec0..1647bcbfe59326c526fb84aca094e5b03f1dc38d 100644 --- a/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx +++ b/Trigger/TrigAnalysis/TrigGlobalEfficiencyCorrection/util/TrigGlobEffCorrValidation.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // contact: jmaurer@cern.ch @@ -471,9 +471,14 @@ int main(int argc, char* argv[]) .setEfficiency("g22_tight_L1EM15VHI", 0.35) .setEfficiency("g120_loose", 0.56) .setEventSelection([](VE ve, VM vm, VP vp) { return (count(ve,13e3f)>1 && count(vm,11e3f)>0) || count(vp,21e3f)>0; }) - )); - - //Info(MSGSOURCE, "Boost version: %i", BOOST_VERSION); + )); + + ANA_CHECK(run_test(Config("4mu") + .setTriggers("4mu4_L14MU3V") + .setLeptonPDF(4, 6, {20e3f}) + .setEfficiency("mu4_L1MU3V", 0.72) + .setEventSelection([](VE, VM vm, VP) { return count(vm,5e3f)>=4; }) + )); return 0; } diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigVertices.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigVertices.py index c7dfaf3fb0531d2a03c43c482dfdfd3f2e8a9cc4..57b4ea91645bb74be60255f12b8f8b8067c3ecfe 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigVertices.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetTrigVertices.py @@ -385,7 +385,7 @@ def adaptiveMultiVertexFinderTool_builder( signature, config ) : actsExtrapolationTool = CfgMgr.ActsExtrapolationTool("ActsExtrapolationTool") actsExtrapolationTool.TrackingGeometryTool = actsTrackingGeometryTool - from ActsTrkPriVtxFinderTool.ActsTrkPriVtxFinderToolConf import ActsTrk__AdaptiveMultiPriVtxFinderTool + from ActsVertexReconstruction.ActsVertexReconstructionConf import ActsTrk__AdaptiveMultiPriVtxFinderTool vertexFinderTool = ActsTrk__AdaptiveMultiPriVtxFinderTool(name = "ActsAdaptiveMultiPriVtxFinderTool" + signature, TrackSelector = trackSelectorTool, diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigTrackSeedGenerator_ITk.h b/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigTrackSeedGenerator_ITk.h index fe06417d69995db6a12cf91377ec70c5a02fab3c..02c66b13e0a4e8b69643461699901108dbd5615c 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigTrackSeedGenerator_ITk.h +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/TrigInDetPattRecoTools/TrigTrackSeedGenerator_ITk.h @@ -15,7 +15,14 @@ class TrigInDetTriplet; class TrigFTF_GNN_DataStorage; class IRoiDescriptor; -typedef std::vector<std::pair<float, TrigInDetTriplet*> > INTERNAL_TRIPLET_BUFFER; +struct GNN_TrigTracklet { +public: +GNN_TrigTracklet(std::vector<const TrigSiSpacePointBase*>& vSP, std::vector<TrigInDetTriplet>& tbuf) : m_track(vSP), m_seeds(tbuf) {}; + ~GNN_TrigTracklet() {}; + + std::vector<const TrigSiSpacePointBase*> m_track; + std::vector<TrigInDetTriplet> m_seeds; +}; typedef class TrigTrackSeedGeneratorITk { @@ -31,11 +38,12 @@ typedef class TrigTrackSeedGeneratorITk { void createSeeds(const IRoiDescriptor*); void createSeedsZv(); void getSeeds(std::vector<TrigInDetTriplet>&); + void getTracklets(const IRoiDescriptor*, std::vector<GNN_TrigTracklet>&); private: - void storeTriplets(INTERNAL_TRIPLET_BUFFER&); - + void runGNN_TrackFinder(const IRoiDescriptor*, std::vector<GNN_TrigTracklet>&); + TrigFTF_GNN_DataStorage* m_storage; const TrigCombinatorialSettings& m_settings; @@ -44,7 +52,7 @@ private: float m_minR_squ, m_maxCurv; - INTERNAL_TRIPLET_BUFFER m_triplets; + std::vector<TrigInDetTriplet> m_triplets; } TRIG_TRACK_SEED_GENERATOR_ITK; diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator_ITk.cxx b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator_ITk.cxx index fb1e8b6f08d4d3402e7972545c90224c98a3ee5a..df9f2d0bd2aa8decfd9ad70fc9e21b44158ef8eb 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator_ITk.cxx +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigTrackSeedGenerator_ITk.cxx @@ -57,7 +57,7 @@ void TrigTrackSeedGeneratorITk::loadSpacePoints(const std::vector<TrigSiSpacePoi } -void TrigTrackSeedGeneratorITk::createSeeds(const IRoiDescriptor* roiDescriptor) { +void TrigTrackSeedGeneratorITk::runGNN_TrackFinder(const IRoiDescriptor* roiDescriptor, std::vector<GNN_TrigTracklet>& vTracks) { const int MaxEdges = 2000000; @@ -441,13 +441,10 @@ void TrigTrackSeedGeneratorITk::createSeeds(const IRoiDescriptor* roiDescriptor) if(vSeeds.empty()) return; - //backtracking TrigFTF_GNN_TRACKING_FILTER tFilter(m_settings.m_layerGeometry, edgeStorage); - INTERNAL_TRIPLET_BUFFER output; - for(auto pS : vSeeds) { if(pS->m_level == -1) continue; @@ -480,6 +477,8 @@ void TrigTrackSeedGeneratorITk::createSeeds(const IRoiDescriptor* roiDescriptor) unsigned int nTriplets = 0; + std::vector<TrigInDetTriplet> output; + for(unsigned int idx_m = 1;idx_m < vSP.size()-1;idx_m++) { const TrigSiSpacePointBase& spM = *vSP.at(idx_m); @@ -550,62 +549,77 @@ void TrigTrackSeedGeneratorITk::createSeeds(const IRoiDescriptor* roiDescriptor) const double Q = fabs_d0*fabs_d0; - TrigInDetTriplet* t = new TrigInDetTriplet(spI, spM, spO, Q); - - output.push_back(std::pair<double, TrigInDetTriplet*>(Q,t)); + output.emplace_back(spI, spM, spO, Q); nTriplets++; + if(nTriplets >= m_settings.m_maxTripletBufferLength) break; } if(nTriplets >= m_settings.m_maxTripletBufferLength) break; } if(nTriplets >= m_settings.m_maxTripletBufferLength) break; } - } + + if(output.empty()) continue; - if(!output.empty()) storeTriplets(output); + vTracks.emplace_back(vSP, output); + } - } +void TrigTrackSeedGeneratorITk::createSeeds(const IRoiDescriptor* roiDescriptor) { -void TrigTrackSeedGeneratorITk::createSeedsZv() { + std::vector<GNN_TrigTracklet> vTracks; + vTracks.reserve(5000); -} + runGNN_TrackFinder(roiDescriptor, vTracks); + + if(vTracks.empty()) return; -void TrigTrackSeedGeneratorITk::storeTriplets(INTERNAL_TRIPLET_BUFFER& tripletVec) { - for(INTERNAL_TRIPLET_BUFFER::iterator it=tripletVec.begin();it!=tripletVec.end();++it) { - double Q = (*it).first; - if (m_settings.m_LRTmode) { - // In LRT mode penalize pixels in Triplets - if((*it).second->s1().isPixel()) Q+=1000; - if((*it).second->s2().isPixel()) Q+=1000; - if((*it).second->s3().isPixel()) Q+=1000; - } else { - // In normal (non LRT) mode penalise SSS by 1000, PSS (if enabled) and PPS by 10000 - if((*it).second->s3().isSCT()) { - Q += (*it).second->s1().isSCT() ? 1000.0 : 10000.0; - } + m_triplets.clear(); + + for(auto& track : vTracks) { + for(auto& seed : track.m_seeds) { + + float newQ = seed.Q(); + + if (m_settings.m_LRTmode) { + // In LRT mode penalize pixels in Triplets + if(seed.s1().isPixel()) newQ+=1000; + if(seed.s2().isPixel()) newQ+=1000; + if(seed.s3().isPixel()) newQ+=1000; + } else { + // In normal (non LRT) mode penalise SSS by 1000, PSS (if enabled) and PPS by 10000 + if(seed.s3().isSCT()) { + newQ += seed.s1().isSCT() ? 1000.0 : 10000.0; + } + } + seed.Q(newQ); + m_triplets.emplace_back(seed); } - m_triplets.push_back(std::pair<double, TrigInDetTriplet*>(Q, (*it).second)); } + vTracks.clear(); + } -void TrigTrackSeedGeneratorITk::getSeeds(std::vector<TrigInDetTriplet>& vs) { +void TrigTrackSeedGeneratorITk::getTracklets(const IRoiDescriptor* roiDescriptor, std::vector<GNN_TrigTracklet>& vTracks) { + runGNN_TrackFinder(roiDescriptor, vTracks); +} + +void TrigTrackSeedGeneratorITk::createSeedsZv() { +} + +void TrigTrackSeedGeneratorITk::getSeeds(std::vector<TrigInDetTriplet>& vs) { vs.clear(); - vs.reserve(m_triplets.size()); std::sort(m_triplets.begin(), m_triplets.end(), - [](const std::pair<float, TrigInDetTriplet>& A, const std::pair<float, TrigInDetTriplet>& B) { - return A.first > B.first; + [](const TrigInDetTriplet& A, const TrigInDetTriplet& B) { + return A.Q() < B.Q(); } ); - for(INTERNAL_TRIPLET_BUFFER::reverse_iterator it=m_triplets.rbegin();it!=m_triplets.rend();++it) { - vs.push_back((*it).second); - } - m_triplets.clear(); + vs = std::move(m_triplets); +} -} diff --git a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json index 7a888266a88ab85e00ddb7055eb65799b36109bc..b6ee71b0915aca8487a4019aed61cfd9dcb36956 100644 --- a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json +++ b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json @@ -189,7 +189,7 @@ "source": "mc", "format": "RDO", "paths": [ - "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/RDO/mc15_14TeV.900040.PG_singlemu_Pt100_etaFlatnp0_43.recon.RDO.e8185_s3856_r13824/RDO.29831688._000001.pool.root.1" + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/RDO/ATLAS-P2-RUN4-01-01-00/mc21_14TeV.900498.PG_single_muonpm_Pt100_etaFlatnp0_43.recon.RDO.e8481_s4038_r14362/RDO.32628466._000005.pool.root.1" ] }, "Bphys_JpsiPhi": { diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_newJO_ITk_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_newJO_ITk_build.py new file mode 100755 index 0000000000000000000000000000000000000000..63f4909dfc4c9a275ae66085dca072d2864b3720 --- /dev/null +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_newJO_ITk_build.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + +# art-description: Trigger AthenaMT test running new-style job options +# art-type: build +# art-include: master/Athena +# art-include: 23.0/Athena +# Skipping art-output which has no effect for build tests. +# If you create a grid version, check art-output in existing grid tests. + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps, Input + +# Generate configuration run file +run = ExecStep.ExecStep('athena') +run.type = 'other' +run.input = 'Single_mu_Run4' +run.executable = 'runHLT_standalone_newJO.py' +run.args += ' --filesInput='+Input.get_input(run.input).paths[0] +run.args += ' Trigger.triggerMenuSetup="Dev_pp_run3_v1"' +run.args += ' Trigger.doRuntimeNaviVal=True' +run.args += ' ITk.doTruth=False' +run.args += ' Tracking.doTruth=False' +run.args += ' Trigger.enableL1CaloPhase1=False' +run.prmon = False + + +# The full test configuration +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [run] +check_log = CheckSteps.CheckLogStep('CheckLog') +check_log.log_file = run.get_log_file_name() +test.check_steps = [check_log] + +import sys +sys.exit(test.run()) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py index 751fdec20cd0c0454cb52a7baf861137612fea34..efb441b0794b837fbcab89fb51aaf610e019a50e 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py @@ -432,11 +432,11 @@ def createTriggerRecoFlags(): # Change tolerance in STEP Propagator flags.addFlag("Trigger.Jet.PFlowTolerance", 1e-2) - def __httFlags(): + def __fpgatracksimFlags(): """Additional function delays import""" - from TrigHTTConfTools.HTTConfigFlags import createHTTConfigFlags - return createHTTConfigFlags() - flags.addFlagsCategory("Trigger.HTT", __httFlags, prefix=True ) + from FPGATrackSimConfTools.FPGATrackSimConfigFlags import createFPGATrackSimConfigFlags + return createFPGATrackSimConfigFlags() + flags.addFlagsCategory("Trigger.FPGATrackSim", __fpgatracksimFlags, prefix=True ) # L1 MUCTPI trigger flags def __muctpiFlags(): diff --git a/graphics/JiveXML/CMakeLists.txt b/graphics/JiveXML/CMakeLists.txt index df0105b93e0c54cfb8af4f883e137261002e230c..d8b3d7b98fd86b4e24d8cd0c98da76aac7b77ea2 100644 --- a/graphics/JiveXML/CMakeLists.txt +++ b/graphics/JiveXML/CMakeLists.txt @@ -5,7 +5,7 @@ atlas_subdir( JiveXML ) # External package(s). list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ) -if ( ATLAS_OS_ID STREQUAL "centos9" ) +if( ( "${ATLAS_OS_ID}" STREQUAL "centos9" ) OR ( "${ATLAS_OS_ID}" STREQUAL "el9" ) ) find_package( RPC ) endif() diff --git a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VP1GeometrySystem.cxx b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VP1GeometrySystem.cxx index b4a58d371c34630db460ac1d6d0c14a2d955ee9f..eb9544fb710251332513ca8dc6b8866adb878f5c 100644 --- a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VP1GeometrySystem.cxx +++ b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VP1GeometrySystem.cxx @@ -364,7 +364,7 @@ void VP1GeometrySystem::Imp::addSubSystem(const VP1GeoFlags::SubSystemFlag& f, const QString& grandchildrenregexp, bool negategrandchildrenregexp) { theclass->message("VP1GeometrySystem::Imp::addSubSystem - flag: '" + QString(f) + "' - matName: '" + str(matname.c_str()) + "'." ); - + QCheckBox * cb = controller->subSystemCheckBox(f); if (!cb) { theclass->message("Error: Problems retrieving checkbox for subsystem "+str(f)); @@ -424,8 +424,13 @@ QWidget * VP1GeometrySystem::buildController() bool negategrandchildrenregexp = false // wheter we want to negate teh granchildren regex */ - m_d->addSubSystem( VP1GeoFlags::Pixel,"Pixel"); - m_d->addSubSystem( VP1GeoFlags::SCT,"SCT"); + if (VP1JobConfigInfo::hasITkGeometry()) { + m_d->addSubSystem( VP1GeoFlags::Pixel,"ITkPixel", "", "ITkPixel"); + m_d->addSubSystem( VP1GeoFlags::SCT,"ITkStrip", "", "ITkStrip"); + } else { + m_d->addSubSystem( VP1GeoFlags::Pixel,"Pixel"); + m_d->addSubSystem( VP1GeoFlags::SCT,"SCT"); + } m_d->addSubSystem( VP1GeoFlags::TRT,"TRT"); m_d->addSubSystem( VP1GeoFlags::InDetServMat,"InDetServMat"); m_d->addSubSystem( VP1GeoFlags::LAr, ".*LAr.*"); @@ -775,6 +780,7 @@ void VP1GeometrySystem::checkboxChanged() message("ERROR: Unknown checkbox"); return; } + SoSwitch * sw = subsys->soswitch; assert(sw); if (cb->isChecked()) { @@ -1400,13 +1406,19 @@ void VP1GeometrySystem::Imp::createPathExtras(const VolumeHandle* volhandle, QSt case VP1GeoFlags::Pixel: { prefix = QString("Pixel::"); entries.push("IDET::IDET"); - entries.push("Pixel::Pixel"); + if (VP1JobConfigInfo::hasITkGeometry()) + entries.push("ITkPixel::ITkPixel"); + else + entries.push("Pixel::Pixel"); return; } case VP1GeoFlags::SCT:{ prefix = QString("SCT::"); entries.push("IDET::IDET"); - entries.push("SCT::SCT"); + if (VP1JobConfigInfo::hasITkGeometry()) + entries.push("ITkStrip::ITkStrip"); + else + entries.push("SCT::SCT"); return; } case VP1GeoFlags::TRT:{ diff --git a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx index 571c704ef37de3a96ef1fcffb26b06dd0c9e1df0..20574539c29819eb1ef9b1ed1c38a2f064d2fe5c 100644 --- a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx +++ b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VisAttributes.cxx @@ -151,6 +151,15 @@ DetVisAttributes::DetVisAttributes() { add("Pixel",material); } + { + SoMaterial *material = new SoMaterial; + material->ambientColor.setValue(0, .157811, .187004); + material->diffuseColor.setValue(0, .631244, .748016); + material->specularColor.setValue(.915152, .915152, .915152); + material->shininess.setValue(0.642424); + add("ITkPixel",material); + } + { SoMaterial *material = new SoMaterial; material->ambientColor.setValue(0, .157811, .187004); @@ -264,6 +273,15 @@ DetVisAttributes::DetVisAttributes() { add("SCT",material); } + { + SoMaterial *material = new SoMaterial; + material->ambientColor.setValue(.37, .69, 1.00); + material->diffuseColor.setValue(.21, .64, 1.00); + material->specularColor.setValue(1, 1, 1); + material->shininess.setValue(1.0); + add("ITkStrip",material); + } + { SoMaterial *material = new SoMaterial; add("LAr",material); diff --git a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VolumeTreeModel.cxx b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VolumeTreeModel.cxx index 28433414ea764ecdb6729d3bb308e0d469958e1d..abfe88574716a8306cf2e35c10d6c2b67a786216 100644 --- a/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VolumeTreeModel.cxx +++ b/graphics/VP1/VP1Systems/VP1GeometrySystems/src/VolumeTreeModel.cxx @@ -113,7 +113,9 @@ VolumeTreeModel::VolumeTreeModel( QObject * parent ) Imp::defineSubSystem(VP1GeoFlags::None,"None",Imp::UNKNOWN); // Inner Detector Imp::defineSubSystem(VP1GeoFlags::Pixel,"Pixel",Imp::INDET); + Imp::defineSubSystem(VP1GeoFlags::Pixel,"ITkPixel",Imp::INDET); Imp::defineSubSystem(VP1GeoFlags::SCT,"SCT",Imp::INDET); + Imp::defineSubSystem(VP1GeoFlags::SCT,"ITkStrip",Imp::INDET); Imp::defineSubSystem(VP1GeoFlags::TRT,"TRT",Imp::INDET); Imp::defineSubSystem(VP1GeoFlags::InDetServMat,"Services",Imp::INDET); // Calorimeters diff --git a/graphics/VP1/VP1Utils/VP1Utils/VP1JobConfigInfo.h b/graphics/VP1/VP1Utils/VP1Utils/VP1JobConfigInfo.h index bbea9ff65ac4e1255f08998d0e609a063bab098e..c3339f2980078908f666023b2064537dc7f8af27 100644 --- a/graphics/VP1/VP1Utils/VP1Utils/VP1JobConfigInfo.h +++ b/graphics/VP1/VP1Utils/VP1Utils/VP1JobConfigInfo.h @@ -32,6 +32,8 @@ public: //These next methods tells us what geomodel parts are initialised: static bool hasGeoModelExperiment();//If GeoModelExperiment/"ATLAS" can be retrieved + static bool hasITkGeometry(); + static bool hasPixelGeometry(); static bool hasSCTGeometry(); static bool hasTRTGeometry(); diff --git a/graphics/VP1/VP1Utils/src/VP1JobConfigInfo.cxx b/graphics/VP1/VP1Utils/src/VP1JobConfigInfo.cxx index e562dd28633d9ed9a0949a580fe52e14f99ac9a8..e169f62a296335583d88b61ae3365824f2411281 100644 --- a/graphics/VP1/VP1Utils/src/VP1JobConfigInfo.cxx +++ b/graphics/VP1/VP1Utils/src/VP1JobConfigInfo.cxx @@ -35,6 +35,7 @@ public: static GeoPVConstLink geoModelWorld; static bool hasGeoModelExperiment; + static bool hasITkGeometry; static bool hasPixelGeometry; static bool hasSCTGeometry; static bool hasTRTGeometry; @@ -55,6 +56,7 @@ GeoPVConstLink VP1JobConfigInfo::Imp::geoModelWorld; // init default values bool VP1JobConfigInfo::Imp::initialised = false; bool VP1JobConfigInfo::Imp::hasGeoModelExperiment = false; +bool VP1JobConfigInfo::Imp::hasITkGeometry = false; bool VP1JobConfigInfo::Imp::hasPixelGeometry = false; bool VP1JobConfigInfo::Imp::hasSCTGeometry = false; bool VP1JobConfigInfo::Imp::hasTRTGeometry = false; @@ -72,6 +74,7 @@ bool VP1JobConfigInfo::Imp::hasCavernInfraGeometry = false; void VP1JobConfigInfo::Imp::turnOffAll() { hasGeoModelExperiment = false; + hasITkGeometry = false; hasPixelGeometry = false; hasSCTGeometry = false; hasTRTGeometry = false; @@ -101,6 +104,7 @@ void VP1JobConfigInfo::Imp::ensureInit() if (VP1Msg::verbose()) { VP1Msg::messageVerbose("VP1JobConfigInfo => Found job configuration:"); VP1Msg::messageVerbose("VP1JobConfigInfo => hasGeoModelExperiment = "+QString(hasGeoModelExperiment?"On":"Off")); + VP1Msg::messageVerbose("VP1JobConfigInfo => hasITkGeometry = "+QString(hasITkGeometry?"On":"Off")); VP1Msg::messageVerbose("VP1JobConfigInfo => hasPixelGeometry = "+QString(hasPixelGeometry?"On":"Off")); VP1Msg::messageVerbose("VP1JobConfigInfo => hasSCTGeometry = "+QString(hasSCTGeometry?"On":"Off")); VP1Msg::messageVerbose("VP1JobConfigInfo => hasTRTGeometry = "+QString(hasTRTGeometry?"On":"Off")); @@ -119,6 +123,7 @@ void VP1JobConfigInfo::Imp::ensureInit() //____________________________________________________________________ bool VP1JobConfigInfo::hasGeoModelExperiment() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasGeoModelExperiment; } +bool VP1JobConfigInfo::hasITkGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasITkGeometry; } bool VP1JobConfigInfo::hasPixelGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasPixelGeometry; } bool VP1JobConfigInfo::hasSCTGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasSCTGeometry; } bool VP1JobConfigInfo::hasTRTGeometry() { if (!Imp::initialised) Imp::ensureInit(); return Imp::hasTRTGeometry; } @@ -180,6 +185,8 @@ bool VP1JobConfigInfo::Imp::actualInit( StoreGateSvc* detStore ) std::string name = av.getName(); if ( !hasPixelGeometry && (name=="Pixel" or name=="ITkPixel")) { hasPixelGeometry = true; + if (not hasITkGeometry and name == "ITkPixel") + hasITkGeometry = true; if ( !hasBCMGeometry ) { //Loop under the top Pixel volume to check if there are BCM volumes //present in the current config: @@ -193,7 +200,11 @@ bool VP1JobConfigInfo::Imp::actualInit( StoreGateSvc* detStore ) } } } - if ( !hasSCTGeometry && (name=="SCT" or name=="ITkStrip")) hasSCTGeometry = true; + if ( !hasSCTGeometry && (name=="SCT" or name=="ITkStrip")) { + hasSCTGeometry = true; + if (not hasITkGeometry and name == "ITkStrip") + hasITkGeometry = true; + } if ( !hasTRTGeometry && name=="TRT") hasTRTGeometry = true; if ( !hasInDetServiceMaterialGeometry && name=="InDetServMat") hasInDetServiceMaterialGeometry = true; if ( !hasBeamPipeGeometry && name=="BeamPipe") hasBeamPipeGeometry = true;