diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TrigHLTSoftKiller.h b/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TrigHLTSoftKiller.h new file mode 100644 index 0000000000000000000000000000000000000000..31528c321137a192e4f2ff7d658c8112a41bdea1 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/TrigHLTJetRec/TrigHLTSoftKiller.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGHLTJETREC_TRIGHLTSOFTKILLER_H +#define TRIGHLTJETREC_TRIGHLTSOFTKILLER_H + +#include "GaudiKernel/ToolHandle.h" +#include "TrigInterfaces/FexAlgo.h" + + +class TrigHLTSoftKiller : public HLT::FexAlgo +{ + + public: + TrigHLTSoftKiller(const std::string& name, ISvcLocator* pSvcLocator); + ~TrigHLTSoftKiller(); + + HLT::ErrorCode hltInitialize(); + HLT::ErrorCode hltExecute(const HLT::TriggerElement* inputTE, + HLT::TriggerElement* outputTE); + HLT::ErrorCode hltFinalize(); + + private: + // TODO Add SoftKiller ToolHandle and related here + + std::string m_outputCollectionLabel; + +}; + +#endif diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py b/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py index d57ea59ff2a3d8df896cf043e659ff356d4397b6..6e7d5fcc4fcbc0508bfe8dda434fad83e004b802 100644 --- a/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py @@ -848,6 +848,27 @@ class TrigHLTEnergyDensity(TrigHLTJetRecConf.TrigHLTEnergyDensity): self.energyDensity = 0 +class TrigHLTSoftKiller(TrigHLTJetRecConf.TrigHLTSoftKiller): + """Supply a specific grid configuration for SoftKiller""" + + def __init__(self, + name, + cluster_calib="LC", + sk_grid_param_eta=0.4, + sk_grid_param_phi=0.4, + output_collection_label='SKclusters', # do not use this + ): + + TrigHLTJetRecConf.TrigHLTSoftKiller.__init__(self,name=name) + self.output_collection_label = output_collection_label + + # TODO create and configure offline SoftKiller tool here, pass it to our tool + # Use cluster_calib, sk_grid_param_eta, and sk_grid_param_phi to configure the offline tool + print "SK: %s, %f, %f"%(cluster_calib,sk_grid_param_eta,sk_grid_param_phi) + + print "SK clusters from clusters" + + # Data scouting algorithm class TrigHLTJetDSSelector(TrigHLTJetRecConf.TrigHLTJetDSSelector): def __init__(self, name, diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetRecGroomer.cxx b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetRecGroomer.cxx index eba3e303672892d05393cf29307589417ef78457..717772f41c4917b8bd095069fdf20a2380821bae 100644 --- a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetRecGroomer.cxx +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetRecGroomer.cxx @@ -82,6 +82,11 @@ const xAOD::JetContainer* TrigHLTJetRecGroomer::build() const ATH_MSG_DEBUG("Ungroomed/groomed jet number " << iJet << " has constituents of " << ungroomedJets->at(iJet)->numConstituents() << "/" << trimmedJets->at(iJet)->numConstituents() << ", pT ratio is " << orig_pt << "/" << trim_pt << " = " << ratio << " , constscale ratio is " << orig_const_pt << "/" << trim_const_pt << " = " << ratio_const << " , emscale ratio is " << orig_em_pt << "/" << trim_em_pt << " = " << ratio_em); } */ + + // Get rid of the intermediate (ungroomed) jets + auto ungroomedStore = ungroomedJets->getStore(); + delete ungroomedStore; + delete ungroomedJets; // Done, return the trimmed jets return trimmedJets; diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTSoftKiller.cxx b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTSoftKiller.cxx new file mode 100644 index 0000000000000000000000000000000000000000..76bfb4d56c46ef2107ca4b3253150c8333597e97 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTSoftKiller.cxx @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// TrigHLTSoftKiller: Trigger algorithm that reads CaloClusters from an +// incoming trigger element, defines a selection on +// the clusters, and outputs a new cluster collection + +#include "TrigHLTJetRec/TrigHLTSoftKiller.h" +#include "xAODCaloEvent/CaloClusterContainer.h" + +TrigHLTSoftKiller::TrigHLTSoftKiller(const std::string& name, ISvcLocator* pSvcLocator) + : HLT::FexAlgo(name, pSvcLocator) +{ + declareProperty( "output_collection_label", m_outputCollectionLabel); +} + +TrigHLTSoftKiller::~TrigHLTSoftKiller() +{ } + +HLT::ErrorCode TrigHLTSoftKiller::hltInitialize() +{ + + ATH_MSG_INFO("Initializing " << name() << "..."); + + // TODO Retrieve any needed ToolHandles here, like the SoftKiller tool + + ATH_MSG_INFO("Initialization successful"); + + return HLT::OK; +} + +HLT::ErrorCode TrigHLTSoftKiller::hltFinalize() +{ + ATH_MSG_INFO("Finalizing " << name() << "..."); + return HLT::OK; +} + +HLT::ErrorCode TrigHLTSoftKiller::hltExecute(const HLT::TriggerElement* inputTE, + HLT::TriggerElement* outputTE) +{ + // Retrieve the input CaloCluster container from the input trigger element + // Get a new SoftKiller-suppressed collection of CaloClusters + // Attach the resulting collection to the output trigger element + + ATH_MSG_DEBUG("outputTE->getId(): " << outputTE->getId()); + ATH_MSG_DEBUG("inputTE->getId(): " << inputTE->getId()); + + // Get the input container + const xAOD::CaloClusterContainer* clusters = nullptr; + HLT::ErrorCode status = getFeature(inputTE,clusters); + if (status == HLT::OK) + { + if (clusters != nullptr) + ATH_MSG_DEBUG("Retrieved input cluster container of size " << clusters->size()); + else + { + ATH_MSG_ERROR("Retrieved NULL input cluster container"); + return HLT::ERROR; + } + } + else + { + ATH_MSG_ERROR("Failed to retrieve input cluster container"); + return HLT::ERROR; + } + + + + // Apply SoftKiller and store the output in clustersSK + const xAOD::CaloClusterContainer* clustersSK = clusters; // TODO change this to the SK cluster output + // TODO add SK here + + + + // Write the resulting container + std::string key = ""; + status = recordAndAttachFeature(outputTE,clustersSK,key,m_outputCollectionLabel); + if (status == HLT::OK) + ATH_MSG_DEBUG("Attached SK cluster container to output TE"); + else + ATH_MSG_ERROR("Failed to attach SK cluster container to output TE, status " << status); + return status; +} + diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/components/TrigHLTJetRec_entries.cxx b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/components/TrigHLTJetRec_entries.cxx index 99d153c9d3d6ff7fa335d8f1e88540240251814c..b0254f124ef001c4a1ac92d78f1ed06a5149e4f8 100644 --- a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/components/TrigHLTJetRec_entries.cxx +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/components/TrigHLTJetRec_entries.cxx @@ -15,6 +15,7 @@ #include "TrigHLTJetRec/TrigHLTHypoDiagnostics.h" #include "TrigHLTJetRec/TrigHLTPSvsFSDiagnostics.h" #include "TrigHLTJetRec/TrigHLTEnergyDensity.h" +#include "TrigHLTJetRec/TrigHLTSoftKiller.h" #include "TrigHLTJetRec/TrigHLTJetDSSelector.h" #include "GaudiKernel/DeclareFactoryEntries.h" #include "TrigHLTJetRec/TrigHLTJetRecGroomer.h" @@ -32,6 +33,7 @@ DECLARE_ALGORITHM_FACTORY( TrigHLTRoIDiagnostics) DECLARE_ALGORITHM_FACTORY( TrigHLTHypoDiagnostics) DECLARE_ALGORITHM_FACTORY( TrigHLTPSvsFSDiagnostics) DECLARE_ALGORITHM_FACTORY( TrigHLTEnergyDensity) +DECLARE_ALGORITHM_FACTORY( TrigHLTSoftKiller) DECLARE_ALGORITHM_FACTORY( TrigHLTJetDSSelector) DECLARE_ALGORITHM_FACTORY( TrigHLTJetRecGroomer) @@ -55,6 +57,7 @@ DECLARE_FACTORY_ENTRIES(TrigHLTJetRec) { DECLARE_ALGORITHM( TrigHLTHypoDiagnostics); DECLARE_ALGORITHM( TrigHLTPSvsFSDiagnostics); DECLARE_ALGORITHM( TrigHLTEnergyDensity); + DECLARE_ALGORITHM( TrigHLTSoftKiller); DECLARE_ALGORITHM( TrigHLTJetDSSelector); DECLARE_ALGORITHM( TrigHLTJetRecGroomer); DECLARE_TOOL(TriggerPseudoJetGetter);