diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py index c195fa4f553b988634d44331e2a5ab7a55fc8bf5..a27b7ae466462510bfc4c2ab8e680bd5d85ad8f9 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py @@ -19,6 +19,7 @@ from TrigCaloRec.TrigCaloRecConf import RoIFCalHadCellContMaker from TrigCaloRec.TrigCaloRecConf import FullCaloCellContMaker from TrigCaloRec.TrigCaloRecConf import TrigLArNoisyROAlg from TrigCaloRec.TrigCaloRecConf import TrigL1BSTowerHypo +from TrigCaloRec.TrigCaloRecConf import TrigCaloClusterCalibratorMT from LArRecUtils.LArRecUtilsConf import LArTowerBuilderTool from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool @@ -1767,4 +1768,83 @@ class HLTCaloCellMaker (_HLTCaloCellMaker): self.MonTool = monTool self.monitorCells = monitorCells +class TrigCaloClusterCalibratorMT_LC(TrigCaloClusterCalibratorMT): + """ Class to set up the default configurations for LC calibrations """ + def __init__(self, name="TrigCaloClusterCalibratorMT_LC", **kwargs): + super(TrigCaloClusterCalibratorMT_LC, self).__init__(name, **kwargs) + + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + from CaloUtils.CaloUtilsConf import CaloLCClassificationTool, CaloLCWeightTool, CaloLCOutOfClusterTool, CaloLCDeadMaterialTool + from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib + from AthenaCommon.GlobalFlags import globalflags + + # Need electronic noise for LCWeights + CaloNoiseCondAlg(noisetype="electronicNoise") + + # Figure out the detector version + det_version_is_rome = globalflags.DetDescrVersion().startswith("Rome") + + self.ClusterCorrectionTools = [] + + # Set up the tools + self += CaloClusterLocalCalib( + "TrigLocalCalib", + ClusterRecoStatus = [1, 2]) + self.TrigLocalCalib += CaloLCClassificationTool( + "TrigLCClassify", + ClassificationKey = "EMFracClassify", + UseSpread = False, + MaxProbability = 0.85 if det_version_is_rome else 0.5, + UseNormalizedEnergyDensity = not det_version_is_rome, + StoreClassificationProbabilityInAOD = True) + self.TrigLocalCalib.ClusterClassificationTool = [self.TrigLocalCalib.TrigLCClassify] + self.TrigLocalCalib += CaloLCWeightTool( + "TrigLCWeight", + CorrectionKey = "H1ClusterCellWeights", + SignalOverNoiseCut = 2.0, + UseHadProbability = True) + self.TrigLocalCalib.LocalCalibTools = [self.TrigLocalCalib.TrigLCWeight] + self.ClusterCorrectionTools.append(self.TrigLocalCalib) + + self += CaloClusterLocalCalib( + "TrigOOCCalib", + ClusterRecoStatus = [1, 2]) + self.TrigOOCCalib += CaloLCOutOfClusterTool( + "TrigLCOut", + CorrectionKey = "OOCCorrection", + UseEmProbability = False, + UseHadProbability = True) + self.TrigOOCCalib.LocalCalibTools = [self.TrigOOCCalib.TrigLCOut] + self.ClusterCorrectionTools.append(self.TrigOOCCalib) + + self += CaloClusterLocalCalib( + "TrigOOCPi0Calib", + ClusterRecoStatus = [1, 2]) + self.TrigOOCPi0Calib += CaloLCOutOfClusterTool( + "TrigLCOutPi0", + CorrectionKey = "OOCPi0Correction", + UseEmProbability = True, + UseHadProbability = False) + self.TrigOOCPi0Calib.LocalCalibTools = [self.TrigOOCPi0Calib.TrigLCOutPi0] + self.ClusterCorrectionTools.append(self.TrigOOCPi0Calib) + + self += CaloClusterLocalCalib( + "TrigDMCalib", + ClusterRecoStatus = [1, 2]) + self.TrigDMCalib += CaloLCDeadMaterialTool( + "TrigLCDeadMaterial", + HadDMCoeffKey = "HadDMCoeff2", + ClusterRecoStatus = 0, + WeightModeDM = 2, + UseHadProbability = True) + self.TrigDMCalib.LocalCalibTools = [self.TrigDMCalib.TrigLCDeadMaterial] + self.ClusterCorrectionTools.append(self.TrigDMCalib) + + # Also set up the monitoring + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + self.MonTool = GenericMonitoringTool("MonTool") + self.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) + self.MonTool.defineHistogram('Eta', path='EXPERT', type='TH1F', title="Cluster #eta; #eta ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5) + self.MonTool.defineHistogram('Phi', path='EXPERT', type='TH1F', title="Cluster #phi; #phi ; Number of Clusters", xbins=64, xmin=-3.2, xmax=3.2) + self.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) diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f51a8338597308cfcdd7f9ab20572e219cb8f095 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.cxx @@ -0,0 +1,125 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/******************************************************************** + * + * NAME: TrigCaloClusterCalibratorMT + * PACKAGE: Trigger/TrigAlgorithms/TrigCaloRec + * + * AUTHOR: Jon Burr + * CREATED: 2020/07/10 + * + * Shallow copy an existing cluster container and apply cluster processors to + * it. Largely copied from the TrigCaloClusterMakerMT. + *********************************************************************/ + +#include "AthenaMonitoringKernel/Monitored.h" +#include "TrigCaloClusterCalibratorMT.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODCore/ShallowAuxContainer.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" +#include "CaloUtils/CaloClusterStoreHelper.h" +#include <tuple> + +TrigCaloClusterCalibratorMT::TrigCaloClusterCalibratorMT( + const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator) +{ +} + +TrigCaloClusterCalibratorMT::~TrigCaloClusterCalibratorMT() +{ +} + +StatusCode TrigCaloClusterCalibratorMT::initialize() +{ + ATH_MSG_INFO("Initialise " << name() ); + + if (!m_monTool.empty() ) + ATH_CHECK(m_monTool.retrieve() ); + else + ATH_MSG_INFO("No monitoring tool configured"); + + ATH_CHECK( m_clusterCorrections.retrieve() ); + ATH_CHECK( m_inputClustersKey.initialize() ); + ATH_CHECK( m_outputClustersKey.initialize() ); + ATH_CHECK( m_outputCellLinksKey.initialize() ); + + return StatusCode::SUCCESS; +} + +StatusCode TrigCaloClusterCalibratorMT::execute(const EventContext& ctx) const +{ + ATH_MSG_DEBUG("Running " << name() ); + auto time_corr = Monitored::Timer("TIME_ClustCorr"); + + // Do the shallow copying + SG::WriteHandle<xAOD::CaloClusterContainer> outputClusters(m_outputClustersKey, ctx); + { + // Make a temporary scope - this means that the unique pointers die at the + // end of the scope (so don't hang around after the move call) + SG::ReadHandle<xAOD::CaloClusterContainer> inputClusters(m_inputClustersKey, ctx); + std::pair<xAOD::CaloClusterContainer*, xAOD::ShallowAuxContainer*> copyPair = + xAOD::shallowCopyContainer(*inputClusters); + // Show that we're taking ownership explicitly + std::unique_ptr<xAOD::CaloClusterContainer> clusters{copyPair.first}; + std::unique_ptr<xAOD::ShallowAuxContainer> clustersAux{copyPair.second}; + // And record + ATH_CHECK( outputClusters.record(std::move(clusters), std::move(clustersAux))); + // We also need to copy across the cell links information. + // To explain: the non-const cell iteration methods use an internal pointer, + // which is only finalized into an element link into the persistent + // container later. Therefore while we have a modifiable cluster, it has to + // have this local pointer present... + for (auto itrPair = std::make_pair(inputClusters->begin(), outputClusters->begin()); + itrPair != std::make_pair(inputClusters->end(), outputClusters->end()); + ++itrPair.first, ++itrPair.second) { + const CaloClusterCellLink* inputLinks = (**itrPair.first).getCellLinks(); + if (!inputLinks) { + ATH_MSG_ERROR("Failed to read the cell links from the input clusters!"); + return StatusCode::FAILURE; + } + (**itrPair.second).addCellLink(std::make_unique<CaloClusterCellLink>(*inputLinks)); + } + } + + time_corr.start(); + for (const ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { + for (xAOD::CaloCluster* cl : *outputClusters) { + if (!m_isSW.value() || + (std::abs(cl->eta0()) < 1.45 && clcorr->name().find("37") != std::string::npos) || + (std::abs(cl->eta0()) >= 1.45 && clcorr->name().find("55") != std::string::npos) ) { + ATH_CHECK(clcorr->execute(ctx, cl)); + ATH_MSG_VERBOSE("Executed correction tool " << clcorr->name()); + } + } + } + time_corr.stop(); + + // Now we also have to make the cell links persistent + SG::WriteHandle<CaloClusterCellLinkContainer> cellLinks(m_outputCellLinksKey, ctx); + ATH_CHECK(CaloClusterStoreHelper::finalizeClusters(cellLinks, outputClusters.ptr())); + // After this is done, the non-const cell iteration functions will segfault! + // This means we really shouldn't let anyone retrieve this as a non-const + // container... + ATH_CHECK( outputClusters.setConst() ); + + // fill monitored containers + // Only monitor kinematic quantities which the calibrations may have changed + Monitored::Group(m_monTool, + time_corr, + Monitored::Collection("Et", *outputClusters, &xAOD::CaloCluster::et), + Monitored::Collection("Phi", *outputClusters, &xAOD::CaloCluster::calPhi), + Monitored::Collection("Eta", *outputClusters, &xAOD::CaloCluster::calEta)).fill(); + + // Add REGTEST entries + if (!outputClusters->empty() ) { + ATH_MSG_DEBUG(" REGTEST: Last Cluster Et = " << outputClusters->back()->et()); + ATH_MSG_DEBUG(" REGTEST: Last Cluster eta = " << outputClusters->back()->eta()); + ATH_MSG_DEBUG(" REGTEST: Last Cluster phi = " << outputClusters->back()->phi()); + } + + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.h b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.h new file mode 100644 index 0000000000000000000000000000000000000000..d43a2555aae4feb9993e0bc55c73433213bb62bb --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.h @@ -0,0 +1,64 @@ +// Hi Emacs ! this is -* C++ -*- + +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ + +/******************************************************************** + * + * NAME: TrigCaloClusterCalibratorMT + * PACKAGE: Trigger/TrigAlgorithms/TrigCaloRec + * + * AUTHOR: Jon Burr + * CREATED: 2020/07/10 + * + * Shallow copy an existing cluster container and apply cluster processors to + * it. Largely copied from the TrigCaloClusterMakerMT. + *********************************************************************/ + +#ifndef TRIGCALOREC_TRIGCALOCLUSTERCALIBRATORMT_H +#define TRIGCALOREC_TRIGCALOCLUSTERCALIBRATORMT_H + +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "CaloRec/CaloClusterProcessor.h" +#include "CaloEvent/CaloClusterCellLinkContainer.h" +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadDecorHandleKey.h" +#include "StoreGate/WriteDecorHandleKey.h" + +class TrigCaloClusterCalibratorMT : public AthReentrantAlgorithm { + public: + TrigCaloClusterCalibratorMT(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~TrigCaloClusterCalibratorMT() override; + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + + private: + ToolHandleArray<CaloClusterProcessor> m_clusterCorrections + {this, "ClusterCorrectionTools", {}, ""}; + + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_inputClustersKey{ + this, "InputClusters", "", + "The input calocluster container to be shallow copied"}; + + SG::WriteHandleKey<xAOD::CaloClusterContainer> m_outputClustersKey{ + this, "OutputClusters", "", + "The output, calibrated calocluster container"}; + + SG::WriteHandleKey<CaloClusterCellLinkContainer> m_outputCellLinksKey{ + this, "OutputCellLinks", "", + "The output cell links containing the updated weights"}; + + ToolHandle<GenericMonitoringTool> m_monTool{ + this, "MonTool", "", "The monitoring tool"}; + + Gaudi::Property<bool> m_isSW{ + this, "IsSW", false, + "Is this running corrections to 'SW' clusters? If it is, then cluster " + "processors will be run selectively based on the cluster's eta"}; +}; //> end class TrigCaloClusterCalibratorMT + +#endif //> !TRIGCALOREC_TRIGCALOCLUSTERCALIBRATORMT_H diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx index a54bb550af541544408c908ac2a8827129fb83d3..ced013b5b11ef09d0466da6f95cc4f1f853315f6 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -60,8 +60,7 @@ class ISvcLocator; ///////////////////////////////////////////////////////////////////// // TrigCaloClusterMakerMT::TrigCaloClusterMakerMT(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_pCaloClusterContainer(NULL) + : AthReentrantAlgorithm(name, pSvcLocator) { } @@ -105,6 +104,28 @@ TrigCaloClusterMakerMT::TrigCaloClusterMakerMT(const std::string& name, ISvcLoca ATH_CHECK( m_outputClustersKey.initialize() ); ATH_CHECK( m_clusterCellLinkOutput.initialize() ); + for (ToolHandle<CaloClusterCollectionProcessor>& clproc : m_clusterMakers) { + // Set the CellsName property on the input tool (why isn't this done in + // python?) + AlgTool* algtool = dynamic_cast<AlgTool*> (clproc.get()); + if (clproc->name().find("CaloTopoClusterMaker") != std::string::npos) { + if (!algtool) { + ATH_MSG_ERROR("Could not cast " << clproc->name() << " to an AlgTool!"); + return StatusCode::FAILURE; + } + ATH_CHECK(algtool->setProperty(StringProperty("CellsName", m_inputCellsKey.key()))); + } + if (clproc->name().find("trigslw") != std::string::npos) + m_isSW = true; + } + + for (ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { + ISetCaloCellContainerName* setter = + dynamic_cast<ISetCaloCellContainerName*> (clcorr.get()); + if (setter) + ATH_CHECK(setter->setCaloCellContainerName(m_inputCellsKey.key())); + } + ATH_MSG_DEBUG("Initialization of TrigCaloClusterMakerMT completed successfully"); return StatusCode::SUCCESS; @@ -119,7 +140,7 @@ return StatusCode::SUCCESS; } -StatusCode TrigCaloClusterMakerMT::execute() +StatusCode TrigCaloClusterMakerMT::execute(const EventContext& ctx) const { // Monitoring initialization... auto time_tot = Monitored::Timer("TIME_execute"); @@ -131,10 +152,6 @@ StatusCode TrigCaloClusterMakerMT::execute() ATH_MSG_DEBUG("in TrigCaloClusterMakerMT::execute()" ); - bool isSW=false; - - auto ctx = getContext(); - // We now take care of the Cluster Making... auto clusterContainer = SG::makeHandle (m_outputClustersKey, ctx); ATH_MSG_VERBOSE(" Output Clusters : " << clusterContainer.name()); @@ -183,24 +200,8 @@ StatusCode TrigCaloClusterMakerMT::execute() // ATH_MSG_DEBUG(" Input Towers : " << towers.name() <<" of size "<< towers->size()); #endif - for (ToolHandle<CaloClusterCollectionProcessor>& clproc : m_clusterMakers) { - - // JTB: TO DO: The offline tools should be changed to set declare ReadHandles + for (const ToolHandle<CaloClusterCollectionProcessor>& clproc : m_clusterMakers) { - // We need to set the properties of the offline tools. this way of doing is ugly... - // Abusing of harcoding?? Yes... - - AlgTool* algtool = dynamic_cast<AlgTool*> (clproc.get()); - if(clproc->name().find("CaloTopoClusterMaker") != std::string::npos){ - - - if(!algtool || algtool->setProperty( StringProperty("CellsName",cells.name() )).isFailure()) { - ATH_MSG_ERROR ("ERROR setting the CellsName name in the offline tool" ); - // return HLT::TOOL_FAILURE; - return StatusCode::SUCCESS; - } - - } #if 0 else if(clproc->name().find("trigslw") != std::string::npos){ if(!algtool || algtool->setProperty( StringProperty("CaloCellContainer",cells.name()) ).isFailure()) { @@ -216,13 +217,8 @@ StatusCode TrigCaloClusterMakerMT::execute() } #endif - - if ( (clproc->name()).find("trigslw") != std::string::npos ) isSW=true; - if ( clproc->execute(pCaloClusterContainer).isFailure() ) { - ATH_MSG_ERROR("Error executing tool " << clproc->name() ); - } else { - ATH_MSG_VERBOSE("Executed tool " << clproc->name() ); - } + ATH_CHECK(clproc->execute(ctx, pCaloClusterContainer)); + ATH_MSG_VERBOSE("Executed tool " << clproc->name() ); } time_clusMaker.stop(); @@ -252,34 +248,15 @@ StatusCode TrigCaloClusterMakerMT::execute() time_clusCorr.start(); ATH_MSG_VERBOSE(" Running cluster correction tools"); - for (ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { + for (const ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { - ATH_MSG_VERBOSE(" Running " << clcorr->name()); - ISetCaloCellContainerName* setter = - dynamic_cast<ISetCaloCellContainerName*> (clcorr.get()); - if (setter) { - if(setter->setCaloCellContainerName(cells.name()) .isFailure()) { - ATH_MSG_ERROR("ERROR setting the CaloCellContainer name in the offline tool" ); - // return HLT::BAD_JOB_SETUP; - return StatusCode::SUCCESS; - } - } - for (xAOD::CaloCluster* cl : *pCaloClusterContainer) { - bool exec = false; - if ( (fabsf(cl->eta0())<1.45) && (clcorr->name().find("37") != std::string::npos ) ) exec=true; - else if ( (fabsf(cl->eta0())>=1.45) && (clcorr->name().find("55") != std::string::npos ) ) exec=true; - else exec = false; - if (!isSW) exec=true; - if ( exec ) { - if ( clcorr->execute(cl).isFailure() ) { - ATH_MSG_ERROR("Error executing correction tool " << clcorr->name() ); - // return HLT::TOOL_FAILURE; - return StatusCode::SUCCESS; - } else { - ATH_MSG_VERBOSE("Executed correction tool " << clcorr->name() ); + if (!m_isSW || + (std::abs(cl->eta0()) < 1.45 && clcorr->name().find("37") != std::string::npos) || + (std::abs(cl->eta0()) >= 1.45 && clcorr->name().find("55") != std::string::npos) ) { + ATH_CHECK(clcorr->execute(ctx, cl) ); + ATH_MSG_VERBOSE("Executed correction tool " << clcorr->name()); } - } // Check conditions } } time_clusCorr.stop(); diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h index 106fc930a79e25736692c271446f6ebea3c95f89..3f133f823be4cd685c741833e2ffa16140f937f7 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h @@ -2,7 +2,7 @@ // Hi Emacs ! this is -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************************** @@ -19,7 +19,7 @@ #ifndef TRIGCALOREC_TRIGCALOCLUSTERMAKERMT_H #define TRIGCALOREC_TRIGCALOCLUSTERMAKERMT_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "CaloEvent/CaloClusterContainer.h" #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloRec/CaloClusterProcessor.h" @@ -36,7 +36,7 @@ class CaloClusterProcessor; class CaloClusterContainer; class CaloCellLinkContainer; -class TrigCaloClusterMakerMT : public AthAlgorithm { +class TrigCaloClusterMakerMT : public AthReentrantAlgorithm { public: @@ -45,7 +45,7 @@ class TrigCaloClusterMakerMT : public AthAlgorithm { virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode execute() override; + virtual StatusCode execute(const EventContext& ctx) const override; private: @@ -57,10 +57,6 @@ class TrigCaloClusterMakerMT : public AthAlgorithm { // Following used for testing only : //bool m_useMeaningfullNames; std::string m_clustersOutputName; - - - //Other members - xAOD::CaloClusterContainer* m_pCaloClusterContainer; // double m_Eta; // double m_Phi; @@ -108,10 +104,7 @@ class TrigCaloClusterMakerMT : public AthAlgorithm { "Decor_ncells", // decorator name "nCells", // default value "Decorator containing the number of cells associated to a cluster"}; - -public: - - inline xAOD::CaloClusterContainer* GetClusterContainer() const {return m_pCaloClusterContainer;} + bool m_isSW{false}; }; #endif diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx index 6e37388b7643f2254b48eed1ac844eaf53dffb56..ff5fdf1b4e272f28f5531bdaff48dd8d75fa749e 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx @@ -17,6 +17,7 @@ #include "../TrigCaloClusterMakerMT.h" #include "../TrigCaloTowerMakerMT.h" +#include "../TrigCaloClusterCalibratorMT.h" #include "TrigCaloRec/TrigCaloTopoTowerAlgorithm.h" #include "TrigCaloRec/TrigCaloCell2ClusterMapper.h" @@ -24,6 +25,7 @@ #include "../HLTCaloCellSumMaker.h" DECLARE_COMPONENT( TrigCaloTowerMakerMT ) +DECLARE_COMPONENT( TrigCaloClusterCalibratorMT ) DECLARE_COMPONENT( TrigCaloClusterMakerMT ) DECLARE_COMPONENT( TrigCaloCellMaker ) DECLARE_COMPONENT( TrigFullCaloCellMaker ) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref index dcc3d0bbb2bdb08087fb52c131c5a49cf3777b50..12963c515b75b2918681edc3afa7032c18b91931 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref @@ -653,8 +653,8 @@ TrigSignatureMoniMT INFO HLT_xe100_pfsum_L1XE50 # TrigSignatureMoniMT INFO -- #1890237897 Events 10 10 2 - - - - - 2 TrigSignatureMoniMT INFO -- #1890237897 Features 2 - - - - - TrigSignatureMoniMT INFO HLT_xe100_tcpufit_L1XE50 #2803198799 -TrigSignatureMoniMT INFO -- #2803198799 Events 10 10 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #2803198799 Features 3 - - - - - +TrigSignatureMoniMT INFO -- #2803198799 Events 10 10 6 - - - - - 6 +TrigSignatureMoniMT INFO -- #2803198799 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe100_trkmht_L1XE50 #1055916731 TrigSignatureMoniMT INFO -- #1055916731 Events 10 10 4 - - - - - 4 TrigSignatureMoniMT INFO -- #1055916731 Features 4 - - - - - @@ -665,14 +665,14 @@ TrigSignatureMoniMT INFO HLT_xe110_tc_em_L1XE50 # TrigSignatureMoniMT INFO -- #607113828 Events 10 10 5 - - - - - 5 TrigSignatureMoniMT INFO -- #607113828 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_xe110_tcpufit_L1XE50 #892853397 -TrigSignatureMoniMT INFO -- #892853397 Events 10 10 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #892853397 Features 3 - - - - - +TrigSignatureMoniMT INFO -- #892853397 Events 10 10 6 - - - - - 6 +TrigSignatureMoniMT INFO -- #892853397 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe30_cell_L1XE10 #1649696554 TrigSignatureMoniMT INFO -- #1649696554 Events 19 19 17 - - - - - 17 TrigSignatureMoniMT INFO -- #1649696554 Features 17 - - - - - TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 #3768353779 -TrigSignatureMoniMT INFO -- #3768353779 Events 19 19 15 - - - - - 15 -TrigSignatureMoniMT INFO -- #3768353779 Features 15 - - - - - +TrigSignatureMoniMT INFO -- #3768353779 Events 19 19 14 - - - - - 14 +TrigSignatureMoniMT INFO -- #3768353779 Features 14 - - - - - TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #3626903018 TrigSignatureMoniMT INFO -- #3626903018 Events 19 19 19 - - - - - 19 TrigSignatureMoniMT INFO -- #3626903018 Features 19 - - - - - @@ -680,8 +680,8 @@ TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 #9 TrigSignatureMoniMT INFO -- #998713382 Events 19 19 14 - - - - - 14 TrigSignatureMoniMT INFO -- #998713382 Features 14 - - - - - TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 #1583719916 -TrigSignatureMoniMT INFO -- #1583719916 Events 19 19 15 - - - - - 15 -TrigSignatureMoniMT INFO -- #1583719916 Features 15 - - - - - +TrigSignatureMoniMT INFO -- #1583719916 Events 19 19 14 - - - - - 14 +TrigSignatureMoniMT INFO -- #1583719916 Features 14 - - - - - TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 #2468872349 TrigSignatureMoniMT INFO -- #2468872349 Events 19 19 17 - - - - - 17 TrigSignatureMoniMT INFO -- #2468872349 Features 17 - - - - - @@ -689,5 +689,5 @@ TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 #53 TrigSignatureMoniMT INFO -- #531141817 Events 10 10 7 - - - - - 7 TrigSignatureMoniMT INFO -- #531141817 Features 7 - - - - - TrigSignatureMoniMT INFO HLT_xe65_cell_xe110_tcpufit_L1XE50 #115518400 -TrigSignatureMoniMT INFO -- #115518400 Events 10 10 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #115518400 Features 3 - - - - - +TrigSignatureMoniMT INFO -- #115518400 Events 10 10 5 - - - - - 5 +TrigSignatureMoniMT INFO -- #115518400 Features 5 - - - - - diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref index 1f54a06d86270b0595ae05cb83f054b6089611c1..433726019e0c508237f4d795a8d5f609071d2896 100644 --- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref +++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref @@ -671,8 +671,8 @@ TrigSignatureMoniMT INFO HLT_xe30_cell_L1XE10 #1 TrigSignatureMoniMT INFO -- #1649696554 Events 20 20 3 - - - - - 3 TrigSignatureMoniMT INFO -- #1649696554 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 #3768353779 -TrigSignatureMoniMT INFO -- #3768353779 Events 20 20 2 - - - - - 2 -TrigSignatureMoniMT INFO -- #3768353779 Features 2 - - - - - +TrigSignatureMoniMT INFO -- #3768353779 Events 20 20 3 - - - - - 3 +TrigSignatureMoniMT INFO -- #3768353779 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #3626903018 TrigSignatureMoniMT INFO -- #3626903018 Events 20 20 16 - - - - - 16 TrigSignatureMoniMT INFO -- #3626903018 Features 16 - - - - - @@ -680,8 +680,8 @@ TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 # TrigSignatureMoniMT INFO -- #998713382 Events 20 20 4 - - - - - 4 TrigSignatureMoniMT INFO -- #998713382 Features 4 - - - - - TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 #1583719916 -TrigSignatureMoniMT INFO -- #1583719916 Events 20 20 2 - - - - - 2 -TrigSignatureMoniMT INFO -- #1583719916 Features 2 - - - - - +TrigSignatureMoniMT INFO -- #1583719916 Events 20 20 6 - - - - - 6 +TrigSignatureMoniMT INFO -- #1583719916 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 #2468872349 TrigSignatureMoniMT INFO -- #2468872349 Events 20 20 5 - - - - - 5 TrigSignatureMoniMT INFO -- #2468872349 Features 5 - - - - - diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py index 1c843c440d1d14f066211fa726b80ef305cdd7ff..3a99da4be12d9e320b668a050d0723ccc2909487 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py @@ -2,7 +2,8 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import RecoFragmentsPool, MenuSequence -from AthenaCommon.CFElements import seqAND +from AthenaCommon.CFElements import seqAND, parOR +from TrigEDMConfig.TriggerEDMRun3 import recordable class CaloMenuDefs(object): @@ -12,6 +13,7 @@ class CaloMenuDefs(object): + def fastCaloSequence(doRinger): """ Creates Fast Calo sequence""" # EV creator @@ -45,3 +47,49 @@ def fastCaloMenuSequence(name, doRinger): Maker = fastCaloViewsMaker, Hypo = theFastCaloHypo, HypoToolGen = TrigEgammaFastCaloHypoToolFromDict ) + + +def cellRecoSequence(flags, name="HLTCaloCellMakerFS", RoIs="FSJETRoI", outputName="CaloCellsFS"): + """ Produce the full scan cell collection """ + if not RoIs: + from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection + RoIs = mapThresholdToL1RoICollection("FSNOSEED") + from TrigT2CaloCommon.CaloDef import setMinimalCaloSetup + setMinimalCaloSetup() + from AthenaCommon.AppMgr import ServiceMgr as svcMgr + from TrigCaloRec.TrigCaloRecConfig import HLTCaloCellMaker + alg = HLTCaloCellMaker(name) + alg.RoIs=RoIs + alg.TrigDataAccessMT=svcMgr.TrigCaloDataAccessSvc + alg.CellsName=outputName + return parOR(name+"RecoSequence", [alg]), alg.CellsName + +def caloClusterRecoSequence( + flags, name="HLTCaloClusterMakerFS", RoIs="FSJETRoI", + outputName="HLT_TopoCaloClustersFS"): + """ Create the EM-level fullscan clusters """ + cell_sequence, cells_name = RecoFragmentsPool.retrieve(cellRecoSequence, flags=None, RoIs=RoIs) + from TrigCaloRec.TrigCaloRecConfig import TrigCaloClusterMakerMT_topo + alg = TrigCaloClusterMakerMT_topo( + name, + doMoments=True, + doLC=False, + cells=cells_name) + alg.CaloClusters = recordable(outputName) + return parOR(name+"RecoSequence", [cell_sequence, alg]), alg.CaloClusters + +def LCCaloClusterRecoSequence( + flags, name="HLTCaloClusterCalibratorLCFS", RoIs="FSJETRoI", + outputName="HLT_TopoCaloClustersLCFS"): + """ Create the LC calibrated fullscan clusters + + The clusters will be created as a shallow copy of the EM level clusters + """ + em_sequence, em_clusters = RecoFragmentsPool.retrieve(caloClusterRecoSequence, flags=None, RoIs=RoIs) + from TrigCaloRec.TrigCaloRecConfig import TrigCaloClusterCalibratorMT_LC + alg = TrigCaloClusterCalibratorMT_LC( + name, + InputClusters = em_clusters, + OutputClusters = outputName, + OutputCellLinks = outputName+"_cellLinks") + return parOR(name+"RecoSequence", [em_sequence, alg]), alg.OutputClusters diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py index bed06937ac70fdf526d51bf84f326da05947231d..9edd076d045650f6098e7d0b81df3700de9cb5c6 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py @@ -110,8 +110,16 @@ def jetRecoSequence( dummyFlags, dataSource, RoIs = 'FSJETRoI', **jetRecoDict): # Start by adding the topocluster reco sequence # This makes EM clusters! - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence - (topoClusterSequence, clustersKey) = RecoFragmentsPool.retrieve(HLTFSTopoRecoSequence,RoIs) + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence, LCCaloClusterRecoSequence) + if jetRecoDict["calib"] == "em": + topoClusterSequence, clustersKey = RecoFragmentsPool.retrieve( + caloClusterRecoSequence, flags=None, RoIs=RoIs) + elif jetRecoDict["calib"] == "lcw": + topoClusterSequence, clustersKey = RecoFragmentsPool.retrieve( + LCCaloClusterRecoSequence, flags=None, RoIs=RoIs) + else: + raise ValueError("Invalid value for calib: '{}'".format(jetRecoDict["calib"])) recoSeq += topoClusterSequence # Set up tracking sequence -- may need to reorganise or relocate diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py index 8b4318d8a45d55ebd10ef76b653a60188786ea45..e5653ddbab2bfd56b39501fd1e1f99b54d67bbc0 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py @@ -36,9 +36,10 @@ class CellConfig(AlgConfig): def __init__(self, **recoDict): super(CellConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSCellMakerRecoSequence + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import cellRecoSequence from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__CellFex - (cellMakerSeq, cellName) = HLTFSCellMakerRecoSequence() + cellMakerSeq, cellName = RecoFragmentsPool.retrieve( + cellRecoSequence, flags=None, RoIs=self.inputMaker.RoIs) self.inputs = [cellMakerSeq] self.fexAlg = self._make_fex_alg( @@ -50,14 +51,18 @@ class TCConfig(AlgConfig): def algType(cls): return "tc" - def __init__(self, **recoDict): - super(TCConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + def __init__(self, calib, **recoDict): + super(TCConfig, self).__init__(calib=calib, **recoDict) + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence, LCCaloClusterRecoSequence) from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__TCFex - # TODO - cluster calibration RoIs = self.inputMaker.RoIs - tcSeq, clusterName = RecoFragmentsPool.retrieve( - HLTFSTopoRecoSequence, RoIs) + if calib == "em": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + caloClusterRecoSequence, flags = None, RoIs=RoIs) + elif calib == "lcw": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + LCCaloClusterRecoSequence, flag = None, RoIs=RoIs) self.inputs = [tcSeq] self.fexAlg = self._make_fex_alg( @@ -69,13 +74,18 @@ class TCPufitConfig(AlgConfig): def algType(cls): return "tcpufit" - def __init__(self, **recoDict): - super(TCPufitConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + def __init__(self, calib, **recoDict): + super(TCPufitConfig, self).__init__(calib=calib, **recoDict) + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence, LCCaloClusterRecoSequence) from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__TCPufitFex RoIs = self.inputMaker.RoIs - tcSeq, clusterName = RecoFragmentsPool.retrieve( - HLTFSTopoRecoSequence, RoIs) + if calib == "em": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + caloClusterRecoSequence, flags=None, RoIs=RoIs) + elif calib == "lcw": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + LCCaloClusterRecoSequence, flags=None, RoIs=RoIs) self.inputs = [tcSeq] self.fexAlg = self._make_fex_alg( @@ -146,7 +156,8 @@ class PFSumConfig(AlgConfig): def __init__(self, **recoDict): super(PFSumConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence) from eflowRec.PFHLTSequence import PFHLTSequence from ..Jet.JetRecoConfiguration import defineJetConstit from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__PFSumFex @@ -156,7 +167,7 @@ class PFSumConfig(AlgConfig): RoIs = self.inputMaker.RoIs tcSeq, clusterName = RecoFragmentsPool.retrieve( - HLTFSTopoRecoSequence, RoIs) + caloClusterRecoSequence, flags=None, RoIs=RoIs) pfseq, pfoPrefix = RecoFragmentsPool.retrieve( PFHLTSequence, None, clustersin = clusterName, tracktype="ftf") constit = defineJetConstit(jetRecoDict, pfoPrefix=pfoPrefix)