Commit 179b08eb authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'towerThinning.TrigT1CaloCalibTools-20200222' into 'master'

TrigT1CaloCalibTools+PrimaryDPDMaker+DerivationFrameworkL1Calo: Convert TriggerTowerThinningAlg to MT.

See merge request !30552
parents ab00baed 245e6076
......@@ -4,6 +4,17 @@
## Load common flags
from AthenaCommon.JobProperties import jobproperties as athCommonFlags
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO1.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO1 )
L1CALO1Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO1Stream.AcceptAlgs(["DFL1CALO1_KERN"])
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
#################
### Setup Augmentation tools
#################
......@@ -31,7 +42,7 @@ thinningTools = []
from TrigT1CaloCalibTools.TrigT1CaloCalibToolsConf import DerivationFramework__TriggerTowerThinningAlg
L1CALO1CaloThinningTool = DerivationFramework__TriggerTowerThinningAlg( name = "L1CALO1CaloThinningTool",
ThinService = "L1CALO1ThinningSvc",
StreamName = streamName,
TriggerTowerLocation = "xAODTriggerTowers",
MinCaloCellET = 0.8,
MinADC = 36,
......@@ -67,19 +78,6 @@ ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool(
svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.TriggerMenuMetaDataTool ]
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO1.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO1 )
L1CALO1Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO1Stream.AcceptAlgs(["DFL1CALO1_KERN"])
from AthenaServices.Configurables import ThinningSvc, createThinningSvc
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
svcMgr += createThinningSvc( svcName="L1CALO1ThinningSvc", outStreams=[evtStream] )
trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
# Generic event info
......
......@@ -4,6 +4,17 @@
## Load common flags
from AthenaCommon.JobProperties import jobproperties as athCommonFlags
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO2.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO2 )
L1CALO2Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO2Stream.AcceptAlgs(["DFL1CALO2_KERN"])
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
#################
### Setup Augmentation tools
#################
......@@ -31,7 +42,7 @@ thinningTools = []
#from TrigT1CaloCalibTools.TrigT1CaloCalibToolsConf import DerivationFramework__TriggerTowerThinningAlg
#L1CALO2CaloThinningTool = DerivationFramework__TriggerTowerThinningAlg( name = "L1CALO2CaloThinningTool",
# ThinService = "L1CALO2ThinningSvc",
# StreamName = streamName,
# TriggerTowerLocation = "xAODTriggerTowers",
# MinCaloCellEnergy = 0.8,
# MinADC = 36,
......@@ -67,19 +78,6 @@ ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool(
svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.TriggerMenuMetaDataTool ]
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO2.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO2 )
L1CALO2Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO2Stream.AcceptAlgs(["DFL1CALO2_KERN"])
from AthenaServices.Configurables import ThinningSvc, createThinningSvc
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
svcMgr += createThinningSvc( svcName="L1CALO2ThinningSvc", outStreams=[evtStream] )
trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
# Generic event info
......
......@@ -4,6 +4,17 @@
## Load common flags
from AthenaCommon.JobProperties import jobproperties as athCommonFlags
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO3.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO3 )
L1CALO3Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO3Stream.AcceptAlgs(["DFL1CALO3_KERN"])
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
#################
### Setup Augmentation tools
#################
......@@ -31,7 +42,7 @@ thinningTools = []
from TrigT1CaloCalibTools.TrigT1CaloCalibToolsConf import DerivationFramework__TriggerTowerThinningAlg
L1CALO3CaloThinningTool = DerivationFramework__TriggerTowerThinningAlg( name = "L1CALO3CaloThinningTool",
ThinService = "L1CALO3ThinningSvc",
StreamName = streamName,
TriggerTowerLocation = "xAODTriggerTowers",
MinCaloCellET = 0.8,
MinADC = 36,
......@@ -67,19 +78,6 @@ ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool(
svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.TriggerMenuMetaDataTool ]
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO3.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO3 )
L1CALO3Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO3Stream.AcceptAlgs(["DFL1CALO3_KERN"])
from AthenaServices.Configurables import ThinningSvc, createThinningSvc
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
svcMgr += createThinningSvc( svcName="L1CALO3ThinningSvc", outStreams=[evtStream] )
trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
# Generic event info
......
......@@ -4,6 +4,17 @@
## Load common flags
from AthenaCommon.JobProperties import jobproperties as athCommonFlags
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO4.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO4 )
L1CALO4Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO4Stream.AcceptAlgs(["DFL1CALO4_KERN"])
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
#################
### Setup Augmentation tools
#################
......@@ -31,7 +42,7 @@ thinningTools = []
from TrigT1CaloCalibTools.TrigT1CaloCalibToolsConf import DerivationFramework__TriggerTowerThinningAlg
L1CALO4CaloThinningTool = DerivationFramework__TriggerTowerThinningAlg( name = "L1CALO4CaloThinningTool",
ThinService = "L1CALO4ThinningSvc",
StreamName = streamName,
TriggerTowerLocation = "xAODTriggerTowers",
MinCaloCellET = 0.8,
MinADC = 36,
......@@ -67,19 +78,6 @@ ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool(
svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.TriggerMenuMetaDataTool ]
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO4.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO4 )
L1CALO4Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO4Stream.AcceptAlgs(["DFL1CALO4_KERN"])
from AthenaServices.Configurables import ThinningSvc, createThinningSvc
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
svcMgr += createThinningSvc( svcName="L1CALO4ThinningSvc", outStreams=[evtStream] )
trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
# Generic event info
......
......@@ -4,6 +4,17 @@
## Load common flags
from AthenaCommon.JobProperties import jobproperties as athCommonFlags
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO5.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO5 )
L1CALO5Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO5Stream.AcceptAlgs(["DFL1CALO5_KERN"])
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
#################
### Setup Augmentation tools
#################
......@@ -31,7 +42,7 @@ thinningTools = []
from TrigT1CaloCalibTools.TrigT1CaloCalibToolsConf import DerivationFramework__TriggerTowerThinningAlg
L1CALO5CaloThinningTool = DerivationFramework__TriggerTowerThinningAlg( name = "L1CALO5CaloThinningTool",
ThinService = "L1CALO5ThinningSvc",
StreamName = streamName,
TriggerTowerLocation = "xAODTriggerTowers",
MinCaloCellET = 0.8,
MinADC = 36,
......@@ -67,19 +78,6 @@ ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool(
svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.TriggerMenuMetaDataTool ]
## Steer output file
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
from D2PDMaker.D2PDHelpers import buildFileName
from PrimaryDPDMaker.PrimaryDPDFlags import primDPD
streamName = primDPD.WriteDAOD_L1CALO5.StreamName
fileName = buildFileName( primDPD.WriteDAOD_L1CALO5 )
L1CALO5Stream = MSMgr.NewPoolRootStream( streamName, fileName )
L1CALO5Stream.AcceptAlgs(["DFL1CALO5_KERN"])
from AthenaServices.Configurables import ThinningSvc, createThinningSvc
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
svcMgr += createThinningSvc( svcName="L1CALO5ThinningSvc", outStreams=[evtStream] )
trackParticleAuxExclusions="-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition"
# Generic event info
......
......@@ -186,7 +186,7 @@ ToolSvc += DESDM_EGAMMATracksThinningTool
from TrigT1CaloCalibTools.TrigT1CaloCalibToolsConf import DerivationFramework__TriggerTowerThinningAlg
DESDM_EGAMMAL1CaloThinning = DerivationFramework__TriggerTowerThinningAlg( name = "DESDM_EGAMMAL1CaloThinning",
ThinService = "DESDM_EGAMMAThinningSvc",
StreamName = primDPD.WriteDESDM_EGAMMAStream.StreamName,
TriggerTowerLocation = "xAODTriggerTowers",
MinCaloCellET = 0.8,
MinADC = 36,
......@@ -235,10 +235,8 @@ StreamDESDM_EGAMMA.AcceptAlgs(["DESDM_EGAMMAKernel"])
# Thinning service name must match the one passed to the thinning tools
from AthenaServices.Configurables import ThinningSvc, createThinningSvc
augStream = MSMgr.GetStream( streamName )
evtStream = augStream.GetEventStream()
svcMgr += createThinningSvc( svcName="DESDM_EGAMMAThinningSvc", outStreams=[evtStream] )
from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
// ***************************************************************************
// * Author: John Morris (john.morris@cern.ch) *
// * Queen Mary University of London *
// * *
#ifndef _TRIGGER_TRIGT1_TRIGT1CALOCALIBTOOLS_TRIGGERTOWERTHINNINGALG_H_
#define _TRIGGER_TRIGT1_TRIGT1CALOCALIBTOOLS_TRIGGERTOWERTHINNINGALG_H_
#ifndef TRIGT1CALOCALIBTOOLS_TRIGGERTOWERTHINNINGALG_H
#define TRIGT1CALOCALIBTOOLS_TRIGGERTOWERTHINNINGALG_H
/**
@class TriggerTowerThinningAlg
......@@ -24,32 +24,32 @@
**/
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrigT1Interfaces/TrigT1CaloDefs.h"
#include "DerivationFrameworkInterfaces/IThinningTool.h"
#include "xAODTrigL1Calo/TriggerTowerContainer.h"
#include "StoreGate/ThinningHandleKey.h"
#include <vector>
#include <TRandom3.h>
class IThinningSvc;
namespace DerivationFramework {
class TriggerTowerThinningAlg : public AthAlgTool , public IThinningTool{
class TriggerTowerThinningAlg : public extends<AthAlgTool, IThinningTool> {
public:
TriggerTowerThinningAlg(const std::string& t, const std::string& n, const IInterface* p);
virtual ~TriggerTowerThinningAlg();
StatusCode initialize();
StatusCode finalize();
virtual StatusCode doThinning() const;
virtual StatusCode initialize() override;
virtual StatusCode finalize() override;
virtual StatusCode doThinning() const override;
private:
ServiceHandle<IThinningSvc> m_thinningSvc;
// StoreGate locations
std::string m_triggerTowerLocation;
StringProperty m_streamName
{ this, "StreamName", "", "Name of the stream being thinned" };
SG::ThinningHandleKey<xAOD::TriggerTowerContainer> m_triggerTowerLocation
{ this, "TriggerTowerLocation", LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation, "" };
// python configurables
double m_minCaloCellET;
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
// ***************************************************************************
// * Author: John Morris (john.morris@cern.ch) *
......@@ -22,13 +22,13 @@
#include "TrigT1CaloCalibTools/TriggerTowerThinningAlg.h"
// TrigT1 common definitions
#include "TrigT1Interfaces/TrigT1CaloDefs.h"
#include "StoreGate/ThinningHandle.h"
#include "GaudiKernel/ThreadLocalContext.h"
namespace DerivationFramework {
TriggerTowerThinningAlg::TriggerTowerThinningAlg(const std::string& t, const std::string& n, const IInterface* p) :
AthAlgTool(t,n,p),
m_thinningSvc( "ThinningSvc", n ),
m_triggerTowerLocation(LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation),
base_class(t,n,p),
m_minCaloCellET(0.4),
m_minADC(32),
m_useRandom(false),
......@@ -40,9 +40,6 @@ namespace DerivationFramework {
m_nTriggerTowersRejected(0),
m_random(0)
{
declareInterface<DerivationFramework::IThinningTool>(this);
declareProperty("ThinService",m_thinningSvc);
declareProperty("TriggerTowerLocation", m_triggerTowerLocation);
declareProperty("MinCaloCellET",m_minCaloCellET);
declareProperty("MinADC",m_minADC);
declareProperty("UseRandom",m_useRandom);
......@@ -56,6 +53,8 @@ namespace DerivationFramework {
StatusCode TriggerTowerThinningAlg::initialize(){
ATH_MSG_INFO("L1Calo TriggerTowerThinningAlg::initialize()");
ATH_CHECK( m_triggerTowerLocation.initialize (m_streamName) );
// Random number generator
if(m_useRandom == true){
m_random = new TRandom3(0);
......@@ -65,7 +64,7 @@ namespace DerivationFramework {
}
StatusCode TriggerTowerThinningAlg::doThinning() const{
StatusCode sc;
const EventContext& ctx = Gaudi::Hive::currentContext();
// Create the mask to be used for thinning
std::vector<bool> mask;
......@@ -74,14 +73,8 @@ namespace DerivationFramework {
unsigned long nKeep(0),nReject(0),nTotal(0);
++m_nEventsProcessed;
// Shall I proceed?
if (!evtStore()->contains<xAOD::TriggerTowerContainer>( m_triggerTowerLocation )) {
ATH_MSG_ERROR("No TriggerTowers in input file, so can't do any thinning!");
return StatusCode::FAILURE;
}
const xAOD::TriggerTowerContainer* tts(nullptr);
CHECK( evtStore()->retrieve( tts , m_triggerTowerLocation ) );
SG::ThinningHandle<xAOD::TriggerTowerContainer> tts
(m_triggerTowerLocation, ctx);
mask.assign(tts->size(),false); // default: don't keep any clusters
......@@ -143,10 +136,7 @@ namespace DerivationFramework {
} // End loop over trigger towers
if (m_thinningSvc->filter(*tts,mask,IThinningSvc::Operator::Or).isFailure()) {
ATH_MSG_ERROR("Application of thinning service failed! ");
return StatusCode::FAILURE;
}
tts.keep (mask);
// Counters
m_nTriggerTowersProcessed += nTotal;
......@@ -157,7 +147,7 @@ namespace DerivationFramework {
<< " and rejecting " << nReject << " cells");
return sc;
return StatusCode::SUCCESS;
}
StatusCode TriggerTowerThinningAlg::finalize(){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment